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 
25 #include <QKeySequence>
26 #include <QObject>
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 = 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 
119  QKeySequence shortcut(
120  const int key, const Account & account,
121  const QString & context = {}) const;
122 
128  QKeySequence shortcut(
129  const QString & nonStandardKey, const Account & account,
130  const QString & context = {}) const;
131 
136  QKeySequence defaultShortcut(
137  const int key, const Account & account,
138  const QString & context = {}) const;
139 
144  QKeySequence defaultShortcut(
145  const QString & nonStandardKey, const Account & account,
146  const QString & context = {}) const;
147 
152  QKeySequence userShortcut(
153  const int key, const Account & account,
154  const QString & context = {}) const;
155 
160  QKeySequence userShortcut(
161  const QString & nonStandardKey, const Account & account,
162  const QString & context = {}) const;
163 
164 Q_SIGNALS:
165  void shortcutChanged(
166  int key, QKeySequence shortcut, const Account & account,
167  QString context);
168 
169  void nonStandardShortcutChanged(
170  QString nonStandardKey, QKeySequence shortcut, const Account & account,
171  QString context);
172 
173 public Q_SLOTS:
174  void setUserShortcut(
175  int key, QKeySequence shortcut, const Account & account,
176  QString context = {});
177 
178  void setNonStandardUserShortcut(
179  QString nonStandardKey, QKeySequence shortcut, const Account & account,
180  QString context = {});
181 
182  void setDefaultShortcut(
183  int key, QKeySequence shortcut, const Account & account,
184  QString context = {});
185 
186  void setNonStandardDefaultShortcut(
187  QString nonStandardKey, QKeySequence shortcut, const Account & account,
188  QString context = {});
189 
190 private:
191  ShortcutManagerPrivate * const d_ptr;
192  Q_DECLARE_PRIVATE(ShortcutManager)
193 };
194 
195 } // namespace quentier
196 
197 #endif // LIB_QUENTIER_UTILITY_SHORTCUT_MANAGER_H
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
QKeySequence userShortcut(const int key, const Account &account, const QString &context={}) const
QKeySequence defaultShortcut(const int key, const Account &account, const QString &context={}) const
QKeySequence shortcut(const int key, const Account &account, const QString &context={}) const
QKeySequence userShortcut(const QString &nonStandardKey, const Account &account, const QString &context={}) const
QKeySequence shortcut(const QString &nonStandardKey, const Account &account, const QString &context={}) const
QKeySequence defaultShortcut(const QString &nonStandardKey, const Account &account, const QString &context={}) const