summaryrefslogtreecommitdiff
path: root/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.h
blob: aec4d918da8e6cff428aaee58ce3143079b11182 (plain)
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
/* $Id$ */
/** @file
 * VBox Qt GUI - UIActionPoolManager class declaration.
 */

/*
 * Copyright (C) 2010-2020 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 */

#ifndef FEQT_INCLUDED_SRC_globals_UIActionPoolManager_h
#define FEQT_INCLUDED_SRC_globals_UIActionPoolManager_h
#ifndef RT_WITHOUT_PRAGMA_ONCE
# pragma once
#endif

/* GUI includes: */
#include "UIActionPool.h"
#include "UILibraryDefs.h"


/** VirtualBox Manager action-pool index enum.
  * Naming convention is following:
  * 1. Every menu index prepended with 'M',
  * 2. Every simple-action index prepended with 'S',
  * 3. Every toggle-action index presended with 'T',
  * 5. Every sub-index contains full parent-index name. */
enum UIActionIndexMN
{
    /* 'File' menu actions: */
    UIActionIndexMN_M_File = UIActionIndex_Max + 1,
    UIActionIndexMN_M_File_S_ImportAppliance,
    UIActionIndexMN_M_File_S_ExportAppliance,
    UIActionIndexMN_M_File_M_Tools,
    UIActionIndexMN_M_File_M_Tools_T_WelcomeScreen,
    UIActionIndexMN_M_File_M_Tools_T_ExtensionPackManager,
    UIActionIndexMN_M_File_M_Tools_T_VirtualMediaManager,
    UIActionIndexMN_M_File_M_Tools_T_NetworkManager,
    UIActionIndexMN_M_File_M_Tools_T_CloudProfileManager,
    UIActionIndexMN_M_File_M_Tools_T_VMActivityOverview,
#ifdef VBOX_GUI_WITH_EXTRADATA_MANAGER_UI
    UIActionIndexMN_M_File_S_ShowExtraDataManager,
#endif
    UIActionIndexMN_M_File_S_Close,

    /* 'Welcome' menu actions: */
    UIActionIndexMN_M_Welcome,
    UIActionIndexMN_M_Welcome_S_New,
    UIActionIndexMN_M_Welcome_S_Add,

    /* 'Group' menu actions: */
    UIActionIndexMN_M_Group,
    UIActionIndexMN_M_Group_S_New,
    UIActionIndexMN_M_Group_S_Add,
    UIActionIndexMN_M_Group_S_Rename,
    UIActionIndexMN_M_Group_S_Remove,
    UIActionIndexMN_M_Group_M_MoveToGroup,
    UIActionIndexMN_M_Group_M_StartOrShow,
    UIActionIndexMN_M_Group_M_StartOrShow_S_StartNormal,
    UIActionIndexMN_M_Group_M_StartOrShow_S_StartHeadless,
    UIActionIndexMN_M_Group_M_StartOrShow_S_StartDetachable,
    UIActionIndexMN_M_Group_T_Pause,
    UIActionIndexMN_M_Group_S_Reset,
    UIActionIndexMN_M_Group_M_Console,
    UIActionIndexMN_M_Group_M_Console_S_CreateConnection,
    UIActionIndexMN_M_Group_M_Console_S_DeleteConnection,
    UIActionIndexMN_M_Group_M_Console_S_ConfigureApplications,
    UIActionIndexMN_M_Group_M_Close,
    UIActionIndexMN_M_Group_M_Close_S_Detach,
    UIActionIndexMN_M_Group_M_Close_S_SaveState,
    UIActionIndexMN_M_Group_M_Close_S_Terminate,
    UIActionIndexMN_M_Group_M_Close_S_Shutdown,
    UIActionIndexMN_M_Group_M_Close_S_PowerOff,
    UIActionIndexMN_M_Group_M_Tools,
    UIActionIndexMN_M_Group_M_Tools_T_Details,
    UIActionIndexMN_M_Group_M_Tools_T_Snapshots,
    UIActionIndexMN_M_Group_M_Tools_T_Logs,
    UIActionIndexMN_M_Group_M_Tools_T_Activity,
    UIActionIndexMN_M_Group_M_Tools_T_FileManager,
    UIActionIndexMN_M_Group_S_Discard,
    UIActionIndexMN_M_Group_S_ShowLogDialog,
    UIActionIndexMN_M_Group_S_Refresh,
    UIActionIndexMN_M_Group_S_ShowInFileManager,
    UIActionIndexMN_M_Group_S_CreateShortcut,
    UIActionIndexMN_M_Group_S_Sort,
    UIActionIndexMN_M_Group_T_Search,

