VirtualBox

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

Last change on this file was 106061, checked in by vboxsync, 7 weeks ago

Copyright year updates by scm.

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette