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