    /* 'Machine' menu actions: */
    UIActionIndexMN_M_Machine,
    UIActionIndexMN_M_Machine_S_New,
    UIActionIndexMN_M_Machine_S_Add,
    UIActionIndexMN_M_Machine_S_Settings,
    UIActionIndexMN_M_Machine_S_Clone,
    UIActionIndexMN_M_Machine_S_Move,
    UIActionIndexMN_M_Machine_S_ExportToOCI,
    UIActionIndexMN_M_Machine_S_Remove,
    UIActionIndexMN_M_Machine_M_MoveToGroup,
    UIActionIndexMN_M_Machine_M_MoveToGroup_S_New,
    UIActionIndexMN_M_Machine_M_StartOrShow,
    UIActionIndexMN_M_Machine_M_StartOrShow_S_StartNormal,
    UIActionIndexMN_M_Machine_M_StartOrShow_S_StartHeadless,
    UIActionIndexMN_M_Machine_M_StartOrShow_S_StartDetachable,
    UIActionIndexMN_M_Machine_T_Pause,
    UIActionIndexMN_M_Machine_S_Reset,
    UIActionIndexMN_M_Machine_M_Console,
    UIActionIndexMN_M_Machine_M_Console_S_CreateConnection,
    UIActionIndexMN_M_Machine_M_Console_S_DeleteConnection,
    UIActionIndexMN_M_Machine_M_Console_S_CopyCommandSerialUnix,
    UIActionIndexMN_M_Machine_M_Console_S_CopyCommandSerialWindows,
    UIActionIndexMN_M_Machine_M_Console_S_CopyCommandVNCUnix,
    UIActionIndexMN_M_Machine_M_Console_S_CopyCommandVNCWindows,
    UIActionIndexMN_M_Machine_M_Console_S_ConfigureApplications,
    UIActionIndexMN_M_Machine_M_Close,
    UIActionIndexMN_M_Machine_M_Close_S_Detach,
    UIActionIndexMN_M_Machine_M_Close_S_SaveState,
    UIActionIndexMN_M_Machine_M_Close_S_Terminate,
    UIActionIndexMN_M_Machine_M_Close_S_Shutdown,
    UIActionIndexMN_M_Machine_M_Close_S_PowerOff,
    UIActionIndexMN_M_Machine_M_Tools,
    UIActionIndexMN_M_Machine_M_Tools_T_Details,
    UIActionIndexMN_M_Machine_M_Tools_T_Snapshots,
    UIActionIndexMN_M_Machine_M_Tools_T_Logs,
    UIActionIndexMN_M_Machine_M_Tools_T_Activity,
    UIActionIndexMN_M_Machine_M_Tools_T_FileManager,
    UIActionIndexMN_M_Machine_S_Discard,
    UIActionIndexMN_M_Machine_S_ShowLogDialog,
    UIActionIndexMN_M_Machine_S_Refresh,
    UIActionIndexMN_M_Machine_S_ShowInFileManager,
    UIActionIndexMN_M_Machine_S_CreateShortcut,
    UIActionIndexMN_M_Machine_S_SortParent,
    UIActionIndexMN_M_Machine_T_Search,

    /* Snapshot Pane actions: */
    UIActionIndexMN_M_Snapshot,
    UIActionIndexMN_M_Snapshot_S_Take,
    UIActionIndexMN_M_Snapshot_S_Delete,
    UIActionIndexMN_M_Snapshot_S_Restore,
    UIActionIndexMN_M_Snapshot_T_Properties,
    UIActionIndexMN_M_Snapshot_S_Clone,

    /* Extension Pack Manager actions: */
    UIActionIndexMN_M_ExtensionWindow,
    UIActionIndexMN_M_Extension,
    UIActionIndexMN_M_Extension_S_Install,
    UIActionIndexMN_M_Extension_S_Uninstall,

    /* Virtual Media Manager actions: */
    UIActionIndexMN_M_MediumWindow,
    UIActionIndexMN_M_Medium,
    UIActionIndexMN_M_Medium_S_Add,
    UIActionIndexMN_M_Medium_S_Create,
    UIActionIndexMN_M_Medium_S_Copy,
    UIActionIndexMN_M_Medium_S_Move,
    UIActionIndexMN_M_Medium_S_Remove,
    UIActionIndexMN_M_Medium_S_Release,
    UIActionIndexMN_M_Medium_T_Details,
    UIActionIndexMN_M_Medium_T_Search,
    UIActionIndexMN_M_Medium_S_Refresh,

    /* Network Manager actions: */
    UIActionIndexMN_M_NetworkWindow,
    UIActionIndexMN_M_Network,
    UIActionIndexMN_M_Network_S_Create,
    UIActionIndexMN_M_Network_S_Remove,
    UIActionIndexMN_M_Network_T_Details,
    UIActionIndexMN_M_Network_S_Refresh,

    /* Cloud Profile Manager actions: */
    UIActionIndexMN_M_CloudWindow,
    UIActionIndexMN_M_Cloud,
    UIActionIndexMN_M_Cloud_S_Add,
    UIActionIndexMN_M_Cloud_S_Import,
    UIActionIndexMN_M_Cloud_S_Remove,
    UIActionIndexMN_M_Cloud_T_Details,
    UIActionIndexMN_M_Cloud_S_TryPage,
    UIActionIndexMN_M_Cloud_S_Help,

