libquentier  0.5.0
The library for rich desktop clients of Evernote service
ShortcutManager.h
1 /*
2  * Copyright 2016-2020 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/types/Account.h>
23 #include <quentier/utility/Linkage.h>
24 #include <quentier/utility/Macros.h>
25 
26 #include <QKeySequence>
27 #include <QObject>
28 
29 namespace quentier {
30 
31 QT_FORWARD_DECLARE_CLASS(ShortcutManagerPrivate)
32 
33 class QUENTIER_EXPORT ShortcutManager: public QObject
34 {
35  Q_OBJECT
36 public:
37  explicit ShortcutManager(QObject * parent = nullptr);
38 
39  enum QuentierShortcutKey
40  {
41  NewNote = 5000,
42  NewTag,
43  NewNotebook,
44  NewSavedSearch,
45  AddAttachment,
46  SaveAttachment,
47  OpenAttachment,
48  CopyAttachment,
49  CutAttachment,
50  RemoveAttachment,
51  RenameAttachment,
52  AddAccount,
53  ExitAccount,
54  SwitchAccount,
55  AccountInfo,
56  NoteSearch,
57  NewNoteSearch,
58  ShowNotes,
59  ShowNotebooks,
60  ShowTags,
61  ShowSavedSearches,
62  ShowDeletedNotes,
63  ShowStatusBar,
64  ShowToolBar,
65  PasteUnformatted,
66  Font,
67  UpperIndex,
68  LowerIndex,
69  AlignLeft,
70  AlignCenter,
71  AlignRight,
72  AlignFull,
73  IncreaseIndentation,
74  DecreaseIndentation,
75  IncreaseFontSize,
76  DecreaseFontSize,
77  InsertNumberedList,
78  InsertBulletedList,
79  Strikethrough,
80  Highlight,
81  InsertTable,
82  InsertRow,
83  InsertColumn,
84  RemoveRow,
85  RemoveColumn,
86  InsertHorizontalLine,
87  InsertToDoTag,
88  EditHyperlink,
89  CopyHyperlink,
90  RemoveHyperlink,
91  Encrypt,
92  Decrypt,
93  DecryptPermanently,
94  BackupLocalStorage,
95  RestoreLocalStorage,
96  UpgradeLocalStorage,
97  LocalStorageStatus,
98  SpellCheck,
99  SpellCheckIgnoreWord,
100  SpellCheckAddWordToUserDictionary,
101  SaveImage,
102  AnnotateImage,
103  ImageRotateClockwise,
104  ImageRotateCounterClockwise,
105  Synchronize,
106  FullSync,
107  ImportFolders,
108  Preferences,
109  ReleaseNotes,
110  ViewLogs,
111  About,
112  UnknownKey = 100000
113  };
114 
120  QKeySequence shortcut(
121  const int key, const Account & account,
122  const QString & context = {}) const;
123 
129  QKeySequence shortcut(
130  const QString & nonStandardKey, const Account & account,
131  const QString & context = {}) const;
132 
137  QKeySequence defaultShortcut(
138  const int key, const Account & account,
139  const QString & context = {}) const;
140 
145  QKeySequence defaultShortcut(
146  const QString & nonStandardKey, const Account & account,
147  const QString & context = {}) const;
148 
153  QKeySequence userShortcut(
154  const int key, const Account & account,
155  const QString & context = {}) const;
156 
161  QKeySequence userShortcut(
162  const QString & nonStandardKey, const Account & account,
163  const QString & context = {}) const;
164 
165 Q_SIGNALS:
166  void shortcutChanged(
167  int key, QKeySequence shortcut, const Account & account,
168  QString context);
169 
170  void nonStandardShortcutChanged(
171  QString nonStandardKey, QKeySequence shortcut, const Account & account,
172  QString context);
173 
174 public Q_SLOTS:
175  void setUserShortcut(
176  int key, QKeySequence shortcut, const Account & account,
177  QString context = {});
178 
179  void setNonStandardUserShortcut(
180  QString nonStandardKey, QKeySequence shortcut, const Account & account,
181  QString context = {});
182 
183  void setDefaultShortcut(
184  int key, QKeySequence shortcut, const Account & account,
185  QString context = {});
186 
187  void setNonStandardDefaultShortcut(
188  QString nonStandardKey, QKeySequence shortcut, const Account & account,
189  QString context = {});
190 
191 private:
192  ShortcutManagerPrivate * const d_ptr;
193  Q_DECLARE_PRIVATE(ShortcutManager)
194 };
195 
196 } // namespace quentier
197 
198 #endif // LIB_QUENTIER_UTILITY_SHORTCUT_MANAGER_H
199 
Definition: DecryptedTextManager.h:26
The Account class encapsulates some details about the account: its name, whether it is local or synch...
Definition: Account.h:39
Definition: ShortcutManager.h:33