libquentier  0.4.0
The library for rich desktop clients of Evernote service
ShortcutManager.h
1 /*
2  * Copyright 2016 Dmitry Ivanov
3  *
4  * This file is part of libquentier
5  *
6  * libquentier is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, version 3 of the License.
9  *
10  * libquentier is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef LIB_QUENTIER_UTILITY_SHORTCUT_MANAGER_H
20 #define LIB_QUENTIER_UTILITY_SHORTCUT_MANAGER_H
21 
22 #include <quentier/utility/Linkage.h>
23 #include <quentier/utility/Macros.h>
24 #include <quentier/types/Account.h>
25 #include <QObject>
26 #include <QKeySequence>
27 
28 namespace quentier {
29 
30 QT_FORWARD_DECLARE_CLASS(ShortcutManagerPrivate)
31 
32 class QUENTIER_EXPORT ShortcutManager: public QObject
33 {
34  Q_OBJECT
35 public:
36  explicit ShortcutManager(QObject * parent = Q_NULLPTR);
37 
38  enum QuentierShortcutKey
39  {
40  NewNote = 5000,
41  NewTag,
42  NewNotebook,
43  NewSavedSearch,
44  AddAttachment,
45  SaveAttachment,
46  OpenAttachment,
47  CopyAttachment,
48  CutAttachment,
49  RemoveAttachment,
50  RenameAttachment,
51  AddAccount,
52  ExitAccount,
53  SwitchAccount,
54  AccountInfo,
55  NoteSearch,
56  NewNoteSearch,
57  ShowNotes,
58  ShowNotebooks,
59  ShowTags,
60  ShowSavedSearches,
61  ShowDeletedNotes,
62  ShowStatusBar,
63  ShowToolBar,
64  PasteUnformatted,
65  Font,
66  UpperIndex,
67  LowerIndex,
68  AlignLeft,
69  AlignCenter,
70  AlignRight,
71  AlignFull,
72  IncreaseIndentation,
73  DecreaseIndentation,
74  IncreaseFontSize,
75  DecreaseFontSize,
76  InsertNumberedList,
77  InsertBulletedList,
78  Strikethrough,
79  Highlight,
80  InsertTable,
81  InsertRow,
82  InsertColumn,
83  RemoveRow,
84  RemoveColumn,
85  InsertHorizontalLine,
86  InsertToDoTag,
87  EditHyperlink,
88  CopyHyperlink,
89  RemoveHyperlink,
90  Encrypt,
91  Decrypt,
92  DecryptPermanently,
93  BackupLocalStorage,
94  RestoreLocalStorage,
95  UpgradeLocalStorage,
96  LocalStorageStatus,
97  SpellCheck,
98  SpellCheckIgnoreWord,
99  SpellCheckAddWordToUserDictionary,
100  SaveImage,
101  AnnotateImage,
102  ImageRotateClockwise,
103  ImageRotateCounterClockwise,
104  Synchronize,
105  FullSync,
106  ImportFolders,
107  Preferences,
108  ReleaseNotes,
109  ViewLogs,
110  About,
111  UnknownKey = 100000
112  };
113 
118  QKeySequence shortcut(const int key, const Account & account, const QString & context = QString()) const;
119 
124  QKeySequence shortcut(const QString & nonStandardKey, const Account & account, const QString & context = QString()) const;
125 
129  QKeySequence defaultShortcut(const int key, const Account & account, const QString & context = QString()) const;
130 
134  QKeySequence defaultShortcut(const QString & nonStandardKey, const Account & account, const QString & context = QString()) const;
135 
139  QKeySequence userShortcut(const int key, const Account & account, const QString & context = QString()) const;
140 
144  QKeySequence userShortcut(const QString & nonStandardKey, const Account & account, const QString & context = QString()) const;
145 
146 Q_SIGNALS:
147  void shortcutChanged(int key, QKeySequence shortcut, const Account & account, QString context);
148  void nonStandardShortcutChanged(QString nonStandardKey, QKeySequence shortcut,
149  const Account & account, QString context);
150 
151 public Q_SLOTS:
152  void setUserShortcut(int key, QKeySequence shortcut, const Account & account, QString context = QString());
153  void setNonStandardUserShortcut(QString nonStandardKey, QKeySequence shortcut,
154  const Account & account, QString context = QString());
155 
156  void setDefaultShortcut(int key, QKeySequence shortcut, const Account & account, QString context = QString());
157  void setNonStandardDefaultShortcut(QString nonStandardKey, QKeySequence shortcut,
158  const Account & account, QString context = QString());
159 
160 private:
161  ShortcutManagerPrivate * const d_ptr;
162  Q_DECLARE_PRIVATE(ShortcutManager)
163 };
164 
165 } // namespace quentier
166 
167 #endif // LIB_QUENTIER_UTILITY_SHORTCUT_MANAGER_H
168 
The Account class encapsulates some details about the account: its name, whether it is local or synch...
Definition: Account.h:24
Definition: ShortcutManager.h:32