summaryrefslogtreecommitdiff
path: root/src/frontend/settingsdialogs/cacceleratorsettings.h
blob: 49408d5ca4e916570b266b20c4591b983fab6050 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*********
*
* In the name of the Father, and of the Son, and of the Holy Spirit.
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/

#ifndef CACCELERATORSETTINGS_H
#define CACCELERATORSETTINGS_H

#include "frontend/bookshelfmanager/btconfigdialog.h"

#include <QPointer>
#include <QWidget>
#include "frontend/settingsdialogs/btshortcutseditor.h"


class BtActionCollection;
class BtShortcutsEditor;
class CConfigurationDialog;
class QComboBox;
class QLabel;
class QStackedWidget;

/**
 * @brief The shortcut settings page.
 * @author The BibleTime team <info@bibletime.info>
 */
class CAcceleratorSettingsPage: public BtConfigDialog::Page {

        Q_OBJECT

    public: /* Methods: */

        CAcceleratorSettingsPage(CConfigurationDialog *parent = 0);

        void save();

    protected: /* Methods: */

        void retranslateUi();

    protected slots:

        void slotKeyChooserTypeChanged(const QString& title);

        // complete the keyChangeRequest
        void completeKeyChangeRequest(BtShortcutsEditor* shortcutsEditor, const QString& keys);

    private:
        struct WindowType {
            QPointer<BtShortcutsEditor> keyChooser;
            BtActionCollection* actionCollection;
            QString title;

            WindowType() {
                keyChooser = 0;
                actionCollection = 0;
            };
            WindowType(const QString& newTitle) {
                title = newTitle;
                keyChooser = 0;
                actionCollection = 0;
            }
        };

        void clearConflictsWithKeys(const QString& keys, const QList<BtShortcutsEditor*> list);
        QString findConflictsWithKeys(const QString& keys, const QList<BtShortcutsEditor*> list);
        QList<BtShortcutsEditor*> getShortcutsEditorListForGroup(BtShortcutsEditor* currentEditor);
        QString getTitleForEditor(BtShortcutsEditor* editor);

        WindowType m_application;
        WindowType m_general;
        WindowType m_bible;
        WindowType m_commentary;
        WindowType m_lexicon;
        WindowType m_book;

        QLabel *m_actionGroupLabel;
        QComboBox* m_typeChooser;
        QStackedWidget* m_keyChooserStack;

};

#endif