VirtualBox

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

Last change on this file since 102493 was 100634, checked in by vboxsync, 14 months ago

FE/Qt: Runtime UI: Adjust action-pool to disable VRDE action when ext-pack is absent at all, not only unusable.

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

© 2024 Oracle
ContactPrivacy/Do Not Sell My InfoTerms of Use