    /* Cloud Console Manager actions: */
    UIActionIndexMN_M_CloudConsoleWindow,
    UIActionIndexMN_M_CloudConsole,
    UIActionIndexMN_M_CloudConsole_S_ApplicationAdd,
    UIActionIndexMN_M_CloudConsole_S_ApplicationRemove,
    UIActionIndexMN_M_CloudConsole_S_ProfileAdd,
    UIActionIndexMN_M_CloudConsole_S_ProfileRemove,
    UIActionIndexMN_M_CloudConsole_T_Details,

    /* VM VM Activity Overview actions: */
    UIActionIndexMN_M_VMActivityOverview,
    UIActionIndexMN_M_VMActivityOverview_M_Columns,
    UIActionIndexMN_M_VMActivityOverview_S_SwitchToMachineActivity,

    /* Maximum index: */
    UIActionIndexMN_Max
};


/** UIActionPool extension
  * representing action-pool singleton for Manager UI. */
class SHARED_LIBRARY_STUFF UIActionPoolManager : public UIActionPool
{
    Q_OBJECT;

protected:

    /** Constructs action-pool.
      * @param  fTemporary  Brings whether this action-pool is temporary,
      *                     used to (re-)initialize shortcuts-pool. */
    UIActionPoolManager(bool fTemporary = false);

    /** Prepares pool. */
    virtual void preparePool() /* override */;
    /** Prepares connections. */
    virtual void prepareConnections() /* override */;

    /** Updates menu. */
    virtual void updateMenu(int iIndex) /* override */;
    /** Updates menus. */
    virtual void updateMenus() /* override */;

    /** Defines whether shortcuts of menu actions with specified @a iIndex should be visible. */
    virtual void setShortcutsVisible(int iIndex, bool fVisible) /* override */;
    /** Returns extra-data ID to save keyboard shortcuts under. */
    virtual QString shortcutsExtraDataID() const /* override */;
    /** Updates shortcuts. */
    virtual void updateShortcuts() /* override */;

private:

    /** Updates 'File' menu. */
    void updateMenuFile();
    /** Updates 'File' / 'Tools' menu. */
    void updateMenuFileTools();
    /** Updates 'Welcome' menu. */
    void updateMenuWelcome();
    /** Updates 'Group' menu. */
    void updateMenuGroup();
    /** Updates 'Machine' menu. */
    void updateMenuMachine();
    /** Updates 'Group' / 'Move to Group' menu. */
    void updateMenuGroupMoveToGroup();
    /** Updates 'Machine' / 'Move to Group' menu. */
    void updateMenuMachineMoveToGroup();
    /** Updates 'Group' / 'Start or Show' menu. */
    void updateMenuGroupStartOrShow();
    /** Updates 'Machine' / 'Start or Show' menu. */
    void updateMenuMachineStartOrShow();
    /** Updates 'Group' / 'Console' menu. */
    void updateMenuGroupConsole();
    /** Updates 'Machine' / 'Console' menu. */
    void updateMenuMachineConsole();
    /** Updates 'Group' / 'Close' menu. */
    void updateMenuGroupClose();
    /** Updates 'Machine' / 'Close' menu. */
    void updateMenuMachineClose();
    /** Updates 'Group' / 'Tools' menu. */
    void updateMenuGroupTools();
    /** Updates 'Machine' / 'Tools' menu. */
    void updateMenuMachineTools();

    /** Updates 'Extension Pack' window menu. */
    void updateMenuExtensionWindow();
    /** Updates 'Extension Pack' menu. */
    void updateMenuExtension();
    /** Updates 'Extension Pack' @a pMenu. */
    void updateMenuExtensionWrapper(UIMenu *pMenu);

    /** Updates 'Medium' window menu. */
    void updateMenuMediumWindow();
    /** Updates 'Medium' menu. */
    void updateMenuMedium();
    /** Updates 'Medium' @a pMenu. */
    void updateMenuMediumWrapper(UIMenu *pMenu);

    /** Updates 'Network' window menu. */
    void updateMenuNetworkWindow();
    /** Updates 'Network' menu. */
    void updateMenuNetwork();
    /** Updates 'Network' @a pMenu. */
    void updateMenuNetworkWrapper(UIMenu *pMenu);

    /** Updates 'Cloud' window menu. */
    void updateMenuCloudWindow();
    /** Updates 'Cloud' menu. */
    void updateMenuCloud();
    /** Updates 'Cloud' @a pMenu. */
    void updateMenuCloudWrapper(UIMenu *pMenu);

    /** Updates 'Cloud Console' window menu. */
    void updateMenuCloudConsoleWindow();
    /** Updates 'Cloud Console' menu. */
    void updateMenuCloudConsole();
    /** Updates 'Cloud Console' @a pMenu. */
    void updateMenuCloudConsoleWrapper(UIMenu *pMenu);

    /** Updates 'VM VM Activity Overview' menu. */
    void updateMenuVMActivityOverview();
    /** Updates 'VM VM Activity Overview' @a pMenu. */
    void updateMenuVMActivityOverviewWrapper(UIMenu *pMenu);

    /** Updates 'Snapshot' menu. */
    void updateMenuSnapshot();

    /** Enables factory in base-class. */
    friend class UIActionPool;
};


#endif /* !FEQT_INCLUDED_SRC_globals_UIActionPoolManager_h */