All Classes Namespaces Functions Variables Enumerations Properties Pages
shortcutspage.h
1 /*
2 
3 Pencil2D - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2012-2020 Matthew Chiawen Chang
6 
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; version 2 of the License.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 */
17 #ifndef SHORTCUTSPAGE_H
18 #define SHORTCUTSPAGE_H
19 
20 #include <QWidget>
21 #include <QModelIndex>
22 #include <QKeySequence>
23 #include <QSettings>
24 
25 class QTreeView;
26 class QStandardItem;
27 class QStandardItemModel;
28 class QLabel;
29 class QLineEdit;
30 class PreferenceManager;
31 
32 namespace Ui
33 {
34  class ShortcutsPage;
35 }
36 
37 class ShortcutsPage : public QWidget
38 {
39  Q_OBJECT
40 public:
41  explicit ShortcutsPage(QWidget* parent = nullptr);
42 
43  void setManager( PreferenceManager* p ) { mManager = p; }
44  ~ShortcutsPage() override;
45 
46 private slots:
47  void tableItemClicked(const QModelIndex&);
48  void keyCapLineEditTextChanged();
49  void saveShortcutsButtonClicked();
50  void loadShortcutsButtonClicked();
51  void restoreShortcutsButtonClicked();
52  void clearButtonClicked();
53 
54 private:
55  bool isKeySequenceExist(const QSettings&, QString, QKeySequence);
56  void removeDuplicateKeySequence(QSettings*, QKeySequence);
57  void treeModelLoadShortcutsSetting();
58 
59  QStandardItemModel* m_treeModel = nullptr;
60  QModelIndex m_currentItemIndex;
61 
62  Ui::ShortcutsPage* ui = nullptr;
63 
64  PreferenceManager* mManager = nullptr;
65 };
66 
67 #endif // SHORTCUTSPAGE_H
Q_OBJECTQ_OBJECT
QObject * parent() const const