-
-
Notifications
You must be signed in to change notification settings - Fork 551
Expand file tree
/
Copy pathActionNames.hpp
More file actions
389 lines (373 loc) · 15.5 KB
/
ActionNames.hpp
File metadata and controls
389 lines (373 loc) · 15.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
#pragma once
#include "controllers/hotkeys/HotkeyCategory.hpp"
#include <QString>
#include <map>
#include <vector>
inline const std::vector<std::pair<QString, std::vector<QString>>>
HOTKEY_ARG_ON_OFF_TOGGLE = {
{"Toggle", {}},
{"Set to on", {"on"}},
{"Set to off", {"off"}},
};
inline const std::vector<std::pair<QString, std::vector<QString>>>
HOTKEY_ARG_WITH_OR_WITHOUT_SELECTION = {
{"No", {"withoutSelection"}},
{"Yes", {"withSelection"}},
};
namespace chatterino {
// ActionDefinition is an action that can be performed with a hotkey
struct ActionDefinition {
// displayName is the value that would be shown to a user when they edit or create a hotkey for an action
QString displayName;
// argumentDescription is a description of the arguments in a format of
// "<required arg: description of possible values> [optional arg: possible
// values]"
QString argumentDescription = "";
// minCountArguments is the minimum amount of arguments the action accepts
// Example action: "Select Tab" in a popup window accepts 1 argument for which tab to select
uint8_t minCountArguments = 0;
// maxCountArguments is the maximum amount of arguments the action accepts
uint8_t maxCountArguments = minCountArguments;
// possibleArguments is empty or contains all possible argument values,
// it is an ordered mapping from option name (what the user sees) to
// arguments (what the action code will see).
// As std::map<K, V> does not guarantee order this is a std::vector<...>
std::vector<std::pair<QString, std::vector<QString>>> possibleArguments =
{};
// When possibleArguments are present this should be a string like
// "Direction:" which will be shown before the values from
// possibleArguments in the UI. Otherwise, it should be empty.
QString argumentsPrompt = "";
// A more detailed description of what argumentsPrompt means
QString argumentsPromptHover = "";
};
using ActionDefinitionMap = std::map<QString, ActionDefinition>;
inline const std::map<HotkeyCategory, ActionDefinitionMap> actionNames{
{HotkeyCategory::PopupWindow,
{
{"reject", ActionDefinition{"Confirmable popups: Cancel"}},
{"accept", ActionDefinition{"Confirmable popups: Confirm"}},
{"delete", ActionDefinition{"Close"}},
{"openTab",
ActionDefinition{
"Select Tab",
"<next, previous, or index of tab to select>",
1,
}},
{"scrollPage",
ActionDefinition{
.displayName = "Scroll",
.argumentDescription = "<direction: up or down>",
.minCountArguments = 1,
.maxCountArguments = 1,
.possibleArguments{
{"Up", {"up"}},
{"Down", {"down"}},
},
.argumentsPrompt = "Direction:",
}},
{"search", ActionDefinition{"Focus search box"}},
{"execModeratorAction",
ActionDefinition{
"Usercard: execute moderation action",
"<ban, unban or number of the timeout button to use>", 1}},
{"pin", ActionDefinition{"Usercard, reply thread: pin window"}},
}},
{HotkeyCategory::Split,
{
{"changeChannel", ActionDefinition{"Change channel"}},
{"clearMessages", ActionDefinition{"Clear messages"}},
{"createClip", ActionDefinition{"Create a clip"}},
{"delete", ActionDefinition{"Close"}},
{"focus",
ActionDefinition{
.displayName = "Focus neighbouring split",
.argumentDescription = "<direction: up, down, left or right>",
.minCountArguments = 1,
.maxCountArguments = 1,
.possibleArguments{
{"Up", {"up"}},
{"Down", {"down"}},
{"Left", {"left"}},
{"Right", {"right"}},
},
.argumentsPrompt = "Direction:",
.argumentsPromptHover =
"Which direction to look for a split to focus?",
}},
{"openInBrowser", ActionDefinition{"Open channel in browser"}},
{"openPlayerInBrowser",
ActionDefinition{"Open stream in browser player"}},
{"openInCustomPlayer",
ActionDefinition{"Open stream in custom player"}},
{"openInStreamlink", ActionDefinition{"Open stream in streamlink"}},
{"openModView", ActionDefinition{"Open mod view in browser"}},
{"openViewerList", ActionDefinition{"Open chatter list"}},
{"pickFilters", ActionDefinition{"Pick filters"}},
{"reconnect", ActionDefinition{"Reconnect to chat"}},
{"reloadEmotes",
ActionDefinition{
.displayName = "Reload emotes",
.argumentDescription =
"[type: channel or subscriber; default: all emotes]",
.minCountArguments = 0,
.maxCountArguments = 1,
.possibleArguments{
{"All emotes", {}},
{"Channel emotes only", {"channel"}},
{"Subscriber emotes only", {"subscriber"}},
},
.argumentsPrompt = "Emote type:",
.argumentsPromptHover = "Which emotes should Chatterino reload",
}},
{"runCommand",
ActionDefinition{
"Run a command",
"<name of command>",
1,
}},
{"scrollPage",
ActionDefinition{
.displayName = "Scroll",
.argumentDescription = "<up or down>",
.minCountArguments = 1,
.maxCountArguments = 1,
.possibleArguments{
{"Up", {"up"}},
{"Down", {"down"}},
},
.argumentsPrompt = "Direction:",
.argumentsPromptHover =
"Which direction do you want to see more messages",
}},
{"scrollToBottom", ActionDefinition{"Scroll to the bottom"}},
{"scrollToTop", ActionDefinition{"Scroll to the top"}},
{"setChannelNotification",
ActionDefinition{
.displayName = "Set channel live notification",
.argumentDescription = "[on or off. default: toggle]",
.minCountArguments = 0,
.maxCountArguments = 1,
.possibleArguments = HOTKEY_ARG_ON_OFF_TOGGLE,
.argumentsPrompt = "New value:",
.argumentsPromptHover = "Should the channel live notification be "
"enabled, disabled or toggled",
}},
{"setModerationMode",
ActionDefinition{
.displayName = "Set moderation mode",
.argumentDescription = "[on or off. default: toggle]",
.minCountArguments = 0,
.maxCountArguments = 1,
.possibleArguments = HOTKEY_ARG_ON_OFF_TOGGLE,
.argumentsPrompt = "New value:",
.argumentsPromptHover =
"Should the moderation mode be enabled, disabled or toggled",
}},
{"showSearch", ActionDefinition{"Search current channel"}},
{"showGlobalSearch", ActionDefinition{"Search all channels"}},
{"debug", ActionDefinition{"Show debug popup"}},
{"popupOverlay", ActionDefinition{"New overlay popup"}},
{"toggleOverlayInertia",
ActionDefinition{
.displayName = "Toggle overlay click-through",
.argumentDescription = "<target popup: this or thisOrAll or all>",
.minCountArguments = 1,
.maxCountArguments = 1,
.possibleArguments{
{"This", {"this"}},
{"All", {"all"}},
{"This or all", {"thisOrAll"}},
},
.argumentsPrompt = "Target popup:",
}},
{"setHighlightSounds",
ActionDefinition{
.displayName = "Set highlight sounds",
.argumentDescription = "[on or off. default: toggle]",
.minCountArguments = 0,
.maxCountArguments = 1,
.possibleArguments = HOTKEY_ARG_ON_OFF_TOGGLE,
.argumentsPrompt = "New value:",
.argumentsPromptHover =
"Should highlight sounds be enabled, disabled or toggled",
}},
{"openSubscriptionPage", ActionDefinition{"Open subscription page"}},
}},
{HotkeyCategory::SplitInput,
{
{"clear", ActionDefinition{"Clear message"}},
{"copy",
ActionDefinition{
.displayName = "Copy",
.argumentDescription =
"<source of text: auto, split or splitInput>",
.minCountArguments = 1,
.possibleArguments{
{"Automatic", {"auto"}},
{"Split", {"split"}},
{"Split Input", {"splitInput"}},
},
.argumentsPrompt = "Source of text:",
}},
{"cursorToStart",
ActionDefinition{
.displayName = "To start of message",
.argumentDescription =
"<selection mode: withSelection or withoutSelection>",
.minCountArguments = 1,
.maxCountArguments = 1,
.possibleArguments = HOTKEY_ARG_WITH_OR_WITHOUT_SELECTION,
.argumentsPrompt = "Select text from cursor to start:",
// XXX: write a hover for this that doesn't suck
}},
{"cursorToEnd",
ActionDefinition{
.displayName = "To end of message",
.argumentDescription =
"<selection mode: withSelection or withoutSelection>",
.minCountArguments = 1,
.maxCountArguments = 1,
.possibleArguments = HOTKEY_ARG_WITH_OR_WITHOUT_SELECTION,
.argumentsPrompt = "Select text from cursor to end:",
// XXX: write a hover for this that doesn't suck
}},
{"nextMessage", ActionDefinition{"Choose next sent message"}},
{"openEmotesPopup", ActionDefinition{"Open emotes list"}},
{"paste", ActionDefinition{"Paste"}},
{"previousMessage",
ActionDefinition{"Choose previously sent message"}},
{"redo", ActionDefinition{"Redo"}},
{"selectAll", ActionDefinition{"Select all"}},
{"selectWord", ActionDefinition{"Select word"}},
{"sendMessage",
ActionDefinition{
.displayName = "Send message",
.argumentDescription =
"[keepInput to not clear the text after sending]",
.minCountArguments = 0,
.maxCountArguments = 1,
.possibleArguments{
{"Default behavior", {}},
{"Keep message in input after sending it", {"keepInput"}},
},
.argumentsPrompt = "Behavior:",
}},
{"undo", ActionDefinition{"Undo"}},
}},
{HotkeyCategory::Window,
{
#ifndef NDEBUG
{"addCheerMessage", ActionDefinition{"Debug: Add cheer test message"}},
{"addEmoteMessage", ActionDefinition{"Debug: Add emote test message"}},
{"addLinkMessage",
ActionDefinition{"Debug: Add test message with a link"}},
{"addMiscMessage", ActionDefinition{"Debug: Add misc test message"}},
{"addRewardMessage",
ActionDefinition{"Debug: Add reward test message"}},
{"addSubMessage", ActionDefinition{"Debug: Add sub test message"}},
#endif
{"moveTab",
ActionDefinition{
"Move tab",
"<where to move the tab: next, previous, or new index of "
"tab>",
1,
}},
{"newSplit", ActionDefinition{"Create a new split"}},
{"newTab", ActionDefinition{"Create a new tab"}},
{"openSettings", ActionDefinition{"Open settings"}},
{"openAccountSelector", ActionDefinition{"Open account selector"}},
{"openTab",
ActionDefinition{
"Select tab",
"<which tab to select: last, next, previous, or index>",
1,
}},
{"openQuickSwitcher", ActionDefinition{"Open the quick switcher"}},
{"popup",
ActionDefinition{
.displayName = "New popup",
.argumentDescription = "<split or window>",
.minCountArguments = 1,
.maxCountArguments = 1,
.possibleArguments{
{"Focused Split", {"split"}},
{"Entire Tab", {"window"}},
},
.argumentsPrompt = "Include:",
.argumentsPromptHover =
"What should be included in the new popup",
}},
{"quit", ActionDefinition{"Quit Chatterino"}},
{"removeTab", ActionDefinition{"Remove current tab"}},
{"reopenSplit", ActionDefinition{"Reopen closed split"}},
{"setStreamerMode",
ActionDefinition{
.displayName = "Set streamer mode",
.argumentDescription =
"[on, off, toggle, or auto. default: toggle]",
.minCountArguments = 0,
.maxCountArguments = 1,
.possibleArguments =
{
{"Toggle on/off", {}},
{"Set to on", {"on"}},
{"Set to off", {"off"}},
{"Set to automatic", {"auto"}},
},
.argumentsPrompt = "New value:",
.argumentsPromptHover =
"Should streamer mode be enabled, disabled, toggled (on/off) "
"or set to auto",
}},
{"toggleLocalR9K", ActionDefinition{"Toggle local R9K"}},
{"zoom",
ActionDefinition{
.displayName = "Zoom in/out",
.argumentDescription = "Argument:",
.minCountArguments = 1,
.maxCountArguments = 1,
.possibleArguments =
{
{"Zoom in", {"in"}},
{"Zoom out", {"out"}},
{"Reset zoom", {"reset"}},
},
.argumentsPrompt = "Option:",
}},
{"setTabVisibility",
ActionDefinition{
.displayName = "Set tab visibility",
.argumentDescription =
"[on, off, toggle, or liveOnly. default: toggle]",
.minCountArguments = 0,
.maxCountArguments = 1,
.possibleArguments{
{"Toggle", {}},
{"Show all tabs", {"on"}},
{"Hide all tabs", {"off"}},
{"Only show live tabs", {"liveOnly"}},
},
.argumentsPrompt = "New value:",
.argumentsPromptHover = "Should the tabs be enabled, disabled, "
"toggled, or live-only.",
}},
{"lockZoom",
ActionDefinition{
.displayName = "Lock zoom",
.argumentDescription = "[lock, unlock, toggle. default: toggle]",
.minCountArguments = 0,
.maxCountArguments = 1,
.possibleArguments{
{"Toggle", {}},
{"Lock zoom", {"lock"}},
{"Unlock zoom", {"unlock"}},
},
.argumentsPrompt = "New value:",
.argumentsPromptHover =
"Should the zoom be locked, unlocked, or toggled.",
}},
}},
};
} // namespace chatterino