dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
shortcutsettings.h
Go to the documentation of this file.
1 
14 /*
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful, but
21  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  * for more details.
24  *
25  * You should have received a copy of the GNU General Public License along
26  * with this program; if not, see <http://www.gnu.org/licenses/>
27  *
28  * Additional note on redistribution: The copyright and license notices above
29  * must be maintained in each individual source file that is a derivative work
30  * of this source file; otherwise redistribution is prohibited.
31  */
32 
33 #ifndef SHORTCUTSETTINGS_H
34 #define SHORTCUTSETTINGS_H
35 
37 
38 #include <QtCore/QObject>
39 #include <QKeySequence>
40 #include <QTreeWidgetItem>
41 #include <QKeyEvent>
42 
43 QT_BEGIN_NAMESPACE
44 class Ui_ShortcutSettings;
45 QT_END_NAMESPACE
46 
47 namespace Core {
48 
49 class Command;
50 
51 namespace Internal {
52 
54  class MainWindow;
55 
56  struct ShortcutItem
57  {
59  QKeySequence m_key;
60  QTreeWidgetItem *m_item;
61  };
62 
64  {
65  Q_OBJECT
66 
67  public:
68  ShortcutSettings(QObject *parent = nullptr);
70 
71  // IOptionsPage
72  QString id() const;
73  QString trName() const;
74  QString category() const;
75  QString trCategory() const;
76 
77  QWidget *createPage(QWidget *parent);
78  void apply();
79  void finish();
80 
81  protected:
82  bool eventFilter(QObject *o, QEvent *e);
83 
84  private slots:
85  void commandChanged(QTreeWidgetItem *current);
86  void filterChanged(const QString &f);
87  void keyChanged();
88  void resetKeySequence();
89  void removeKeySequence();
90  void defaultAction();
91 
92  private:
93  void setKeySequence(const QKeySequence &key);
94  bool filter(const QString &f, const QTreeWidgetItem *item);
95  void initialize();
96 
97  void handleKeyEvent(QKeyEvent *e);
98  int translateModifiers(Qt::KeyboardModifiers state, const QString &text);
99 
100  QList<ShortcutItem *> m_scitems;
101  ActionManagerPrivate *m_am;
102  int m_key[4], m_keyNum;
103  Ui_ShortcutSettings *m_page;
104  };
105 
106 } // namespace Internal
107 } // namespace Core
108 
109 #endif // SHORTCUTSETTINGS_H
bool eventFilter(QObject *o, QEvent *e)
ShortcutSettings(QObject *parent=nullptr)
Definition: icore.h:39
The IOptionsPage is an interface for providing options pages.
Definition: ioptionspage.h:42
QWidget * createPage(QWidget *parent)
The class Command represents an action like a menu item, tool button, or shortcut. You don't create Command objects directly, instead use {ActionManager::registerAction()} to register an action and retrieve a Command. The Command object represents the user visible action and its properties. If multiple actions are registered with the same ID (but different contexts) the returned Command is the shared one between these actions.
Definition: command.h:43
e
Definition: OPPlots.m:99