VirtualBox

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

Last change on this file since 82781 was 80760, checked in by vboxsync, 5 years ago

FE/Qt: bugref:8938. Converting connection syntaxes under manager and global subfolders.not complete.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use