VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.cpp@ 103771

Last change on this file since 103771 was 103771, checked in by vboxsync, 3 months ago

FE/Qt: UICommon: Switching dependency from UICommon to UIGlobalSession whenever is possible.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 155.2 KB
Line 
1/* $Id: UIActionPoolRuntime.cpp 103771 2024-03-11 15:16:04Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIActionPoolRuntime class implementation.
4 */
5
6/*
7 * Copyright (C) 2010-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28/* Qt includes: */
29#include <QActionGroup>
30
31/* GUI includes: */
32#include "UICommon.h"
33#include "UIActionPoolRuntime.h"
34#include "UIConverter.h"
35#include "UIDesktopWidgetWatchdog.h"
36#include "UIExtraDataManager.h"
37#include "UIGlobalSession.h"
38#include "UIIconPool.h"
39#include "UIShortcutPool.h"
40
41/* COM includes: */
42#include "CExtPack.h"
43#include "CExtPackManager.h"
44
45/* External includes: */
46#include <math.h>
47
48
49/* Namespaces: */
50using namespace UIExtraDataDefs;
51
52
53/** Menu action extension, used as 'Machine' menu class. */
54class UIActionMenuRuntimeMachine : public UIActionMenu
55{
56 Q_OBJECT;
57
58public:
59
60 /** Constructs action passing @a pParent to the base-class. */
61 UIActionMenuRuntimeMachine(UIActionPool *pParent)
62 : UIActionMenu(pParent)
63 {}
64
65protected:
66
67 /** Returns action extra-data ID. */
68 virtual int extraDataID() const RT_OVERRIDE
69 {
70 return UIExtraDataMetaDefs::MenuType_Machine;
71 }
72 /** Returns action extra-data key. */
73 virtual QString extraDataKey() const RT_OVERRIDE
74 {
75 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Machine);
76 }
77 /** Returns whether action is allowed. */
78 virtual bool isAllowed() const RT_OVERRIDE
79 {
80 return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Machine);
81 }
82
83 /** Handles translation event. */
84 virtual void retranslateUi() RT_OVERRIDE
85 {
86 setName(QApplication::translate("UIActionPool", "&Machine"));
87 }
88};
89
90/** Simple action extension, used as 'Show Settings' action class. */
91class UIActionSimpleRuntimeShowSettings : public UIActionSimple
92{
93 Q_OBJECT;
94
95public:
96
97 /** Constructs action passing @a pParent to the base-class. */
98 UIActionSimpleRuntimeShowSettings(UIActionPool *pParent)
99 : UIActionSimple(pParent, ":/vm_settings_16px.png", ":/vm_settings_disabled_16px.png", true)
100 {}
101
102protected:
103
104 /** Returns action extra-data ID. */
105 virtual int extraDataID() const RT_OVERRIDE
106 {
107 return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog;
108 }
109 /** Returns action extra-data key. */
110 virtual QString extraDataKey() const RT_OVERRIDE
111 {
112 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog);
113 }
114 /** Returns whether action is allowed. */
115 virtual bool isAllowed() const RT_OVERRIDE
116 {
117 return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog);
118 }
119
120 /** Returns shortcut extra-data ID. */
121 virtual QString shortcutExtraDataID() const RT_OVERRIDE
122 {
123 return QString("SettingsDialog");
124 }
125
126 /** Returns default shortcut. */
127 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
128 {
129 return QKeySequence("S");
130 }
131
132 /** Handles translation event. */
133 virtual void retranslateUi() RT_OVERRIDE
134 {
135 setName(QApplication::translate("UIActionPool", "&Settings..."));
136 setStatusTip(QApplication::translate("UIActionPool", "Display the virtual machine settings window"));
137 }
138};
139
140/** Simple action extension, used as 'Perform Take Snapshot' action class. */
141class UIActionSimpleRuntimePerformTakeSnapshot : public UIActionSimple
142{
143 Q_OBJECT;
144
145public:
146
147 /** Constructs action passing @a pParent to the base-class. */
148 UIActionSimpleRuntimePerformTakeSnapshot(UIActionPool *pParent)
149 : UIActionSimple(pParent, ":/snapshot_take_16px.png", ":/snapshot_take_disabled_16px.png", true)
150 {}
151
152protected:
153
154 /** Returns action extra-data ID. */
155 virtual int extraDataID() const RT_OVERRIDE
156 {
157 return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot;
158 }
159 /** Returns action extra-data key. */
160 virtual QString extraDataKey() const RT_OVERRIDE
161 {
162 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot);
163 }
164 /** Returns whether action is allowed. */
165 virtual bool isAllowed() const RT_OVERRIDE
166 {
167 return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot);
168 }
169
170 /** Returns shortcut extra-data ID. */
171 virtual QString shortcutExtraDataID() const RT_OVERRIDE
172 {
173 return QString("TakeSnapshot");
174 }
175
176 /** Returns default shortcut. */
177 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
178 {
179 return QKeySequence("T");
180 }
181
182 /** Handles translation event. */
183 virtual void retranslateUi() RT_OVERRIDE
184 {
185 setName(QApplication::translate("UIActionPool", "Take Sn&apshot..."));
186 setStatusTip(QApplication::translate("UIActionPool", "Take a snapshot of the virtual machine"));
187 }
188};
189
190/** Simple action extension, used as 'Show Information Dialog' action class. */
191class UIActionSimpleRuntimeShowInformationDialog : public UIActionSimple
192{
193 Q_OBJECT;
194
195public:
196
197 /** Constructs action passing @a pParent to the base-class. */
198 UIActionSimpleRuntimeShowInformationDialog(UIActionPool *pParent)
199 : UIActionSimple(pParent, ":/session_info_16px.png", ":/session_info_disabled_16px.png", true)
200 {}
201
202protected:
203
204 /** Returns action extra-data ID. */
205 virtual int extraDataID() const RT_OVERRIDE
206 {
207 return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_InformationDialog;
208 }
209 /** Returns action extra-data key. */
210 virtual QString extraDataKey() const RT_OVERRIDE
211 {
212 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_InformationDialog);
213 }
214 /** Returns whether action is allowed. */
215 virtual bool isAllowed() const RT_OVERRIDE
216 {
217 return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_InformationDialog);
218 }
219
220 /** Returns shortcut extra-data ID. */
221 virtual QString shortcutExtraDataID() const RT_OVERRIDE
222 {
223 return QString("InformationDialog");
224 }
225
226 /** Returns default shortcut. */
227 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
228 {
229 return QKeySequence("N");
230 }
231
232 /** Handles translation event. */
233 virtual void retranslateUi() RT_OVERRIDE
234 {
235 setName(QApplication::translate("UIActionPool", "Session I&nformation..."));
236 setStatusTip(QApplication::translate("UIActionPool", "Display the virtual machine session information window"));
237 }
238};
239
240/** Simple action extension, used as 'Show File Manager Dialog' action class. */
241class UIActionSimpleRuntimeShowFileManagerDialog : public UIActionSimple
242{
243 Q_OBJECT;
244
245public:
246
247 /** Constructs action passing @a pParent to the base-class. */
248 UIActionSimpleRuntimeShowFileManagerDialog(UIActionPool *pParent)
249 : UIActionSimple(pParent, ":/file_manager_16px.png", ":/file_manager_disabled_16px.png", true)
250 {}
251
252protected:
253
254 /** Returns action extra-data ID. */
255 virtual int extraDataID() const RT_OVERRIDE
256 {
257 return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_FileManagerDialog;
258 }
259 /** Returns action extra-data key. */
260 virtual QString extraDataKey() const RT_OVERRIDE
261 {
262 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_FileManagerDialog);
263 }
264 /** Returns whether action is allowed. */
265 virtual bool isAllowed() const RT_OVERRIDE
266 {
267 return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_FileManagerDialog);
268 }
269
270 /** Returns shortcut extra-data ID. */
271 virtual QString shortcutExtraDataID() const RT_OVERRIDE
272 {
273 return QString("FileManagerDialog");
274 }
275
276 /** Returns default shortcut. */
277 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
278 {
279 return QKeySequence();
280 }
281
282 /** Handles translation event. */
283 virtual void retranslateUi() RT_OVERRIDE
284 {
285 setName(QApplication::translate("UIActionPool", "File Manager..."));
286 setStatusTip(QApplication::translate("UIActionPool", "Display the virtual machine file manager window"));
287 }
288};
289
290/** Toggle action extension, used as 'Pause' action class. */
291class UIActionToggleRuntimePause : public UIActionToggle
292{
293 Q_OBJECT;
294
295public:
296
297 /** Constructs action passing @a pParent to the base-class. */
298 UIActionToggleRuntimePause(UIActionPool *pParent)
299 : UIActionToggle(pParent,
300 ":/vm_pause_on_16px.png", ":/vm_pause_16px.png",
301 ":/vm_pause_on_disabled_16px.png", ":/vm_pause_disabled_16px.png",
302 true)
303 {}
304
305protected:
306
307 /** Returns action extra-data ID. */
308 virtual int extraDataID() const RT_OVERRIDE
309 {
310 return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause;
311 }
312 /** Returns action extra-data key. */
313 virtual QString extraDataKey() const RT_OVERRIDE
314 {
315 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause);
316 }
317 /** Returns whether action is allowed. */
318 virtual bool isAllowed() const RT_OVERRIDE
319 {
320 return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause);
321 }
322
323 /** Returns shortcut extra-data ID. */
324 virtual QString shortcutExtraDataID() const RT_OVERRIDE
325 {
326 return QString("Pause");
327 }
328
329 /** Returns default shortcut. */
330 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
331 {
332 return QKeySequence("P");
333 }
334
335 /** Handles translation event. */
336 virtual void retranslateUi() RT_OVERRIDE
337 {
338 setName(QApplication::translate("UIActionPool", "&Pause"));
339 setStatusTip(QApplication::translate("UIActionPool", "Suspend the execution of the virtual machine"));
340 }
341};
342
343/** Simple action extension, used as 'Perform Reset' action class. */
344class UIActionSimpleRuntimePerformReset : public UIActionSimple
345{
346 Q_OBJECT;
347
348public:
349
350 /** Constructs action passing @a pParent to the base-class. */
351 UIActionSimpleRuntimePerformReset(UIActionPool *pParent)
352 : UIActionSimple(pParent, ":/vm_reset_16px.png", ":/vm_reset_disabled_16px.png", true)
353 {}
354
355protected:
356
357 /** Returns action extra-data ID. */
358 virtual int extraDataID() const RT_OVERRIDE
359 {
360 return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Reset;
361 }
362 /** Returns action extra-data key. */
363 virtual QString extraDataKey() const RT_OVERRIDE
364 {
365 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Reset);
366 }
367 /** Returns whether action is allowed. */
368 virtual bool isAllowed() const RT_OVERRIDE
369 {
370 return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Reset);
371 }
372
373 /** Returns shortcut extra-data ID. */
374 virtual QString shortcutExtraDataID() const RT_OVERRIDE
375 {
376 return QString("Reset");
377 }
378
379 /** Returns default shortcut. */
380 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
381 {
382 return QKeySequence("R");
383 }
384
385 /** Handles translation event. */
386 virtual void retranslateUi() RT_OVERRIDE
387 {
388 setName(QApplication::translate("UIActionPool", "&Reset"));
389 setStatusTip(QApplication::translate("UIActionPool", "Reset the virtual machine"));
390 }
391};
392
393/** Simple action extension, used as 'Perform Detach' action class. */
394class UIActionSimpleRuntimePerformDetach : public UIActionSimple
395{
396 Q_OBJECT;
397
398public:
399
400 /** Constructs action passing @a pParent to the base-class. */
401 UIActionSimpleRuntimePerformDetach(UIActionPool *pParent)
402 : UIActionSimple(pParent, ":/vm_create_shortcut_16px.png", ":/vm_create_shortcut_disabled_16px.png", true)
403 {}
404
405protected:
406
407 /** Returns action extra-data ID. */
408 virtual int extraDataID() const RT_OVERRIDE
409 {
410 return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Detach;
411 }
412 /** Returns action extra-data key. */
413 virtual QString extraDataKey() const RT_OVERRIDE
414 {
415 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Detach);
416 }
417 /** Returns whether action is allowed. */
418 virtual bool isAllowed() const RT_OVERRIDE
419 {
420 return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Detach);
421 }
422
423 /** Returns shortcut extra-data ID. */
424 virtual QString shortcutExtraDataID() const RT_OVERRIDE
425 {
426 return QString("DetachUI");
427 }
428
429 /** Handles translation event. */
430 virtual void retranslateUi() RT_OVERRIDE
431 {
432 setName(QApplication::translate("UIActionPool", "&Detach GUI"));
433 setStatusTip(QApplication::translate("UIActionPool", "Detach the GUI from headless VM"));
434 }
435};
436
437/** Simple action extension, used as 'Perform Save State' action class. */
438class UIActionSimpleRuntimePerformSaveState : public UIActionSimple
439{
440 Q_OBJECT;
441
442public:
443
444 /** Constructs action passing @a pParent to the base-class. */
445 UIActionSimpleRuntimePerformSaveState(UIActionPool *pParent)
446 : UIActionSimple(pParent, ":/vm_save_state_16px.png", ":/vm_save_state_disabled_16px.png", true)
447 {}
448
449protected:
450
451 /** Returns action extra-data ID. */
452 virtual int extraDataID() const RT_OVERRIDE
453 {
454 return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SaveState;
455 }
456 /** Returns action extra-data key. */
457 virtual QString extraDataKey() const RT_OVERRIDE
458 {
459 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SaveState);
460 }
461 /** Returns whether action is allowed. */
462 virtual bool isAllowed() const RT_OVERRIDE
463 {
464 return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SaveState);
465 }
466
467 /** Returns shortcut extra-data ID. */
468 virtual QString shortcutExtraDataID() const RT_OVERRIDE
469 {
470 return QString("SaveState");
471 }
472
473 /** Handles translation event. */
474 virtual void retranslateUi() RT_OVERRIDE
475 {
476 setName(QApplication::translate("UIActionPool", "&Save State"));
477 setStatusTip(QApplication::translate("UIActionPool", "Save the state of the virtual machine"));
478 }
479};
480
481/** Simple action extension, used as 'Perform Shutdown' action class. */
482class UIActionSimpleRuntimePerformShutdown : public UIActionSimple
483{
484 Q_OBJECT;
485
486public:
487
488 /** Constructs action passing @a pParent to the base-class. */
489 UIActionSimpleRuntimePerformShutdown(UIActionPool *pParent)
490 : UIActionSimple(pParent, ":/vm_shutdown_16px.png", ":/vm_shutdown_disabled_16px.png", true)
491 {}
492
493protected:
494
495 /** Returns action extra-data ID. */
496 virtual int extraDataID() const RT_OVERRIDE
497 {
498 return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Shutdown;
499 }
500 /** Returns action extra-data key. */
501 virtual QString extraDataKey() const RT_OVERRIDE
502 {
503 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Shutdown);
504 }
505 /** Returns whether action is allowed. */
506 virtual bool isAllowed() const RT_OVERRIDE
507 {
508 return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Shutdown);
509 }
510
511 /** Returns shortcut extra-data ID. */
512 virtual QString shortcutExtraDataID() const RT_OVERRIDE
513 {
514 return QString("Shutdown");
515 }
516
517 /** Returns default shortcut. */
518 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
519 {
520#ifdef VBOX_WS_MAC
521 return QKeySequence("U");
522#else
523 return QKeySequence("H");
524#endif
525 }
526
527 /** Handles translation event. */
528 virtual void retranslateUi() RT_OVERRIDE
529 {
530 setName(QApplication::translate("UIActionPool", "ACPI Sh&utdown"));
531 setStatusTip(QApplication::translate("UIActionPool", "Send the ACPI Shutdown signal to the virtual machine"));
532 }
533};
534
535/** Simple action extension, used as 'Perform PowerOff' action class. */
536class UIActionSimpleRuntimePerformPowerOff : public UIActionSimple
537{
538 Q_OBJECT;
539
540public:
541
542 /** Constructs action passing @a pParent to the base-class. */
543 UIActionSimpleRuntimePerformPowerOff(UIActionPool *pParent)
544 : UIActionSimple(pParent, ":/vm_poweroff_16px.png", ":/vm_poweroff_disabled_16px.png", true)
545 {}
546
547protected:
548
549 /** Returns action extra-data ID. */
550 virtual int extraDataID() const RT_OVERRIDE
551 {
552 return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_PowerOff;
553 }
554 /** Returns action extra-data key. */
555 virtual QString extraDataKey() const RT_OVERRIDE
556 {
557 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_PowerOff);
558 }
559 /** Returns whether action is allowed. */
560 virtual bool isAllowed() const RT_OVERRIDE
561 {
562 return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_PowerOff);
563 }
564
565 /** Returns shortcut extra-data ID. */
566 virtual QString shortcutExtraDataID() const RT_OVERRIDE
567 {
568 return QString("PowerOff");
569 }
570
571 /** Handles translation event. */
572 virtual void retranslateUi() RT_OVERRIDE
573 {
574 setName(QApplication::translate("UIActionPool", "Po&wer Off"));
575 setStatusTip(QApplication::translate("UIActionPool", "Power off the virtual machine"));
576 }
577};
578
579/** Simple action extension, used as 'Show Logs' action class. */
580class UIActionSimpleRuntimeShowLogs : public UIActionSimple
581{
582 Q_OBJECT;
583
584public:
585
586 /** Constructs action passing @a pParent to the base-class. */
587 UIActionSimpleRuntimeShowLogs(UIActionPool *pParent)
588 : UIActionSimple(pParent, ":/vm_show_logs_16px.png", ":/vm_show_logs_disabled_16px.png", true)
589 {}
590
591protected:
592
593 /** Returns action extra-data ID. */
594 virtual int extraDataID() const RT_OVERRIDE
595 {
596 return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_LogDialog;
597 }
598 /** Returns action extra-data key. */
599 virtual QString extraDataKey() const RT_OVERRIDE
600 {
601 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_LogDialog);
602 }
603 /** Returns whether action is allowed. */
604 virtual bool isAllowed() const RT_OVERRIDE
605 {
606 return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_LogDialog);
607 }
608
609 /** Returns shortcut extra-data ID. */
610 virtual QString shortcutExtraDataID() const RT_OVERRIDE
611 {
612 return QString("LogWindow");
613 }
614
615 /** Handles translation event. */
616 virtual void retranslateUi() RT_OVERRIDE
617 {
618 setName(QApplication::translate("UIActionPool", "Show &Log..."));
619 setStatusTip(QApplication::translate("UIActionPool", "Display the log viewer window"));
620 }
621};
622
623/** Menu action extension, used as 'View' menu class. */
624class UIActionMenuRuntimeView : public UIActionMenu
625{
626 Q_OBJECT;
627
628public:
629
630 /** Constructs action passing @a pParent to the base-class. */
631 UIActionMenuRuntimeView(UIActionPool *pParent)
632 : UIActionMenu(pParent)
633 {}
634
635protected:
636
637 /** Returns action extra-data ID. */
638 virtual int extraDataID() const RT_OVERRIDE
639 {
640 return UIExtraDataMetaDefs::MenuType_View;
641 }
642 /** Returns action extra-data key. */
643 virtual QString extraDataKey() const RT_OVERRIDE
644 {
645 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_View);
646 }
647 /** Returns whether action is allowed. */
648 virtual bool isAllowed() const RT_OVERRIDE
649 {
650 return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_View);
651 }
652
653 /** Handles translation event. */
654 virtual void retranslateUi() RT_OVERRIDE
655 {
656 setName(QApplication::translate("UIActionPool", "&View"));
657 }
658};
659
660/** Menu action extension, used as 'View Popup' menu class. */
661class UIActionMenuRuntimeViewPopup : public UIActionMenu
662{
663 Q_OBJECT;
664
665public:
666
667 /** Constructs action passing @a pParent to the base-class. */
668 UIActionMenuRuntimeViewPopup(UIActionPool *pParent)
669 : UIActionMenu(pParent)
670 {}
671
672protected:
673
674 /** Returns action extra-data ID. */
675 virtual int extraDataID() const RT_OVERRIDE
676 {
677 return UIExtraDataMetaDefs::MenuType_View;
678 }
679 /** Returns action extra-data key. */
680 virtual QString extraDataKey() const RT_OVERRIDE
681 {
682 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_View);
683 }
684 /** Returns whether action is allowed. */
685 virtual bool isAllowed() const RT_OVERRIDE
686 {
687 return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_View);
688 }
689
690 /** Handles translation event. */
691 virtual void retranslateUi() RT_OVERRIDE {}
692};
693
694/** Toggle action extension, used as 'Full-screen Mode' action class. */
695class UIActionToggleRuntimeFullscreenMode : public UIActionToggle
696{
697 Q_OBJECT;
698
699public:
700
701 /** Constructs action passing @a pParent to the base-class. */
702 UIActionToggleRuntimeFullscreenMode(UIActionPool *pParent)
703 : UIActionToggle(pParent,
704 ":/fullscreen_on_16px.png", ":/fullscreen_16px.png",
705 ":/fullscreen_on_disabled_16px.png", ":/fullscreen_disabled_16px.png",
706 true)
707 {}
708
709protected:
710
711 /** Returns action extra-data ID. */
712 virtual int extraDataID() const RT_OVERRIDE
713 {
714 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_Fullscreen;
715 }
716 /** Returns action extra-data key. */
717 virtual QString extraDataKey() const RT_OVERRIDE
718 {
719 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Fullscreen);
720 }
721 /** Returns whether action is allowed. */
722 virtual bool isAllowed() const RT_OVERRIDE
723 {
724 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Fullscreen);
725 }
726
727 /** Returns shortcut extra-data ID. */
728 virtual QString shortcutExtraDataID() const RT_OVERRIDE
729 {
730 return QString("FullscreenMode");
731 }
732
733 /** Returns default shortcut. */
734 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
735 {
736 return QKeySequence("F");
737 }
738
739 /** Handles translation event. */
740 virtual void retranslateUi() RT_OVERRIDE
741 {
742 setName(QApplication::translate("UIActionPool", "&Full-screen Mode"));
743 setStatusTip(QApplication::translate("UIActionPool", "Switch between normal and full-screen mode"));
744 }
745};
746
747/** Toggle action extension, used as 'Seamless Mode' action class. */
748class UIActionToggleRuntimeSeamlessMode : public UIActionToggle
749{
750 Q_OBJECT;
751
752public:
753
754 /** Constructs action passing @a pParent to the base-class. */
755 UIActionToggleRuntimeSeamlessMode(UIActionPool *pParent)
756 : UIActionToggle(pParent,
757 ":/seamless_on_16px.png", ":/seamless_16px.png",
758 ":/seamless_on_disabled_16px.png", ":/seamless_disabled_16px.png",
759 true)
760 {}
761
762protected:
763
764 /** Returns action extra-data ID. */
765 virtual int extraDataID() const RT_OVERRIDE
766 {
767 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_Seamless;
768 }
769 /** Returns action extra-data key. */
770 virtual QString extraDataKey() const RT_OVERRIDE
771 {
772 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Seamless);
773 }
774 /** Returns whether action is allowed. */
775 virtual bool isAllowed() const RT_OVERRIDE
776 {
777 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Seamless);
778 }
779
780 /** Returns shortcut extra-data ID. */
781 virtual QString shortcutExtraDataID() const RT_OVERRIDE
782 {
783 return QString("SeamlessMode");
784 }
785
786 /** Returns default shortcut. */
787 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
788 {
789 return QKeySequence("L");
790 }
791
792 /** Handles translation event. */
793 virtual void retranslateUi() RT_OVERRIDE
794 {
795 setName(QApplication::translate("UIActionPool", "Seam&less Mode"));
796 setStatusTip(QApplication::translate("UIActionPool", "Switch between normal and seamless desktop integration mode"));
797 }
798};
799
800/** Toggle action extension, used as 'Scaled Mode' action class. */
801class UIActionToggleRuntimeScaledMode : public UIActionToggle
802{
803 Q_OBJECT;
804
805public:
806
807 /** Constructs action passing @a pParent to the base-class. */
808 UIActionToggleRuntimeScaledMode(UIActionPool *pParent)
809 : UIActionToggle(pParent,
810 ":/scale_on_16px.png", ":/scale_16px.png",
811 ":/scale_on_disabled_16px.png", ":/scale_disabled_16px.png",
812 true)
813 {}
814
815protected:
816
817 /** Returns action extra-data ID. */
818 virtual int extraDataID() const RT_OVERRIDE
819 {
820 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_Scale;
821 }
822 /** Returns action extra-data key. */
823 virtual QString extraDataKey() const RT_OVERRIDE
824 {
825 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Scale);
826 }
827 /** Returns whether action is allowed. */
828 virtual bool isAllowed() const RT_OVERRIDE
829 {
830 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Scale);
831 }
832
833 /** Returns shortcut extra-data ID. */
834 virtual QString shortcutExtraDataID() const RT_OVERRIDE
835 {
836 return QString("ScaleMode");
837 }
838
839 /** Returns default shortcut. */
840 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
841 {
842 return QKeySequence("C");
843 }
844
845 /** Handles translation event. */
846 virtual void retranslateUi() RT_OVERRIDE
847 {
848 setName(QApplication::translate("UIActionPool", "S&caled Mode"));
849 setStatusTip(QApplication::translate("UIActionPool", "Switch between normal and scaled mode"));
850 }
851};
852
853#ifndef VBOX_WS_MAC
854/** Simple action extension, used as 'Perform Minimize Window' action class. */
855class UIActionSimpleRuntimePerformMinimizeWindow : public UIActionSimple
856{
857 Q_OBJECT;
858
859public:
860
861 /** Constructs action passing @a pParent to the base-class. */
862 UIActionSimpleRuntimePerformMinimizeWindow(UIActionPool *pParent)
863 : UIActionSimple(pParent, ":/minimize_16px.png", ":/minimize_16px.png", true)
864 {}
865
866protected:
867
868 /** Returns action extra-data ID. */
869 virtual int extraDataID() const RT_OVERRIDE
870 {
871 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_MinimizeWindow;
872 }
873 /** Returns action extra-data key. */
874 virtual QString extraDataKey() const RT_OVERRIDE
875 {
876 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MinimizeWindow);
877 }
878 /** Returns whether action is allowed. */
879 virtual bool isAllowed() const RT_OVERRIDE
880 {
881 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MinimizeWindow);
882 }
883
884 /** Returns shortcut extra-data ID. */
885 virtual QString shortcutExtraDataID() const RT_OVERRIDE
886 {
887 return QString("WindowMinimize");
888 }
889
890 /** Returns default shortcut. */
891 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
892 {
893 return QKeySequence("M");
894 }
895
896 /** Handles translation event. */
897 virtual void retranslateUi() RT_OVERRIDE
898 {
899 setName(QApplication::translate("UIActionPool", "&Minimize Window"));
900 setStatusTip(QApplication::translate("UIActionPool", "Minimize active window"));
901 }
902};
903#endif /* !VBOX_WS_MAC */
904
905/** Simple action extension, used as 'Perform Window Adjust' action class. */
906class UIActionSimpleRuntimePerformWindowAdjust : public UIActionSimple
907{
908 Q_OBJECT;
909
910public:
911
912 /** Constructs action passing @a pParent to the base-class. */
913 UIActionSimpleRuntimePerformWindowAdjust(UIActionPool *pParent)
914 : UIActionSimple(pParent, ":/adjust_win_size_16px.png", ":/adjust_win_size_disabled_16px.png", true)
915 {}
916
917protected:
918
919 /** Returns action extra-data ID. */
920 virtual int extraDataID() const RT_OVERRIDE
921 {
922 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow;
923 }
924 /** Returns action extra-data key. */
925 virtual QString extraDataKey() const RT_OVERRIDE
926 {
927 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow);
928 }
929 /** Returns whether action is allowed. */
930 virtual bool isAllowed() const RT_OVERRIDE
931 {
932 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow);
933 }
934
935 /** Returns shortcut extra-data ID. */
936 virtual QString shortcutExtraDataID() const RT_OVERRIDE
937 {
938 return QString("WindowAdjust");
939 }
940
941 /** Returns default shortcut. */
942 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
943 {
944 return QKeySequence("A");
945 }
946
947 /** Handles translation event. */
948 virtual void retranslateUi() RT_OVERRIDE
949 {
950 setName(QApplication::translate("UIActionPool", "&Adjust Window Size"));
951 setStatusTip(QApplication::translate("UIActionPool", "Adjust window size and position to best fit the guest display"));
952 }
953};
954
955/** Toggle action extension, used as 'Guest Autoresize' action class. */
956class UIActionToggleRuntimeGuestAutoresize : public UIActionToggle
957{
958 Q_OBJECT;
959
960public:
961
962 /** Constructs action passing @a pParent to the base-class. */
963 UIActionToggleRuntimeGuestAutoresize(UIActionPool *pParent)
964 : UIActionToggle(pParent,
965 ":/auto_resize_on_on_16px.png", ":/auto_resize_on_16px.png",
966 ":/auto_resize_on_on_disabled_16px.png", ":/auto_resize_on_disabled_16px.png",
967 true)
968 {}
969
970protected:
971
972 /** Returns action extra-data ID. */
973 virtual int extraDataID() const RT_OVERRIDE
974 {
975 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize;
976 }
977 /** Returns action extra-data key. */
978 virtual QString extraDataKey() const RT_OVERRIDE
979 {
980 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize);
981 }
982 /** Returns whether action is allowed. */
983 virtual bool isAllowed() const RT_OVERRIDE
984 {
985 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize);
986 }
987
988 /** Returns shortcut extra-data ID. */
989 virtual QString shortcutExtraDataID() const RT_OVERRIDE
990 {
991 return QString("GuestAutoresize");
992 }
993
994 /** Handles translation event. */
995 virtual void retranslateUi() RT_OVERRIDE
996 {
997 setName(QApplication::translate("UIActionPool", "Auto-resize &Guest Display"));
998 setStatusTip(QApplication::translate("UIActionPool", "Automatically resize the guest display when the window is resized"));
999 }
1000};
1001
1002/** Simple action extension, used as 'Perform Take Screenshot' action class. */
1003class UIActionSimpleRuntimePerformTakeScreenshot : public UIActionSimple
1004{
1005 Q_OBJECT;
1006
1007public:
1008
1009 /** Constructs action passing @a pParent to the base-class. */
1010 UIActionSimpleRuntimePerformTakeScreenshot(UIActionPool *pParent)
1011 : UIActionSimple(pParent, ":/screenshot_take_16px.png", ":/screenshot_take_disabled_16px.png", true)
1012 {}
1013
1014protected:
1015
1016 /** Returns action extra-data ID. */
1017 virtual int extraDataID() const RT_OVERRIDE
1018 {
1019 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_TakeScreenshot;
1020 }
1021 /** Returns action extra-data key. */
1022 virtual QString extraDataKey() const RT_OVERRIDE
1023 {
1024 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_TakeScreenshot);
1025 }
1026 /** Returns whether action is allowed. */
1027 virtual bool isAllowed() const RT_OVERRIDE
1028 {
1029 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_TakeScreenshot);
1030 }
1031
1032 /** Returns shortcut extra-data ID. */
1033 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1034 {
1035 return QString("TakeScreenshot");
1036 }
1037
1038 /** Returns default shortcut. */
1039 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1040 {
1041 return QKeySequence("E");
1042 }
1043
1044 /** Handles translation event. */
1045 virtual void retranslateUi() RT_OVERRIDE
1046 {
1047 setName(QApplication::translate("UIActionPool", "Take Screensh&ot..."));
1048 setStatusTip(QApplication::translate("UIActionPool", "Take guest display screenshot"));
1049 }
1050};
1051
1052/** Menu action extension, used as 'View' menu class. */
1053class UIActionMenuRuntimeRecording : public UIActionMenu
1054{
1055 Q_OBJECT;
1056
1057public:
1058
1059 /** Constructs action passing @a pParent to the base-class. */
1060 UIActionMenuRuntimeRecording(UIActionPool *pParent)
1061 : UIActionMenu(pParent)
1062 {}
1063
1064protected:
1065
1066 /** Returns action extra-data ID. */
1067 virtual int extraDataID() const RT_OVERRIDE
1068 {
1069 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_Recording;
1070 }
1071 /** Returns action extra-data key. */
1072 virtual QString extraDataKey() const RT_OVERRIDE
1073 {
1074 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Recording);
1075 }
1076 /** Returns whether action is allowed. */
1077 virtual bool isAllowed() const RT_OVERRIDE
1078 {
1079 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Recording);
1080 }
1081
1082 /** Handles translation event. */
1083 virtual void retranslateUi() RT_OVERRIDE
1084 {
1085 setName(QApplication::translate("UIActionPool", "&Recording"));
1086 }
1087};
1088
1089/** Simple action extension, used as 'Show Recording Settings' action class. */
1090class UIActionSimpleRuntimeShowRecordingSettings : public UIActionSimple
1091{
1092 Q_OBJECT;
1093
1094public:
1095
1096 /** Constructs action passing @a pParent to the base-class. */
1097 UIActionSimpleRuntimeShowRecordingSettings(UIActionPool *pParent)
1098 : UIActionSimple(pParent, ":/video_capture_settings_16px.png", ":/video_capture_settings_16px.png", true)
1099 {}
1100
1101protected:
1102
1103 /** Returns action extra-data ID. */
1104 virtual int extraDataID() const RT_OVERRIDE
1105 {
1106 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_RecordingSettings;
1107 }
1108 /** Returns action extra-data key. */
1109 virtual QString extraDataKey() const RT_OVERRIDE
1110 {
1111 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_RecordingSettings);
1112 }
1113 /** Returns whether action is allowed. */
1114 virtual bool isAllowed() const RT_OVERRIDE
1115 {
1116 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_RecordingSettings);
1117 }
1118
1119 /** Returns shortcut extra-data ID. */
1120 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1121 {
1122 return QString("RecordingSettingsDialog");
1123 }
1124
1125 /** Handles translation event. */
1126 virtual void retranslateUi() RT_OVERRIDE
1127 {
1128 setName(QApplication::translate("UIActionPool", "&Recording Settings..."));
1129 setStatusTip(QApplication::translate("UIActionPool", "Display virtual machine settings window to configure video/audio recording"));
1130 }
1131};
1132
1133/** Toggle action extension, used as 'Recording' action class. */
1134class UIActionToggleRuntimeRecording : public UIActionToggle
1135{
1136 Q_OBJECT;
1137
1138public:
1139
1140 /** Constructs action passing @a pParent to the base-class. */
1141 UIActionToggleRuntimeRecording(UIActionPool *pParent)
1142 : UIActionToggle(pParent,
1143 ":/video_capture_on_16px.png", ":/video_capture_16px.png",
1144 ":/video_capture_on_disabled_16px.png", ":/video_capture_disabled_16px.png",
1145 true)
1146 {}
1147
1148protected:
1149
1150 /** Returns action extra-data ID. */
1151 virtual int extraDataID() const RT_OVERRIDE
1152 {
1153 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_StartRecording;
1154 }
1155 /** Returns action extra-data key. */
1156 virtual QString extraDataKey() const RT_OVERRIDE
1157 {
1158 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StartRecording);
1159 }
1160 /** Returns whether action is allowed. */
1161 virtual bool isAllowed() const RT_OVERRIDE
1162 {
1163 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StartRecording);
1164 }
1165
1166 /** Returns shortcut extra-data ID. */
1167 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1168 {
1169 return QString("Recording");
1170 }
1171
1172 /** Handles translation event. */
1173 virtual void retranslateUi() RT_OVERRIDE
1174 {
1175 setName(QApplication::translate("UIActionPool", "&Recording"));
1176 setStatusTip(QApplication::translate("UIActionPool", "Enable guest video/audio recording"));
1177 }
1178};
1179
1180/** Toggle action extension, used as 'VRDE Server' action class. */
1181class UIActionToggleRuntimeVRDEServer : public UIActionToggle
1182{
1183 Q_OBJECT;
1184
1185public:
1186
1187 /** Constructs action passing @a pParent to the base-class. */
1188 UIActionToggleRuntimeVRDEServer(UIActionPool *pParent)
1189 : UIActionToggle(pParent,
1190 ":/vrdp_on_16px.png", ":/vrdp_16px.png",
1191 ":/vrdp_on_disabled_16px.png", ":/vrdp_disabled_16px.png",
1192 true)
1193 {}
1194
1195protected:
1196
1197 /** Returns action extra-data ID. */
1198 virtual int extraDataID() const RT_OVERRIDE
1199 {
1200 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer;
1201 }
1202 /** Returns action extra-data key. */
1203 virtual QString extraDataKey() const RT_OVERRIDE
1204 {
1205 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer);
1206 }
1207 /** Returns whether action is allowed. */
1208 virtual bool isAllowed() const RT_OVERRIDE
1209 {
1210 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer);
1211 }
1212
1213 /** Returns shortcut extra-data ID. */
1214 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1215 {
1216 return QString("VRDPServer");
1217 }
1218
1219 /** Handles translation event. */
1220 virtual void retranslateUi() RT_OVERRIDE
1221 {
1222 setName(QApplication::translate("UIActionPool", "R&emote Display"));
1223 setStatusTip(QApplication::translate("UIActionPool", "Allow remote desktop (RDP) connections to this machine"));
1224 }
1225};
1226
1227/** Menu action extension, used as 'MenuBar' menu class. */
1228class UIActionMenuRuntimeMenuBar : public UIActionMenu
1229{
1230 Q_OBJECT;
1231
1232public:
1233
1234 /** Constructs action passing @a pParent to the base-class. */
1235 UIActionMenuRuntimeMenuBar(UIActionPool *pParent)
1236 : UIActionMenu(pParent, ":/menubar_16px.png", ":/menubar_disabled_16px.png")
1237 {}
1238
1239protected:
1240
1241 /** Returns action extra-data ID. */
1242 virtual int extraDataID() const RT_OVERRIDE
1243 {
1244 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar;
1245 }
1246 /** Returns action extra-data key. */
1247 virtual QString extraDataKey() const RT_OVERRIDE
1248 {
1249 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar);
1250 }
1251 /** Returns whether action is allowed. */
1252 virtual bool isAllowed() const RT_OVERRIDE
1253 {
1254 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar);
1255 }
1256
1257 /** Handles translation event. */
1258 virtual void retranslateUi() RT_OVERRIDE
1259 {
1260 setName(QApplication::translate("UIActionPool", "&Menu Bar"));
1261 }
1262};
1263
1264/** Simple action extension, used as 'Show MenuBar Settings Window' action class. */
1265class UIActionSimpleRuntimeShowMenuBarSettings : public UIActionSimple
1266{
1267 Q_OBJECT;
1268
1269public:
1270
1271 /** Constructs action passing @a pParent to the base-class. */
1272 UIActionSimpleRuntimeShowMenuBarSettings(UIActionPool *pParent)
1273 : UIActionSimple(pParent, ":/menubar_settings_16px.png", ":/menubar_settings_disabled_16px.png", true)
1274 {}
1275
1276protected:
1277
1278 /** Returns action extra-data ID. */
1279 virtual int extraDataID() const RT_OVERRIDE
1280 {
1281 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings;
1282 }
1283 /** Returns action extra-data key. */
1284 virtual QString extraDataKey() const RT_OVERRIDE
1285 {
1286 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings);
1287 }
1288 /** Returns whether action is allowed. */
1289 virtual bool isAllowed() const RT_OVERRIDE
1290 {
1291 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings);
1292 }
1293
1294 /** Returns shortcut extra-data ID. */
1295 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1296 {
1297 return QString("MenuBarSettings");
1298 }
1299
1300 /** Handles translation event. */
1301 virtual void retranslateUi() RT_OVERRIDE
1302 {
1303 setName(QApplication::translate("UIActionPool", "&Menu Bar Settings..."));
1304 setStatusTip(QApplication::translate("UIActionPool", "Display window to configure menu-bar"));
1305 }
1306};
1307
1308#ifndef VBOX_WS_MAC
1309/** Toggle action extension, used as 'MenuBar' action class. */
1310class UIActionToggleRuntimeMenuBar : public UIActionToggle
1311{
1312 Q_OBJECT;
1313
1314public:
1315
1316 /** Constructs action passing @a pParent to the base-class. */
1317 UIActionToggleRuntimeMenuBar(UIActionPool *pParent)
1318 : UIActionToggle(pParent,
1319 ":/menubar_on_16px.png", ":/menubar_16px.png",
1320 ":/menubar_on_disabled_16px.png", ":/menubar_disabled_16px.png",
1321 true)
1322 {}
1323
1324protected:
1325
1326 /** Returns action extra-data ID. */
1327 virtual int extraDataID() const RT_OVERRIDE
1328 {
1329 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleMenuBar;
1330 }
1331 /** Returns action extra-data key. */
1332 virtual QString extraDataKey() const RT_OVERRIDE
1333 {
1334 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleMenuBar);
1335 }
1336 /** Returns whether action is allowed. */
1337 virtual bool isAllowed() const RT_OVERRIDE
1338 {
1339 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleMenuBar);
1340 }
1341
1342 /** Returns shortcut extra-data ID. */
1343 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1344 {
1345 return QString("ToggleMenuBar");
1346 }
1347
1348 /** Handles translation event. */
1349 virtual void retranslateUi() RT_OVERRIDE
1350 {
1351 setName(QApplication::translate("UIActionPool", "Show Menu &Bar"));
1352 setStatusTip(QApplication::translate("UIActionPool", "Enable menu-bar"));
1353 }
1354};
1355#endif /* !VBOX_WS_MAC */
1356
1357/** Menu action extension, used as 'StatusBar' menu class. */
1358class UIActionMenuRuntimeStatusBar : public UIActionMenu
1359{
1360 Q_OBJECT;
1361
1362public:
1363
1364 /** Constructs action passing @a pParent to the base-class. */
1365 UIActionMenuRuntimeStatusBar(UIActionPool *pParent)
1366 : UIActionMenu(pParent, ":/statusbar_16px.png", ":/statusbar_disabled_16px.png")
1367 {}
1368
1369protected:
1370
1371 /** Returns action extra-data ID. */
1372 virtual int extraDataID() const RT_OVERRIDE
1373 {
1374 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar;
1375 }
1376 /** Returns action extra-data key. */
1377 virtual QString extraDataKey() const RT_OVERRIDE
1378 {
1379 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar);
1380 }
1381 /** Returns whether action is allowed. */
1382 virtual bool isAllowed() const RT_OVERRIDE
1383 {
1384 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar);
1385 }
1386
1387 /** Handles translation event. */
1388 virtual void retranslateUi() RT_OVERRIDE
1389 {
1390 setName(QApplication::translate("UIActionPool", "&Status Bar"));
1391 }
1392};
1393
1394/** Simple action extension, used as 'Show StatusBar Settings Window' action class. */
1395class UIActionSimpleRuntimeShowStatusBarSettings : public UIActionSimple
1396{
1397 Q_OBJECT;
1398
1399public:
1400
1401 /** Constructs action passing @a pParent to the base-class. */
1402 UIActionSimpleRuntimeShowStatusBarSettings(UIActionPool *pParent)
1403 : UIActionSimple(pParent, ":/statusbar_settings_16px.png", ":/statusbar_settings_disabled_16px.png", true)
1404 {}
1405
1406protected:
1407
1408 /** Returns action extra-data ID. */
1409 virtual int extraDataID() const RT_OVERRIDE
1410 {
1411 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings;
1412 }
1413 /** Returns action extra-data key. */
1414 virtual QString extraDataKey() const RT_OVERRIDE
1415 {
1416 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings);
1417 }
1418 /** Returns whether action is allowed. */
1419 virtual bool isAllowed() const RT_OVERRIDE
1420 {
1421 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings);
1422 }
1423
1424 /** Returns shortcut extra-data ID. */
1425 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1426 {
1427 return QString("StatusBarSettings");
1428 }
1429
1430 /** Handles translation event. */
1431 virtual void retranslateUi() RT_OVERRIDE
1432 {
1433 setName(QApplication::translate("UIActionPool", "&Status Bar Settings..."));
1434 setStatusTip(QApplication::translate("UIActionPool", "Display window to configure status-bar"));
1435 }
1436};
1437
1438/** Toggle action extension, used as 'StatusBar' action class. */
1439class UIActionToggleRuntimeStatusBar : public UIActionToggle
1440{
1441 Q_OBJECT;
1442
1443public:
1444
1445 /** Constructs action passing @a pParent to the base-class. */
1446 UIActionToggleRuntimeStatusBar(UIActionPool *pParent)
1447 : UIActionToggle(pParent,
1448 ":/statusbar_on_16px.png", ":/statusbar_16px.png",
1449 ":/statusbar_on_disabled_16px.png", ":/statusbar_disabled_16px.png",
1450 true)
1451 {}
1452
1453protected:
1454
1455 /** Returns action extra-data ID. */
1456 virtual int extraDataID() const RT_OVERRIDE
1457 {
1458 return UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar;
1459 }
1460 /** Returns action extra-data key. */
1461 virtual QString extraDataKey() const RT_OVERRIDE
1462 {
1463 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar);
1464 }
1465 /** Returns whether action is allowed. */
1466 virtual bool isAllowed() const RT_OVERRIDE
1467 {
1468 return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar);
1469 }
1470
1471 /** Returns shortcut extra-data ID. */
1472 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1473 {
1474 return QString("ToggleStatusBar");
1475 }
1476
1477 /** Handles translation event. */
1478 virtual void retranslateUi() RT_OVERRIDE
1479 {
1480 setName(QApplication::translate("UIActionPool", "Show Status &Bar"));
1481 setStatusTip(QApplication::translate("UIActionPool", "Enable status-bar"));
1482 }
1483};
1484
1485/** Menu action extension, used as 'Input' menu class. */
1486class UIActionMenuRuntimeInput : public UIActionMenu
1487{
1488 Q_OBJECT;
1489
1490public:
1491
1492 /** Constructs action passing @a pParent to the base-class. */
1493 UIActionMenuRuntimeInput(UIActionPool *pParent)
1494 : UIActionMenu(pParent)
1495 {}
1496
1497protected:
1498
1499 /** Returns action extra-data ID. */
1500 virtual int extraDataID() const RT_OVERRIDE
1501 {
1502 return UIExtraDataMetaDefs::MenuType_Input;
1503 }
1504 /** Returns action extra-data key. */
1505 virtual QString extraDataKey() const RT_OVERRIDE
1506 {
1507 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Input);
1508 }
1509 /** Returns whether action is allowed. */
1510 virtual bool isAllowed() const RT_OVERRIDE
1511 {
1512 return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Input);
1513 }
1514
1515 /** Handles translation event. */
1516 virtual void retranslateUi() RT_OVERRIDE
1517 {
1518 setName(QApplication::translate("UIActionPool", "&Input"));
1519 }
1520};
1521
1522/** Menu action extension, used as 'Keyboard' menu class. */
1523class UIActionMenuRuntimeKeyboard : public UIActionMenu
1524{
1525 Q_OBJECT;
1526
1527public:
1528
1529 /** Constructs action passing @a pParent to the base-class. */
1530 UIActionMenuRuntimeKeyboard(UIActionPool *pParent)
1531 : UIActionMenu(pParent, ":/keyboard_16px.png")
1532 {}
1533
1534protected:
1535
1536 /** Returns action extra-data ID. */
1537 virtual int extraDataID() const RT_OVERRIDE
1538 {
1539 return UIExtraDataMetaDefs::RuntimeMenuInputActionType_Keyboard;
1540 }
1541 /** Returns action extra-data key. */
1542 virtual QString extraDataKey() const RT_OVERRIDE
1543 {
1544 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_Keyboard);
1545 }
1546 /** Returns whether action is allowed. */
1547 virtual bool isAllowed() const RT_OVERRIDE
1548 {
1549 return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_Keyboard);
1550 }
1551
1552 /** Handles translation event. */
1553 virtual void retranslateUi() RT_OVERRIDE
1554 {
1555 setName(QApplication::translate("UIActionPool", "&Keyboard"));
1556 }
1557};
1558
1559/** Simple action extension, used as 'Show Keyboard Settings' action class. */
1560class UIActionSimpleRuntimeShowKeyboardSettings : public UIActionSimple
1561{
1562 Q_OBJECT;
1563
1564public:
1565
1566 /** Constructs action passing @a pParent to the base-class. */
1567 UIActionSimpleRuntimeShowKeyboardSettings(UIActionPool *pParent)
1568 : UIActionSimple(pParent, ":/keyboard_settings_16px.png", ":/keyboard_settings_disabled_16px.png", true)
1569 {}
1570
1571protected:
1572
1573 /** Returns action extra-data ID. */
1574 virtual int extraDataID() const RT_OVERRIDE
1575 {
1576 return UIExtraDataMetaDefs::RuntimeMenuInputActionType_KeyboardSettings;
1577 }
1578 /** Returns action extra-data key. */
1579 virtual QString extraDataKey() const RT_OVERRIDE
1580 {
1581 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_KeyboardSettings);
1582 }
1583 /** Returns whether action is allowed. */
1584 virtual bool isAllowed() const RT_OVERRIDE
1585 {
1586 return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_KeyboardSettings);
1587 }
1588
1589 /** Returns shortcut extra-data ID. */
1590 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1591 {
1592 return QString("KeyboardSettings");
1593 }
1594
1595 /** Handles translation event. */
1596 virtual void retranslateUi() RT_OVERRIDE
1597 {
1598 setName(QApplication::translate("UIActionPool", "&Keyboard Settings..."));
1599 setStatusTip(QApplication::translate("UIActionPool", "Display global preferences window to configure keyboard shortcuts"));
1600 }
1601};
1602
1603/** Simple action extension, used as 'Show Soft Keyboard' action class. */
1604class UIActionSimpleRuntimeShowSoftKeyboard : public UIActionSimple
1605{
1606 Q_OBJECT;
1607
1608public:
1609
1610 /** Constructs action passing @a pParent to the base-class. */
1611 UIActionSimpleRuntimeShowSoftKeyboard(UIActionPool *pParent)
1612 : UIActionSimple(pParent, UIIconPool::iconSet(":/soft_keyboard_16px.png"), true)
1613 {}
1614
1615protected:
1616
1617 /** Returns action extra-data ID. */
1618 virtual int extraDataID() const RT_OVERRIDE
1619 {
1620 return UIExtraDataMetaDefs::RuntimeMenuInputActionType_SoftKeyboard;
1621 }
1622 /** Returns action extra-data key. */
1623 virtual QString extraDataKey() const RT_OVERRIDE
1624 {
1625 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_SoftKeyboard);
1626 }
1627 /** Returns whether action is allowed. */
1628 virtual bool isAllowed() const RT_OVERRIDE
1629 {
1630 return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_SoftKeyboard);
1631 }
1632
1633 /** Returns shortcut extra-data ID. */
1634 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1635 {
1636 return QString("SoftKeyboard");
1637 }
1638
1639 /** Handles translation event. */
1640 virtual void retranslateUi() RT_OVERRIDE
1641 {
1642 setName(QApplication::translate("UIActionPool", "&Soft Keyboard..."));
1643 setStatusTip(QApplication::translate("UIActionPool", "Display soft keyboard"));
1644 }
1645};
1646
1647/** Simple action extension, used as 'Perform Type CAD' action class. */
1648class UIActionSimpleRuntimePerformTypeCAD : public UIActionSimple
1649{
1650 Q_OBJECT;
1651
1652public:
1653
1654 /** Constructs action passing @a pParent to the base-class. */
1655 UIActionSimpleRuntimePerformTypeCAD(UIActionPool *pParent)
1656 : UIActionSimple(pParent, true)
1657 {}
1658
1659protected:
1660
1661 /** Returns action extra-data ID. */
1662 virtual int extraDataID() const RT_OVERRIDE
1663 {
1664 return UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCAD;
1665 }
1666 /** Returns action extra-data key. */
1667 virtual QString extraDataKey() const RT_OVERRIDE
1668 {
1669 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCAD);
1670 }
1671 /** Returns whether action is allowed. */
1672 virtual bool isAllowed() const RT_OVERRIDE
1673 {
1674 return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCAD);
1675 }
1676
1677 /** Returns shortcut extra-data ID. */
1678 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1679 {
1680 return QString("TypeCAD");
1681 }
1682
1683 /** Returns default shortcut. */
1684 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1685 {
1686 return QKeySequence("Del");
1687 }
1688
1689 /** Handles translation event. */
1690 virtual void retranslateUi() RT_OVERRIDE
1691 {
1692 setName(QApplication::translate("UIActionPool", "&Insert %1", "that means send the %1 key sequence to the virtual machine").arg("Ctrl-Alt-Del"));
1693 setStatusTip(QApplication::translate("UIActionPool", "Send the %1 sequence to the virtual machine").arg("Ctrl-Alt-Del"));
1694 }
1695};
1696
1697#ifdef VBOX_WS_NIX
1698/** X11: Simple action extension, used as 'Perform Type CABS' action class. */
1699class UIActionSimpleRuntimePerformTypeCABS : public UIActionSimple
1700{
1701 Q_OBJECT;
1702
1703public:
1704
1705 /** Constructs action passing @a pParent to the base-class. */
1706 UIActionSimpleRuntimePerformTypeCABS(UIActionPool *pParent)
1707 : UIActionSimple(pParent, true)
1708 {}
1709
1710protected:
1711
1712 /** Returns action extra-data ID. */
1713 virtual int extraDataID() const RT_OVERRIDE
1714 {
1715 return UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCABS;
1716 }
1717 /** Returns action extra-data key. */
1718 virtual QString extraDataKey() const RT_OVERRIDE
1719 {
1720 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCABS);
1721 }
1722 /** Returns whether action is allowed. */
1723 virtual bool isAllowed() const RT_OVERRIDE
1724 {
1725 return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCABS);
1726 }
1727
1728 /** Returns shortcut extra-data ID. */
1729 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1730 {
1731 return QString("TypeCABS");
1732 }
1733
1734 /** Returns default shortcut. */
1735 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1736 {
1737 return QKeySequence("Backspace");
1738 }
1739
1740 /** Handles translation event. */
1741 virtual void retranslateUi() RT_OVERRIDE
1742 {
1743 setName(QApplication::translate("UIActionPool", "&Insert %1", "that means send the %1 key sequence to the virtual machine").arg("Ctrl-Alt-Backspace"));
1744 setStatusTip(QApplication::translate("UIActionPool", "Send the %1 sequence to the virtual machine").arg("Ctrl-Alt-Backspace"));
1745 }
1746};
1747#endif /* VBOX_WS_NIX */
1748
1749/** Simple action extension, used as 'Perform Type Ctrl Break' action class. */
1750class UIActionSimpleRuntimePerformTypeCtrlBreak : public UIActionSimple
1751{
1752 Q_OBJECT;
1753
1754public:
1755
1756 /** Constructs action passing @a pParent to the base-class. */
1757 UIActionSimpleRuntimePerformTypeCtrlBreak(UIActionPool *pParent)
1758 : UIActionSimple(pParent, true)
1759 {}
1760
1761protected:
1762
1763 /** Returns action extra-data ID. */
1764 virtual int extraDataID() const RT_OVERRIDE
1765 {
1766 return UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCtrlBreak;
1767 }
1768 /** Returns action extra-data key. */
1769 virtual QString extraDataKey() const RT_OVERRIDE
1770 {
1771 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCtrlBreak);
1772 }
1773 /** Returns whether action is allowed. */
1774 virtual bool isAllowed() const RT_OVERRIDE
1775 {
1776 return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCtrlBreak);
1777 }
1778
1779 /** Returns shortcut extra-data ID. */
1780 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1781 {
1782 return QString("TypeCtrlBreak");
1783 }
1784
1785 /** Handles translation event. */
1786 virtual void retranslateUi() RT_OVERRIDE
1787 {
1788 setName(QApplication::translate("UIActionPool", "&Insert %1", "that means send the %1 key sequence to the virtual machine").arg("Ctrl-Break"));
1789 setStatusTip(QApplication::translate("UIActionPool", "Send the %1 sequence to the virtual machine").arg("Ctrl-Break"));
1790 }
1791};
1792
1793/** Simple action extension, used as 'Perform Type Insert' action class. */
1794class UIActionSimpleRuntimePerformTypeInsert : public UIActionSimple
1795{
1796 Q_OBJECT;
1797
1798public:
1799
1800 /** Constructs action passing @a pParent to the base-class. */
1801 UIActionSimpleRuntimePerformTypeInsert(UIActionPool *pParent)
1802 : UIActionSimple(pParent, true)
1803 {}
1804
1805protected:
1806
1807 /** Returns action extra-data ID. */
1808 virtual int extraDataID() const RT_OVERRIDE
1809 {
1810 return UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeInsert;
1811 }
1812 /** Returns action extra-data key. */
1813 virtual QString extraDataKey() const RT_OVERRIDE
1814 {
1815 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeInsert);
1816 }
1817 /** Returns whether action is allowed. */
1818 virtual bool isAllowed() const RT_OVERRIDE
1819 {
1820 return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeInsert);
1821 }
1822
1823 /** Returns shortcut extra-data ID. */
1824 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1825 {
1826 return QString("TypeInsert");
1827 }
1828
1829 /** Handles translation event. */
1830 virtual void retranslateUi() RT_OVERRIDE
1831 {
1832 setName(QApplication::translate("UIActionPool", "&Insert %1", "that means send the %1 key sequence to the virtual machine").arg("Insert"));
1833 setStatusTip(QApplication::translate("UIActionPool", "Send the %1 sequence to the virtual machine").arg("Insert"));
1834 }
1835};
1836
1837/** Simple action extension, used as 'Perform Type PrintScreen' action class. */
1838class UIActionSimpleRuntimePerformTypePrintScreen : public UIActionSimple
1839{
1840 Q_OBJECT;
1841
1842public:
1843
1844 /** Constructs action passing @a pParent to the base-class. */
1845 UIActionSimpleRuntimePerformTypePrintScreen(UIActionPool *pParent)
1846 : UIActionSimple(pParent, true)
1847 {}
1848
1849protected:
1850
1851 /** Returns action extra-data ID. */
1852 virtual int extraDataID() const RT_OVERRIDE
1853 {
1854 return UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypePrintScreen;
1855 }
1856 /** Returns action extra-data key. */
1857 virtual QString extraDataKey() const RT_OVERRIDE
1858 {
1859 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypePrintScreen);
1860 }
1861 /** Returns whether action is allowed. */
1862 virtual bool isAllowed() const RT_OVERRIDE
1863 {
1864 return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypePrintScreen);
1865 }
1866
1867 /** Returns shortcut extra-data ID. */
1868 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1869 {
1870 return QString("TypePrintScreen");
1871 }
1872
1873 /** Handles translation event. */
1874 virtual void retranslateUi() RT_OVERRIDE
1875 {
1876 setName(QApplication::translate("UIActionPool", "&Insert %1", "that means send the %1 key sequence to the virtual machine").arg("Print Screen"));
1877 setStatusTip(QApplication::translate("UIActionPool", "Send the %1 sequence to the virtual machine").arg("Print Screen"));
1878 }
1879};
1880
1881/** Simple action extension, used as 'Perform Type Alt PrintScreen' action class. */
1882class UIActionSimpleRuntimePerformTypeAltPrintScreen : public UIActionSimple
1883{
1884 Q_OBJECT;
1885
1886public:
1887
1888 /** Constructs action passing @a pParent to the base-class. */
1889 UIActionSimpleRuntimePerformTypeAltPrintScreen(UIActionPool *pParent)
1890 : UIActionSimple(pParent, true)
1891 {}
1892
1893protected:
1894
1895 /** Returns action extra-data ID. */
1896 virtual int extraDataID() const RT_OVERRIDE
1897 {
1898 return UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeAltPrintScreen;
1899 }
1900 /** Returns action extra-data key. */
1901 virtual QString extraDataKey() const RT_OVERRIDE
1902 {
1903 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeAltPrintScreen);
1904 }
1905 /** Returns whether action is allowed. */
1906 virtual bool isAllowed() const RT_OVERRIDE
1907 {
1908 return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeAltPrintScreen);
1909 }
1910
1911 /** Returns shortcut extra-data ID. */
1912 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1913 {
1914 return QString("TypeAltPrintScreen");
1915 }
1916
1917 /** Handles translation event. */
1918 virtual void retranslateUi() RT_OVERRIDE
1919 {
1920 setName(QApplication::translate("UIActionPool", "&Insert %1", "that means send the %1 key sequence to the virtual machine").arg("Alt Print Screen"));
1921 setStatusTip(QApplication::translate("UIActionPool", "Send the %1 sequence to the virtual machine").arg("Alt Print Screen"));
1922 }
1923};
1924
1925/** Toggle action extension, used as 'Perform Host Key Combo Press/Release' action class. */
1926class UIActionToggleRuntimePerformTypeHostKeyCombo : public UIActionToggle
1927{
1928 Q_OBJECT;
1929
1930public:
1931
1932 /** Constructs action passing @a pParent to the base-class. */
1933 UIActionToggleRuntimePerformTypeHostKeyCombo(UIActionPool *pParent)
1934 : UIActionToggle(pParent, true)
1935 {}
1936
1937protected:
1938
1939 /** Returns action extra-data ID. */
1940 virtual int extraDataID() const RT_OVERRIDE
1941 {
1942 return UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeHostKeyCombo;
1943 }
1944 /** Returns action extra-data key. */
1945 virtual QString extraDataKey() const RT_OVERRIDE
1946 {
1947 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeHostKeyCombo);
1948 }
1949 /** Returns whether action is allowed. */
1950 virtual bool isAllowed() const RT_OVERRIDE
1951 {
1952 return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeHostKeyCombo);
1953 }
1954
1955 /** Returns shortcut extra-data ID. */
1956 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1957 {
1958 return QString("TypeHostKeyCombo");
1959 }
1960
1961 /** Returns default shortcut. */
1962 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1963 {
1964#ifdef VBOX_WS_MAC
1965 return QKeySequence("Insert");
1966#else
1967 return QKeySequence("Insert");
1968#endif
1969 }
1970
1971 /** Handles translation event. */
1972 virtual void retranslateUi() RT_OVERRIDE
1973 {
1974 setName(QApplication::translate("UIActionPool", "&Insert %1", "that means send the %1 key sequence to the virtual machine").arg("Host Key Combo"));
1975 setStatusTip(QApplication::translate("UIActionPool", "Send the %1 sequence to the virtual machine").arg("Host Key Combo"));
1976 }
1977};
1978
1979/** Menu action extension, used as 'Mouse' menu class. */
1980class UIActionMenuRuntimeMouse : public UIActionMenu
1981{
1982 Q_OBJECT;
1983
1984public:
1985
1986 /** Constructs action passing @a pParent to the base-class. */
1987 UIActionMenuRuntimeMouse(UIActionPool *pParent)
1988 : UIActionMenu(pParent)
1989 {}
1990
1991protected:
1992
1993 /** Returns action extra-data ID. */
1994 virtual int extraDataID() const RT_OVERRIDE
1995 {
1996 return UIExtraDataMetaDefs::RuntimeMenuInputActionType_Mouse;
1997 }
1998 /** Returns action extra-data key. */
1999 virtual QString extraDataKey() const RT_OVERRIDE
2000 {
2001 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_Mouse);
2002 }
2003 /** Returns whether action is allowed. */
2004 virtual bool isAllowed() const RT_OVERRIDE
2005 {
2006 return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_Mouse);
2007 }
2008
2009 /** Handles translation event. */
2010 virtual void retranslateUi() RT_OVERRIDE
2011 {
2012 setName(QApplication::translate("UIActionPool", "&Mouse"));
2013 }
2014};
2015
2016/** Toggle action extension, used as 'Mouse Integration' action class. */
2017class UIActionToggleRuntimeMouseIntegration : public UIActionToggle
2018{
2019 Q_OBJECT;
2020
2021public:
2022
2023 /** Constructs action passing @a pParent to the base-class. */
2024 UIActionToggleRuntimeMouseIntegration(UIActionPool *pParent)
2025 : UIActionToggle(pParent,
2026 ":/mouse_can_seamless_on_16px.png", ":/mouse_can_seamless_16px.png",
2027 ":/mouse_can_seamless_on_disabled_16px.png", ":/mouse_can_seamless_disabled_16px.png",
2028 true)
2029 {}
2030
2031protected:
2032
2033 /** Returns action extra-data ID. */
2034 virtual int extraDataID() const RT_OVERRIDE
2035 {
2036 return UIExtraDataMetaDefs::RuntimeMenuInputActionType_MouseIntegration;
2037 }
2038 /** Returns action extra-data key. */
2039 virtual QString extraDataKey() const RT_OVERRIDE
2040 {
2041 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_MouseIntegration);
2042 }
2043 /** Returns whether action is allowed. */
2044 virtual bool isAllowed() const RT_OVERRIDE
2045 {
2046 return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_MouseIntegration);
2047 }
2048
2049 /** Returns shortcut extra-data ID. */
2050 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2051 {
2052 return QString("MouseIntegration");
2053 }
2054
2055 /** Handles translation event. */
2056 virtual void retranslateUi() RT_OVERRIDE
2057 {
2058 setName(QApplication::translate("UIActionPool", "&Mouse Integration"));
2059 setStatusTip(QApplication::translate("UIActionPool", "Enable host mouse pointer integration"));
2060 }
2061};
2062
2063
2064/** Menu action extension, used as 'Devices' menu class. */
2065class UIActionMenuRuntimeDevices : public UIActionMenu
2066{
2067 Q_OBJECT;
2068
2069public:
2070
2071 /** Constructs action passing @a pParent to the base-class. */
2072 UIActionMenuRuntimeDevices(UIActionPool *pParent)
2073 : UIActionMenu(pParent)
2074 {}
2075
2076protected:
2077
2078 /** Returns action extra-data ID. */
2079 virtual int extraDataID() const RT_OVERRIDE
2080 {
2081 return UIExtraDataMetaDefs::MenuType_Devices;
2082 }
2083 /** Returns action extra-data key. */
2084 virtual QString extraDataKey() const RT_OVERRIDE
2085 {
2086 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Devices);
2087 }
2088 /** Returns whether action is allowed. */
2089 virtual bool isAllowed() const RT_OVERRIDE
2090 {
2091 return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Devices);
2092 }
2093
2094 /** Handles translation event. */
2095 virtual void retranslateUi() RT_OVERRIDE
2096 {
2097 setName(QApplication::translate("UIActionPool", "&Devices"));
2098 }
2099};
2100
2101/** Menu action extension, used as 'Hard Drives' menu class. */
2102class UIActionMenuRuntimeHardDrives : public UIActionMenu
2103{
2104 Q_OBJECT;
2105
2106public:
2107
2108 /** Constructs action passing @a pParent to the base-class. */
2109 UIActionMenuRuntimeHardDrives(UIActionPool *pParent)
2110 : UIActionMenu(pParent, ":/hd_16px.png", ":/hd_disabled_16px.png")
2111 {
2112 setShowToolTip(true);
2113 }
2114
2115protected:
2116
2117 /** Returns action extra-data ID. */
2118 virtual int extraDataID() const RT_OVERRIDE
2119 {
2120 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrives;
2121 }
2122 /** Returns action extra-data key. */
2123 virtual QString extraDataKey() const RT_OVERRIDE
2124 {
2125 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrives);
2126 }
2127 /** Returns whether action is allowed. */
2128 virtual bool isAllowed() const RT_OVERRIDE
2129 {
2130 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrives);
2131 }
2132
2133 /** Handles translation event. */
2134 virtual void retranslateUi() RT_OVERRIDE
2135 {
2136 setName(QApplication::translate("UIActionPool", "&Hard Disks"));
2137 }
2138};
2139
2140/** Simple action extension, used as 'Show Hard Drives Settings' action class. */
2141class UIActionSimpleRuntimeShowHardDrivesSettings : public UIActionSimple
2142{
2143 Q_OBJECT;
2144
2145public:
2146
2147 /** Constructs action passing @a pParent to the base-class. */
2148 UIActionSimpleRuntimeShowHardDrivesSettings(UIActionPool *pParent)
2149 : UIActionSimple(pParent, ":/hd_settings_16px.png", ":/hd_settings_disabled_16px.png", true)
2150 {}
2151
2152protected:
2153
2154 /** Returns action extra-data ID. */
2155 virtual int extraDataID() const RT_OVERRIDE
2156 {
2157 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrivesSettings;
2158 }
2159 /** Returns action extra-data key. */
2160 virtual QString extraDataKey() const RT_OVERRIDE
2161 {
2162 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrivesSettings);
2163 }
2164 /** Returns whether action is allowed. */
2165 virtual bool isAllowed() const RT_OVERRIDE
2166 {
2167 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrivesSettings);
2168 }
2169
2170 /** Returns shortcut extra-data ID. */
2171 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2172 {
2173 return QString("HardDriveSettingsDialog");
2174 }
2175
2176 /** Handles translation event. */
2177 virtual void retranslateUi() RT_OVERRIDE
2178 {
2179 setName(QApplication::translate("UIActionPool", "&Hard Disk Settings..."));
2180 setStatusTip(QApplication::translate("UIActionPool", "Display virtual machine settings window to configure hard disks"));
2181 }
2182};
2183
2184/** Menu action extension, used as 'Optical Drives' menu class. */
2185class UIActionMenuRuntimeOpticalDevices : public UIActionMenu
2186{
2187 Q_OBJECT;
2188
2189public:
2190
2191 /** Constructs action passing @a pParent to the base-class. */
2192 UIActionMenuRuntimeOpticalDevices(UIActionPool *pParent)
2193 : UIActionMenu(pParent, ":/cd_16px.png", ":/cd_disabled_16px.png")
2194 {
2195 setShowToolTip(true);
2196 }
2197
2198protected:
2199
2200 /** Returns action extra-data ID. */
2201 virtual int extraDataID() const RT_OVERRIDE
2202 {
2203 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices;
2204 }
2205 /** Returns action extra-data key. */
2206 virtual QString extraDataKey() const RT_OVERRIDE
2207 {
2208 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices);
2209 }
2210 /** Returns whether action is allowed. */
2211 virtual bool isAllowed() const RT_OVERRIDE
2212 {
2213 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices);
2214 }
2215
2216 /** Handles translation event. */
2217 virtual void retranslateUi() RT_OVERRIDE
2218 {
2219 setName(QApplication::translate("UIActionPool", "&Optical Drives"));
2220 }
2221};
2222
2223/** Menu action extension, used as 'Floppy Drives' menu class. */
2224class UIActionMenuRuntimeFloppyDevices : public UIActionMenu
2225{
2226 Q_OBJECT;
2227
2228public:
2229
2230 /** Constructs action passing @a pParent to the base-class. */
2231 UIActionMenuRuntimeFloppyDevices(UIActionPool *pParent)
2232 : UIActionMenu(pParent, ":/fd_16px.png", ":/fd_disabled_16px.png")
2233 {
2234 setShowToolTip(true);
2235 }
2236
2237protected:
2238
2239 /** Returns action extra-data ID. */
2240 virtual int extraDataID() const RT_OVERRIDE
2241 {
2242 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices;
2243 }
2244 /** Returns action extra-data key. */
2245 virtual QString extraDataKey() const RT_OVERRIDE
2246 {
2247 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices);
2248 }
2249 /** Returns whether action is allowed. */
2250 virtual bool isAllowed() const RT_OVERRIDE
2251 {
2252 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices);
2253 }
2254
2255 /** Handles translation event. */
2256 virtual void retranslateUi() RT_OVERRIDE
2257 {
2258 setName(QApplication::translate("UIActionPool", "&Floppy Drives"));
2259 }
2260};
2261
2262/** Menu action extension, used as 'Audio' menu class. */
2263class UIActionMenuRuntimeAudio : public UIActionMenu
2264{
2265 Q_OBJECT;
2266
2267public:
2268
2269 /** Constructs action passing @a pParent to the base-class. */
2270 UIActionMenuRuntimeAudio(UIActionPool *pParent)
2271 : UIActionMenu(pParent, ":/audio_16px.png", ":/audio_all_off_16px.png")
2272 {}
2273
2274protected:
2275
2276 /** Returns action extra-data ID. */
2277 virtual int extraDataID() const RT_OVERRIDE
2278 {
2279 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Audio;
2280 }
2281 /** Returns action extra-data key. */
2282 virtual QString extraDataKey() const RT_OVERRIDE
2283 {
2284 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Audio);
2285 }
2286 /** Returns whether action is allowed. */
2287 virtual bool isAllowed() const RT_OVERRIDE
2288 {
2289 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Audio);
2290 }
2291
2292 /** Handles translation event. */
2293 virtual void retranslateUi() RT_OVERRIDE
2294 {
2295 setName(QApplication::translate("UIActionPool", "&Audio"));
2296 }
2297};
2298
2299/** Toggle action extension, used as 'Audio Output' action class. */
2300class UIActionToggleRuntimeAudioOutput : public UIActionToggle
2301{
2302 Q_OBJECT;
2303
2304public:
2305
2306 /** Constructs action passing @a pParent to the base-class. */
2307 UIActionToggleRuntimeAudioOutput(UIActionPool *pParent)
2308 : UIActionToggle(pParent,
2309 ":/audio_output_on_16px.png", ":/audio_output_16px.png",
2310 ":/audio_output_on_16px.png", ":/audio_output_16px.png",
2311 true)
2312 {}
2313
2314protected:
2315
2316 /** Returns action extra-data ID. */
2317 virtual int extraDataID() const RT_OVERRIDE
2318 {
2319 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioOutput;
2320 }
2321 /** Returns action extra-data key. */
2322 virtual QString extraDataKey() const RT_OVERRIDE
2323 {
2324 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioOutput);
2325 }
2326 /** Returns whether action is allowed. */
2327 virtual bool isAllowed() const RT_OVERRIDE
2328 {
2329 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioOutput);
2330 }
2331
2332 /** Returns shortcut extra-data ID. */
2333 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2334 {
2335 return QString("ToggleAudioOutput");
2336 }
2337
2338 /** Handles translation event. */
2339 virtual void retranslateUi() RT_OVERRIDE
2340 {
2341 setName(QApplication::translate("UIActionPool", "Audio Output"));
2342 setStatusTip(QApplication::translate("UIActionPool", "Enable audio output"));
2343 }
2344};
2345
2346/** Toggle action extension, used as 'Audio Input' action class. */
2347class UIActionToggleRuntimeAudioInput : public UIActionToggle
2348{
2349 Q_OBJECT;
2350
2351public:
2352
2353 /** Constructs action passing @a pParent to the base-class. */
2354 UIActionToggleRuntimeAudioInput(UIActionPool *pParent)
2355 : UIActionToggle(pParent,
2356 ":/audio_input_on_16px.png", ":/audio_input_16px.png",
2357 ":/audio_input_on_16px.png", ":/audio_input_16px.png",
2358 true)
2359 {}
2360
2361protected:
2362
2363 /** Returns action extra-data ID. */
2364 virtual int extraDataID() const RT_OVERRIDE
2365 {
2366 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioInput;
2367 }
2368 /** Returns action extra-data key. */
2369 virtual QString extraDataKey() const RT_OVERRIDE
2370 {
2371 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioInput);
2372 }
2373 /** Returns whether action is allowed. */
2374 virtual bool isAllowed() const RT_OVERRIDE
2375 {
2376 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_AudioInput);
2377 }
2378
2379 /** Returns shortcut extra-data ID. */
2380 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2381 {
2382 return QString("ToggleAudioInput");
2383 }
2384
2385 /** Handles translation event. */
2386 virtual void retranslateUi() RT_OVERRIDE
2387 {
2388 setName(QApplication::translate("UIActionPool", "Audio Input"));
2389 setStatusTip(QApplication::translate("UIActionPool", "Enable audio input"));
2390 }
2391};
2392
2393/** Menu action extension, used as 'Network Adapters' menu class. */
2394class UIActionMenuRuntimeNetworkAdapters : public UIActionMenu
2395{
2396 Q_OBJECT;
2397
2398public:
2399
2400 /** Constructs action passing @a pParent to the base-class. */
2401 UIActionMenuRuntimeNetworkAdapters(UIActionPool *pParent)
2402 : UIActionMenu(pParent, ":/nw_16px.png", ":/nw_disabled_16px.png")
2403 {}
2404
2405protected:
2406
2407 /** Returns action extra-data ID. */
2408 virtual int extraDataID() const RT_OVERRIDE
2409 {
2410 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network;
2411 }
2412 /** Returns action extra-data key. */
2413 virtual QString extraDataKey() const RT_OVERRIDE
2414 {
2415 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network);
2416 }
2417 /** Returns whether action is allowed. */
2418 virtual bool isAllowed() const RT_OVERRIDE
2419 {
2420 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network);
2421 }
2422
2423 /** Handles translation event. */
2424 virtual void retranslateUi() RT_OVERRIDE
2425 {
2426 setName(QApplication::translate("UIActionPool", "&Network"));
2427 }
2428};
2429
2430/** Simple action extension, used as 'Show Network Settings' action class. */
2431class UIActionSimpleRuntimeShowNetworkSettings : public UIActionSimple
2432{
2433 Q_OBJECT;
2434
2435public:
2436
2437 /** Constructs action passing @a pParent to the base-class. */
2438 UIActionSimpleRuntimeShowNetworkSettings(UIActionPool *pParent)
2439 : UIActionSimple(pParent, ":/nw_settings_16px.png", ":/nw_settings_disabled_16px.png", true)
2440 {}
2441
2442protected:
2443
2444 /** Returns action extra-data ID. */
2445 virtual int extraDataID() const RT_OVERRIDE
2446 {
2447 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings;
2448 }
2449 /** Returns action extra-data key. */
2450 virtual QString extraDataKey() const RT_OVERRIDE
2451 {
2452 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings);
2453 }
2454 /** Returns whether action is allowed. */
2455 virtual bool isAllowed() const RT_OVERRIDE
2456 {
2457 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings);
2458 }
2459
2460 /** Returns shortcut extra-data ID. */
2461 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2462 {
2463 return QString("NetworkSettingsDialog");
2464 }
2465
2466 /** Handles translation event. */
2467 virtual void retranslateUi() RT_OVERRIDE
2468 {
2469 setName(QApplication::translate("UIActionPool", "&Network Settings..."));
2470 setStatusTip(QApplication::translate("UIActionPool", "Display virtual machine settings window to configure network adapters"));
2471 }
2472};
2473
2474/** Menu action extension, used as 'USB Devices' menu class. */
2475class UIActionMenuRuntimeUSBDevices : public UIActionMenu
2476{
2477 Q_OBJECT;
2478
2479public:
2480
2481 /** Constructs action passing @a pParent to the base-class. */
2482 UIActionMenuRuntimeUSBDevices(UIActionPool *pParent)
2483 : UIActionMenu(pParent, ":/usb_16px.png", ":/usb_disabled_16px.png")
2484 {
2485 setShowToolTip(true);
2486 }
2487
2488protected:
2489
2490 /** Returns action extra-data ID. */
2491 virtual int extraDataID() const RT_OVERRIDE
2492 {
2493 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices;
2494 }
2495 /** Returns action extra-data key. */
2496 virtual QString extraDataKey() const RT_OVERRIDE
2497 {
2498 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices);
2499 }
2500 /** Returns whether action is allowed. */
2501 virtual bool isAllowed() const RT_OVERRIDE
2502 {
2503 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices);
2504 }
2505
2506 /** Handles translation event. */
2507 virtual void retranslateUi() RT_OVERRIDE
2508 {
2509 setName(QApplication::translate("UIActionPool", "&USB"));
2510 }
2511};
2512
2513/** Simple action extension, used as 'Show USB Devices Settings' action class. */
2514class UIActionSimpleRuntimeShowUSBDevicesSettings : public UIActionSimple
2515{
2516 Q_OBJECT;
2517
2518public:
2519
2520 /** Constructs action passing @a pParent to the base-class. */
2521 UIActionSimpleRuntimeShowUSBDevicesSettings(UIActionPool *pParent)
2522 : UIActionSimple(pParent, ":/usb_settings_16px.png", ":/usb_settings_disabled_16px.png", true)
2523 {}
2524
2525protected:
2526
2527 /** Returns action extra-data ID. */
2528 virtual int extraDataID() const RT_OVERRIDE
2529 {
2530 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevicesSettings;
2531 }
2532 /** Returns action extra-data key. */
2533 virtual QString extraDataKey() const RT_OVERRIDE
2534 {
2535 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevicesSettings);
2536 }
2537 /** Returns whether action is allowed. */
2538 virtual bool isAllowed() const RT_OVERRIDE
2539 {
2540 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevicesSettings);
2541 }
2542
2543 /** Returns shortcut extra-data ID. */
2544 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2545 {
2546 return QString("USBDevicesSettingsDialog");
2547 }
2548
2549 /** Handles translation event. */
2550 virtual void retranslateUi() RT_OVERRIDE
2551 {
2552 setName(QApplication::translate("UIActionPool", "&USB Settings..."));
2553 setStatusTip(QApplication::translate("UIActionPool", "Display virtual machine settings window to configure USB devices"));
2554 }
2555};
2556
2557/** Menu action extension, used as 'Web Cams' menu class. */
2558class UIActionMenuRuntimeWebCams : public UIActionMenu
2559{
2560 Q_OBJECT;
2561
2562public:
2563
2564 /** Constructs action passing @a pParent to the base-class. */
2565 UIActionMenuRuntimeWebCams(UIActionPool *pParent)
2566 : UIActionMenu(pParent, ":/web_camera_16px.png", ":/web_camera_disabled_16px.png")
2567 {
2568 setShowToolTip(true);
2569 }
2570
2571protected:
2572
2573 /** Returns action extra-data ID. */
2574 virtual int extraDataID() const RT_OVERRIDE
2575 {
2576 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams;
2577 }
2578 /** Returns action extra-data key. */
2579 virtual QString extraDataKey() const RT_OVERRIDE
2580 {
2581 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams);
2582 }
2583 /** Returns whether action is allowed. */
2584 virtual bool isAllowed() const RT_OVERRIDE
2585 {
2586 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams);
2587 }
2588
2589 /** Handles translation event. */
2590 virtual void retranslateUi() RT_OVERRIDE
2591 {
2592 setName(QApplication::translate("UIActionPool", "&Webcams"));
2593 }
2594};
2595
2596/** Menu action extension, used as 'Shared Clipboard' menu class. */
2597class UIActionMenuRuntimeSharedClipboard : public UIActionMenu
2598{
2599 Q_OBJECT;
2600
2601public:
2602
2603 /** Constructs action passing @a pParent to the base-class. */
2604 UIActionMenuRuntimeSharedClipboard(UIActionPool *pParent)
2605 : UIActionMenu(pParent, ":/shared_clipboard_16px.png", ":/shared_clipboard_disabled_16px.png")
2606 {}
2607
2608protected:
2609
2610 /** Returns action extra-data ID. */
2611 virtual int extraDataID() const RT_OVERRIDE
2612 {
2613 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedClipboard;
2614 }
2615 /** Returns action extra-data key. */
2616 virtual QString extraDataKey() const RT_OVERRIDE
2617 {
2618 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedClipboard);
2619 }
2620 /** Returns whether action is allowed. */
2621 virtual bool isAllowed() const RT_OVERRIDE
2622 {
2623 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedClipboard);
2624 }
2625
2626 /** Handles translation event. */
2627 virtual void retranslateUi() RT_OVERRIDE
2628 {
2629 setName(QApplication::translate("UIActionPool", "Shared &Clipboard"));
2630 }
2631};
2632
2633/** Menu action extension, used as 'Drag & Drop' menu class. */
2634class UIActionMenuRuntimeDragAndDrop : public UIActionMenu
2635{
2636 Q_OBJECT;
2637
2638public:
2639
2640 /** Constructs action passing @a pParent to the base-class. */
2641 UIActionMenuRuntimeDragAndDrop(UIActionPool *pParent)
2642 : UIActionMenu(pParent, ":/drag_drop_16px.png", ":/drag_drop_disabled_16px.png")
2643 {}
2644
2645protected:
2646
2647 /** Returns action extra-data ID. */
2648 virtual int extraDataID() const RT_OVERRIDE
2649 {
2650 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_DragAndDrop;
2651 }
2652 /** Returns action extra-data key. */
2653 virtual QString extraDataKey() const RT_OVERRIDE
2654 {
2655 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_DragAndDrop);
2656 }
2657 /** Returns whether action is allowed. */
2658 virtual bool isAllowed() const RT_OVERRIDE
2659 {
2660 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_DragAndDrop);
2661 }
2662
2663 /** Handles translation event. */
2664 virtual void retranslateUi() RT_OVERRIDE
2665 {
2666 setName(QApplication::translate("UIActionPool", "&Drag and Drop"));
2667 }
2668};
2669
2670/** Menu action extension, used as 'Shared Folders' menu class. */
2671class UIActionMenuRuntimeSharedFolders : public UIActionMenu
2672{
2673 Q_OBJECT;
2674
2675public:
2676
2677 /** Constructs action passing @a pParent to the base-class. */
2678 UIActionMenuRuntimeSharedFolders(UIActionPool *pParent)
2679 : UIActionMenu(pParent, ":/sf_16px.png", ":/sf_disabled_16px.png")
2680 {}
2681
2682protected:
2683
2684 /** Returns action extra-data ID. */
2685 virtual int extraDataID() const RT_OVERRIDE
2686 {
2687 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders;
2688 }
2689 /** Returns action extra-data key. */
2690 virtual QString extraDataKey() const RT_OVERRIDE
2691 {
2692 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders);
2693 }
2694 /** Returns whether action is allowed. */
2695 virtual bool isAllowed() const RT_OVERRIDE
2696 {
2697 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders);
2698 }
2699
2700 /** Handles translation event. */
2701 virtual void retranslateUi() RT_OVERRIDE
2702 {
2703 setName(QApplication::translate("UIActionPool", "&Shared Folders"));
2704 }
2705};
2706
2707/** Simple action extension, used as 'Show Shared Folders Settings' action class. */
2708class UIActionSimpleRuntimeShowSharedFoldersSettings : public UIActionSimple
2709{
2710 Q_OBJECT;
2711
2712public:
2713
2714 /** Constructs action passing @a pParent to the base-class. */
2715 UIActionSimpleRuntimeShowSharedFoldersSettings(UIActionPool *pParent)
2716 : UIActionSimple(pParent, ":/sf_settings_16px.png", ":/sf_settings_disabled_16px.png", true)
2717 {}
2718
2719protected:
2720
2721 /** Returns action extra-data ID. */
2722 virtual int extraDataID() const RT_OVERRIDE
2723 {
2724 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings;
2725 }
2726 /** Returns action extra-data key. */
2727 virtual QString extraDataKey() const RT_OVERRIDE
2728 {
2729 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings);
2730 }
2731 /** Returns whether action is allowed. */
2732 virtual bool isAllowed() const RT_OVERRIDE
2733 {
2734 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings);
2735 }
2736
2737 /** Returns shortcut extra-data ID. */
2738 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2739 {
2740 return QString("SharedFoldersSettingsDialog");
2741 }
2742
2743 /** Handles translation event. */
2744 virtual void retranslateUi() RT_OVERRIDE
2745 {
2746 setName(QApplication::translate("UIActionPool", "&Shared Folders Settings..."));
2747 setStatusTip(QApplication::translate("UIActionPool", "Display virtual machine settings window to configure shared folders"));
2748 }
2749};
2750
2751/** Simple action extension, used as 'Perform Insert Guest Additions Disk' action class. */
2752class UIActionSimpleRuntimePerformInsertGuestAdditionsDisk : public UIActionSimple
2753{
2754 Q_OBJECT;
2755
2756public:
2757
2758 /** Constructs action passing @a pParent to the base-class. */
2759 UIActionSimpleRuntimePerformInsertGuestAdditionsDisk(UIActionPool *pParent)
2760 : UIActionSimple(pParent, ":/guesttools_16px.png", ":/guesttools_disabled_16px.png", true)
2761 {}
2762
2763protected:
2764
2765 /** Returns action extra-data ID. */
2766 virtual int extraDataID() const RT_OVERRIDE
2767 {
2768 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InsertGuestAdditionsDisk;
2769 }
2770 /** Returns action extra-data key. */
2771 virtual QString extraDataKey() const RT_OVERRIDE
2772 {
2773 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InsertGuestAdditionsDisk);
2774 }
2775 /** Returns whether action is allowed. */
2776 virtual bool isAllowed() const RT_OVERRIDE
2777 {
2778 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InsertGuestAdditionsDisk);
2779 }
2780
2781 /** Returns shortcut extra-data ID. */
2782 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2783 {
2784 return QString("InsertGuestAdditionsDisk");
2785 }
2786
2787 /** Handles translation event. */
2788 virtual void retranslateUi() RT_OVERRIDE
2789 {
2790 setName(QApplication::translate("UIActionPool", "&Insert Guest Additions CD image..."));
2791 setStatusTip(QApplication::translate("UIActionPool", "Insert the Guest Additions disk file into the virtual optical drive"));
2792 }
2793};
2794
2795/** Simple action extension, used as 'Perform Upgrade Guest Additions' action class. */
2796class UIActionSimpleRuntimePerformUpgradeGuestAdditions : public UIActionSimple
2797{
2798 Q_OBJECT;
2799
2800public:
2801
2802 /** Constructs action passing @a pParent to the base-class. */
2803 UIActionSimpleRuntimePerformUpgradeGuestAdditions(UIActionPool *pParent)
2804 : UIActionSimple(pParent, ":/guesttools_update_16px.png", ":/guesttools_update_disabled_16px.png", true)
2805 {}
2806
2807protected:
2808
2809 /** Returns action extra-data ID. */
2810 virtual int extraDataID() const RT_OVERRIDE
2811 {
2812 return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_UpgradeGuestAdditions;
2813 }
2814 /** Returns action extra-data key. */
2815 virtual QString extraDataKey() const RT_OVERRIDE
2816 {
2817 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_UpgradeGuestAdditions);
2818 }
2819 /** Returns whether action is allowed. */
2820 virtual bool isAllowed() const RT_OVERRIDE
2821 {
2822 return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_UpgradeGuestAdditions);
2823 }
2824
2825 /** Returns shortcut extra-data ID. */
2826 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2827 {
2828 return QString("UpgradeGuestAdditions");
2829 }
2830
2831 /** Handles translation event. */
2832 virtual void retranslateUi() RT_OVERRIDE
2833 {
2834 setName(QApplication::translate("UIActionPool", "&Upgrade Guest Additions..."));
2835 setStatusTip(QApplication::translate("UIActionPool", "Upgrade Guest Additions"));
2836 }
2837};
2838
2839#ifdef VBOX_WITH_DEBUGGER_GUI
2840/** Menu action extension, used as 'Debug' menu class. */
2841class UIActionMenuRuntimeDebug : public UIActionMenu
2842{
2843 Q_OBJECT;
2844
2845public:
2846
2847 /** Constructs action passing @a pParent to the base-class. */
2848 UIActionMenuRuntimeDebug(UIActionPool *pParent)
2849 : UIActionMenu(pParent)
2850 {}
2851
2852protected:
2853
2854 /** Returns action extra-data ID. */
2855 virtual int extraDataID() const RT_OVERRIDE
2856 {
2857 return UIExtraDataMetaDefs::MenuType_Debug;
2858 }
2859 /** Returns action extra-data key. */
2860 virtual QString extraDataKey() const RT_OVERRIDE
2861 {
2862 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Debug);
2863 }
2864 /** Returns whether action is allowed. */
2865 virtual bool isAllowed() const RT_OVERRIDE
2866 {
2867 return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Debug);
2868 }
2869
2870 /** Handles translation event. */
2871 virtual void retranslateUi() RT_OVERRIDE
2872 {
2873 setName(QApplication::translate("UIActionPool", "De&bug"));
2874 }
2875};
2876
2877/** Simple action extension, used as 'Show Statistics' action class. */
2878class UIActionSimpleRuntimeShowStatistics : public UIActionSimple
2879{
2880 Q_OBJECT;
2881
2882public:
2883
2884 /** Constructs action passing @a pParent to the base-class. */
2885 UIActionSimpleRuntimeShowStatistics(UIActionPool *pParent)
2886 : UIActionSimple(pParent, true)
2887 {}
2888
2889protected:
2890
2891 /** Returns action extra-data ID. */
2892 virtual int extraDataID() const RT_OVERRIDE
2893 {
2894 return UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics;
2895 }
2896 /** Returns action extra-data key. */
2897 virtual QString extraDataKey() const RT_OVERRIDE
2898 {
2899 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics);
2900 }
2901 /** Returns whether action is allowed. */
2902 virtual bool isAllowed() const RT_OVERRIDE
2903 {
2904 return actionPool()->toRuntime()->isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics);
2905 }
2906
2907 /** Returns shortcut extra-data ID. */
2908 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2909 {
2910 return QString("StatisticWindow");
2911 }
2912
2913 /** Handles translation event. */
2914 virtual void retranslateUi() RT_OVERRIDE
2915 {
2916 setName(QApplication::translate("UIActionPool", "&Statistics...", "debug action"));
2917 }
2918};
2919
2920/** Simple action extension, used as 'Show Command Line' action class. */
2921class UIActionSimpleRuntimeShowCommandLine : public UIActionSimple
2922{
2923 Q_OBJECT;
2924
2925public:
2926
2927 /** Constructs action passing @a pParent to the base-class. */
2928 UIActionSimpleRuntimeShowCommandLine(UIActionPool *pParent)
2929 : UIActionSimple(pParent, true)
2930 {}
2931
2932protected:
2933
2934 /** Returns action extra-data ID. */
2935 virtual int extraDataID() const RT_OVERRIDE
2936 {
2937 return UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine;
2938 }
2939 /** Returns action extra-data key. */
2940 virtual QString extraDataKey() const RT_OVERRIDE
2941 {
2942 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine);
2943 }
2944 /** Returns whether action is allowed. */
2945 virtual bool isAllowed() const RT_OVERRIDE
2946 {
2947 return actionPool()->toRuntime()->isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine);
2948 }
2949
2950 /** Returns shortcut extra-data ID. */
2951 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2952 {
2953 return QString("CommandLineWindow");
2954 }
2955
2956 /** Handles translation event. */
2957 virtual void retranslateUi() RT_OVERRIDE
2958 {
2959 setName(QApplication::translate("UIActionPool", "&Command Line...", "debug action"));
2960 }
2961};
2962
2963/** Toggle action extension, used as 'Logging' action class. */
2964class UIActionToggleRuntimeLogging : public UIActionToggle
2965{
2966 Q_OBJECT;
2967
2968public:
2969
2970 /** Constructs action passing @a pParent to the base-class. */
2971 UIActionToggleRuntimeLogging(UIActionPool *pParent)
2972 : UIActionToggle(pParent, true)
2973 {}
2974
2975protected:
2976
2977 /** Returns action extra-data ID. */
2978 virtual int extraDataID() const RT_OVERRIDE
2979 {
2980 return UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging;
2981 }
2982 /** Returns action extra-data key. */
2983 virtual QString extraDataKey() const RT_OVERRIDE
2984 {
2985 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging);
2986 }
2987 /** Returns whether action is allowed. */
2988 virtual bool isAllowed() const RT_OVERRIDE
2989 {
2990 return actionPool()->toRuntime()->isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging);
2991 }
2992
2993 /** Returns shortcut extra-data ID. */
2994 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2995 {
2996 return QString("Logging");
2997 }
2998
2999 /** Handles translation event. */
3000 virtual void retranslateUi() RT_OVERRIDE
3001 {
3002 setName(QApplication::translate("UIActionPool", "&Logging", "debug action"));
3003 }
3004};
3005
3006/** Simple action extension, used as 'Guest Control Terminal' action class. */
3007class UIActionSimpleRuntimeGuestControlConsole : public UIActionSimple
3008{
3009 Q_OBJECT;
3010
3011public:
3012
3013 /** Constructs action passing @a pParent to the base-class. */
3014 UIActionSimpleRuntimeGuestControlConsole(UIActionPool *pParent)
3015 : UIActionSimple(pParent, true)
3016 {}
3017
3018protected:
3019
3020 /** Returns action extra-data ID. */
3021 virtual int extraDataID() const RT_OVERRIDE
3022 {
3023 return UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_GuestControlConsole;
3024 }
3025 /** Returns action extra-data key. */
3026 virtual QString extraDataKey() const RT_OVERRIDE
3027 {
3028 return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_GuestControlConsole);
3029 }
3030 /** Returns whether action is allowed. */
3031 virtual bool isAllowed() const RT_OVERRIDE
3032 {
3033 return actionPool()->toRuntime()->isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_GuestControlConsole);
3034 }
3035
3036 /** Returns shortcut extra-data ID. */
3037 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3038 {
3039 return QString("GuestControlConsole");
3040 }
3041
3042 /** Handles translation event. */
3043 virtual void retranslateUi() RT_OVERRIDE
3044 {
3045 setName(QApplication::translate("UIActionPool", "Guest Control Terminal...", "debug action"));
3046 }
3047};
3048#endif /* VBOX_WITH_DEBUGGER_GUI */
3049
3050#ifdef VBOX_WS_MAC
3051/** macOS: Menu action extension, used as 'Dock' menu class. */
3052class UIActionMenuDock : public UIActionMenu
3053{
3054 Q_OBJECT;
3055
3056public:
3057
3058 /** Constructs action passing @a pParent to the base-class. */
3059 UIActionMenuDock(UIActionPool *pParent)
3060 : UIActionMenu(pParent)
3061 {}
3062
3063protected:
3064
3065 /** Handles translation event. */
3066 virtual void retranslateUi() RT_OVERRIDE {}
3067};
3068
3069/** macOS: Menu action extension, used as 'Dock Settings' menu class. */
3070class UIActionMenuDockSettings : public UIActionMenu
3071{
3072 Q_OBJECT;
3073
3074public:
3075
3076 /** Constructs action passing @a pParent to the base-class. */
3077 UIActionMenuDockSettings(UIActionPool *pParent)
3078 : UIActionMenu(pParent)
3079 {}
3080
3081protected:
3082
3083 /** Handles translation event. */
3084 virtual void retranslateUi() RT_OVERRIDE
3085 {
3086 setName(QApplication::translate("UIActionPool", "Dock Icon"));
3087 }
3088};
3089
3090/** macOS: Toggle action extension, used as 'Dock Preview Monitor' action class. */
3091class UIActionToggleDockPreviewMonitor : public UIActionToggle
3092{
3093 Q_OBJECT;
3094
3095public:
3096
3097 /** Constructs action passing @a pParent to the base-class. */
3098 UIActionToggleDockPreviewMonitor(UIActionPool *pParent)
3099 : UIActionToggle(pParent)
3100 {}
3101
3102protected:
3103
3104 /** Returns shortcut extra-data ID. */
3105 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3106 {
3107 return QString("DockPreviewMonitor");
3108 }
3109
3110 /** Handles translation event. */
3111 virtual void retranslateUi() RT_OVERRIDE
3112 {
3113 setName(QApplication::translate("UIActionPool", "Show Monitor Preview"));
3114 }
3115};
3116
3117/** macOS: Toggle action extension, used as 'Dock Disable Monitor' action class. */
3118class UIActionToggleDockDisableMonitor : public UIActionToggle
3119{
3120 Q_OBJECT;
3121
3122public:
3123
3124 /** Constructs action passing @a pParent to the base-class. */
3125 UIActionToggleDockDisableMonitor(UIActionPool *pParent)
3126 : UIActionToggle(pParent)
3127 {}
3128
3129protected:
3130
3131 /** Returns shortcut extra-data ID. */
3132 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3133 {
3134 return QString("DockDisableMonitor");
3135 }
3136
3137 /** Handles translation event. */
3138 virtual void retranslateUi() RT_OVERRIDE
3139 {
3140 setName(QApplication::translate("UIActionPool", "Show Application Icon"));
3141 }
3142};
3143
3144/** macOS: Toggle action extension, used as 'Dock Icon Disable Overlay' action class. */
3145class UIActionToggleDockIconDisableOverlay : public UIActionToggle
3146{
3147 Q_OBJECT;
3148
3149public:
3150
3151 /** Constructs action passing @a pParent to the base-class. */
3152 UIActionToggleDockIconDisableOverlay(UIActionPool *pParent)
3153 : UIActionToggle(pParent)
3154 {}
3155
3156protected:
3157
3158 /** Returns shortcut extra-data ID. */
3159 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3160 {
3161 return QString("DockOverlayDisable");
3162 }
3163
3164 /** Handles translation event. */
3165 virtual void retranslateUi() RT_OVERRIDE
3166 {
3167 setName(QApplication::translate("UIActionPool", "Disable Dock Icon Overlay"));
3168 }
3169};
3170#endif /* VBOX_WS_MAC */
3171
3172
3173/*********************************************************************************************************************************
3174* Class UIActionPoolRuntime implementation. *
3175*********************************************************************************************************************************/
3176
3177UIActionPoolRuntime::UIActionPoolRuntime(bool fTemporary /* = false */)
3178 : UIActionPool(UIType_RuntimeUI, fTemporary)
3179 , m_cHostScreens(0)
3180 , m_cGuestScreens(0)
3181 , m_fGuestSupportsGraphics(false)
3182{
3183}
3184
3185void UIActionPoolRuntime::setHostScreenCount(int cCount)
3186{
3187 m_cHostScreens = cCount;
3188 m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
3189}
3190
3191void UIActionPoolRuntime::setGuestScreenCount(int cCount)
3192{
3193 m_cGuestScreens = cCount;
3194 m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
3195}
3196
3197void UIActionPoolRuntime::setGuestScreenSize(int iGuestScreen, const QSize &size)
3198{
3199 m_mapGuestScreenSize[iGuestScreen] = size;
3200 m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
3201}
3202
3203void UIActionPoolRuntime::setGuestScreenVisible(int iGuestScreen, bool fVisible)
3204{
3205 m_mapGuestScreenIsVisible[iGuestScreen] = fVisible;
3206 m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
3207}
3208
3209void UIActionPoolRuntime::setGuestSupportsGraphics(bool fSupports)
3210{
3211 m_fGuestSupportsGraphics = fSupports;
3212 m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
3213}
3214
3215void UIActionPoolRuntime::setHostScreenForGuestScreenMap(const QMap<int, int> &scheme)
3216{
3217 m_mapHostScreenForGuestScreen = scheme;
3218 m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
3219}
3220
3221QMap<int, int> UIActionPoolRuntime::hostScreenForGuestScreenMap() const
3222{
3223 return m_mapHostScreenForGuestScreen;
3224}
3225
3226bool UIActionPoolRuntime::isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType type) const
3227{
3228 foreach (const UIExtraDataMetaDefs::RuntimeMenuMachineActionType &restriction, m_restrictedActionsMenuMachine.values())
3229 if (restriction & type)
3230 return false;
3231 return true;
3232}
3233
3234void UIActionPoolRuntime::setRestrictionForMenuMachine(UIActionRestrictionLevel level,
3235 UIExtraDataMetaDefs::RuntimeMenuMachineActionType restriction)
3236{
3237 m_restrictedActionsMenuMachine[level] = restriction;
3238 m_invalidations << UIActionIndexRT_M_Machine;
3239}
3240
3241bool UIActionPoolRuntime::isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType type) const
3242{
3243 foreach (const UIExtraDataMetaDefs::RuntimeMenuViewActionType &restriction, m_restrictedActionsMenuView.values())
3244 if (restriction & type)
3245 return false;
3246 return true;
3247}
3248
3249void UIActionPoolRuntime::setRestrictionForMenuView(UIActionRestrictionLevel level,
3250 UIExtraDataMetaDefs::RuntimeMenuViewActionType restriction)
3251{
3252 m_restrictedActionsMenuView[level] = restriction;
3253 m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
3254}
3255
3256bool UIActionPoolRuntime::isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType type) const
3257{
3258 foreach (const UIExtraDataMetaDefs::RuntimeMenuInputActionType &restriction, m_restrictedActionsMenuInput.values())
3259 if (restriction & type)
3260 return false;
3261 return true;
3262}
3263
3264void UIActionPoolRuntime::setRestrictionForMenuInput(UIActionRestrictionLevel level,
3265 UIExtraDataMetaDefs::RuntimeMenuInputActionType restriction)
3266{
3267 m_restrictedActionsMenuInput[level] = restriction;
3268 m_invalidations << UIActionIndexRT_M_Input;
3269}
3270
3271bool UIActionPoolRuntime::isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType type) const
3272{
3273 foreach (const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType &restriction, m_restrictedActionsMenuDevices.values())
3274 if (restriction & type)
3275 return false;
3276 return true;
3277}
3278
3279void UIActionPoolRuntime::setRestrictionForMenuDevices(UIActionRestrictionLevel level,
3280 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restriction)
3281{
3282 m_restrictedActionsMenuDevices[level] = restriction;
3283 m_invalidations << UIActionIndexRT_M_Devices;
3284}
3285
3286#ifdef VBOX_WITH_DEBUGGER_GUI
3287bool UIActionPoolRuntime::isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType type) const
3288{
3289 foreach (const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType &restriction, m_restrictedActionsMenuDebug.values())
3290 if (restriction & type)
3291 return false;
3292 return true;
3293}
3294
3295void UIActionPoolRuntime::setRestrictionForMenuDebugger(UIActionRestrictionLevel level,
3296 UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restriction)
3297{
3298 m_restrictedActionsMenuDebug[level] = restriction;
3299 m_invalidations << UIActionIndexRT_M_Debug;
3300}
3301#endif /* VBOX_WITH_DEBUGGER_GUI */
3302
3303void UIActionPoolRuntime::preparePool()
3304{
3305 /* 'Machine' actions: */
3306 m_pool[UIActionIndexRT_M_Machine] = new UIActionMenuRuntimeMachine(this);
3307 m_pool[UIActionIndexRT_M_Machine_S_Settings] = new UIActionSimpleRuntimeShowSettings(this);
3308 m_pool[UIActionIndexRT_M_Machine_S_TakeSnapshot] = new UIActionSimpleRuntimePerformTakeSnapshot(this);
3309 m_pool[UIActionIndexRT_M_Machine_S_ShowInformation] = new UIActionSimpleRuntimeShowInformationDialog(this);
3310 m_pool[UIActionIndexRT_M_Machine_S_ShowFileManager] = new UIActionSimpleRuntimeShowFileManagerDialog(this);
3311 m_pool[UIActionIndexRT_M_Machine_T_Pause] = new UIActionToggleRuntimePause(this);
3312 m_pool[UIActionIndexRT_M_Machine_S_Reset] = new UIActionSimpleRuntimePerformReset(this);
3313 m_pool[UIActionIndexRT_M_Machine_S_Detach] = new UIActionSimpleRuntimePerformDetach(this);
3314 m_pool[UIActionIndexRT_M_Machine_S_SaveState] = new UIActionSimpleRuntimePerformSaveState(this);
3315 m_pool[UIActionIndexRT_M_Machine_S_Shutdown] = new UIActionSimpleRuntimePerformShutdown(this);
3316 m_pool[UIActionIndexRT_M_Machine_S_PowerOff] = new UIActionSimpleRuntimePerformPowerOff(this);
3317 m_pool[UIActionIndexRT_M_Machine_S_ShowLogDialog] = new UIActionSimpleRuntimeShowLogs(this);
3318
3319 /* 'View' actions: */
3320 m_pool[UIActionIndexRT_M_View] = new UIActionMenuRuntimeView(this);
3321 m_pool[UIActionIndexRT_M_ViewPopup] = new UIActionMenuRuntimeViewPopup(this);
3322 m_pool[UIActionIndexRT_M_View_T_Fullscreen] = new UIActionToggleRuntimeFullscreenMode(this);
3323 m_pool[UIActionIndexRT_M_View_T_Seamless] = new UIActionToggleRuntimeSeamlessMode(this);
3324 m_pool[UIActionIndexRT_M_View_T_Scale] = new UIActionToggleRuntimeScaledMode(this);
3325#ifndef VBOX_WS_MAC
3326 m_pool[UIActionIndexRT_M_View_S_MinimizeWindow] = new UIActionSimpleRuntimePerformMinimizeWindow(this);
3327#endif /* !VBOX_WS_MAC */
3328 m_pool[UIActionIndexRT_M_View_S_AdjustWindow] = new UIActionSimpleRuntimePerformWindowAdjust(this);
3329 m_pool[UIActionIndexRT_M_View_T_GuestAutoresize] = new UIActionToggleRuntimeGuestAutoresize(this);
3330 m_pool[UIActionIndexRT_M_View_S_TakeScreenshot] = new UIActionSimpleRuntimePerformTakeScreenshot(this);
3331 m_pool[UIActionIndexRT_M_View_M_Recording] = new UIActionMenuRuntimeRecording(this);
3332 m_pool[UIActionIndexRT_M_View_M_Recording_S_Settings] = new UIActionSimpleRuntimeShowRecordingSettings(this);
3333 m_pool[UIActionIndexRT_M_View_M_Recording_T_Start] = new UIActionToggleRuntimeRecording(this);
3334 m_pool[UIActionIndexRT_M_View_T_VRDEServer] = new UIActionToggleRuntimeVRDEServer(this);
3335 m_pool[UIActionIndexRT_M_View_M_MenuBar] = new UIActionMenuRuntimeMenuBar(this);
3336 m_pool[UIActionIndexRT_M_View_M_MenuBar_S_Settings] = new UIActionSimpleRuntimeShowMenuBarSettings(this);
3337#ifndef VBOX_WS_MAC
3338 m_pool[UIActionIndexRT_M_View_M_MenuBar_T_Visibility] = new UIActionToggleRuntimeMenuBar(this);
3339#endif /* !VBOX_WS_MAC */
3340 m_pool[UIActionIndexRT_M_View_M_StatusBar] = new UIActionMenuRuntimeStatusBar(this);
3341 m_pool[UIActionIndexRT_M_View_M_StatusBar_S_Settings] = new UIActionSimpleRuntimeShowStatusBarSettings(this);
3342 m_pool[UIActionIndexRT_M_View_M_StatusBar_T_Visibility] = new UIActionToggleRuntimeStatusBar(this);
3343
3344 /* 'Input' actions: */
3345 m_pool[UIActionIndexRT_M_Input] = new UIActionMenuRuntimeInput(this);
3346 m_pool[UIActionIndexRT_M_Input_M_Keyboard] = new UIActionMenuRuntimeKeyboard(this);
3347 m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_Settings] = new UIActionSimpleRuntimeShowKeyboardSettings(this);
3348 m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_SoftKeyboard] = new UIActionSimpleRuntimeShowSoftKeyboard(this);
3349 m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_TypeCAD] = new UIActionSimpleRuntimePerformTypeCAD(this);
3350#ifdef VBOX_WS_NIX
3351 m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_TypeCABS] = new UIActionSimpleRuntimePerformTypeCABS(this);
3352#endif /* VBOX_WS_NIX */
3353 m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_TypeCtrlBreak] = new UIActionSimpleRuntimePerformTypeCtrlBreak(this);
3354 m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_TypeInsert] = new UIActionSimpleRuntimePerformTypeInsert(this);
3355 m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_TypePrintScreen] = new UIActionSimpleRuntimePerformTypePrintScreen(this);
3356 m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_TypeAltPrintScreen] = new UIActionSimpleRuntimePerformTypeAltPrintScreen(this);
3357 m_pool[UIActionIndexRT_M_Input_M_Keyboard_T_TypeHostKeyCombo] = new UIActionToggleRuntimePerformTypeHostKeyCombo(this);
3358 m_pool[UIActionIndexRT_M_Input_M_Mouse] = new UIActionMenuRuntimeMouse(this);
3359 m_pool[UIActionIndexRT_M_Input_M_Mouse_T_Integration] = new UIActionToggleRuntimeMouseIntegration(this);
3360
3361 /* 'Devices' actions: */
3362 m_pool[UIActionIndexRT_M_Devices] = new UIActionMenuRuntimeDevices(this);
3363 m_pool[UIActionIndexRT_M_Devices_M_HardDrives] = new UIActionMenuRuntimeHardDrives(this);
3364 m_pool[UIActionIndexRT_M_Devices_M_HardDrives_S_Settings] = new UIActionSimpleRuntimeShowHardDrivesSettings(this);
3365 m_pool[UIActionIndexRT_M_Devices_M_OpticalDevices] = new UIActionMenuRuntimeOpticalDevices(this);
3366 m_pool[UIActionIndexRT_M_Devices_M_FloppyDevices] = new UIActionMenuRuntimeFloppyDevices(this);
3367 m_pool[UIActionIndexRT_M_Devices_M_Audio] = new UIActionMenuRuntimeAudio(this);
3368 m_pool[UIActionIndexRT_M_Devices_M_Audio_T_Output] = new UIActionToggleRuntimeAudioOutput(this);
3369 m_pool[UIActionIndexRT_M_Devices_M_Audio_T_Input] = new UIActionToggleRuntimeAudioInput(this);
3370 m_pool[UIActionIndexRT_M_Devices_M_Network] = new UIActionMenuRuntimeNetworkAdapters(this);
3371 m_pool[UIActionIndexRT_M_Devices_M_Network_S_Settings] = new UIActionSimpleRuntimeShowNetworkSettings(this);
3372 m_pool[UIActionIndexRT_M_Devices_M_USBDevices] = new UIActionMenuRuntimeUSBDevices(this);
3373 m_pool[UIActionIndexRT_M_Devices_M_USBDevices_S_Settings] = new UIActionSimpleRuntimeShowUSBDevicesSettings(this);
3374 m_pool[UIActionIndexRT_M_Devices_M_WebCams] = new UIActionMenuRuntimeWebCams(this);
3375 m_pool[UIActionIndexRT_M_Devices_M_SharedClipboard] = new UIActionMenuRuntimeSharedClipboard(this);
3376 m_pool[UIActionIndexRT_M_Devices_M_DragAndDrop] = new UIActionMenuRuntimeDragAndDrop(this);
3377 m_pool[UIActionIndexRT_M_Devices_M_SharedFolders] = new UIActionMenuRuntimeSharedFolders(this);
3378 m_pool[UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings] = new UIActionSimpleRuntimeShowSharedFoldersSettings(this);
3379 m_pool[UIActionIndexRT_M_Devices_S_InsertGuestAdditionsDisk] = new UIActionSimpleRuntimePerformInsertGuestAdditionsDisk(this);
3380 m_pool[UIActionIndexRT_M_Devices_S_UpgradeGuestAdditions] = new UIActionSimpleRuntimePerformUpgradeGuestAdditions(this);
3381
3382#ifdef VBOX_WITH_DEBUGGER_GUI
3383 /* 'Debug' actions: */
3384 m_pool[UIActionIndexRT_M_Debug] = new UIActionMenuRuntimeDebug(this);
3385 m_pool[UIActionIndexRT_M_Debug_S_ShowStatistics] = new UIActionSimpleRuntimeShowStatistics(this);
3386 m_pool[UIActionIndexRT_M_Debug_S_ShowCommandLine] = new UIActionSimpleRuntimeShowCommandLine(this);
3387 m_pool[UIActionIndexRT_M_Debug_T_Logging] = new UIActionToggleRuntimeLogging(this);
3388 m_pool[UIActionIndexRT_M_Debug_S_GuestControlConsole] = new UIActionSimpleRuntimeGuestControlConsole(this);
3389#endif /* VBOX_WITH_DEBUGGER_GUI */
3390
3391#ifdef VBOX_WS_MAC
3392 /* 'Dock' actions: */
3393 m_pool[UIActionIndexRT_M_Dock] = new UIActionMenuDock(this);
3394 m_pool[UIActionIndexRT_M_Dock_M_DockSettings] = new UIActionMenuDockSettings(this);
3395 m_pool[UIActionIndexRT_M_Dock_M_DockSettings_T_PreviewMonitor] = new UIActionToggleDockPreviewMonitor(this);
3396 m_pool[UIActionIndexRT_M_Dock_M_DockSettings_T_DisableMonitor] = new UIActionToggleDockDisableMonitor(this);
3397 m_pool[UIActionIndexRT_M_Dock_M_DockSettings_T_DisableOverlay] = new UIActionToggleDockIconDisableOverlay(this);
3398#endif /* VBOX_WS_MAC */
3399
3400 /* Prepare update-handlers for known menus: */
3401 m_menuUpdateHandlers[UIActionIndexRT_M_Machine].ptfr = &UIActionPoolRuntime::updateMenuMachine;
3402 m_menuUpdateHandlers[UIActionIndexRT_M_View].ptfr = &UIActionPoolRuntime::updateMenuView;
3403 m_menuUpdateHandlers[UIActionIndexRT_M_ViewPopup].ptfr = &UIActionPoolRuntime::updateMenuViewPopup;
3404 m_menuUpdateHandlers[UIActionIndexRT_M_View_M_Recording].ptfr = &UIActionPoolRuntime::updateMenuViewRecording;
3405 m_menuUpdateHandlers[UIActionIndexRT_M_View_M_MenuBar].ptfr = &UIActionPoolRuntime::updateMenuViewMenuBar;
3406 m_menuUpdateHandlers[UIActionIndexRT_M_View_M_StatusBar].ptfr = &UIActionPoolRuntime::updateMenuViewStatusBar;
3407 m_menuUpdateHandlers[UIActionIndexRT_M_Input].ptfr = &UIActionPoolRuntime::updateMenuInput;
3408 m_menuUpdateHandlers[UIActionIndexRT_M_Input_M_Keyboard].ptfr = &UIActionPoolRuntime::updateMenuInputKeyboard;
3409 m_menuUpdateHandlers[UIActionIndexRT_M_Input_M_Mouse].ptfr = &UIActionPoolRuntime::updateMenuInputMouse;
3410 m_menuUpdateHandlers[UIActionIndexRT_M_Devices].ptfr = &UIActionPoolRuntime::updateMenuDevices;
3411 m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_HardDrives].ptfr = &UIActionPoolRuntime::updateMenuDevicesHardDrives;
3412 m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_Audio].ptfr = &UIActionPoolRuntime::updateMenuDevicesAudio;
3413 m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_Network].ptfr = &UIActionPoolRuntime::updateMenuDevicesNetwork;
3414 m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_USBDevices].ptfr = &UIActionPoolRuntime::updateMenuDevicesUSBDevices;
3415 m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_SharedFolders].ptfr = &UIActionPoolRuntime::updateMenuDevicesSharedFolders;
3416#ifdef VBOX_WITH_DEBUGGER_GUI
3417 m_menuUpdateHandlers[UIActionIndexRT_M_Debug].ptfr = &UIActionPoolRuntime::updateMenuDebug;
3418#endif /* VBOX_WITH_DEBUGGER_GUI */
3419
3420 /* Call to base-class: */
3421 UIActionPool::preparePool();
3422}
3423
3424void UIActionPoolRuntime::prepareConnections()
3425{
3426 /* Prepare connections: */
3427 connect(gShortcutPool, &UIShortcutPool::sigManagerShortcutsReloaded,
3428 this, &UIActionPoolRuntime::sltApplyShortcuts);
3429 connect(gShortcutPool, &UIShortcutPool::sigRuntimeShortcutsReloaded,
3430 this, &UIActionPoolRuntime::sltApplyShortcuts);
3431 connect(gEDataManager, &UIExtraDataManager::sigMenuBarConfigurationChange,
3432 this, &UIActionPoolRuntime::sltHandleConfigurationChange);
3433
3434 /* Call to base-class: */
3435 UIActionPool::prepareConnections();
3436}
3437
3438void UIActionPoolRuntime::updateConfiguration()
3439{
3440 /* Get machine ID: */
3441 const QUuid uMachineID = uiCommon().managedVMUuid();
3442 if (uMachineID.isNull())
3443 return;
3444
3445 /* Recache common action restrictions: */
3446 m_restrictedMenus[UIActionRestrictionLevel_Base] = gEDataManager->restrictedRuntimeMenuTypes(uMachineID);
3447 m_restrictedActionsMenuApplication[UIActionRestrictionLevel_Base] = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(uMachineID);
3448 m_restrictedActionsMenuMachine[UIActionRestrictionLevel_Base] = gEDataManager->restrictedRuntimeMenuMachineActionTypes(uMachineID);
3449 m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] = gEDataManager->restrictedRuntimeMenuViewActionTypes(uMachineID);
3450 m_restrictedActionsMenuInput[UIActionRestrictionLevel_Base] = gEDataManager->restrictedRuntimeMenuInputActionTypes(uMachineID);
3451 m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] = gEDataManager->restrictedRuntimeMenuDevicesActionTypes(uMachineID);
3452#ifdef VBOX_WITH_DEBUGGER_GUI
3453 m_restrictedActionsMenuDebug[UIActionRestrictionLevel_Base] = gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(uMachineID);
3454#endif /* VBOX_WITH_DEBUGGER_GUI */
3455#ifdef VBOX_WS_MAC
3456 m_restrictedActionsMenuWindow[UIActionRestrictionLevel_Base] = gEDataManager->restrictedRuntimeMenuWindowActionTypes(uMachineID);
3457#endif /* VBOX_WS_MAC */
3458 m_restrictedActionsMenuHelp[UIActionRestrictionLevel_Base] = gEDataManager->restrictedRuntimeMenuHelpActionTypes(uMachineID);
3459
3460 /* Recache visual state action restrictions: */
3461 UIVisualStateType restrictedVisualStates = gEDataManager->restrictedVisualStates(uMachineID);
3462 {
3463 if (restrictedVisualStates & UIVisualStateType_Fullscreen)
3464 m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
3465 (m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuViewActionType_Fullscreen);
3466 if (restrictedVisualStates & UIVisualStateType_Seamless)
3467 m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
3468 (m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuViewActionType_Seamless);
3469 if (restrictedVisualStates & UIVisualStateType_Scale)
3470 m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
3471 (m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuViewActionType_Scale);
3472 }
3473
3474 /* Recache reconfiguration action restrictions: */
3475 bool fReconfigurationAllowed = gEDataManager->machineReconfigurationEnabled(uMachineID);
3476 if (!fReconfigurationAllowed)
3477 {
3478 m_restrictedActionsMenuMachine[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuMachineActionType)
3479 (m_restrictedActionsMenuMachine[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog);
3480 m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
3481 (m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuViewActionType_RecordingSettings);
3482 m_restrictedActionsMenuInput[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuInputActionType)
3483 (m_restrictedActionsMenuInput[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuInputActionType_KeyboardSettings);
3484 m_restrictedActionsMenuInput[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuInputActionType)
3485 (m_restrictedActionsMenuInput[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuInputActionType_SoftKeyboard);
3486 m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
3487 (m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrivesSettings);
3488 m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
3489 (m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings);
3490 m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
3491 (m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevicesSettings);
3492 m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
3493 (m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings);
3494 }
3495
3496 /* Recache snapshot related action restrictions: */
3497 bool fSnapshotOperationsAllowed = gEDataManager->machineSnapshotOperationsEnabled(uMachineID);
3498 if (!fSnapshotOperationsAllowed)
3499 {
3500 m_restrictedActionsMenuMachine[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuMachineActionType)
3501 (m_restrictedActionsMenuMachine[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot);
3502 }
3503
3504 /* Recache extension-pack related action restrictions: */
3505 CExtPackManager extPackManager = gpGlobalSession->virtualBox().GetExtensionPackManager();
3506 if (extPackManager.isNull() || !extPackManager.IsExtPackUsable(GUI_ExtPackName))
3507 {
3508 m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
3509 (m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer);
3510 }
3511
3512 /* Recache close related action restrictions: */
3513 MachineCloseAction restrictedCloseActions = gEDataManager->restrictedMachineCloseActions(uMachineID);
3514 bool fAllCloseActionsRestricted = (!uiCommon().isSeparateProcess() || (restrictedCloseActions & MachineCloseAction_Detach))
3515 && (restrictedCloseActions & MachineCloseAction_SaveState)
3516 && (restrictedCloseActions & MachineCloseAction_Shutdown)
3517 && (restrictedCloseActions & MachineCloseAction_PowerOff);
3518 if (fAllCloseActionsRestricted)
3519 {
3520 m_restrictedActionsMenuApplication[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::MenuApplicationActionType)
3521 (m_restrictedActionsMenuApplication[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::MenuApplicationActionType_Close);
3522 }
3523
3524 /* Call to base-class: */
3525 UIActionPool::updateConfiguration();
3526}
3527
3528void UIActionPoolRuntime::updateMenu(int iIndex)
3529{
3530 /* If index belongs to base-class => delegate to base-class: */
3531 if (iIndex < UIActionIndex_Max)
3532 UIActionPool::updateMenu(iIndex);
3533 /* Otherwise,
3534 * if menu with such index is invalidated
3535 * and there is update-handler => handle it here: */
3536 else if ( iIndex > UIActionIndex_Max
3537 && m_invalidations.contains(iIndex)
3538 && m_menuUpdateHandlers.contains(iIndex))
3539 (this->*(m_menuUpdateHandlers.value(iIndex).ptfr))();
3540}
3541
3542void UIActionPoolRuntime::updateMenus()
3543{
3544 /* Clear menu list: */
3545 m_mainMenus.clear();
3546
3547 /* 'Application' menu: */
3548 addMenu(m_mainMenus, action(UIActionIndex_M_Application));
3549 updateMenuApplication();
3550
3551 /* 'Machine' menu: */
3552 addMenu(m_mainMenus, action(UIActionIndexRT_M_Machine));
3553 updateMenuMachine();
3554
3555 /* 'View' menu: */
3556 addMenu(m_mainMenus, action(UIActionIndexRT_M_View));
3557 updateMenuView();
3558 /* 'View' popup menu: */
3559 addMenu(m_mainMenus, action(UIActionIndexRT_M_ViewPopup), false);
3560 updateMenuViewPopup();
3561
3562 /* 'Input' menu: */
3563 addMenu(m_mainMenus, action(UIActionIndexRT_M_Input));
3564 updateMenuInput();
3565
3566 /* 'Devices' menu: */
3567 addMenu(m_mainMenus, action(UIActionIndexRT_M_Devices));
3568 updateMenuDevices();
3569
3570#ifdef VBOX_WITH_DEBUGGER_GUI
3571 /* 'Debug' menu: */
3572 addMenu(m_mainMenus, action(UIActionIndexRT_M_Debug), uiCommon().isDebuggerEnabled());
3573 updateMenuDebug();
3574#endif
3575
3576#ifdef VBOX_WS_MAC
3577 /* 'Window' menu: */
3578 addMenu(m_mainMenus, action(UIActionIndex_M_Window));
3579 updateMenuWindow();
3580#endif
3581
3582 /* 'Help' menu: */
3583 addMenu(m_mainMenus, action(UIActionIndex_Menu_Help));
3584 updateMenuHelp();
3585
3586 /* 'Log Viewer' menu: */
3587 updateMenuLogViewerWindow();
3588
3589 /* 'File Manager' menu: */
3590 updateMenuFileManager();
3591}
3592
3593QString UIActionPoolRuntime::shortcutsExtraDataID() const
3594{
3595 return GUI_Input_MachineShortcuts;
3596}
3597
3598void UIActionPoolRuntime::updateShortcuts()
3599{
3600 /* Call to base-class: */
3601 UIActionPool::updateShortcuts();
3602 /* Create temporary Manager UI pool to do the same: */
3603 if (!isTemporary())
3604 UIActionPool::createTemporary(UIType_ManagerUI);
3605}
3606
3607void UIActionPoolRuntime::sltHandleConfigurationChange(const QUuid &uMachineID)
3608{
3609 /* Skip unrelated machine IDs: */
3610 if (uiCommon().managedVMUuid() != uMachineID)
3611 return;
3612
3613 /* Update configuration: */
3614 updateConfiguration();
3615}
3616
3617void UIActionPoolRuntime::sltPrepareMenuViewScreen()
3618{
3619 /* Make sure sender is valid: */
3620 QMenu *pMenu = qobject_cast<QMenu*>(sender());
3621 AssertPtrReturnVoid(pMenu);
3622
3623 /* Do we have to show resize, remap or rescale actions? */
3624 const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize);
3625 const bool fAllowToShowActionRemap = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Remap);
3626 const bool fAllowToShowActionRescale = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Rescale);
3627
3628 /* Clear contents: */
3629 pMenu->clear();
3630
3631 /* Separator: */
3632 bool fSeparator = false;
3633
3634 /* Resize actions: */
3635 if (fAllowToShowActionResize)
3636 {
3637 updateMenuViewResize(pMenu);
3638 fSeparator = true;
3639 }
3640
3641 /* Separator: */
3642 if (fSeparator)
3643 {
3644 pMenu->addSeparator();
3645 fSeparator = false;
3646 }
3647
3648 /* Remap actions: */
3649 if (fAllowToShowActionRemap && (m_cHostScreens > 1 || m_cGuestScreens > 1))
3650 {
3651 updateMenuViewRemap(pMenu);
3652 fSeparator = true;
3653 }
3654
3655 /* Separator: */
3656 if (fSeparator)
3657 {
3658 pMenu->addSeparator();
3659 fSeparator = false;
3660 }
3661
3662 /* Rescale actions: */
3663 if (fAllowToShowActionRescale)
3664 {
3665 updateMenuViewRescale(pMenu);
3666 fSeparator = true;
3667 }
3668}
3669
3670void UIActionPoolRuntime::sltHandleActionTriggerViewScreenToggle()
3671{
3672 /* Make sure sender is valid: */
3673 QAction *pAction = qobject_cast<QAction*>(sender());
3674 AssertPtrReturnVoid(pAction);
3675
3676 /* Send request to enable/disable guest-screen: */
3677 const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
3678 const bool fScreenEnabled = pAction->isChecked();
3679 emit sigNotifyAboutTriggeringViewScreenToggle(iGuestScreenIndex, fScreenEnabled);
3680}
3681
3682void UIActionPoolRuntime::sltHandleActionTriggerViewScreenResize(QAction *pAction)
3683{
3684 /* Make sure sender is valid: */
3685 AssertPtrReturnVoid(pAction);
3686
3687 /* Send request to resize guest-screen to required size: */
3688 const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
3689 const QSize size = pAction->property("Requested Size").toSize();
3690 emit sigNotifyAboutTriggeringViewScreenResize(iGuestScreenIndex, size);
3691}
3692
3693void UIActionPoolRuntime::sltHandleActionTriggerViewScreenRemap(QAction *pAction)
3694{
3695 /* Make sure sender is valid: */
3696 AssertPtrReturnVoid(pAction);
3697
3698 /* Send request to remap guest-screen to required host-screen: */
3699 const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
3700 const int iHostScreenIndex = pAction->property("Host Screen Index").toInt();
3701 emit sigNotifyAboutTriggeringViewScreenRemap(iGuestScreenIndex, iHostScreenIndex);
3702}
3703
3704void UIActionPoolRuntime::sltHandleActionTriggerViewScreenRescale(QAction *pAction)
3705{
3706 /* Make sure sender is valid: */
3707 AssertPtrReturnVoid(pAction);
3708
3709 /* Change scale-factor directly: */
3710 const double dScaleFactor = pAction->property("Requested Scale Factor").toDouble();
3711 const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
3712 gEDataManager->setScaleFactor(dScaleFactor, uiCommon().managedVMUuid(), iGuestScreenIndex);
3713}
3714
3715void UIActionPoolRuntime::updateMenuMachine()
3716{
3717 /* Get corresponding menu: */
3718 UIMenu *pMenu = action(UIActionIndexRT_M_Machine)->menu();
3719 AssertPtrReturnVoid(pMenu);
3720 /* Clear contents: */
3721 pMenu->clear();
3722
3723 /* Separator: */
3724 bool fSeparator = false;
3725
3726 /* 'Settings Dialog' action: */
3727 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_Settings)) || fSeparator;
3728
3729 /* Separator: */
3730 if (fSeparator)
3731 {
3732 pMenu->addSeparator();
3733 fSeparator = false;
3734 }
3735
3736 /* 'Take Snapshot' action: */
3737 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_TakeSnapshot)) || fSeparator;
3738 /* 'Information Dialog' action: */
3739 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_ShowInformation)) || fSeparator;
3740 /* 'File Manager' action: */
3741 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_ShowFileManager)) || fSeparator;
3742 /* 'Log Dialog' action: */
3743 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_ShowLogDialog)) || fSeparator;
3744
3745 /* Separator: */
3746 if (fSeparator)
3747 {
3748 pMenu->addSeparator();
3749 fSeparator = false;
3750 }
3751
3752 /* 'Pause' action: */
3753 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_T_Pause)) || fSeparator;
3754 /* 'Reset' action: */
3755 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_Reset)) || fSeparator;
3756 /* 'Detach' action: */
3757 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_Detach)) || fSeparator;
3758 /* 'SaveState' action: */
3759 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_SaveState)) || fSeparator;
3760 /* 'Shutdown' action: */
3761 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_Shutdown)) || fSeparator;
3762 /* 'PowerOff' action: */
3763 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_PowerOff)) || fSeparator;
3764
3765 /* Mark menu as valid: */
3766 m_invalidations.remove(UIActionIndexRT_M_Machine);
3767}
3768
3769void UIActionPoolRuntime::updateMenuView()
3770{
3771 /* Get corresponding menu: */
3772 UIMenu *pMenu = action(UIActionIndexRT_M_View)->menu();
3773 AssertPtrReturnVoid(pMenu);
3774 /* Clear contents: */
3775 pMenu->clear();
3776
3777 /* Separator: */
3778 bool fSeparator = false;
3779
3780 /* 'Fullscreen' action: */
3781 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_Fullscreen)) || fSeparator;
3782 /* 'Seamless' action: */
3783 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_Seamless)) || fSeparator;
3784 /* 'Scale' action: */
3785 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_Scale)) || fSeparator;
3786
3787 /* Separator: */
3788 if (fSeparator)
3789 {
3790 pMenu->addSeparator();
3791 fSeparator = false;
3792 }
3793
3794 /* 'Adjust Window' action: */
3795 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_S_AdjustWindow)) || fSeparator;
3796 /* 'Guest Autoresize' action: */
3797 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_GuestAutoresize)) || fSeparator;
3798
3799 /* Separator: */
3800 if (fSeparator)
3801 {
3802 pMenu->addSeparator();
3803 fSeparator = false;
3804 }
3805
3806 /* 'Take Screenshot' action: */
3807 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_S_TakeScreenshot)) || fSeparator;
3808 /* 'Recording' submenu: */
3809 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_Recording), false) || fSeparator;
3810 updateMenuViewRecording();
3811 /* 'Recording Start' action: */
3812 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_Recording_T_Start)) || fSeparator;
3813 /* 'VRDE Server' action: */
3814 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_VRDEServer)) || fSeparator;
3815
3816 /* Separator: */
3817 if (fSeparator)
3818 {
3819 pMenu->addSeparator();
3820 fSeparator = false;
3821 }
3822
3823 /* 'Menu Bar' submenu: */
3824 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_MenuBar)) || fSeparator;
3825 updateMenuViewMenuBar();
3826 /* 'Status Bar' submenu: */
3827 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_StatusBar)) || fSeparator;
3828 updateMenuViewStatusBar();
3829
3830 /* Separator: */
3831 if (fSeparator)
3832 {
3833 pMenu->addSeparator();
3834 fSeparator = false;
3835 }
3836
3837 /* Do we have to show resize, remap or rescale actions? */
3838 const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize);
3839 const bool fAllowToShowActionRemap = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Remap);
3840 const bool fAllowToShowActionRescale = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Rescale);
3841 if (fAllowToShowActionResize || fAllowToShowActionRemap || fAllowToShowActionRescale)
3842 {
3843 for (int iGuestScreenIndex = 0; iGuestScreenIndex < m_cGuestScreens; ++iGuestScreenIndex)
3844 {
3845 /* Add 'Virtual Screen %1' menu: */
3846 QMenu *pSubMenu = pMenu->addMenu(UIIconPool::iconSet(":/virtual_screen_16px.png",
3847 ":/virtual_screen_disabled_16px.png"),
3848 QApplication::translate("UIActionPool", "Virtual Screen %1").arg(iGuestScreenIndex + 1));
3849 pSubMenu->setProperty("Guest Screen Index", iGuestScreenIndex);
3850 connect(pSubMenu, &QMenu::aboutToShow, this, &UIActionPoolRuntime::sltPrepareMenuViewScreen);
3851 }
3852 }
3853
3854 /* Mark menu as valid: */
3855 m_invalidations.remove(UIActionIndexRT_M_View);
3856}
3857
3858void UIActionPoolRuntime::updateMenuViewPopup()
3859{
3860 /* Get corresponding menu: */
3861 UIMenu *pMenu = action(UIActionIndexRT_M_ViewPopup)->menu();
3862 AssertPtrReturnVoid(pMenu);
3863 /* Clear contents: */
3864 pMenu->clear();
3865
3866 /* Separator: */
3867 bool fSeparator = false;
3868
3869 /* 'Adjust Window' action: */
3870 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_S_AdjustWindow)) || fSeparator;
3871 /* 'Guest Autoresize' action: */
3872 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_GuestAutoresize)) || fSeparator;
3873
3874 /* Separator: */
3875 if (fSeparator)
3876 {
3877 pMenu->addSeparator();
3878 fSeparator = false;
3879 }
3880
3881 /* Do we have to show resize or rescale actions? */
3882 const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize);
3883 const bool fAllowToShowActionRescale = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Rescale);
3884 if (fAllowToShowActionResize || fAllowToShowActionRescale)
3885 {
3886 for (int iGuestScreenIndex = 0; iGuestScreenIndex < m_cGuestScreens; ++iGuestScreenIndex)
3887 {
3888 /* Add 'Virtual Screen %1' menu: */
3889 QMenu *pSubMenu = pMenu->addMenu(UIIconPool::iconSet(":/virtual_screen_16px.png",
3890 ":/virtual_screen_disabled_16px.png"),
3891 QApplication::translate("UIActionPool", "Virtual Screen %1").arg(iGuestScreenIndex + 1));
3892 pSubMenu->setProperty("Guest Screen Index", iGuestScreenIndex);
3893 connect(pSubMenu, &QMenu::aboutToShow, this, &UIActionPoolRuntime::sltPrepareMenuViewScreen);
3894 }
3895 }
3896
3897 /* Mark menu as valid: */
3898 m_invalidations.remove(UIActionIndexRT_M_ViewPopup);
3899}
3900
3901void UIActionPoolRuntime::updateMenuViewRecording()
3902{
3903 /* Get corresponding menu: */
3904 UIMenu *pMenu = action(UIActionIndexRT_M_View_M_Recording)->menu();
3905 AssertPtrReturnVoid(pMenu);
3906 /* Clear contents: */
3907 pMenu->clear();
3908
3909 /* Separator: */
3910 bool fSeparator = false;
3911
3912 /* 'Recording Settings' action: */
3913 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_Recording_S_Settings)) || fSeparator;
3914
3915 /* Separator: */
3916 if (fSeparator)
3917 {
3918 pMenu->addSeparator();
3919 fSeparator = false;
3920 }
3921
3922 /* 'Start Recording' action: */
3923 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_Recording_T_Start)) || fSeparator;
3924
3925 /* Mark menu as valid: */
3926 m_invalidations.remove(UIActionIndexRT_M_View_M_Recording);
3927}
3928
3929void UIActionPoolRuntime::updateMenuViewMenuBar()
3930{
3931 /* Get corresponding menu: */
3932 UIMenu *pMenu = action(UIActionIndexRT_M_View_M_MenuBar)->menu();
3933 AssertPtrReturnVoid(pMenu);
3934 /* Clear contents: */
3935 pMenu->clear();
3936
3937 /* 'Menu Bar Settings' action: */
3938 addAction(pMenu, action(UIActionIndexRT_M_View_M_MenuBar_S_Settings));
3939#ifndef VBOX_WS_MAC
3940 /* 'Toggle Menu Bar' action: */
3941 addAction(pMenu, action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility));
3942#endif
3943
3944 /* Mark menu as valid: */
3945 m_invalidations.remove(UIActionIndexRT_M_View_M_MenuBar);
3946}
3947
3948void UIActionPoolRuntime::updateMenuViewStatusBar()
3949{
3950 /* Get corresponding menu: */
3951 UIMenu *pMenu = action(UIActionIndexRT_M_View_M_StatusBar)->menu();
3952 AssertPtrReturnVoid(pMenu);
3953 /* Clear contents: */
3954 pMenu->clear();
3955
3956 /* 'Status Bar Settings' action: */
3957 addAction(pMenu, action(UIActionIndexRT_M_View_M_StatusBar_S_Settings));
3958 /* 'Toggle Status Bar' action: */
3959 addAction(pMenu, action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility));
3960
3961 /* Mark menu as valid: */
3962 m_invalidations.remove(UIActionIndexRT_M_View_M_StatusBar);
3963}
3964
3965void UIActionPoolRuntime::updateMenuViewResize(QMenu *pMenu)
3966{
3967 AssertPtrReturnVoid(pMenu);
3968
3969 /* Prepare content: */
3970 const QList<QSize> sizes = QList<QSize>()
3971 << QSize(640, 480)
3972 << QSize(800, 600)
3973 << QSize(1024, 768)
3974 << QSize(1152, 864)
3975 << QSize(1280, 720)
3976 << QSize(1280, 800)
3977 << QSize(1366, 768)
3978 << QSize(1440, 900)
3979 << QSize(1600, 900)
3980 << QSize(1680, 1050)
3981 << QSize(1920, 1080)
3982 << QSize(1920, 1200);
3983
3984 /* Get corresponding screen index and frame-buffer size: */
3985 const int iGuestScreenIndex = pMenu->property("Guest Screen Index").toInt();
3986 const QSize screenSize = m_mapGuestScreenSize.value(iGuestScreenIndex);
3987 const bool fScreenEnabled = m_mapGuestScreenIsVisible.value(iGuestScreenIndex);
3988
3989 /* For non-primary screens: */
3990 if (iGuestScreenIndex > 0)
3991 {
3992 /* Create 'toggle' action: */
3993 QAction *pToggleAction = pMenu->addAction(QApplication::translate("UIActionPool", "Enable", "Virtual Screen"),
3994 this, SLOT(sltHandleActionTriggerViewScreenToggle()));
3995 if (pToggleAction)
3996 {
3997 /* Configure 'toggle' action: */
3998 pToggleAction->setEnabled(m_fGuestSupportsGraphics);
3999 pToggleAction->setProperty("Guest Screen Index", iGuestScreenIndex);
4000 pToggleAction->setCheckable(true);
4001 pToggleAction->setChecked(fScreenEnabled);
4002 /* Add separator: */
4003 pMenu->addSeparator();
4004 }
4005 }
4006
4007 /* Create exclusive 'resize' action-group: */
4008 QActionGroup *pActionGroup = new QActionGroup(pMenu);
4009 if (pActionGroup)
4010 {
4011 /* Configure exclusive 'resize' action-group: */
4012 pActionGroup->setExclusive(true);
4013
4014 /* For every available size: */
4015 foreach (const QSize &size, sizes)
4016 {
4017 /* Create exclusive 'resize' action: */
4018 QAction *pAction = pActionGroup->addAction(QApplication::translate("UIActionPool", "Resize to %1x%2", "Virtual Screen")
4019 .arg(size.width()).arg(size.height()));
4020 if (pAction)
4021 {
4022 /* Configure exclusive 'resize' action: */
4023 pAction->setEnabled(m_fGuestSupportsGraphics && fScreenEnabled);
4024 pAction->setProperty("Guest Screen Index", iGuestScreenIndex);
4025 pAction->setProperty("Requested Size", size);
4026 pAction->setCheckable(true);
4027 if ( screenSize.width() == size.width()
4028 && screenSize.height() == size.height())
4029 pAction->setChecked(true);
4030 }
4031 }
4032
4033 /* Insert group actions into menu: */
4034 pMenu->addActions(pActionGroup->actions());
4035 /* Install listener for exclusive action-group: */
4036 connect(pActionGroup, &QActionGroup::triggered,
4037 this, &UIActionPoolRuntime::sltHandleActionTriggerViewScreenResize);
4038 }
4039}
4040
4041void UIActionPoolRuntime::updateMenuViewRemap(QMenu *pMenu)
4042{
4043 AssertPtrReturnVoid(pMenu);
4044
4045 /* Get corresponding screen index: */
4046 const int iGuestScreenIndex = pMenu->property("Guest Screen Index").toInt();
4047 const bool fScreenEnabled = m_mapGuestScreenIsVisible.value(iGuestScreenIndex);
4048
4049 /* For non-primary screens: */
4050 if (iGuestScreenIndex > 0)
4051 {
4052 /* Create 'toggle' action: */
4053 QAction *pToggleAction = pMenu->addAction(QApplication::translate("UIActionPool", "Enable", "Virtual Screen"),
4054 this, SLOT(sltHandleActionTriggerViewScreenToggle()));
4055 if (pToggleAction)
4056 {
4057 /* Configure 'toggle' action: */
4058 pToggleAction->setEnabled(m_fGuestSupportsGraphics);
4059 pToggleAction->setProperty("Guest Screen Index", iGuestScreenIndex);
4060 pToggleAction->setCheckable(true);
4061 pToggleAction->setChecked(fScreenEnabled);
4062 /* Add separator: */
4063 pMenu->addSeparator();
4064 }
4065 }
4066
4067 /* Create exclusive 'remap' action-group: */
4068 QActionGroup *pActionGroup = new QActionGroup(pMenu);
4069 if (pActionGroup)
4070 {
4071 /* Configure exclusive 'remap' action-group: */
4072 pActionGroup->setExclusive(true);
4073
4074 /* For every host-screen index: */
4075 for (int iHostScreenIndex = 0; iHostScreenIndex < m_cHostScreens; ++iHostScreenIndex)
4076 {
4077 /* Create exclusive 'remap' action: */
4078 QAction *pAction = pActionGroup->addAction(QApplication::translate("UIActionPool", "Use Host Screen %1")
4079 .arg(iHostScreenIndex + 1));
4080 if (pAction)
4081 {
4082 /* Configure exclusive 'remap' action: */
4083 pAction->setEnabled(m_fGuestSupportsGraphics && fScreenEnabled);
4084 pAction->setProperty("Guest Screen Index", iGuestScreenIndex);
4085 pAction->setProperty("Host Screen Index", iHostScreenIndex);
4086 pAction->setCheckable(true);
4087 if ( m_mapHostScreenForGuestScreen.contains(iGuestScreenIndex)
4088 && m_mapHostScreenForGuestScreen.value(iGuestScreenIndex) == iHostScreenIndex)
4089 pAction->setChecked(true);
4090 }
4091 }
4092
4093 /* Insert group actions into menu: */
4094 pMenu->addActions(pActionGroup->actions());
4095 /* Install listener for exclusive action-group: */
4096 connect(pActionGroup, &QActionGroup::triggered,
4097 this, &UIActionPoolRuntime::sltHandleActionTriggerViewScreenRemap);
4098 }
4099}
4100
4101void UIActionPoolRuntime::updateMenuViewRescale(QMenu *pMenu)
4102{
4103 AssertPtrReturnVoid(pMenu);
4104
4105 /* Get corresponding screen index and scale-factor: */
4106 const int iGuestScreenIndex = pMenu->property("Guest Screen Index").toInt();
4107 const double dCurrentScaleFactor = gEDataManager->scaleFactor(uiCommon().managedVMUuid(), iGuestScreenIndex);
4108
4109 /* Create exclusive 'rescale' action-group: */
4110 QActionGroup *pActionGroup = new QActionGroup(pMenu);
4111 if (pActionGroup)
4112 {
4113 /* Configure exclusive 'rescale' action-group: */
4114 pActionGroup->setExclusive(true);
4115
4116 /* Get device-pixel-ratio: */
4117 bool fDevicePixelRatioMentioned = false;
4118 const double dDevicePixelRatioActual = qMin(UIDesktopWidgetWatchdog::devicePixelRatioActual(m_mapHostScreenForGuestScreen.value(iGuestScreenIndex)),
4119 10.0 /* meh, who knows? */);
4120
4121 /* Calculate minimum, maximum and step: */
4122 const double dMinimum = 1.0;
4123 const double dMaximum = ceil(dMinimum + dDevicePixelRatioActual);
4124 const double dStep = 0.25;
4125
4126 /* Now, iterate possible scale-factors: */
4127 double dScaleFactor = dMinimum;
4128 do
4129 {
4130 /* Create exclusive 'rescale' action: */
4131 QAction *pAction = pActionGroup->addAction(QString());
4132 if (pAction)
4133 {
4134 pAction->setProperty("Guest Screen Index", iGuestScreenIndex);
4135 /* For the 'unscaled' action: */
4136 if (dScaleFactor == 1.0)
4137 {
4138 pAction->setProperty("Requested Scale Factor", dScaleFactor);
4139 if (dDevicePixelRatioActual == 1.0)
4140 pAction->setText(QApplication::translate("UIActionPool", "Scale to %1%", "scale-factor")
4141 .arg(dScaleFactor * 100));
4142 else
4143 pAction->setText(QApplication::translate("UIActionPool", "Scale to %1% (unscaled output)", "scale-factor")
4144 .arg(dScaleFactor * 100));
4145 }
4146 /* For the 'autoscaled' action: */
4147 else if ( (dScaleFactor >= dDevicePixelRatioActual)
4148 && (dDevicePixelRatioActual != 1.0)
4149 && !fDevicePixelRatioMentioned)
4150 {
4151 pAction->setProperty("Requested Scale Factor", dDevicePixelRatioActual);
4152 pAction->setText(QApplication::translate("UIActionPool", "Scale to %1% (autoscaled output)", "scale-factor")
4153 .arg(dDevicePixelRatioActual * 100));
4154 fDevicePixelRatioMentioned = true;
4155 }
4156 /* For other actions: */
4157 else
4158 {
4159 pAction->setProperty("Requested Scale Factor", dScaleFactor);
4160 pAction->setText(QApplication::translate("UIActionPool", "Scale to %1%", "scale-factor")
4161 .arg(dScaleFactor * 100));
4162 }
4163
4164 /* Configure exclusive 'scale-factor' action: */
4165 pAction->setCheckable(true);
4166 if (dScaleFactor == dCurrentScaleFactor)
4167 pAction->setChecked(true);
4168 }
4169
4170 /* Increment scale-factor: */
4171 dScaleFactor += dStep;
4172 }
4173 while (dScaleFactor <= dMaximum);
4174
4175 /* Insert group actions into menu: */
4176 pMenu->addActions(pActionGroup->actions());
4177 /* Install listener for exclusive action-group: */
4178 connect(pActionGroup, &QActionGroup::triggered,
4179 this, &UIActionPoolRuntime::sltHandleActionTriggerViewScreenRescale);
4180 }
4181}
4182
4183void UIActionPoolRuntime::updateMenuInput()
4184{
4185 /* Get corresponding menu: */
4186 UIMenu *pMenu = action(UIActionIndexRT_M_Input)->menu();
4187 AssertPtrReturnVoid(pMenu);
4188 /* Clear contents: */
4189 pMenu->clear();
4190
4191 /* Separator: */
4192 bool fSeparator = false;
4193
4194 /* 'Keyboard' submenu: */
4195 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard)) || fSeparator;
4196 updateMenuInputKeyboard();
4197 /* 'Mouse' submenu: */
4198 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Mouse), false) || fSeparator;
4199 updateMenuInputMouse();
4200
4201 /* Separator: */
4202 if (fSeparator)
4203 {
4204 pMenu->addSeparator();
4205 fSeparator = false;
4206 }
4207
4208 /* 'Mouse Integration' action: */
4209 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Mouse_T_Integration)) || fSeparator;
4210
4211 /* Mark menu as valid: */
4212 m_invalidations.remove(UIActionIndexRT_M_Input);
4213}
4214
4215void UIActionPoolRuntime::updateMenuInputKeyboard()
4216{
4217 /* Get corresponding menu: */
4218 UIMenu *pMenu = action(UIActionIndexRT_M_Input_M_Keyboard)->menu();
4219 AssertPtrReturnVoid(pMenu);
4220 /* Clear contents: */
4221 pMenu->clear();
4222
4223 /* Separator: */
4224 bool fSeparator = false;
4225
4226 /* 'Keyboard Settings' action: */
4227 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_Settings)) || fSeparator;
4228 /* 'Soft Keyboard' action: */
4229 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_SoftKeyboard)) || fSeparator;
4230 /* Separator: */
4231 if (fSeparator)
4232 {
4233 pMenu->addSeparator();
4234 fSeparator = false;
4235 }
4236
4237 /* 'Type CAD' action: */
4238 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeCAD)) || fSeparator;
4239#ifdef VBOX_WS_NIX
4240 /* 'Type CABS' action: */
4241 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeCABS)) || fSeparator;
4242#endif
4243 /* 'Type Ctrl-Break' action: */
4244 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeCtrlBreak)) || fSeparator;
4245 /* 'Type Insert' action: */
4246 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeInsert)) || fSeparator;
4247 /* 'Type Print Screen' action: */
4248 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_TypePrintScreen)) || fSeparator;
4249 /* 'Type Alt Print Screen' action: */
4250 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeAltPrintScreen)) || fSeparator;
4251 /* 'Type Host Key Combo' action: */
4252 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_T_TypeHostKeyCombo)) || fSeparator;
4253
4254 /* Mark menu as valid: */
4255 m_invalidations.remove(UIActionIndexRT_M_Input_M_Keyboard);
4256}
4257
4258void UIActionPoolRuntime::updateMenuInputMouse()
4259{
4260 /* Get corresponding menu: */
4261 UIMenu *pMenu = action(UIActionIndexRT_M_Input_M_Mouse)->menu();
4262 AssertPtrReturnVoid(pMenu);
4263 /* Clear contents: */
4264 pMenu->clear();
4265
4266 /* 'Machine Integration' action: */
4267 addAction(pMenu, action(UIActionIndexRT_M_Input_M_Mouse_T_Integration));
4268
4269 /* Mark menu as valid: */
4270 m_invalidations.remove(UIActionIndexRT_M_Input_M_Mouse);
4271}
4272
4273void UIActionPoolRuntime::updateMenuDevices()
4274{
4275 /* Get corresponding menu: */
4276 UIMenu *pMenu = action(UIActionIndexRT_M_Devices)->menu();
4277 AssertPtrReturnVoid(pMenu);
4278 /* Clear contents: */
4279 pMenu->clear();
4280
4281 /* Separator: */
4282 bool fSeparator = false;
4283
4284 /* 'Hard Drives' submenu: */
4285 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_HardDrives)) || fSeparator;
4286 updateMenuDevicesHardDrives();
4287 /* 'Optical Devices' submenu: */
4288 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_OpticalDevices)) || fSeparator;
4289 /* 'Floppy Devices' submenu: */
4290 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_FloppyDevices)) || fSeparator;
4291 /* 'Audio' submenu: */
4292 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_Audio)) || fSeparator;
4293 updateMenuDevicesAudio();
4294 /* 'Network' submenu: */
4295 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_Network)) || fSeparator;
4296 updateMenuDevicesNetwork();
4297 /* 'USB Devices' submenu: */
4298 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_USBDevices)) || fSeparator;
4299 updateMenuDevicesUSBDevices();
4300 /* 'Web Cams' submenu: */
4301 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_WebCams)) || fSeparator;
4302
4303 /* Separator: */
4304 if (fSeparator)
4305 {
4306 pMenu->addSeparator();
4307 fSeparator = false;
4308 }
4309
4310 /* 'Shared Folders' submenu: */
4311 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedFolders)) || fSeparator;
4312 updateMenuDevicesSharedFolders();
4313 /* 'Shared Clipboard' submenu: */
4314 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedClipboard)) || fSeparator;
4315 /* 'Drag&Drop' submenu: */
4316 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_DragAndDrop)) || fSeparator;
4317
4318 /* Separator: */
4319 if (fSeparator)
4320 {
4321 pMenu->addSeparator();
4322 fSeparator = false;
4323 }
4324
4325 /* Insert Guest Additions Disk action: */
4326 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_S_InsertGuestAdditionsDisk)) || fSeparator;
4327 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_S_UpgradeGuestAdditions)) || fSeparator;
4328
4329 /* Mark menu as valid: */
4330 m_invalidations.remove(UIActionIndexRT_M_Devices);
4331}
4332
4333void UIActionPoolRuntime::updateMenuDevicesHardDrives()
4334{
4335 /* Get corresponding menu: */
4336 UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_HardDrives)->menu();
4337 AssertPtrReturnVoid(pMenu);
4338 /* Clear contents: */
4339 pMenu->clear();
4340
4341 /* 'Hard Drives Settings' action: */
4342 addAction(pMenu, action(UIActionIndexRT_M_Devices_M_HardDrives_S_Settings));
4343
4344 /* Mark menu as valid: */
4345 m_invalidations.remove(UIActionIndexRT_M_Devices_M_HardDrives);
4346}
4347
4348void UIActionPoolRuntime::updateMenuDevicesAudio()
4349{
4350 /* Get corresponding menu: */
4351 UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_Audio)->menu();
4352 AssertPtrReturnVoid(pMenu);
4353 /* Clear contents: */
4354 pMenu->clear();
4355
4356 /* 'Output' action: */
4357 addAction(pMenu, action(UIActionIndexRT_M_Devices_M_Audio_T_Output));
4358 /* 'Input' action: */
4359 addAction(pMenu, action(UIActionIndexRT_M_Devices_M_Audio_T_Input));
4360
4361 /* Mark menu as valid: */
4362 m_invalidations.remove(UIActionIndexRT_M_Devices_M_Audio);
4363}
4364
4365void UIActionPoolRuntime::updateMenuDevicesNetwork()
4366{
4367 /* Get corresponding menu: */
4368 UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_Network)->menu();
4369 AssertPtrReturnVoid(pMenu);
4370 /* Clear contents: */
4371 pMenu->clear();
4372
4373 /* Separator: */
4374 bool fSeparator = false;
4375
4376 /* 'Network Settings' action: */
4377 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_Network_S_Settings)) || fSeparator;
4378
4379 /* Separator: */
4380 if (fSeparator)
4381 {
4382 pMenu->addSeparator();
4383 fSeparator = false;
4384 }
4385
4386 /* This menu always remains invalid.. */
4387}
4388
4389void UIActionPoolRuntime::updateMenuDevicesUSBDevices()
4390{
4391 /* Get corresponding menu: */
4392 UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_USBDevices)->menu();
4393 AssertPtrReturnVoid(pMenu);
4394 /* Clear contents: */
4395 pMenu->clear();
4396
4397 /* Separator: */
4398 bool fSeparator = false;
4399
4400 /* 'USB Devices Settings' action: */
4401 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_USBDevices_S_Settings)) || fSeparator;
4402
4403 /* Separator: */
4404 if (fSeparator)
4405 {
4406 pMenu->addSeparator();
4407 fSeparator = false;
4408 }
4409
4410 /* This menu always remains invalid.. */
4411}
4412
4413void UIActionPoolRuntime::updateMenuDevicesSharedFolders()
4414{
4415 /* Get corresponding menu: */
4416 UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_SharedFolders)->menu();
4417 AssertPtrReturnVoid(pMenu);
4418 /* Clear contents: */
4419 pMenu->clear();
4420
4421 /* 'Shared Folders Settings' action: */
4422 addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings));
4423
4424 /* Mark menu as valid: */
4425 m_invalidations.remove(UIActionIndexRT_M_Devices_M_SharedFolders);
4426}
4427
4428#ifdef VBOX_WITH_DEBUGGER_GUI
4429void UIActionPoolRuntime::updateMenuDebug()
4430{
4431 /* Get corresponding menu: */
4432 UIMenu *pMenu = action(UIActionIndexRT_M_Debug)->menu();
4433 AssertPtrReturnVoid(pMenu);
4434 /* Clear contents: */
4435 pMenu->clear();
4436
4437 /* 'Statistics' action: */
4438 addAction(pMenu, action(UIActionIndexRT_M_Debug_S_ShowStatistics));
4439 /* 'Command Line' action: */
4440 addAction(pMenu, action(UIActionIndexRT_M_Debug_S_ShowCommandLine));
4441 /* 'Logging' action: */
4442 addAction(pMenu, action(UIActionIndexRT_M_Debug_T_Logging));
4443 /* 'Guest Control Terminal' action: */
4444 addAction(pMenu, action(UIActionIndexRT_M_Debug_S_GuestControlConsole));
4445
4446 /* Mark menu as valid: */
4447 m_invalidations.remove(UIActionIndexRT_M_Debug);
4448}
4449#endif /* VBOX_WITH_DEBUGGER_GUI */
4450
4451
4452#include "UIActionPoolRuntime.moc"
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use