VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp@ 104158

Last change on this file since 104158 was 103710, checked in by vboxsync, 9 months ago

FE/Qt: Get rid of unwanted UICommon includes across whole the GUI.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 139.9 KB
Line 
1/* $Id: UIActionPool.cpp 103710 2024-03-06 16:53:27Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIActionPool class implementation.
4 */
5
6/*
7 * Copyright (C) 2010-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28/* Qt includes: */
29#include <QActionGroup>
30#include <QHelpEvent>
31#include <QToolTip>
32
33/* GUI includes: */
34#include "UIActionPool.h"
35#include "UIActionPoolManager.h"
36#include "UIActionPoolRuntime.h"
37#include "UIConverter.h"
38#include "UIIconPool.h"
39#include "UIMessageCenter.h"
40#include "UIShortcutPool.h"
41#include "UITranslator.h"
42#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
43# include "UIExtraDataManager.h"
44# include "UINetworkRequestManager.h"
45# include "UIUpdateManager.h"
46#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
47
48
49/** Additional Qt event types. */
50enum UIEventTypeActionPool
51{
52 UIEventTypeActionPool_ActivateAction = QEvent::User + 101,
53};
54
55/** QEvent extension
56 * representing action-activation event. */
57class ActivateActionEvent : public QEvent
58{
59public:
60
61 /** Constructs @a pAction event. */
62 ActivateActionEvent(QAction *pAction)
63 : QEvent((QEvent::Type)UIEventTypeActionPool_ActivateAction)
64 , m_pAction(pAction)
65 {}
66
67 /** Returns the action this event corresponds to. */
68 QAction *action() const { return m_pAction; }
69
70private:
71
72 /** Holds the action this event corresponds to. */
73 QAction *m_pAction;
74};
75
76
77/*********************************************************************************************************************************
78* Class UIMenu implementation. *
79*********************************************************************************************************************************/
80
81UIMenu::UIMenu()
82 : m_fShowToolTip(false)
83#ifdef VBOX_WS_MAC
84 , m_fConsumable(false)
85 , m_fConsumed(false)
86#endif
87{
88}
89
90bool UIMenu::event(QEvent *pEvent)
91{
92 /* Handle particular event-types: */
93 switch (pEvent->type())
94 {
95 /* Tool-tip request handler: */
96 case QEvent::ToolTip:
97 {
98 /* Get current help-event: */
99 QHelpEvent *pHelpEvent = static_cast<QHelpEvent*>(pEvent);
100 /* Get action which caused help-event: */
101 QAction *pAction = actionAt(pHelpEvent->pos());
102 /* If action present => show action's tool-tip if needed: */
103 if (pAction && m_fShowToolTip)
104 QToolTip::showText(pHelpEvent->globalPos(), pAction->toolTip());
105 break;
106 }
107 default:
108 break;
109 }
110 /* Call to base-class: */
111 return QMenu::event(pEvent);
112}
113
114
115/*********************************************************************************************************************************
116* Class UIAction implementation. *
117*********************************************************************************************************************************/
118
119UIAction::UIAction(UIActionPool *pParent, UIActionType enmType, bool fMachineMenuAction /* = false */)
120 : QAction(pParent)
121 , m_pActionPool(pParent)
122 , m_enmActionPoolType(pParent->type())
123 , m_enmType(enmType)
124 , m_fMachineMenuAction(fMachineMenuAction)
125 , m_iState(0)
126 , m_fShortcutHidden(false)
127{
128 /* By default there is no specific menu role.
129 * It will be set explicitly later. */
130 setMenuRole(QAction::NoRole);
131
132#ifdef VBOX_WS_MAC
133 /* Make sure each action notifies it's parent about hovering: */
134 connect(this, &UIAction::hovered,
135 static_cast<UIActionPool*>(parent()), &UIActionPool::sltActionHovered);
136#endif
137}
138
139UIMenu *UIAction::menu() const
140{
141 return QAction::menu() ? qobject_cast<UIMenu*>(QAction::menu()) : 0;
142}
143
144void UIAction::setState(int iState)
145{
146 m_iState = iState;
147 updateIcon();
148 retranslateUi();
149 handleStateChange();
150}
151
152void UIAction::setIcon(int iState, const QIcon &icon)
153{
154 m_icons.resize(iState + 1);
155 m_icons[iState] = icon;
156 updateIcon();
157}
158
159void UIAction::setIcon(const QIcon &icon)
160{
161 setIcon(0, icon);
162}
163
164void UIAction::setName(const QString &strName)
165{
166 /* Remember internal name: */
167 m_strName = strName;
168 /* Update text according new name: */
169 updateText();
170}
171
172void UIAction::setShortcuts(const QList<QKeySequence> &shortcuts)
173{
174 /* Only for manager's action-pool: */
175 if (m_enmActionPoolType == UIType_ManagerUI)
176 {
177 /* If primary shortcut should be visible: */
178 if (!m_fShortcutHidden)
179 /* Call to base-class: */
180 QAction::setShortcuts(shortcuts);
181 /* Remember shortcuts: */
182 m_shortcuts = shortcuts;
183 }
184 /* Update text according to new primary shortcut: */
185 updateText();
186}
187
188void UIAction::showShortcut()
189{
190 m_fShortcutHidden = false;
191 if (!m_shortcuts.isEmpty())
192 QAction::setShortcuts(m_shortcuts);
193}
194
195void UIAction::hideShortcut()
196{
197 m_fShortcutHidden = true;
198 if (!shortcut().isEmpty())
199 QAction::setShortcuts(QList<QKeySequence>());
200}
201
202QString UIAction::nameInMenu() const
203{
204 /* Action-name format depends on action-pool type: */
205 switch (m_enmActionPoolType)
206 {
207 /* Unchanged name for Manager UI: */
208 case UIType_ManagerUI: return name();
209 /* Filtered name for Runtime UI: */
210 case UIType_RuntimeUI: return UITranslator::removeAccelMark(name());
211 }
212 /* Nothing by default: */
213 return QString();
214}
215
216void UIAction::updateIcon()
217{
218 QAction::setIcon(m_icons.value(m_iState, m_icons.value(0)));
219}
220
221void UIAction::updateText()
222{
223 /* First of all, action-text depends on action type: */
224 switch (m_enmType)
225 {
226 case UIActionType_Menu:
227 {
228 /* For menu types it's very easy: */
229 setText(nameInMenu());
230 break;
231 }
232 default:
233 {
234 /* For rest of action types it depends on action-pool type: */
235 switch (m_enmActionPoolType)
236 {
237 /* The same as menu name for Manager UI: */
238 case UIType_ManagerUI:
239 {
240 setText(nameInMenu());
241 break;
242 }
243 /* With shortcut appended for Runtime UI: */
244 case UIType_RuntimeUI:
245 {
246 if (m_fMachineMenuAction)
247 setText(UITranslator::insertKeyToActionText(nameInMenu(),
248 gShortcutPool->shortcut(actionPool(), this).primaryToPortableText()));
249 else
250 setText(nameInMenu());
251 break;
252 }
253 }
254 break;
255 }
256 }
257}
258
259/* static */
260QString UIAction::simplifyText(QString strText)
261{
262 return strText.remove('.').remove('&');
263}
264
265
266/*********************************************************************************************************************************
267* Class UIActionMenu implementation. *
268*********************************************************************************************************************************/
269
270UIActionMenu::UIActionMenu(UIActionPool *pParent,
271 const QString &strIcon, const QString &strIconDisabled)
272 : UIAction(pParent, UIActionType_Menu)
273 , m_pMenu(0)
274{
275 if (!strIcon.isNull())
276 setIcon(UIIconPool::iconSet(strIcon, strIconDisabled));
277 prepare();
278}
279
280UIActionMenu::UIActionMenu(UIActionPool *pParent,
281 const QString &strIconNormal, const QString &strIconSmall,
282 const QString &strIconNormalDisabled, const QString &strIconSmallDisabled)
283 : UIAction(pParent, UIActionType_Menu)
284 , m_pMenu(0)
285{
286 if (!strIconNormal.isNull())
287 setIcon(UIIconPool::iconSetFull(strIconNormal, strIconSmall, strIconNormalDisabled, strIconSmallDisabled));
288 prepare();
289}
290
291UIActionMenu::UIActionMenu(UIActionPool *pParent,
292 const QIcon &icon)
293 : UIAction(pParent, UIActionType_Menu)
294 , m_pMenu(0)
295{
296 if (!icon.isNull())
297 setIcon(icon);
298 prepare();
299}
300
301UIActionMenu::~UIActionMenu()
302{
303#if !defined(VBOX_IS_QT6_OR_LATER) || !defined(RT_OS_DARWIN) /** @todo qt6: Tcrashes in QCocoaMenuBar::menuForTag during GUI
304 * termination, so disabled it for now and hope it isn't needed. */
305 /* Hide menu: */
306 hideMenu();
307#endif
308 /* Delete menu: */
309 delete m_pMenu;
310 m_pMenu = 0;
311}
312
313void UIActionMenu::setShowToolTip(bool fShowToolTip)
314{
315 AssertPtrReturnVoid(m_pMenu);
316 m_pMenu->setShowToolTip(fShowToolTip);
317}
318
319void UIActionMenu::showMenu()
320{
321 /* Show menu if necessary: */
322 if (!menu())
323 setMenu(m_pMenu);
324}
325
326void UIActionMenu::hideMenu()
327{
328 /* Hide menu if necessary: */
329 if (menu())
330 setMenu((QMenu *)0);
331}
332
333void UIActionMenu::prepare()
334{
335 /* Create menu: */
336 m_pMenu = new UIMenu;
337 AssertPtrReturnVoid(m_pMenu);
338 {
339 /* Prepare menu: */
340 connect(m_pMenu, &UIMenu::aboutToShow,
341 actionPool(), &UIActionPool::sltHandleMenuPrepare);
342 /* Show menu: */
343 showMenu();
344 }
345}
346
347
348/*********************************************************************************************************************************
349* Class UIActionSimple implementation. *
350*********************************************************************************************************************************/
351
352UIActionSimple::UIActionSimple(UIActionPool *pParent,
353 bool fMachineMenuAction /* = false */)
354 : UIAction(pParent, UIActionType_Simple, fMachineMenuAction)
355{
356}
357
358UIActionSimple::UIActionSimple(UIActionPool *pParent,
359 const QString &strIcon, const QString &strIconDisabled,
360 bool fMachineMenuAction /* = false */)
361 : UIAction(pParent, UIActionType_Simple, fMachineMenuAction)
362{
363 if (!strIcon.isNull())
364 setIcon(UIIconPool::iconSet(strIcon, strIconDisabled));
365}
366
367UIActionSimple::UIActionSimple(UIActionPool *pParent,
368 const QString &strIconNormal, const QString &strIconSmall,
369 const QString &strIconNormalDisabled, const QString &strIconSmallDisabled,
370 bool fMachineMenuAction /* = false */)
371 : UIAction(pParent, UIActionType_Simple, fMachineMenuAction)
372{
373 if (!strIconNormal.isNull())
374 setIcon(UIIconPool::iconSetFull(strIconNormal, strIconSmall, strIconNormalDisabled, strIconSmallDisabled));
375}
376
377UIActionSimple::UIActionSimple(UIActionPool *pParent,
378 const QIcon &icon,
379 bool fMachineMenuAction /* = false */)
380 : UIAction(pParent, UIActionType_Simple, fMachineMenuAction)
381{
382 if (!icon.isNull())
383 setIcon(icon);
384}
385
386
387/*********************************************************************************************************************************
388* Class UIActionToggle implementation. *
389*********************************************************************************************************************************/
390
391UIActionToggle::UIActionToggle(UIActionPool *pParent,
392 bool fMachineMenuAction /* = false */)
393 : UIAction(pParent, UIActionType_Toggle, fMachineMenuAction)
394{
395 prepare();
396}
397
398UIActionToggle::UIActionToggle(UIActionPool *pParent,
399 const QString &strIcon, const QString &strIconDisabled,
400 bool fMachineMenuAction /* = false */)
401 : UIAction(pParent, UIActionType_Toggle, fMachineMenuAction)
402{
403 if (!strIcon.isNull())
404 setIcon(UIIconPool::iconSet(strIcon, strIconDisabled));
405 prepare();
406}
407
408UIActionToggle::UIActionToggle(UIActionPool *pParent,
409 const QString &strIconOn, const QString &strIconOff,
410 const QString &strIconOnDisabled, const QString &strIconOffDisabled,
411 bool fMachineMenuAction /* = false */)
412 : UIAction(pParent, UIActionType_Toggle, fMachineMenuAction)
413{
414 if (!strIconOn.isNull())
415 setIcon(UIIconPool::iconSetOnOff(strIconOn, strIconOff, strIconOnDisabled, strIconOffDisabled));
416 prepare();
417}
418
419UIActionToggle::UIActionToggle(UIActionPool *pParent,
420 const QIcon &icon,
421 bool fMachineMenuAction /* = false */)
422 : UIAction(pParent, UIActionType_Toggle, fMachineMenuAction)
423{
424 if (!icon.isNull())
425 setIcon(icon);
426 prepare();
427}
428
429void UIActionToggle::prepare()
430{
431 setCheckable(true);
432}
433
434
435/** Menu action extension, used as 'Application' menu class. */
436class UIActionMenuApplication : public UIActionMenu
437{
438 Q_OBJECT;
439
440public:
441
442 /** Constructs action passing @a pParent to the base-class. */
443 UIActionMenuApplication(UIActionPool *pParent)
444 : UIActionMenu(pParent)
445 {
446#ifdef VBOX_WS_MAC
447 menu()->setConsumable(true);
448#endif
449 retranslateUi();
450 }
451
452protected:
453
454 /** Returns action extra-data ID. */
455 virtual int extraDataID() const RT_OVERRIDE
456 {
457 return UIExtraDataMetaDefs::MenuType_Application;
458 }
459 /** Returns action extra-data key. */
460 virtual QString extraDataKey() const RT_OVERRIDE
461 {
462 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Application);
463 }
464 /** Returns whether action is allowed. */
465 virtual bool isAllowed() const RT_OVERRIDE
466 {
467 return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Application);
468 }
469
470 /** Handles translation event. */
471 virtual void retranslateUi() RT_OVERRIDE
472 {
473#ifdef VBOX_WS_MAC
474 setName(QApplication::translate("UIActionPool", "&VirtualBox"));
475#else
476 setName(QApplication::translate("UIActionPool", "&File"));
477#endif
478 }
479};
480
481/** Simple action extension, used as 'Close' action class. */
482class UIActionSimplePerformClose : public UIActionSimple
483{
484 Q_OBJECT;
485
486public:
487
488 /** Constructs action passing @a pParent to the base-class. */
489 UIActionSimplePerformClose(UIActionPool *pParent)
490 : UIActionSimple(pParent, ":/exit_16px.png", ":/exit_16px.png", true)
491 {
492 setMenuRole(QAction::QuitRole);
493 }
494
495protected:
496
497 /** Returns action extra-data ID. */
498 virtual int extraDataID() const RT_OVERRIDE
499 {
500 return UIExtraDataMetaDefs::MenuApplicationActionType_Close;
501 }
502 /** Returns action extra-data key. */
503 virtual QString extraDataKey() const RT_OVERRIDE
504 {
505 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuApplicationActionType_Close);
506 }
507 /** Returns whether action is allowed. */
508 virtual bool isAllowed() const RT_OVERRIDE
509 {
510 return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_Close);
511 }
512
513 /** Returns shortcut extra-data ID. */
514 virtual QString shortcutExtraDataID() const RT_OVERRIDE
515 {
516 return QString("Close");
517 }
518
519 /** Returns default shortcut. */
520 virtual QKeySequence defaultShortcut(UIType enmActionPoolType) const RT_OVERRIDE
521 {
522 switch (enmActionPoolType)
523 {
524 case UIType_ManagerUI: break;
525 case UIType_RuntimeUI: return QKeySequence("Q");
526 }
527 return QKeySequence();
528 }
529
530 /** Handles translation event. */
531 virtual void retranslateUi() RT_OVERRIDE
532 {
533 setName(QApplication::translate("UIActionPool", "&Close..."));
534 setStatusTip(QApplication::translate("UIActionPool", "Close the virtual machine"));
535 }
536};
537
538#ifdef VBOX_WS_MAC
539/** Menu action extension, used as 'Window' menu class. */
540class UIActionMenuWindow : public UIActionMenu
541{
542 Q_OBJECT;
543
544public:
545
546 /** Constructs action passing @a pParent to the base-class. */
547 UIActionMenuWindow(UIActionPool *pParent)
548 : UIActionMenu(pParent)
549 {}
550
551protected:
552
553 /** Returns action extra-data ID. */
554 virtual int extraDataID() const RT_OVERRIDE
555 {
556 return UIExtraDataMetaDefs::MenuType_Window;
557 }
558 /** Returns action extra-data key. */
559 virtual QString extraDataKey() const RT_OVERRIDE
560 {
561 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Window);
562 }
563 /** Returns whether action is allowed. */
564 virtual bool isAllowed() const RT_OVERRIDE
565 {
566 return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Window);
567 }
568
569 /** Handles translation event. */
570 virtual void retranslateUi() RT_OVERRIDE
571 {
572 setName(QApplication::translate("UIActionPool", "&Window"));
573 }
574};
575
576/** Simple action extension, used as 'Minimize' action class. */
577class UIActionSimpleMinimize : public UIActionSimple
578{
579 Q_OBJECT;
580
581public:
582
583 /** Constructs action passing @a pParent to the base-class. */
584 UIActionSimpleMinimize(UIActionPool *pParent)
585 : UIActionSimple(pParent)
586 {}
587
588protected:
589
590 /** Returns action extra-data ID. */
591 virtual int extraDataID() const RT_OVERRIDE
592 {
593 return UIExtraDataMetaDefs::MenuWindowActionType_Minimize;
594 }
595 /** Returns action extra-data key. */
596 virtual QString extraDataKey() const RT_OVERRIDE
597 {
598 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuWindowActionType_Minimize);
599 }
600 /** Returns whether action is allowed. */
601 virtual bool isAllowed() const RT_OVERRIDE
602 {
603 return actionPool()->isAllowedInMenuWindow(UIExtraDataMetaDefs::MenuWindowActionType_Minimize);
604 }
605
606 /** Returns shortcut extra-data ID. */
607 virtual QString shortcutExtraDataID() const RT_OVERRIDE
608 {
609 return QString("Minimize");
610 }
611
612 /** Handles translation event. */
613 virtual void retranslateUi() RT_OVERRIDE
614 {
615 setName(QApplication::translate("UIActionPool", "&Minimize"));
616 setStatusTip(QApplication::translate("UIActionPool", "Minimize active window"));
617 }
618};
619#endif /* VBOX_WS_MAC */
620
621/** Menu action extension, used as 'Help' menu class. */
622class UIActionMenuHelp : public UIActionMenu
623{
624 Q_OBJECT;
625
626public:
627
628 /** Constructs action passing @a pParent to the base-class. */
629 UIActionMenuHelp(UIActionPool *pParent)
630 : UIActionMenu(pParent)
631 {
632 retranslateUi();
633 }
634
635protected:
636
637 /** Returns action extra-data ID. */
638 virtual int extraDataID() const RT_OVERRIDE
639 {
640 return UIExtraDataMetaDefs::MenuType_Help;
641 }
642 /** Returns action extra-data key. */
643 virtual QString extraDataKey() const RT_OVERRIDE
644 {
645 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Help);
646 }
647 /** Returns whether action is allowed. */
648 virtual bool isAllowed() const RT_OVERRIDE
649 {
650 return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Help);
651 }
652
653 /** Handles translation event. */
654 virtual void retranslateUi() RT_OVERRIDE
655 {
656 setName(QApplication::translate("UIActionPool", "&Help"));
657 }
658};
659
660/** Simple action extension, used as 'Contents' action class. */
661class UIActionSimpleContents : public UIActionSimple
662{
663 Q_OBJECT;
664
665public:
666
667 /** Constructs action passing @a pParent to the base-class. */
668 UIActionSimpleContents(UIActionPool *pParent)
669 : UIActionSimple(pParent, UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_DialogHelp), true)
670 {
671 retranslateUi();
672 }
673
674protected:
675
676 /** Returns action extra-data ID. */
677 virtual int extraDataID() const RT_OVERRIDE
678 {
679 return UIExtraDataMetaDefs::MenuHelpActionType_Contents;
680 }
681 /** Returns action extra-data key. */
682 virtual QString extraDataKey() const RT_OVERRIDE
683 {
684 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_Contents);
685 }
686 /** Returns whether action is allowed. */
687 virtual bool isAllowed() const RT_OVERRIDE
688 {
689 return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_Contents);
690 }
691
692 /** Returns shortcut extra-data ID. */
693 virtual QString shortcutExtraDataID() const RT_OVERRIDE
694 {
695 return QString("Help");
696 }
697
698 /** Returns standard shortcut. */
699 virtual QKeySequence standardShortcut(UIType enmActionPoolType) const RT_OVERRIDE
700 {
701 switch (enmActionPoolType)
702 {
703 case UIType_ManagerUI: return UIShortcutPool::standardSequence(QKeySequence::HelpContents);
704 case UIType_RuntimeUI: break;
705 }
706 return QKeySequence();
707 }
708
709 /** Handles translation event. */
710 virtual void retranslateUi() RT_OVERRIDE
711 {
712 setName(QApplication::translate("UIActionPool", "&Contents..."));
713 setStatusTip(QApplication::translate("UIActionPool", "Show help contents"));
714 }
715};
716
717/** Simple action extension, used as 'Online Documentation' action class. */
718class UIActionSimpleOnlineDocumentation : public UIActionSimple
719{
720 Q_OBJECT;
721
722public:
723
724 /** Constructs action passing @a pParent to the base-class. */
725 UIActionSimpleOnlineDocumentation(UIActionPool *pParent)
726 : UIActionSimple(pParent, ":/site_oracle_16px.png", ":/site_oracle_16px.png", true)
727 {
728 retranslateUi();
729 }
730
731protected:
732
733 /** Returns action extra-data ID. */
734 virtual int extraDataID() const RT_OVERRIDE
735 {
736 return UIExtraDataMetaDefs::MenuHelpActionType_OnlineDocumentation;
737 }
738 /** Returns action extra-data key. */
739 virtual QString extraDataKey() const RT_OVERRIDE
740 {
741 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_OnlineDocumentation);
742 }
743 /** Returns whether action is allowed. */
744 virtual bool isAllowed() const RT_OVERRIDE
745 {
746 return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_OnlineDocumentation);
747 }
748
749 /** Returns shortcut extra-data ID. */
750 virtual QString shortcutExtraDataID() const RT_OVERRIDE
751 {
752 return QString("OnlineDocumentation");
753 }
754
755 /** Handles translation event. */
756 virtual void retranslateUi() RT_OVERRIDE
757 {
758 setName(QApplication::translate("UIActionPool", "&Online Documentation..."));
759 setStatusTip(QApplication::translate("UIActionPool", "Open the browser and go to the VirtualBox user manual"));
760 }
761};
762
763/** Simple action extension, used as 'Web Site' action class. */
764class UIActionSimpleWebSite : public UIActionSimple
765{
766 Q_OBJECT;
767
768public:
769
770 /** Constructs action passing @a pParent to the base-class. */
771 UIActionSimpleWebSite(UIActionPool *pParent)
772 : UIActionSimple(pParent, ":/site_16px.png", ":/site_16px.png", true)
773 {
774 retranslateUi();
775 }
776
777protected:
778
779 /** Returns action extra-data ID. */
780 virtual int extraDataID() const RT_OVERRIDE
781 {
782 return UIExtraDataMetaDefs::MenuHelpActionType_WebSite;
783 }
784 /** Returns action extra-data key. */
785 virtual QString extraDataKey() const RT_OVERRIDE
786 {
787 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_WebSite);
788 }
789 /** Returns whether action is allowed. */
790 virtual bool isAllowed() const RT_OVERRIDE
791 {
792 return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_WebSite);
793 }
794
795 /** Returns shortcut extra-data ID. */
796 virtual QString shortcutExtraDataID() const RT_OVERRIDE
797 {
798 return QString("Web");
799 }
800
801 /** Handles translation event. */
802 virtual void retranslateUi() RT_OVERRIDE
803 {
804 setName(QApplication::translate("UIActionPool", "&VirtualBox Web Site..."));
805 setStatusTip(QApplication::translate("UIActionPool", "Open the browser and go to the VirtualBox product web site"));
806 }
807};
808
809/** Simple action extension, used as 'Bug Tracker' action class. */
810class UIActionSimpleBugTracker : public UIActionSimple
811{
812 Q_OBJECT;
813
814public:
815
816 /** Constructs action passing @a pParent to the base-class. */
817 UIActionSimpleBugTracker(UIActionPool *pParent)
818 : UIActionSimple(pParent, ":/site_bugtracker_16px.png", ":/site_bugtracker_16px.png", true)
819 {
820 retranslateUi();
821 }
822
823protected:
824
825 /** Returns action extra-data ID. */
826 virtual int extraDataID() const RT_OVERRIDE
827 {
828 return UIExtraDataMetaDefs::MenuHelpActionType_BugTracker;
829 }
830 /** Returns action extra-data key. */
831 virtual QString extraDataKey() const RT_OVERRIDE
832 {
833 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_BugTracker);
834 }
835 /** Returns whether action is allowed. */
836 virtual bool isAllowed() const RT_OVERRIDE
837 {
838 return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_BugTracker);
839 }
840
841 /** Returns shortcut extra-data ID. */
842 virtual QString shortcutExtraDataID() const RT_OVERRIDE
843 {
844 return QString("BugTracker");
845 }
846
847 /** Handles translation event. */
848 virtual void retranslateUi() RT_OVERRIDE
849 {
850 setName(QApplication::translate("UIActionPool", "&VirtualBox Bug Tracker..."));
851 setStatusTip(QApplication::translate("UIActionPool", "Open the browser and go to the VirtualBox product bug tracker"));
852 }
853};
854
855/** Simple action extension, used as 'Forums' action class. */
856class UIActionSimpleForums : public UIActionSimple
857{
858 Q_OBJECT;
859
860public:
861
862 /** Constructs action passing @a pParent to the base-class. */
863 UIActionSimpleForums(UIActionPool *pParent)
864 : UIActionSimple(pParent, ":/site_forum_16px.png", ":/site_forum_16px.png", true)
865 {
866 retranslateUi();
867 }
868
869protected:
870
871 /** Returns action extra-data ID. */
872 virtual int extraDataID() const RT_OVERRIDE
873 {
874 return UIExtraDataMetaDefs::MenuHelpActionType_Forums;
875 }
876 /** Returns action extra-data key. */
877 virtual QString extraDataKey() const RT_OVERRIDE
878 {
879 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_Forums);
880 }
881 /** Returns whether action is allowed. */
882 virtual bool isAllowed() const RT_OVERRIDE
883 {
884 return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_Forums);
885 }
886
887 /** Returns shortcut extra-data ID. */
888 virtual QString shortcutExtraDataID() const RT_OVERRIDE
889 {
890 return QString("Forums");
891 }
892
893 /** Handles translation event. */
894 virtual void retranslateUi() RT_OVERRIDE
895 {
896 setName(QApplication::translate("UIActionPool", "&VirtualBox Forums..."));
897 setStatusTip(QApplication::translate("UIActionPool", "Open the browser and go to the VirtualBox product forums"));
898 }
899};
900
901/** Simple action extension, used as 'Oracle' action class. */
902class UIActionSimpleOracle : public UIActionSimple
903{
904 Q_OBJECT;
905
906public:
907
908 /** Constructs action passing @a pParent to the base-class. */
909 UIActionSimpleOracle(UIActionPool *pParent)
910 : UIActionSimple(pParent, ":/site_oracle_16px.png", ":/site_oracle_16px.png", true)
911 {
912 retranslateUi();
913 }
914
915protected:
916
917 /** Returns action extra-data ID. */
918 virtual int extraDataID() const RT_OVERRIDE
919 {
920 return UIExtraDataMetaDefs::MenuHelpActionType_Oracle;
921 }
922 /** Returns action extra-data key. */
923 virtual QString extraDataKey() const RT_OVERRIDE
924 {
925 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_Oracle);
926 }
927 /** Returns whether action is allowed. */
928 virtual bool isAllowed() const RT_OVERRIDE
929 {
930 return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_Oracle);
931 }
932
933 /** Returns shortcut extra-data ID. */
934 virtual QString shortcutExtraDataID() const RT_OVERRIDE
935 {
936 return QString("Oracle");
937 }
938
939 /** Handles translation event. */
940 virtual void retranslateUi() RT_OVERRIDE
941 {
942 setName(QApplication::translate("UIActionPool", "&Oracle Web Site..."));
943 setStatusTip(QApplication::translate("UIActionPool", "Open the browser and go to the Oracle web site"));
944 }
945};
946
947/** Simple action extension, used as 'Reset Warnings' action class. */
948class UIActionSimpleResetWarnings : public UIActionSimple
949{
950 Q_OBJECT;
951
952public:
953
954 /** Constructs action passing @a pParent to the base-class. */
955 UIActionSimpleResetWarnings(UIActionPool *pParent)
956 : UIActionSimple(pParent, ":/reset_warnings_16px.png", ":/reset_warnings_16px.png", true)
957 {
958 setMenuRole(QAction::ApplicationSpecificRole);
959 retranslateUi();
960 }
961
962protected:
963
964 /** Returns action extra-data ID. */
965 virtual int extraDataID() const RT_OVERRIDE
966 {
967 return UIExtraDataMetaDefs::MenuApplicationActionType_ResetWarnings;
968 }
969 /** Returns action extra-data key. */
970 virtual QString extraDataKey() const RT_OVERRIDE
971 {
972 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuApplicationActionType_ResetWarnings);
973 }
974 /** Returns whether action is allowed. */
975 virtual bool isAllowed() const RT_OVERRIDE
976 {
977 return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_ResetWarnings);
978 }
979
980 /** Returns shortcut extra-data ID. */
981 virtual QString shortcutExtraDataID() const RT_OVERRIDE
982 {
983 return QString("ResetWarnings");
984 }
985
986 /** Handles translation event. */
987 virtual void retranslateUi() RT_OVERRIDE
988 {
989 setName(QApplication::translate("UIActionPool", "&Reset All Warnings"));
990 setStatusTip(QApplication::translate("UIActionPool", "Go back to showing all suppressed warnings and messages"));
991 }
992};
993
994#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
995/** Simple action extension, used as 'Check for Updates' action class. */
996class UIActionSimpleCheckForUpdates : public UIActionSimple
997{
998 Q_OBJECT;
999
1000public:
1001
1002 /** Constructs action passing @a pParent to the base-class. */
1003 UIActionSimpleCheckForUpdates(UIActionPool *pParent)
1004 : UIActionSimple(pParent, ":/refresh_16px.png", ":/refresh_disabled_16px.png", true)
1005 {
1006 setMenuRole(QAction::ApplicationSpecificRole);
1007 retranslateUi();
1008 }
1009
1010protected:
1011
1012 /** Returns action extra-data ID. */
1013 virtual int extraDataID() const RT_OVERRIDE
1014 {
1015 return UIExtraDataMetaDefs::MenuApplicationActionType_CheckForUpdates;
1016 }
1017 /** Returns action extra-data key. */
1018 virtual QString extraDataKey() const RT_OVERRIDE
1019 {
1020 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuApplicationActionType_CheckForUpdates);
1021 }
1022 /** Returns whether action is allowed. */
1023 virtual bool isAllowed() const RT_OVERRIDE
1024 {
1025 return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_CheckForUpdates);
1026 }
1027
1028 /** Returns shortcut extra-data ID. */
1029 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1030 {
1031 return QString("Update");
1032 }
1033
1034 /** Handles translation event. */
1035 virtual void retranslateUi() RT_OVERRIDE
1036 {
1037 setName(QApplication::translate("UIActionPool", "C&heck for Updates..."));
1038 setStatusTip(QApplication::translate("UIActionPool", "Check for a new VirtualBox version"));
1039 }
1040};
1041#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
1042
1043/** Simple action extension, used as 'About' action class. */
1044class UIActionSimpleAbout : public UIActionSimple
1045{
1046 Q_OBJECT;
1047
1048public:
1049
1050 /** Constructs action passing @a pParent to the base-class. */
1051 UIActionSimpleAbout(UIActionPool *pParent)
1052 : UIActionSimple(pParent, ":/about_16px.png", ":/about_16px.png", true)
1053 {
1054 setMenuRole(QAction::AboutRole);
1055 retranslateUi();
1056 }
1057
1058protected:
1059
1060 /** Returns action extra-data ID. */
1061 virtual int extraDataID() const RT_OVERRIDE
1062 {
1063#ifdef VBOX_WS_MAC
1064 return UIExtraDataMetaDefs::MenuApplicationActionType_About;
1065#else
1066 return UIExtraDataMetaDefs::MenuHelpActionType_About;
1067#endif
1068 }
1069 /** Returns action extra-data key. */
1070 virtual QString extraDataKey() const RT_OVERRIDE
1071 {
1072#ifdef VBOX_WS_MAC
1073 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuApplicationActionType_About);
1074#else
1075 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_About);
1076#endif
1077 }
1078 /** Returns whether action is allowed. */
1079 virtual bool isAllowed() const RT_OVERRIDE
1080 {
1081#ifdef VBOX_WS_MAC
1082 return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_About);
1083#else
1084 return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_About);
1085#endif
1086 }
1087
1088 /** Returns shortcut extra-data ID. */
1089 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1090 {
1091 return QString("About");
1092 }
1093
1094 /** Handles translation event. */
1095 virtual void retranslateUi() RT_OVERRIDE
1096 {
1097 setName(QApplication::translate("UIActionPool", "&About VirtualBox..."));
1098 setStatusTip(QApplication::translate("UIActionPool", "Display a window with product information"));
1099 }
1100};
1101
1102/** Simple action extension, used as 'Preferences' action class. */
1103class UIActionSimplePreferences : public UIActionSimple
1104{
1105 Q_OBJECT;
1106
1107public:
1108
1109 /** Constructs action passing @a pParent to the base-class. */
1110 UIActionSimplePreferences(UIActionPool *pParent)
1111 : UIActionSimple(pParent,
1112 ":/global_settings_32px.png", ":/global_settings_16px.png",
1113 ":/global_settings_disabled_32px.png", ":/global_settings_disabled_16px.png",
1114 true)
1115 {
1116 setMenuRole(QAction::PreferencesRole);
1117 retranslateUi();
1118 }
1119
1120protected:
1121
1122 /** Returns action extra-data ID. */
1123 virtual int extraDataID() const RT_OVERRIDE
1124 {
1125 return UIExtraDataMetaDefs::MenuApplicationActionType_Preferences;
1126 }
1127 /** Returns action extra-data key. */
1128 virtual QString extraDataKey() const RT_OVERRIDE
1129 {
1130 return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuApplicationActionType_Preferences);
1131 }
1132 /** Returns whether action is allowed. */
1133 virtual bool isAllowed() const RT_OVERRIDE
1134 {
1135 return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_Preferences);
1136 }
1137
1138 /** Returns shortcut extra-data ID. */
1139 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1140 {
1141 return QString("Preferences");
1142 }
1143
1144 /** Returns default shortcut. */
1145 virtual QKeySequence defaultShortcut(UIType enmActionPoolType) const RT_OVERRIDE
1146 {
1147 switch (enmActionPoolType)
1148 {
1149 case UIType_ManagerUI: return QKeySequence("Ctrl+G");
1150 case UIType_RuntimeUI: break;
1151 }
1152 return QKeySequence();
1153 }
1154
1155 /** Handles translation event. */
1156 virtual void retranslateUi() RT_OVERRIDE
1157 {
1158 setName(QApplication::translate("UIActionPool", "&Preferences...", "global preferences window"));
1159 setStatusTip(QApplication::translate("UIActionPool", "Display the global preferences window"));
1160 setToolTip( QApplication::translate("UIActionPool", "Display Global Preferences")
1161 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1162 }
1163};
1164
1165/** Menu action extension, used as 'Log' menu class. */
1166class UIActionMenuSelectorLog : public UIActionMenu
1167{
1168 Q_OBJECT;
1169
1170public:
1171
1172 /** Constructs action passing @a pParent to the base-class. */
1173 UIActionMenuSelectorLog(UIActionPool *pParent)
1174 : UIActionMenu(pParent)
1175 {}
1176
1177protected:
1178
1179 /** Returns shortcut extra-data ID. */
1180 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1181 {
1182 return QString("LogViewerMenu");
1183 }
1184
1185 /** Handles translation event. */
1186 virtual void retranslateUi() RT_OVERRIDE
1187 {
1188 setName(QApplication::translate("UIActionPool", "&Log"));
1189 }
1190};
1191
1192/** Simple action extension, used as 'Toggle Pane Find' action class. */
1193class UIActionMenuSelectorLogTogglePaneFind : public UIActionToggle
1194{
1195 Q_OBJECT;
1196
1197public:
1198
1199 /** Constructs action passing @a pParent to the base-class. */
1200 UIActionMenuSelectorLogTogglePaneFind(UIActionPool *pParent)
1201 : UIActionToggle(pParent)
1202 {
1203 setShortcutContext(Qt::WidgetWithChildrenShortcut);
1204 setIcon(UIIconPool::iconSetFull(":/log_viewer_find_32px.png", ":/log_viewer_find_16px.png",
1205 ":/log_viewer_find_disabled_32px.png", ":/log_viewer_find_disabled_16px.png"));
1206 }
1207
1208protected:
1209
1210 /** Returns shortcut extra-data ID. */
1211 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1212 {
1213 return QString("ToggleLogFind");
1214 }
1215
1216 /** Returns default shortcut. */
1217 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1218 {
1219 return QKeySequence("Ctrl+Shift+F");
1220 }
1221
1222 /** Handles translation event. */
1223 virtual void retranslateUi() RT_OVERRIDE
1224 {
1225 setName(QApplication::translate("UIActionPool", "&Find"));
1226 setShortcutScope(QApplication::translate("UIActionPool", "Log Viewer"));
1227 setStatusTip(QApplication::translate("UIActionPool", "Open pane with searching options"));
1228 setToolTip( QApplication::translate("UIActionPool", "Open Find Pane")
1229 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1230 }
1231};
1232
1233/** Simple action extension, used as 'Toggle Pane Filter' action class. */
1234class UIActionMenuSelectorLogTogglePaneFilter : public UIActionToggle
1235{
1236 Q_OBJECT;
1237
1238public:
1239
1240 /** Constructs action passing @a pParent to the base-class. */
1241 UIActionMenuSelectorLogTogglePaneFilter(UIActionPool *pParent)
1242 : UIActionToggle(pParent)
1243 {
1244 setShortcutContext(Qt::WidgetWithChildrenShortcut);
1245 setIcon(UIIconPool::iconSetFull(":/log_viewer_filter_32px.png", ":/log_viewer_filter_16px.png",
1246 ":/log_viewer_filter_disabled_32px.png", ":/log_viewer_filter_disabled_16px.png"));
1247 }
1248
1249protected:
1250
1251 /** Returns shortcut extra-data ID. */
1252 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1253 {
1254 return QString("ToggleLogFilter");
1255 }
1256
1257 /** Returns default shortcut. */
1258 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1259 {
1260 return QKeySequence("Ctrl+Shift+T");
1261 }
1262
1263 /** Handles translation event. */
1264 virtual void retranslateUi() RT_OVERRIDE
1265 {
1266 setName(QApplication::translate("UIActionPool", "&Filter"));
1267 setShortcutScope(QApplication::translate("UIActionPool", "Log Viewer"));
1268 setStatusTip(QApplication::translate("UIActionPool", "Open pane with filtering options"));
1269 setToolTip( QApplication::translate("UIActionPool", "Open Filter Pane")
1270 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1271 }
1272};
1273
1274/** Simple action extension, used as 'Toggle Pane Bookmark' action class. */
1275class UIActionMenuSelectorLogTogglePaneBookmark : public UIActionToggle
1276{
1277 Q_OBJECT;
1278
1279public:
1280
1281 /** Constructs action passing @a pParent to the base-class. */
1282 UIActionMenuSelectorLogTogglePaneBookmark(UIActionPool *pParent)
1283 : UIActionToggle(pParent)
1284 {
1285 setShortcutContext(Qt::WidgetWithChildrenShortcut);
1286 setIcon(UIIconPool::iconSetFull(":/log_viewer_bookmark_32px.png", ":/log_viewer_bookmark_16px.png",
1287 ":/log_viewer_bookmark_disabled_32px.png", ":/log_viewer_bookmark_disabled_16px.png"));
1288 }
1289
1290protected:
1291
1292 /** Returns shortcut extra-data ID. */
1293 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1294 {
1295 return QString("ToggleLogBookmark");
1296 }
1297
1298 /** Returns default shortcut. */
1299 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1300 {
1301 return QKeySequence("Ctrl+Shift+D");
1302 }
1303
1304 /** Handles translation event. */
1305 virtual void retranslateUi() RT_OVERRIDE
1306 {
1307 setName(QApplication::translate("UIActionPool", "&Bookmark"));
1308 setShortcutScope(QApplication::translate("UIActionPool", "Log Viewer"));
1309 setStatusTip(QApplication::translate("UIActionPool", "Open pane with bookmarking options"));
1310 setToolTip( QApplication::translate("UIActionPool", "Open Bookmark Pane")
1311 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1312 }
1313};
1314
1315/** Simple action extension, used as 'Toggle Pane Preferences' action class. */
1316class UIActionMenuSelectorLogTogglePanePreferences : public UIActionToggle
1317{
1318 Q_OBJECT;
1319
1320public:
1321
1322 /** Constructs action passing @a pParent to the base-class. */
1323 UIActionMenuSelectorLogTogglePanePreferences(UIActionPool *pParent)
1324 : UIActionToggle(pParent)
1325 {
1326 setShortcutContext(Qt::WidgetWithChildrenShortcut);
1327 setIcon(UIIconPool::iconSetFull(":/log_viewer_options_32px.png", ":/log_viewer_options_16px.png",
1328 ":/log_viewer_options_disabled_32px.png", ":/log_viewer_options_disabled_16px.png"));
1329 }
1330
1331protected:
1332
1333 /** Returns shortcut extra-data ID. */
1334 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1335 {
1336 return QString("ToggleLogPreferences");
1337 }
1338
1339 /** Returns default shortcut. */
1340 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1341 {
1342 return QKeySequence("Ctrl+Shift+P");
1343 }
1344
1345 /** Handles translation event. */
1346 virtual void retranslateUi() RT_OVERRIDE
1347 {
1348 setName(QApplication::translate("UIActionPool", "&Preferences"));
1349 setShortcutScope(QApplication::translate("UIActionPool", "Log Viewer"));
1350 setStatusTip(QApplication::translate("UIActionPool", "Open pane with log viewer preferences"));
1351 setToolTip( QApplication::translate("UIActionPool", "Open Preferences Pane")
1352 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1353 }
1354};
1355
1356/** Simple action extension, used as 'Perform Refresh' action class. */
1357class UIActionMenuSelectorLogPerformRefresh : public UIActionSimple
1358{
1359 Q_OBJECT;
1360
1361public:
1362
1363 /** Constructs action passing @a pParent to the base-class. */
1364 UIActionMenuSelectorLogPerformRefresh(UIActionPool *pParent)
1365 : UIActionSimple(pParent,
1366 ":/log_viewer_refresh_32px.png", ":/log_viewer_refresh_16px.png",
1367 ":/log_viewer_refresh_disabled_32px.png", ":/log_viewer_refresh_disabled_16px.png")
1368 {
1369 setShortcutContext(Qt::WidgetWithChildrenShortcut);
1370 }
1371
1372protected:
1373
1374 /** Returns shortcut extra-data ID. */
1375 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1376 {
1377 return QString("RefreshLog");
1378 }
1379
1380 /** Returns default shortcut. */
1381 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1382 {
1383 return QKeySequence("Ctrl+Shift+R");
1384 }
1385
1386 /** Returns standard shortcut. */
1387 virtual QKeySequence standardShortcut(UIType) const RT_OVERRIDE
1388 {
1389 return actionPool()->isTemporary() ? QKeySequence() : QKeySequence(QKeySequence::Refresh);
1390 }
1391
1392 /** Handles translation event. */
1393 virtual void retranslateUi() RT_OVERRIDE
1394 {
1395 setName(QApplication::translate("UIActionPool", "&Refresh"));
1396 setShortcutScope(QApplication::translate("UIActionPool", "Log Viewer"));
1397 setStatusTip(QApplication::translate("UIActionPool", "Refresh the currently viewed log"));
1398 setToolTip( QApplication::translate("UIActionPool", "Refresh Viewed Log")
1399 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1400 }
1401};
1402
1403/** Simple action extension, used as 'Perform Reload' action class. */
1404class UIActionMenuSelectorLogPerformReload : public UIActionSimple
1405{
1406 Q_OBJECT;
1407
1408public:
1409
1410 /** Constructs action passing @a pParent to the base-class. */
1411 UIActionMenuSelectorLogPerformReload(UIActionPool *pParent)
1412 : UIActionSimple(pParent,
1413 ":/log_viewer_refresh_32px.png", ":/log_viewer_refresh_16px.png",
1414 ":/log_viewer_refresh_disabled_32px.png", ":/log_viewer_refresh_disabled_16px.png")
1415 {
1416 setShortcutContext(Qt::WidgetWithChildrenShortcut);
1417 }
1418
1419protected:
1420
1421 /** Returns shortcut extra-data ID. */
1422 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1423 {
1424 return QString("ReloadAllLogs");
1425 }
1426
1427 /** Returns default shortcut. */
1428 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1429 {
1430 return QKeySequence();
1431 }
1432
1433 /** Returns standard shortcut. */
1434 virtual QKeySequence standardShortcut(UIType) const RT_OVERRIDE
1435 {
1436 return QKeySequence();
1437 }
1438
1439 /** Handles translation event. */
1440 virtual void retranslateUi() RT_OVERRIDE
1441 {
1442 setName(QApplication::translate("UIActionPool", "&Reload"));
1443 setShortcutScope(QApplication::translate("UIActionPool", "Log Viewer"));
1444 setStatusTip(QApplication::translate("UIActionPool", "Reread all the log files and refresh pages"));
1445 setToolTip( QApplication::translate("UIActionPool", "Reload Log Files")
1446 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1447 }
1448};
1449
1450/** Simple action extension, used as 'Perform Save' action class. */
1451class UIActionMenuSelectorLogPerformSave : public UIActionSimple
1452{
1453 Q_OBJECT;
1454
1455public:
1456
1457 /** Constructs action passing @a pParent to the base-class. */
1458 UIActionMenuSelectorLogPerformSave(UIActionPool *pParent)
1459 : UIActionSimple(pParent,
1460 ":/log_viewer_save_32px.png", ":/log_viewer_save_16px.png",
1461 ":/log_viewer_save_disabled_32px.png", ":/log_viewer_save_disabled_16px.png")
1462 {
1463 setShortcutContext(Qt::WidgetWithChildrenShortcut);
1464 }
1465
1466protected:
1467
1468 /** Returns shortcut extra-data ID. */
1469 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1470 {
1471 return QString("SaveLog");
1472 }
1473
1474 /** Returns default shortcut. */
1475 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1476 {
1477 return QKeySequence("Ctrl+Shift+S");
1478 }
1479
1480 /** Handles translation event. */
1481 virtual void retranslateUi() RT_OVERRIDE
1482 {
1483 setName(QApplication::translate("UIActionPool", "&Save..."));
1484 setShortcutScope(QApplication::translate("UIActionPool", "Log Viewer"));
1485 setStatusTip(QApplication::translate("UIActionPool", "Save selected virtual machine log"));
1486 setToolTip( QApplication::translate("UIActionPool", "Save Virtual Machine Log")
1487 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1488 }
1489};
1490
1491/** Menu action extension, used as 'File Manager' menu class. */
1492class UIActionMenuFileManager : public UIActionMenu
1493{
1494 Q_OBJECT;
1495
1496public:
1497
1498 /** Constructs action passing @a pParent to the base-class. */
1499 UIActionMenuFileManager(UIActionPool *pParent)
1500 : UIActionMenu(pParent)
1501 {}
1502
1503protected:
1504
1505 /** Returns shortcut extra-data ID. */
1506 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1507 {
1508 return QString("FileManagerMenu");
1509 }
1510
1511 /** Handles translation event. */
1512 virtual void retranslateUi() RT_OVERRIDE
1513 {
1514 setName(QApplication::translate("UIActionPool", "File Manager"));
1515 }
1516};
1517
1518class UIActionMenuFileManagerHostSubmenu : public UIActionMenu
1519{
1520 Q_OBJECT;
1521
1522public:
1523
1524 /** Constructs action passing @a pParent to the base-class. */
1525 UIActionMenuFileManagerHostSubmenu(UIActionPool *pParent)
1526 : UIActionMenu(pParent)
1527 {}
1528
1529protected:
1530
1531 /** Returns shortcut extra-data ID. */
1532 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1533 {
1534 return QString("FileManagerHostSubmenu");
1535 }
1536
1537 /** Handles translation event. */
1538 virtual void retranslateUi() RT_OVERRIDE
1539 {
1540 setName(QApplication::translate("UIActionPool", "Host"));
1541 }
1542};
1543
1544class UIActionMenuFileManagerGuestSubmenu : public UIActionMenu
1545{
1546 Q_OBJECT;
1547
1548public:
1549
1550 /** Constructs action passing @a pParent to the base-class. */
1551 UIActionMenuFileManagerGuestSubmenu(UIActionPool *pParent)
1552 : UIActionMenu(pParent)
1553 {}
1554
1555protected:
1556
1557 /** Returns shortcut extra-data ID. */
1558 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1559 {
1560 return QString("FileManagerGuestSubmenu");
1561 }
1562
1563 /** Handles translation event. */
1564 virtual void retranslateUi() RT_OVERRIDE
1565 {
1566 setName(QApplication::translate("UIActionPool", "Guest"));
1567 }
1568};
1569
1570/** Simple action extension, used as 'Copy to Guest' in file manager action class. */
1571class UIActionMenuFileManagerCopyToGuest : public UIActionSimple
1572{
1573 Q_OBJECT;
1574
1575public:
1576
1577 /** Constructs action passing @a pParent to the base-class. */
1578 UIActionMenuFileManagerCopyToGuest(UIActionPool *pParent)
1579 : UIActionSimple(pParent,
1580 ":/file_manager_copy_to_guest_24px.png", ":/file_manager_copy_to_guest_16px.png",
1581 ":/file_manager_copy_to_guest_disabled_24px.png", ":/file_manager_copy_to_guest_disabled_16px.png"){}
1582
1583protected:
1584
1585 /** Returns shortcut extra-data ID. */
1586 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1587 {
1588 return QString("FileManagerCopyToGuest");
1589 }
1590
1591 /** Returns default shortcut. */
1592 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1593 {
1594 return QKeySequence();
1595 }
1596
1597 /** Handles translation event. */
1598 virtual void retranslateUi() RT_OVERRIDE
1599 {
1600 setName(QApplication::translate("UIActionPool", "Copy to guest"));
1601 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
1602 setStatusTip(QApplication::translate("UIActionPool", "Copy the selected object(s) from host to guest"));
1603 setToolTip( QApplication::translate("UIActionPool", "Copy from Host to Guest")
1604 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1605 }
1606};
1607
1608/** Simple action extension, used as 'Copy to Host' in file manager action class. */
1609class UIActionMenuFileManagerCopyToHost : public UIActionSimple
1610{
1611 Q_OBJECT;
1612
1613public:
1614
1615 /** Constructs action passing @a pParent to the base-class. */
1616 UIActionMenuFileManagerCopyToHost(UIActionPool *pParent)
1617 : UIActionSimple(pParent,
1618 ":/file_manager_copy_to_host_24px.png", ":/file_manager_copy_to_host_16px.png",
1619 ":/file_manager_copy_to_host_disabled_24px.png", ":/file_manager_copy_to_host_disabled_16px.png"){}
1620
1621protected:
1622
1623 /** Returns shortcut extra-data ID. */
1624 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1625 {
1626 return QString("FileManagerCopyToHost");
1627 }
1628
1629 /** Returns default shortcut. */
1630 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1631 {
1632 return QKeySequence();
1633 }
1634
1635 /** Handles translation event. */
1636 virtual void retranslateUi() RT_OVERRIDE
1637 {
1638 setName(QApplication::translate("UIActionPool", "Copy to host"));
1639 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
1640 setStatusTip(QApplication::translate("UIActionPool", "Copy the selected object(s) from guest to host"));
1641 setToolTip( QApplication::translate("UIActionPool", "Copy from Guest to Host")
1642 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1643 }
1644};
1645
1646/** Toggle action extension, used to toggle 'File Manager Preferences' panel in file manager. */
1647class UIActionMenuFileManagerPreferences : public UIActionToggle
1648{
1649 Q_OBJECT;
1650
1651public:
1652
1653 /** Constructs action passing @a pParent to the base-class. */
1654 UIActionMenuFileManagerPreferences(UIActionPool *pParent)
1655 : UIActionToggle(pParent)
1656 {
1657 setShortcutContext(Qt::WidgetWithChildrenShortcut);
1658 setIcon(UIIconPool::iconSetFull(":/file_manager_options_32px.png", ":/file_manager_options_16px.png",
1659 ":/file_manager_options_disabled_32px.png", ":/file_manager_options_disabled_16px.png"));
1660 }
1661
1662protected:
1663
1664 /** Returns shortcut extra-data ID. */
1665 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1666 {
1667 return QString("ToggleFileManagerOptionsPanel");
1668 }
1669
1670 /** Returns default shortcut. */
1671 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1672 {
1673 return QKeySequence();
1674 }
1675
1676 /** Handles translation event. */
1677 virtual void retranslateUi() RT_OVERRIDE
1678 {
1679 setName(QApplication::translate("UIActionPool", "Preferences"));
1680 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
1681 setStatusTip(QApplication::translate("UIActionPool", "Open panel with file manager preferences"));
1682 setToolTip( QApplication::translate("UIActionPool", "Open Preferences Pane")
1683 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1684 }
1685};
1686
1687/** Toggle action extension, used to toggle 'File Manager Log' panel in file manager. */
1688class UIActionMenuFileManagerLog : public UIActionToggle
1689{
1690 Q_OBJECT;
1691
1692public:
1693
1694 /** Constructs action passing @a pParent to the base-class. */
1695 UIActionMenuFileManagerLog(UIActionPool *pParent)
1696 : UIActionToggle(pParent)
1697 {
1698 setShortcutContext(Qt::WidgetWithChildrenShortcut);
1699 setIcon(UIIconPool::iconSetFull(":/file_manager_log_32px.png", ":/file_manager_log_16px.png",
1700 ":/file_manager_log_disabled_32px.png", ":/file_manager_log_disabled_16px.png"));
1701 }
1702
1703protected:
1704
1705 /** Returns shortcut extra-data ID. */
1706 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1707 {
1708 return QString("ToggleFileManagerLogPanel");
1709 }
1710
1711 /** Returns default shortcut. */
1712 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1713 {
1714 return QKeySequence();
1715 }
1716
1717 /** Handles translation event. */
1718 virtual void retranslateUi() RT_OVERRIDE
1719 {
1720 setName(QApplication::translate("UIActionPool", "Log"));
1721 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
1722 setStatusTip(QApplication::translate("UIActionPool", "Open panel with file manager log"));
1723 setToolTip( QApplication::translate("UIActionPool", "Open Log Pane")
1724 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1725 }
1726};
1727
1728/** Toggle action extension, used to toggle 'File Manager Operations' panel in file manager. */
1729class UIActionMenuFileManagerOperations : public UIActionToggle
1730{
1731 Q_OBJECT;
1732
1733public:
1734
1735 /** Constructs action passing @a pParent to the base-class. */
1736 UIActionMenuFileManagerOperations(UIActionPool *pParent)
1737 : UIActionToggle(pParent)
1738 {
1739 setShortcutContext(Qt::WidgetWithChildrenShortcut);
1740 setIcon(UIIconPool::iconSetFull(":/file_manager_operations_32px.png", ":/file_manager_operations_16px.png",
1741 ":/file_manager_operations_disabled_32px.png", ":/file_manager_operations_disabled_16px.png"));
1742 }
1743
1744protected:
1745
1746 /** Returns shortcut extra-data ID. */
1747 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1748 {
1749 return QString("ToggleFileManagerOperationsPanel");
1750 }
1751
1752 /** Returns default shortcut. */
1753 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1754 {
1755 return QKeySequence();
1756 }
1757
1758 /** Handles translation event. */
1759 virtual void retranslateUi() RT_OVERRIDE
1760 {
1761 setName(QApplication::translate("UIActionPool", "Operations"));
1762 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
1763 setStatusTip(QApplication::translate("UIActionPool", "Open panel with file manager operations"));
1764 setToolTip( QApplication::translate("UIActionPool", "Open Operations Pane")
1765 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1766 }
1767};
1768
1769/** Toggle action extension, used to toggle 'File Manager Guest Session' panel in file manager. */
1770class UIActionMenuFileManagerGuestSession : public UIActionToggle
1771{
1772 Q_OBJECT;
1773
1774public:
1775
1776 /** Constructs action passing @a pParent to the base-class. */
1777 UIActionMenuFileManagerGuestSession(UIActionPool *pParent)
1778 : UIActionToggle(pParent)
1779 {
1780 setShortcutContext(Qt::WidgetWithChildrenShortcut);
1781 setIcon(UIIconPool::iconSetFull(":/file_manager_session_32px.png", ":/file_manager_session_16px.png",
1782 ":/file_manager_session_disabled_32px.png", ":/file_manager_session_disabled_16px.png"));
1783 }
1784
1785protected:
1786
1787 /** Returns shortcut extra-data ID. */
1788 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1789 {
1790 return QString("ToggleFileManagerGuestSessionPanel");
1791 }
1792
1793 /** Returns default shortcut. */
1794 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1795 {
1796 return QKeySequence();
1797 }
1798
1799 /** Handles translation event. */
1800 virtual void retranslateUi() RT_OVERRIDE
1801 {
1802 setName(QApplication::translate("UIActionPool", "Session"));
1803 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
1804 setStatusTip(QApplication::translate("UIActionPool", "Toggle guest session panel of the file manager"));
1805 setToolTip( QApplication::translate("UIActionPool", "Toggle Guest Session Panel")
1806 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1807 }
1808};
1809
1810/** Simple action extension, used as 'Perform GoUp' in file manager action class. */
1811class UIActionMenuFileManagerGoUp : public UIActionSimple
1812{
1813 Q_OBJECT;
1814
1815public:
1816
1817 /** Constructs action passing @a pParent to the base-class. */
1818 UIActionMenuFileManagerGoUp(UIActionPool *pParent)
1819 : UIActionSimple(pParent,
1820 ":/file_manager_go_up_24px.png", ":/file_manager_go_up_16px.png",
1821 ":/file_manager_go_up_disabled_24px.png", ":/file_manager_go_up_disabled_16px.png")
1822 {}
1823
1824protected:
1825
1826 /** Returns shortcut extra-data ID. */
1827 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1828 {
1829 return QString("FileManagerGoUp");
1830 }
1831
1832 /** Returns default shortcut. */
1833 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1834 {
1835 return QKeySequence();
1836 }
1837
1838 /** Handles translation event. */
1839 virtual void retranslateUi() RT_OVERRIDE
1840 {
1841 setName(QApplication::translate("UIActionPool", "Go Up"));
1842 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
1843 setStatusTip(QApplication::translate("UIActionPool", "Go one level up to parent folder"));
1844 setToolTip( QApplication::translate("UIActionPool", "Go One Level Up")
1845 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1846 }
1847};
1848
1849/** Simple action extension, used as 'Perform GoHome' in file manager action class. */
1850class UIActionMenuFileManagerGoHome : public UIActionSimple
1851{
1852 Q_OBJECT;
1853
1854public:
1855
1856 /** Constructs action passing @a pParent to the base-class. */
1857 UIActionMenuFileManagerGoHome(UIActionPool *pParent)
1858 : UIActionSimple(pParent,
1859 ":/file_manager_go_home_24px.png", ":/file_manager_go_home_16px.png",
1860 ":/file_manager_go_home_disabled_24px.png", ":/file_manager_go_home_disabled_16px.png")
1861 {}
1862
1863protected:
1864
1865 /** Returns shortcut extra-data ID. */
1866 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1867 {
1868 return QString("FileManagerGoHome");
1869 }
1870
1871 /** Returns default shortcut. */
1872 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1873 {
1874 return QKeySequence();
1875 }
1876
1877 /** Handles translation event. */
1878 virtual void retranslateUi() RT_OVERRIDE
1879 {
1880 setName(QApplication::translate("UIActionPool", "Go Home"));
1881 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
1882 setStatusTip(QApplication::translate("UIActionPool", "Go to home folder"));
1883 setToolTip( QApplication::translate("UIActionPool", "Go to Home Folder")
1884 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1885 }
1886};
1887
1888/** Simple action extension, used as 'Perform GoForward' in file manager action class. */
1889class UIActionMenuFileManagerGoForward : public UIActionSimple
1890{
1891 Q_OBJECT;
1892
1893public:
1894
1895 /** Constructs action passing @a pParent to the base-class. */
1896 UIActionMenuFileManagerGoForward(UIActionPool *pParent)
1897 : UIActionSimple(pParent,
1898 ":/file_manager_go_forward_24px.png", ":/file_manager_go_forward_16px.png",
1899 ":/file_manager_go_forward_disabled_24px.png", ":/file_manager_go_forward_disabled_16px.png")
1900 {}
1901
1902protected:
1903
1904 /** Returns shortcut extra-data ID. */
1905 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1906 {
1907 return QString("FileManagerGoForward");
1908 }
1909
1910 /** Returns default shortcut. */
1911 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1912 {
1913 return QKeySequence();
1914 }
1915
1916 /** Handles translation event. */
1917 virtual void retranslateUi() RT_OVERRIDE
1918 {
1919 setName(QApplication::translate("UIActionPool", "Go Forward"));
1920 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
1921 setStatusTip(QApplication::translate("UIActionPool", "Go forward"));
1922 setToolTip( QApplication::translate("UIActionPool", "Go Forward")
1923 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1924 }
1925};
1926
1927/** Simple action extension, used as 'Perform GoBackward' in file manager action class. */
1928class UIActionMenuFileManagerGoBackward : public UIActionSimple
1929{
1930 Q_OBJECT;
1931
1932public:
1933
1934 /** Constructs action passing @a pParent to the base-class. */
1935 UIActionMenuFileManagerGoBackward(UIActionPool *pParent)
1936 : UIActionSimple(pParent,
1937 ":/file_manager_go_backward_24px.png", ":/file_manager_go_backward_16px.png",
1938 ":/file_manager_go_backward_disabled_24px.png", ":/file_manager_go_backward_disabled_16px.png")
1939 {}
1940
1941protected:
1942
1943 /** Returns shortcut extra-data ID. */
1944 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1945 {
1946 return QString("FileManagerGoBackward");
1947 }
1948
1949 /** Returns default shortcut. */
1950 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1951 {
1952 return QKeySequence();
1953 }
1954
1955 /** Handles translation event. */
1956 virtual void retranslateUi() RT_OVERRIDE
1957 {
1958 setName(QApplication::translate("UIActionPool", "Go Backward"));
1959 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
1960 setStatusTip(QApplication::translate("UIActionPool", "Go forward"));
1961 setToolTip( QApplication::translate("UIActionPool", "Go Backward")
1962 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
1963 }
1964};
1965
1966/** Simple action extension, used as 'Perform Delete' in file manager action class. */
1967class UIActionMenuFileManagerDelete : public UIActionSimple
1968{
1969 Q_OBJECT;
1970
1971public:
1972
1973 /** Constructs action passing @a pParent to the base-class. */
1974 UIActionMenuFileManagerDelete(UIActionPool *pParent)
1975 : UIActionSimple(pParent,
1976 ":/file_manager_delete_24px.png", ":/file_manager_delete_16px.png",
1977 ":/file_manager_delete_disabled_24px.png", ":/file_manager_delete_disabled_16px.png")
1978 {}
1979
1980protected:
1981
1982 /** Returns shortcut extra-data ID. */
1983 virtual QString shortcutExtraDataID() const RT_OVERRIDE
1984 {
1985 return QString("FileManagerDelete");
1986 }
1987
1988 /** Returns default shortcut. */
1989 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
1990 {
1991 return QKeySequence();
1992 }
1993
1994 /** Handles translation event. */
1995 virtual void retranslateUi() RT_OVERRIDE
1996 {
1997 setName(QApplication::translate("UIActionPool", "Delete"));
1998 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
1999 setStatusTip(QApplication::translate("UIActionPool", "Delete selected file object(s)"));
2000 setToolTip( QApplication::translate("UIActionPool", "Delete Selected Object(s)")
2001 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2002 }
2003};
2004
2005/** Simple action extension, used as 'Perform Refresh' in file manager action class. */
2006class UIActionMenuFileManagerRefresh : public UIActionSimple
2007{
2008 Q_OBJECT;
2009
2010public:
2011
2012 /** Constructs action passing @a pParent to the base-class. */
2013 UIActionMenuFileManagerRefresh(UIActionPool *pParent)
2014 : UIActionSimple(pParent,
2015 ":/file_manager_refresh_24px.png", ":/file_manager_refresh_16px.png",
2016 ":/file_manager_refresh_disabled_24px.png", ":/file_manager_refresh_disabled_16px.png")
2017 {}
2018
2019protected:
2020
2021 /** Returns shortcut extra-data ID. */
2022 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2023 {
2024 return QString("FileManagerRefresh");
2025 }
2026
2027 /** Returns default shortcut. */
2028 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
2029 {
2030 return QKeySequence();
2031 }
2032
2033 /** Handles translation event. */
2034 virtual void retranslateUi() RT_OVERRIDE
2035 {
2036 setName(QApplication::translate("UIActionPool", "Refresh"));
2037 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
2038 setStatusTip(QApplication::translate("UIActionPool", "Refresh"));
2039 setToolTip( QApplication::translate("UIActionPool", "Refresh Contents")
2040 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2041 }
2042};
2043
2044/** Simple action extension, used as 'Perform Rename' in file manager action class. */
2045class UIActionMenuFileManagerRename : public UIActionSimple
2046{
2047 Q_OBJECT;
2048
2049public:
2050
2051 /** Constructs action passing @a pParent to the base-class. */
2052 UIActionMenuFileManagerRename(UIActionPool *pParent)
2053 : UIActionSimple(pParent,
2054 ":/file_manager_rename_24px.png", ":/file_manager_rename_16px.png",
2055 ":/file_manager_rename_disabled_24px.png", ":/file_manager_rename_disabled_16px.png"){}
2056
2057protected:
2058
2059 /** Returns shortcut extra-data ID. */
2060 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2061 {
2062 return QString("FileManagerRename");
2063 }
2064
2065 /** Returns default shortcut. */
2066 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
2067 {
2068 return QKeySequence();
2069 }
2070
2071 /** Handles translation event. */
2072 virtual void retranslateUi() RT_OVERRIDE
2073 {
2074 setName(QApplication::translate("UIActionPool", "Rename"));
2075 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
2076 setStatusTip(QApplication::translate("UIActionPool", "Rename selected file object"));
2077 setToolTip( QApplication::translate("UIActionPool", "Rename Selected Object")
2078 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2079 }
2080};
2081
2082/** Simple action extension, used as 'Perform Rename' in file manager action class. */
2083class UIActionMenuFileManagerCreateNewDirectory : public UIActionSimple
2084{
2085 Q_OBJECT;
2086
2087public:
2088
2089 /** Constructs action passing @a pParent to the base-class. */
2090 UIActionMenuFileManagerCreateNewDirectory(UIActionPool *pParent)
2091 : UIActionSimple(pParent,
2092 ":/file_manager_new_directory_24px.png", ":/file_manager_new_directory_16px.png",
2093 ":/file_manager_new_directory_disabled_24px.png", ":/file_manager_new_directory_disabled_16px.png"){}
2094
2095protected:
2096
2097 /** Returns shortcut extra-data ID. */
2098 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2099 {
2100 return QString("FileManagerCreateNewDirectory");
2101 }
2102
2103 /** Returns default shortcut. */
2104 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
2105 {
2106 return QKeySequence();
2107 }
2108
2109 /** Handles translation event. */
2110 virtual void retranslateUi() RT_OVERRIDE
2111 {
2112 setName(QApplication::translate("UIActionPool", "Create New Directory"));
2113 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
2114 setStatusTip(QApplication::translate("UIActionPool", "Create New Directory"));
2115 setToolTip( QApplication::translate("UIActionPool", "Create New Directory")
2116 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2117 }
2118};
2119
2120/** Simple action extension, used as 'Perform Copy' in file manager action class. */
2121class UIActionMenuFileManagerCopy : public UIActionSimple
2122{
2123 Q_OBJECT;
2124
2125public:
2126
2127 /** Constructs action passing @a pParent to the base-class. */
2128 UIActionMenuFileManagerCopy(UIActionPool *pParent)
2129 : UIActionSimple(pParent,
2130 ":/file_manager_copy_24px.png", ":/file_manager_copy_16px.png",
2131 ":/file_manager_copy_disabled_24px.png", ":/file_manager_copy_disabled_16px.png"){}
2132
2133protected:
2134
2135 /** Returns shortcut extra-data ID. */
2136 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2137 {
2138 return QString("FileManagerCopy");
2139 }
2140
2141 /** Returns default shortcut. */
2142 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
2143 {
2144 return QKeySequence();
2145 }
2146
2147 /** Handles translation event. */
2148 virtual void retranslateUi() RT_OVERRIDE
2149 {
2150 setName(QApplication::translate("UIActionPool", "Copy"));
2151 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
2152 setStatusTip(QApplication::translate("UIActionPool", "Copy selected file object(s)"));
2153 setToolTip( QApplication::translate("UIActionPool", "Copy Selected Object(s)")
2154 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2155 }
2156};
2157
2158/** Simple action extension, used as 'Perform Cut' in file manager action class. */
2159class UIActionMenuFileManagerCut : public UIActionSimple
2160{
2161 Q_OBJECT;
2162
2163public:
2164
2165 /** Constructs action passing @a pParent to the base-class. */
2166 UIActionMenuFileManagerCut(UIActionPool *pParent)
2167 : UIActionSimple(pParent,
2168 ":/file_manager_cut_24px.png", ":/file_manager_cut_16px.png",
2169 ":/file_manager_cut_disabled_24px.png", ":/file_manager_cut_disabled_16px.png"){}
2170
2171protected:
2172
2173 /** Returns shortcut extra-data ID. */
2174 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2175 {
2176 return QString("FileManagerCut");
2177 }
2178
2179 /** Returns default shortcut. */
2180 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
2181 {
2182 return QKeySequence();
2183 }
2184
2185 /** Handles translation event. */
2186 virtual void retranslateUi() RT_OVERRIDE
2187 {
2188 setName(QApplication::translate("UIActionPool", "Cut"));
2189 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
2190 setStatusTip(QApplication::translate("UIActionPool", "Cut selected file object(s)"));
2191 setToolTip( QApplication::translate("UIActionPool", "Cut Selected Object(s)")
2192 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2193 }
2194};
2195
2196/** Simple action extension, used as 'Perform Paste' in file manager action class. */
2197class UIActionMenuFileManagerPaste : public UIActionSimple
2198{
2199 Q_OBJECT;
2200
2201public:
2202
2203 /** Constructs action passing @a pParent to the base-class. */
2204 UIActionMenuFileManagerPaste(UIActionPool *pParent)
2205 : UIActionSimple(pParent,
2206 ":/file_manager_paste_24px.png", ":/file_manager_paste_16px.png",
2207 ":/file_manager_paste_disabled_24px.png", ":/file_manager_paste_disabled_16px.png"){}
2208
2209protected:
2210
2211 /** Returns shortcut extra-data ID. */
2212 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2213 {
2214 return QString("FileManagerPaste");
2215 }
2216
2217 /** Returns default shortcut. */
2218 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
2219 {
2220 return QKeySequence();
2221 }
2222
2223 /** Handles translation event. */
2224 virtual void retranslateUi() RT_OVERRIDE
2225 {
2226 setName(QApplication::translate("UIActionPool", "Paste"));
2227 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
2228 setStatusTip(QApplication::translate("UIActionPool", "Paste copied/cut file object(s)"));
2229 setToolTip( QApplication::translate("UIActionPool", "Paste Copied/Cut Object(s)")
2230 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2231 }
2232};
2233
2234/** Simple action extension, used as 'Select All' in file manager action class. */
2235class UIActionMenuFileManagerSelectAll : public UIActionSimple
2236{
2237 Q_OBJECT;
2238
2239public:
2240
2241 /** Constructs action passing @a pParent to the base-class. */
2242 UIActionMenuFileManagerSelectAll(UIActionPool *pParent)
2243 : UIActionSimple(pParent,
2244 ":/file_manager_select_all_24px.png", ":/file_manager_select_all_16px.png",
2245 ":/file_manager_select_all_disabled_24px.png", ":/file_manager_select_all_disabled_16px.png"){}
2246
2247protected:
2248
2249 /** Returns shortcut extra-data ID. */
2250 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2251 {
2252 return QString("FileManagerSelectAll");
2253 }
2254
2255 /** Returns default shortcut. */
2256 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
2257 {
2258 return QKeySequence();
2259 }
2260
2261 /** Handles translation event. */
2262 virtual void retranslateUi() RT_OVERRIDE
2263 {
2264 setName(QApplication::translate("UIActionPool", "Select All"));
2265 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
2266 setStatusTip(QApplication::translate("UIActionPool", "Select all files objects"));
2267 setToolTip( QApplication::translate("UIActionPool", "Select All Objects")
2268 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2269 }
2270};
2271
2272/** Simple action extension, used as 'Invert Selection' in file manager action class. */
2273class UIActionMenuFileManagerInvertSelection : public UIActionSimple
2274{
2275 Q_OBJECT;
2276
2277public:
2278
2279 /** Constructs action passing @a pParent to the base-class. */
2280 UIActionMenuFileManagerInvertSelection(UIActionPool *pParent)
2281 : UIActionSimple(pParent,
2282 ":/file_manager_invert_selection_24px.png", ":/file_manager_invert_selection_16px.png",
2283 ":/file_manager_invert_selection_disabled_24px.png", ":/file_manager_invert_selection_disabled_16px.png"){}
2284
2285protected:
2286
2287 /** Returns shortcut extra-data ID. */
2288 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2289 {
2290 return QString("FileManagerInvertSelection");
2291 }
2292
2293 /** Returns default shortcut. */
2294 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
2295 {
2296 return QKeySequence();
2297 }
2298
2299 /** Handles translation event. */
2300 virtual void retranslateUi() RT_OVERRIDE
2301 {
2302 setName(QApplication::translate("UIActionPool", "Invert Selection"));
2303 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
2304 setStatusTip(QApplication::translate("UIActionPool", "Invert the current selection"));
2305 setToolTip( QApplication::translate("UIActionPool", "Invert Current Selection")
2306 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2307 }
2308};
2309
2310/** Simple action extension, used as 'Show Properties' in file manager action class. */
2311class UIActionMenuFileManagerShowProperties : public UIActionSimple
2312{
2313 Q_OBJECT;
2314
2315public:
2316
2317 /** Constructs action passing @a pParent to the base-class. */
2318 UIActionMenuFileManagerShowProperties(UIActionPool *pParent)
2319 : UIActionSimple(pParent,
2320 ":/file_manager_properties_24px.png", ":/file_manager_properties_16px.png",
2321 ":/file_manager_properties_disabled_24px.png", ":/file_manager_properties_disabled_16px.png"){}
2322
2323protected:
2324
2325 /** Returns shortcut extra-data ID. */
2326 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2327 {
2328 return QString("FileManagerShowProperties");
2329 }
2330
2331 /** Returns default shortcut. */
2332 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
2333 {
2334 return QKeySequence();
2335 }
2336
2337 /** Handles translation event. */
2338 virtual void retranslateUi() RT_OVERRIDE
2339 {
2340 setName(QApplication::translate("UIActionPool", "Show Properties"));
2341 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
2342 setStatusTip(QApplication::translate("UIActionPool", "Show the properties of currently selected file object(s)"));
2343 setToolTip( QApplication::translate("UIActionPool", "Show Properties of Current Object(s)")
2344 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2345 }
2346};
2347
2348/** Menu action extension, used as 'VISO Creator' menu class. */
2349class UIActionMenuVISOCreator : public UIActionMenu
2350{
2351 Q_OBJECT;
2352
2353public:
2354
2355 /** Constructs action passing @a pParent to the base-class. */
2356 UIActionMenuVISOCreator(UIActionPool *pParent)
2357 : UIActionMenu(pParent)
2358 {}
2359
2360protected:
2361
2362 /** Returns shortcut extra-data ID. */
2363 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2364 {
2365 return QString("VISOCreatorMenu");
2366 }
2367
2368 /** Handles translation event. */
2369 virtual void retranslateUi() RT_OVERRIDE
2370 {
2371 setName(QApplication::translate("UIActionPool", "VISO Creator"));
2372 }
2373};
2374
2375/** Toggle action extension, used to toggle 'VISO Creator settings' dialog in file manager. */
2376class UIActionMenuVISOCreatorToggleSettingsDialog : public UIActionToggle
2377{
2378 Q_OBJECT;
2379
2380public:
2381
2382 /** Constructs action passing @a pParent to the base-class. */
2383 UIActionMenuVISOCreatorToggleSettingsDialog(UIActionPool *pParent)
2384 : UIActionToggle(pParent)
2385 {
2386 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2387 setIcon(UIIconPool::iconSetFull(":/file_manager_options_32px.png",
2388 ":/%file_manager_options_16px.png",
2389 ":/file_manager_options_disabled_32px.png",
2390 ":/file_manager_options_disabled_16px.png"));
2391 }
2392
2393protected:
2394
2395 /** Returns shortcut extra-data ID. */
2396 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2397 {
2398 return QString("ToggleVISOCreatorSettingsDialog");
2399 }
2400
2401 /** Returns default shortcut. */
2402 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
2403 {
2404 return QKeySequence();
2405 }
2406
2407 /** Handles translation event. */
2408 virtual void retranslateUi() RT_OVERRIDE
2409 {
2410 setName(QApplication::translate("UIActionPool", "Settings"));
2411 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2412 setStatusTip(QApplication::translate("UIActionPool", "Open VISO Creator settings dialog"));
2413 setToolTip(QApplication::translate("UIActionPool", "Open Settings Dialog")
2414 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2415 }
2416};
2417
2418class UIActionMenuVISOCreatorAdd : public UIActionSimple
2419{
2420 Q_OBJECT;
2421
2422public:
2423 /** Constructs action passing @a pParent to the base-class. */
2424 UIActionMenuVISOCreatorAdd(UIActionPool *pParent)
2425 : UIActionSimple(pParent,
2426 ":/file_manager_copy_to_guest_24px.png",
2427 ":/file_manager_copy_to_guest_16px.png",
2428 ":/file_manager_copy_to_guest_disabled_24px.png",
2429 ":/file_manager_copy_to_guest_disabled_16px.png")
2430 {
2431 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2432 }
2433
2434protected:
2435
2436 /** Returns shortcut extra-data ID. */
2437 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2438 {
2439 return QString("VISOAddItem");
2440 }
2441
2442 /** Handles translation event. */
2443 virtual void retranslateUi() RT_OVERRIDE
2444 {
2445 setName(QApplication::translate("UIActionPool", "&Add"));
2446 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2447 setStatusTip(QApplication::translate("UIActionPool", "Add selected item(s) to VISO"));
2448 setToolTip(QApplication::translate("UIActionPool", "Add Item(s) to VISO")
2449 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2450 }
2451};
2452
2453class UIActionMenuVISOCreatorRemove : public UIActionSimple
2454{
2455 Q_OBJECT;
2456
2457public:
2458 /** Constructs action passing @a pParent to the base-class. */
2459 UIActionMenuVISOCreatorRemove(UIActionPool *pParent)
2460 : UIActionSimple(pParent,
2461 ":/file_manager_delete_24px.png",
2462 ":/file_manager_delete_16px.png",
2463 ":/file_manager_delete_disabled_24px.png",
2464 ":/file_manager_delete_disabled_16px.png")
2465 {
2466 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2467 }
2468
2469protected:
2470
2471 /** Returns shortcut extra-data ID. */
2472 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2473 {
2474 return QString("VISORemoveItem");
2475 }
2476
2477 /** Handles translation event. */
2478 virtual void retranslateUi() RT_OVERRIDE
2479 {
2480 setName(QApplication::translate("UIActionPool", "&Remove"));
2481 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2482 setStatusTip(QApplication::translate("UIActionPool", "Remove selected item(s) from VISO"));
2483 setToolTip(QApplication::translate("UIActionPool", "Remove Selected Item(s) from VISO")
2484 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2485 }
2486};
2487
2488class UIActionMenuVISOCreatorRestore : public UIActionSimple
2489{
2490 Q_OBJECT;
2491
2492public:
2493 /** Constructs action passing @a pParent to the base-class. */
2494 UIActionMenuVISOCreatorRestore(UIActionPool *pParent)
2495 : UIActionSimple(pParent,
2496 ":/file_manager_restore_24px.png",
2497 ":/file_manager_restore_16px.png",
2498 ":/file_manager_restore_disabled_24px.png",
2499 ":/file_manager_restore_disabled_16px.png")
2500 {
2501 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2502 }
2503
2504protected:
2505
2506 /** Returns shortcut extra-data ID. */
2507 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2508 {
2509 return QString("VISORestoreItem");
2510 }
2511
2512 /** Handles translation event. */
2513 virtual void retranslateUi() RT_OVERRIDE
2514 {
2515 setName(QApplication::translate("UIActionPool", "&Restore"));
2516 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2517 setStatusTip(QApplication::translate("UIActionPool", "Restore selected item(s)"));
2518 setToolTip(QApplication::translate("UIActionPool", "Restore Selected Item(s)")
2519 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2520 }
2521};
2522
2523class UIActionMenuVISOCreatorCreateNewDirectory : public UIActionSimple
2524{
2525 Q_OBJECT;
2526
2527public:
2528 /** Constructs action passing @a pParent to the base-class. */
2529 UIActionMenuVISOCreatorCreateNewDirectory(UIActionPool *pParent)
2530 : UIActionSimple(pParent,
2531 ":/file_manager_new_directory_24px.png",
2532 ":/file_manager_new_directory_16px.png",
2533 ":/file_manager_new_directory_disabled_24px.png",
2534 ":/file_manager_new_directory_disabled_16px.png")
2535 {
2536 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2537 }
2538
2539protected:
2540
2541 /** Returns shortcut extra-data ID. */
2542 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2543 {
2544 return QString("VISONewDirectory");
2545 }
2546
2547 /** Handles translation event. */
2548 virtual void retranslateUi() RT_OVERRIDE
2549 {
2550 setName(QApplication::translate("UIActionPool", "&New Directory"));
2551 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2552 setStatusTip(QApplication::translate("UIActionPool", "Create a new directory under the current location"));
2553 setToolTip(QApplication::translate("UIActionPool", "Create New Directory")
2554 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2555 }
2556};
2557
2558class UIActionMenuVISOCreatorRename : public UIActionSimple
2559{
2560 Q_OBJECT;
2561
2562public:
2563 /** Constructs action passing @a pParent to the base-class. */
2564 UIActionMenuVISOCreatorRename(UIActionPool *pParent)
2565 : UIActionSimple(pParent,
2566 ":/file_manager_rename_24px.png",
2567 ":/file_manager_rename_16px.png",
2568 ":/file_manager_rename_disabled_24px.png",
2569 ":/file_manager_rename_disabled_16px.png")
2570 {
2571 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2572 }
2573
2574protected:
2575
2576 /** Returns shortcut extra-data ID. */
2577 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2578 {
2579 return QString("VISORenameItem");
2580 }
2581
2582 /** Handles translation event. */
2583 virtual void retranslateUi() RT_OVERRIDE
2584 {
2585 setName(QApplication::translate("UIActionPool", "&Rename"));
2586 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2587 setStatusTip(QApplication::translate("UIActionPool", "Rename the selected object"));
2588 setToolTip(QApplication::translate("UIActionPool", "Rename Selected VISO File Object")
2589 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2590 }
2591};
2592
2593class UIActionMenuVISOCreatorReset : public UIActionSimple
2594{
2595 Q_OBJECT;
2596
2597public:
2598 /** Constructs action passing @a pParent to the base-class. */
2599 UIActionMenuVISOCreatorReset(UIActionPool *pParent)
2600 : UIActionSimple(pParent,
2601 ":/cd_remove_16px.png", ":/cd_remove_disabled_16px.png")
2602 {
2603 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2604 }
2605
2606protected:
2607
2608 /** Returns shortcut extra-data ID. */
2609 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2610 {
2611 return QString("VISOReset");
2612 }
2613
2614 /** Handles translation event. */
2615 virtual void retranslateUi() RT_OVERRIDE
2616 {
2617 setName(QApplication::translate("UIActionPool", "R&eset"));
2618 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2619 setStatusTip(QApplication::translate("UIActionPool", "Reset the VISO content."));
2620 setToolTip(QApplication::translate("UIActionPool", "Reset the VISO content.")
2621 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2622 }
2623};
2624
2625class UIActionMenuVISOCreatorOpen : public UIActionSimple
2626{
2627 Q_OBJECT;
2628
2629public:
2630 /** Constructs action passing @a pParent to the base-class. */
2631 UIActionMenuVISOCreatorOpen(UIActionPool *pParent)
2632 : UIActionSimple(pParent,
2633 ":/cd_remove_16px.png", ":/cd_remove_32px.png")
2634 {
2635 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2636 }
2637
2638protected:
2639
2640 /** Returns shortcut extra-data ID. */
2641 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2642 {
2643 return QString("VISOOpen");
2644 }
2645
2646 /** Handles translation event. */
2647 virtual void retranslateUi() RT_OVERRIDE
2648 {
2649 setName(QApplication::translate("UIActionPool", "Open"));
2650 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2651 setStatusTip(QApplication::translate("UIActionPool", "Open the VISO content."));
2652 setToolTip(QApplication::translate("UIActionPool", "Open the VISO content.")
2653 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2654 }
2655};
2656
2657class UIActionMenuVISOCreatorSaveAs : public UIActionSimple
2658{
2659 Q_OBJECT;
2660
2661public:
2662 /** Constructs action passing @a pParent to the base-class. */
2663 UIActionMenuVISOCreatorSaveAs(UIActionPool *pParent)
2664 : UIActionSimple(pParent,
2665 ":/cd_write_16px.png", ":/cd_write_32px.png")
2666 {
2667 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2668 }
2669
2670protected:
2671
2672 /** Returns shortcut extra-data ID. */
2673 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2674 {
2675 return QString("VISOSaveAs");
2676 }
2677
2678 /** Handles translation event. */
2679 virtual void retranslateUi() RT_OVERRIDE
2680 {
2681 setName(QApplication::translate("UIActionPool", "Save As"));
2682 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2683 setStatusTip(QApplication::translate("UIActionPool", "Save the VISO content."));
2684 setToolTip(QApplication::translate("UIActionPool", "Save the VISO content.")
2685 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2686 }
2687};
2688
2689class UIActionMenuVISOCreatorImportISO : public UIActionSimple
2690{
2691 Q_OBJECT;
2692
2693public:
2694 /** Constructs action passing @a pParent to the base-class. */
2695 UIActionMenuVISOCreatorImportISO(UIActionPool *pParent)
2696 : UIActionSimple(pParent,
2697 ":/cd_add_16px.png", ":/cd_add_32px.png", ":/cd_add_disabled_16px.png", ":/cd_add_disabled_32px.png")
2698 {
2699 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2700 }
2701
2702protected:
2703
2704 /** Returns shortcut extra-data ID. */
2705 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2706 {
2707 return QString("ISOImport");
2708 }
2709
2710 /** Handles translation event. */
2711 virtual void retranslateUi() RT_OVERRIDE
2712 {
2713 setName(QApplication::translate("UIActionPool", "ISOImport"));
2714 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2715 setStatusTip(QApplication::translate("UIActionPool", "Import ISO into the VISO content."));
2716 setToolTip(QApplication::translate("UIActionPool", "Import Selected ISO into the VISO content.")
2717 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2718 }
2719};
2720
2721
2722class UIActionMenuVISOCreatorRemoveISO : public UIActionSimple
2723{
2724 Q_OBJECT;
2725
2726public:
2727 /** Constructs action passing @a pParent to the base-class. */
2728 UIActionMenuVISOCreatorRemoveISO(UIActionPool *pParent)
2729 : UIActionSimple(pParent,
2730 ":/cd_remove_16px.png", ":/cd_remove_32px.png", ":/cd_remove_disabled_16px.png", ":/cd_remove_disabled_32px.png")
2731 {
2732 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2733 }
2734
2735protected:
2736
2737 /** Returns shortcut extra-data ID. */
2738 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2739 {
2740 return QString("ISORemove");
2741 }
2742
2743 /** Handles translation event. */
2744 virtual void retranslateUi() RT_OVERRIDE
2745 {
2746 setName(QApplication::translate("UIActionPool", "ISORemove"));
2747 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2748 setStatusTip(QApplication::translate("UIActionPool", "Remove the imported ISO from the VISO content."));
2749 setToolTip(QApplication::translate("UIActionPool", "Remove the imported ISO from the VISO content.")
2750 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2751 }
2752};
2753
2754/** Simple action extension, used as 'Perform GoUp' in VISO creator action class. */
2755class UIActionMenuVISOCreatorGoUp : public UIActionSimple
2756{
2757 Q_OBJECT;
2758
2759public:
2760
2761 /** Constructs action passing @a pParent to the base-class. */
2762 UIActionMenuVISOCreatorGoUp(UIActionPool *pParent)
2763 : UIActionSimple(pParent,
2764 ":/file_manager_go_up_24px.png", ":/file_manager_go_up_16px.png",
2765 ":/file_manager_go_up_disabled_24px.png", ":/file_manager_go_up_disabled_16px.png")
2766 {}
2767
2768protected:
2769
2770 /** Returns shortcut extra-data ID. */
2771 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2772 {
2773 return QString("VISOCreatorGoUp");
2774 }
2775
2776 /** Returns default shortcut. */
2777 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
2778 {
2779 return QKeySequence();
2780 }
2781
2782 /** Handles translation event. */
2783 virtual void retranslateUi() RT_OVERRIDE
2784 {
2785 setName(QApplication::translate("UIActionPool", "Go Up"));
2786 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2787 setStatusTip(QApplication::translate("UIActionPool", "Go one level up to parent folder"));
2788 setToolTip( QApplication::translate("UIActionPool", "Go One Level Up")
2789 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2790 }
2791};
2792
2793/** Simple action extension, used as 'Perform GoHome' in VISO creator action class. */
2794class UIActionMenuVISOCreatorGoHome : public UIActionSimple
2795{
2796 Q_OBJECT;
2797
2798public:
2799
2800 /** Constructs action passing @a pParent to the base-class. */
2801 UIActionMenuVISOCreatorGoHome(UIActionPool *pParent)
2802 : UIActionSimple(pParent,
2803 ":/file_manager_go_home_24px.png", ":/file_manager_go_home_16px.png",
2804 ":/file_manager_go_home_disabled_24px.png", ":/file_manager_go_home_disabled_16px.png")
2805 {}
2806
2807protected:
2808
2809 /** Returns shortcut extra-data ID. */
2810 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2811 {
2812 return QString("VISOCreatorGoHome");
2813 }
2814
2815 /** Returns default shortcut. */
2816 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
2817 {
2818 return QKeySequence();
2819 }
2820
2821 /** Handles translation event. */
2822 virtual void retranslateUi() RT_OVERRIDE
2823 {
2824 setName(QApplication::translate("UIActionPool", "Go Home"));
2825 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2826 setStatusTip(QApplication::translate("UIActionPool", "Go to home folder"));
2827 setToolTip( QApplication::translate("UIActionPool", "Go to Home Folder")
2828 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2829 }
2830};
2831
2832/** Simple action extension, used as 'Perform GoForward' in VISO creator action class. */
2833class UIActionMenuVISOCreatorGoForward : public UIActionSimple
2834{
2835 Q_OBJECT;
2836
2837public:
2838
2839 /** Constructs action passing @a pParent to the base-class. */
2840 UIActionMenuVISOCreatorGoForward(UIActionPool *pParent)
2841 : UIActionSimple(pParent,
2842 ":/file_manager_go_forward_24px.png", ":/file_manager_go_forward_16px.png",
2843 ":/file_manager_go_forward_disabled_24px.png", ":/file_manager_go_forward_disabled_16px.png")
2844 {}
2845
2846protected:
2847
2848 /** Returns shortcut extra-data ID. */
2849 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2850 {
2851 return QString("VISOCreatorGoForward");
2852 }
2853
2854 /** Returns default shortcut. */
2855 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
2856 {
2857 return QKeySequence();
2858 }
2859
2860 /** Handles translation event. */
2861 virtual void retranslateUi() RT_OVERRIDE
2862 {
2863 setName(QApplication::translate("UIActionPool", "Go Forward"));
2864 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2865 setStatusTip(QApplication::translate("UIActionPool", "Go forward"));
2866 setToolTip( QApplication::translate("UIActionPool", "Go Forward")
2867 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2868 }
2869};
2870
2871/** Simple action extension, used as 'Perform GoBackward' in VISO creator action class. */
2872class UIActionMenuVISOCreatorGoBackward : public UIActionSimple
2873{
2874 Q_OBJECT;
2875
2876public:
2877
2878 /** Constructs action passing @a pParent to the base-class. */
2879 UIActionMenuVISOCreatorGoBackward(UIActionPool *pParent)
2880 : UIActionSimple(pParent,
2881 ":/file_manager_go_backward_24px.png", ":/file_manager_go_backward_16px.png",
2882 ":/file_manager_go_backward_disabled_24px.png", ":/file_manager_go_backward_disabled_16px.png")
2883 {}
2884
2885protected:
2886
2887 /** Returns shortcut extra-data ID. */
2888 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2889 {
2890 return QString("VISOCreatorGoBackward");
2891 }
2892
2893 /** Returns default shortcut. */
2894 virtual QKeySequence defaultShortcut(UIType) const RT_OVERRIDE
2895 {
2896 return QKeySequence();
2897 }
2898
2899 /** Handles translation event. */
2900 virtual void retranslateUi() RT_OVERRIDE
2901 {
2902 setName(QApplication::translate("UIActionPool", "Go Backward"));
2903 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2904 setStatusTip(QApplication::translate("UIActionPool", "Go forward"));
2905 setToolTip( QApplication::translate("UIActionPool", "Go Backward")
2906 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2907 }
2908};
2909
2910/** Menu action extension, used as 'Menu Selector' menu class. */
2911class UIActionMenuMediumSelector : public UIActionMenu
2912{
2913 Q_OBJECT;
2914
2915public:
2916
2917 /** Constructs action passing @a pParent to the base-class. */
2918 UIActionMenuMediumSelector(UIActionPool *pParent)
2919 : UIActionMenu(pParent)
2920 {}
2921
2922protected:
2923
2924 /** Returns shortcut extra-data ID. */
2925 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2926 {
2927 return QString("MediumSelector");
2928 }
2929
2930 /** Handles translation event. */
2931 virtual void retranslateUi() RT_OVERRIDE
2932 {
2933 setName(QApplication::translate("UIActionPool", "&Medium Selector"));
2934 }
2935};
2936
2937/** Simple action extension, used as 'Add' action class. */
2938class UIActionMenuMediumSelectorAddHD : public UIActionSimple
2939{
2940 Q_OBJECT;
2941
2942public:
2943
2944 /** Constructs action passing @a pParent to the base-class. */
2945 UIActionMenuMediumSelectorAddHD(UIActionPool *pParent)
2946 : UIActionSimple(pParent, ":/hd_add_32px.png", ":/hd_add_16px.png",
2947 ":/hd_add_disabled_32px.png", ":/hd_add_disabled_16px.png")
2948 {
2949 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2950 }
2951
2952protected:
2953
2954 /** Returns shortcut extra-data ID. */
2955 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2956 {
2957 return QString("MediumSelectorAddHD");
2958 }
2959
2960 /** Handles translation event. */
2961 virtual void retranslateUi() RT_OVERRIDE
2962 {
2963 setName(QApplication::translate("UIActionPool", "&Add..."));
2964 setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
2965 setStatusTip(QApplication::translate("UIActionPool", "Add existing disk image file"));
2966 setToolTip( QApplication::translate("UIActionPool", "Add Disk Image File")
2967 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2968 }
2969};
2970
2971/** Simple action extension, used as 'Add' action class. */
2972class UIActionMenuMediumSelectorAddCD : public UIActionSimple
2973{
2974 Q_OBJECT;
2975
2976public:
2977
2978 /** Constructs action passing @a pParent to the base-class. */
2979 UIActionMenuMediumSelectorAddCD(UIActionPool *pParent)
2980 : UIActionSimple(pParent, ":/cd_add_32px.png", ":/cd_add_16px.png",
2981 ":/cd_add_disabled_32px.png", ":/cd_add_disabled_16px.png")
2982 {
2983 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2984 }
2985
2986protected:
2987
2988 /** Returns shortcut extra-data ID. */
2989 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2990 {
2991 return QString("MediumSelectorAddCD");
2992 }
2993
2994 /** Handles translation event. */
2995 virtual void retranslateUi() RT_OVERRIDE
2996 {
2997 setName(QApplication::translate("UIActionPool", "&Add..."));
2998 setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
2999 setStatusTip(QApplication::translate("UIActionPool", "Add existing disk image file"));
3000 setToolTip( QApplication::translate("UIActionPool", "Add Disk Image File")
3001 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
3002 }
3003};
3004
3005/** Simple action extension, used as 'Add' action class. */
3006class UIActionMenuMediumSelectorAddFD : public UIActionSimple
3007{
3008 Q_OBJECT;
3009
3010public:
3011
3012 /** Constructs action passing @a pParent to the base-class. */
3013 UIActionMenuMediumSelectorAddFD(UIActionPool *pParent)
3014 : UIActionSimple(pParent, ":/fd_add_32px.png", ":/fd_add_16px.png",
3015 ":/fd_add_disabled_32px.png", ":/fd_add_disabled_16px.png")
3016 {
3017 setShortcutContext(Qt::WidgetWithChildrenShortcut);
3018 }
3019
3020protected:
3021
3022 /** Returns shortcut extra-data ID. */
3023 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3024 {
3025 return QString("MediumSelectorAddFD");
3026 }
3027
3028 /** Handles translation event. */
3029 virtual void retranslateUi() RT_OVERRIDE
3030 {
3031 setName(QApplication::translate("UIActionPool", "&Add..."));
3032 setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
3033 setStatusTip(QApplication::translate("UIActionPool", "Add existing disk image file"));
3034 setToolTip( QApplication::translate("UIActionPool", "Add Disk Image File")
3035 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
3036 }
3037};
3038
3039/** Simple action extension, used as 'Create' action class. */
3040class UIActionMenuMediumSelectorCreateHD : public UIActionSimple
3041{
3042 Q_OBJECT;
3043
3044public:
3045
3046 /** Constructs action passing @a pParent to the base-class. */
3047 UIActionMenuMediumSelectorCreateHD(UIActionPool *pParent)
3048 : UIActionSimple(pParent, ":/hd_create_32px.png", ":/hd_create_16px.png",
3049 ":/hd_create_disabled_32px.png", ":/hd_create_disabled_16px.png")
3050 {
3051 setShortcutContext(Qt::WidgetWithChildrenShortcut);
3052 }
3053
3054protected:
3055
3056 /** Returns shortcut extra-data ID. */
3057 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3058 {
3059 return QString("MediumSelectorCreateHD");
3060 }
3061
3062 /** Handles translation event. */
3063 virtual void retranslateUi() RT_OVERRIDE
3064 {
3065 setName(QApplication::translate("UIActionPool", "&Create..."));
3066 setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
3067 setStatusTip(QApplication::translate("UIActionPool", "Create a new disk image file"));
3068 setToolTip( QApplication::translate("UIActionPool", "Create Disk Image File")
3069 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
3070 }
3071};
3072
3073/** Simple action extension, used as 'Create' action class. */
3074class UIActionMenuMediumSelectorCreateCD : public UIActionSimple
3075{
3076 Q_OBJECT;
3077
3078public:
3079
3080 /** Constructs action passing @a pParent to the base-class. */
3081 UIActionMenuMediumSelectorCreateCD(UIActionPool *pParent)
3082 : UIActionSimple(pParent, ":/cd_create_32px.png", ":/cd_create_16px.png",
3083 ":/cd_create_disabled_32px.png", ":/cd_create_disabled_16px.png")
3084 {
3085 setShortcutContext(Qt::WidgetWithChildrenShortcut);
3086 }
3087
3088protected:
3089
3090 /** Returns shortcut extra-data ID. */
3091 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3092 {
3093 return QString("MediumSelectorCreateCD");
3094 }
3095
3096 /** Handles translation event. */
3097 virtual void retranslateUi() RT_OVERRIDE
3098 {
3099 setName(QApplication::translate("UIActionPool", "&Create..."));
3100 setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
3101 setStatusTip(QApplication::translate("UIActionPool", "Create a new disk image file"));
3102 setToolTip( QApplication::translate("UIActionPool", "Create Disk Image File")
3103 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
3104 }
3105};
3106
3107/** Simple action extension, used as 'Create' action class. */
3108class UIActionMenuMediumSelectorCreateFD : public UIActionSimple
3109{
3110 Q_OBJECT;
3111
3112public:
3113
3114 /** Constructs action passing @a pParent to the base-class. */
3115 UIActionMenuMediumSelectorCreateFD(UIActionPool *pParent)
3116 : UIActionSimple(pParent, ":/fd_create_32px.png", ":/fd_create_16px.png",
3117 ":/fd_create_disabled_32px.png", ":/fd_create_disabled_16px.png")
3118 {
3119 setShortcutContext(Qt::WidgetWithChildrenShortcut);
3120 }
3121
3122protected:
3123
3124 /** Returns shortcut extra-data ID. */
3125 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3126 {
3127 return QString("MediumSelectorCreateFD");
3128 }
3129
3130 /** Handles translation event. */
3131 virtual void retranslateUi() RT_OVERRIDE
3132 {
3133 setName(QApplication::translate("UIActionPool", "&Create..."));
3134 setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
3135 setStatusTip(QApplication::translate("UIActionPool", "Create a new disk image file"));
3136 setToolTip( QApplication::translate("UIActionPool", "Create Disk Image File")
3137 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
3138 }
3139};
3140
3141/** Simple action extension, used as 'Create' action class. */
3142class UIActionMenuMediumSelectorRefresh : public UIActionSimple
3143{
3144 Q_OBJECT;
3145
3146public:
3147
3148 /** Constructs action passing @a pParent to the base-class. */
3149 UIActionMenuMediumSelectorRefresh(UIActionPool *pParent)
3150 : UIActionSimple(pParent, ":/refresh_32px.png", ":/refresh_16px.png",
3151 ":/refresh_disabled_32px.png", ":/refresh_disabled_16px.png")
3152 {
3153 setShortcutContext(Qt::WidgetWithChildrenShortcut);
3154 }
3155
3156protected:
3157
3158 /** Returns shortcut extra-data ID. */
3159 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3160 {
3161 return QString("MediumSelectorRefresh");
3162 }
3163
3164 /** Handles translation event. */
3165 virtual void retranslateUi() RT_OVERRIDE
3166 {
3167 setName(QApplication::translate("UIActionPool", "&Refresh..."));
3168 setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
3169 setStatusTip(QApplication::translate("UIActionPool", "Refresh disk images"));
3170 setToolTip( QApplication::translate("UIActionPool", "Refresh Disk Images")
3171 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
3172 }
3173};
3174
3175/** Menu action extension, used as 'Activity' menu class. */
3176class UIActionMenuSelectorActivity : public UIActionMenu
3177{
3178 Q_OBJECT;
3179
3180public:
3181
3182 /** Constructs action passing @a pParent to the base-class. */
3183 UIActionMenuSelectorActivity(UIActionPool *pParent)
3184 : UIActionMenu(pParent)
3185 {}
3186
3187protected:
3188
3189 /** Returns shortcut extra-data ID. */
3190 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3191 {
3192 return QString("VMActivityMonitorMenu");
3193 }
3194
3195 /** Handles translation event. */
3196 virtual void retranslateUi() RT_OVERRIDE
3197 {
3198 setName(QApplication::translate("UIActionPool", "&Activity"));
3199 }
3200};
3201
3202/** Simple action extension, used as 'Perform Export' action class. */
3203class UIActionMenuSelectorActivityPerformExport : public UIActionSimple
3204{
3205 Q_OBJECT;
3206
3207public:
3208
3209 /** Constructs action passing @a pParent to the base-class. */
3210 UIActionMenuSelectorActivityPerformExport(UIActionPool *pParent)
3211 : UIActionSimple(pParent,
3212 ":/performance_monitor_export_32px.png", ":/performance_monitor_export_16px.png",
3213 ":/performance_monitor_export_disabled_32px.png", ":/performance_monitor_export_disabled_16px.png")
3214 {
3215 setShortcutContext(Qt::WidgetWithChildrenShortcut);
3216 }
3217
3218protected:
3219
3220 /** Returns shortcut extra-data ID. */
3221 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3222 {
3223 return QString("VMActivityMonitorExportCharts");
3224 }
3225
3226 /** Handles translation event. */
3227 virtual void retranslateUi() RT_OVERRIDE
3228 {
3229 setName(QApplication::translate("UIActionPool", "&Export..."));
3230 setShortcutScope(QApplication::translate("UIActionPool", "VM Activity Monitor"));
3231 setStatusTip(QApplication::translate("UIActionPool", "Export the chart data into a text file"));
3232 setToolTip( QApplication::translate("UIActionPool", "Export Data to File")
3233 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
3234 }
3235};
3236
3237/** Simple action extension, used as 'To VM Activity Overview' action class. */
3238class UIActionMenuSelectorActivityToVMActivityOverview : public UIActionSimple
3239{
3240 Q_OBJECT;
3241
3242public:
3243
3244 /** Constructs action passing @a pParent to the base-class. */
3245 UIActionMenuSelectorActivityToVMActivityOverview(UIActionPool *pParent)
3246 : UIActionSimple(pParent,
3247 ":/resources_monitor_24px.png", ":/resource_monitor_16px.png",
3248 ":/resource_monitor_disabled_24px.png", ":/resource_monitor_disabled_16px.png")
3249 {
3250 setShortcutContext(Qt::WidgetWithChildrenShortcut);
3251 }
3252
3253protected:
3254
3255 /** Returns shortcut extra-data ID. */
3256 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3257 {
3258 return QString("ToVMActivityOverview");
3259 }
3260
3261 /** Handles translation event. */
3262 virtual void retranslateUi() RT_OVERRIDE
3263 {
3264 setName(QApplication::translate("UIActionPool", "&Activity Overview..."));
3265 setShortcutScope(QApplication::translate("UIActionPool", "Activity Monitor"));
3266 setStatusTip(QApplication::translate("UIActionPool", "Navigate to the vm activity overview"));
3267 setToolTip( QApplication::translate("UIActionPool", "Navigate to VM Activity Overview")
3268 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
3269 }
3270};
3271
3272
3273/*********************************************************************************************************************************
3274* Class UIActionPool implementation. *
3275*********************************************************************************************************************************/
3276
3277/* static */
3278UIActionPool *UIActionPool::create(UIType enmType)
3279{
3280 UIActionPool *pActionPool = 0;
3281 switch (enmType)
3282 {
3283 case UIType_ManagerUI: pActionPool = new UIActionPoolManager; break;
3284 case UIType_RuntimeUI: pActionPool = new UIActionPoolRuntime; break;
3285 default: AssertFailedReturn(0);
3286 }
3287 AssertPtrReturn(pActionPool, 0);
3288 pActionPool->prepare();
3289 return pActionPool;
3290}
3291
3292/* static */
3293void UIActionPool::destroy(UIActionPool *pActionPool)
3294{
3295 AssertPtrReturnVoid(pActionPool);
3296 pActionPool->cleanup();
3297 delete pActionPool;
3298}
3299
3300/* static */
3301void UIActionPool::createTemporary(UIType enmType)
3302{
3303 UIActionPool *pActionPool = 0;
3304 switch (enmType)
3305 {
3306 case UIType_ManagerUI: pActionPool = new UIActionPoolManager(true); break;
3307 case UIType_RuntimeUI: pActionPool = new UIActionPoolRuntime(true); break;
3308 default: AssertFailedReturnVoid();
3309 }
3310 AssertPtrReturnVoid(pActionPool);
3311 pActionPool->prepare();
3312 pActionPool->cleanup();
3313 delete pActionPool;
3314}
3315
3316UIActionPoolManager *UIActionPool::toManager()
3317{
3318 return qobject_cast<UIActionPoolManager*>(this);
3319}
3320
3321UIActionPoolRuntime *UIActionPool::toRuntime()
3322{
3323 return qobject_cast<UIActionPoolRuntime*>(this);
3324}
3325
3326UIAction *UIActionPool::action(int iIndex) const
3327{
3328 AssertReturn(m_pool.contains(iIndex), 0);
3329 return m_pool.value(iIndex);
3330}
3331
3332QList<UIAction*> UIActionPool::actions() const
3333{
3334 return m_pool.values();
3335}
3336
3337QActionGroup *UIActionPool::actionGroup(int iIndex) const
3338{
3339 AssertReturn(m_groupPool.contains(iIndex), 0);
3340 return m_groupPool.value(iIndex);
3341}
3342
3343bool UIActionPool::isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType enmType) const
3344{
3345 foreach (const UIExtraDataMetaDefs::MenuType &enmRestriction, m_restrictedMenus.values())
3346 if (enmRestriction & enmType)
3347 return false;
3348 return true;
3349}
3350
3351void UIActionPool::setRestrictionForMenuBar(UIActionRestrictionLevel enmLevel, UIExtraDataMetaDefs::MenuType enmRestriction)
3352{
3353 m_restrictedMenus[enmLevel] = enmRestriction;
3354 updateMenus();
3355}
3356
3357bool UIActionPool::isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType enmType) const
3358{
3359 foreach (const UIExtraDataMetaDefs::MenuApplicationActionType &enmRestriction, m_restrictedActionsMenuApplication.values())
3360 if (enmRestriction & enmType)
3361 return false;
3362 return true;
3363}
3364
3365void UIActionPool::setRestrictionForMenuApplication(UIActionRestrictionLevel enmLevel, UIExtraDataMetaDefs::MenuApplicationActionType enmRestriction)
3366{
3367 m_restrictedActionsMenuApplication[enmLevel] = enmRestriction;
3368 m_invalidations << UIActionIndex_M_Application;
3369}
3370
3371#ifdef VBOX_WS_MAC
3372bool UIActionPool::isAllowedInMenuWindow(UIExtraDataMetaDefs::MenuWindowActionType enmType) const
3373{
3374 foreach (const UIExtraDataMetaDefs::MenuWindowActionType &enmRestriction, m_restrictedActionsMenuWindow.values())
3375 if (enmRestriction & enmType)
3376 return false;
3377 return true;
3378}
3379
3380void UIActionPool::setRestrictionForMenuWindow(UIActionRestrictionLevel enmLevel, UIExtraDataMetaDefs::MenuWindowActionType enmRestriction)
3381{
3382 m_restrictedActionsMenuWindow[enmLevel] = enmRestriction;
3383 m_invalidations << UIActionIndex_M_Window;
3384}
3385#endif /* VBOX_WS_MAC */
3386
3387bool UIActionPool::isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType enmType) const
3388{
3389 foreach (const UIExtraDataMetaDefs::MenuHelpActionType &enmRestriction, m_restrictedActionsMenuHelp.values())
3390 if (enmRestriction & enmType)
3391 return false;
3392 return true;
3393}
3394
3395void UIActionPool::setRestrictionForMenuHelp(UIActionRestrictionLevel enmLevel, UIExtraDataMetaDefs::MenuHelpActionType enmRestriction)
3396{
3397 m_restrictedActionsMenuHelp[enmLevel] = enmRestriction;
3398 m_invalidations << UIActionIndex_Menu_Help;
3399}
3400
3401bool UIActionPool::processHotKey(const QKeySequence &key)
3402{
3403 /* Iterate through the whole list of keys: */
3404 foreach (const int &iKey, m_pool.keys())
3405 {
3406 /* Get current action: */
3407 UIAction *pAction = m_pool.value(iKey);
3408 /* Skip menus/separators: */
3409 if (pAction->type() == UIActionType_Menu)
3410 continue;
3411 /* Get the hot-key of the current action: */
3412 const QString strHotKey = gShortcutPool->shortcut(this, pAction).primaryToPortableText();
3413 if (pAction->isEnabled() && pAction->isAllowed() && !strHotKey.isEmpty())
3414 {
3415 if (key.matches(QKeySequence(strHotKey)) == QKeySequence::ExactMatch)
3416 {
3417 /* We asynchronously post a special event instead of calling
3418 * pAction->trigger() directly, to let key presses and
3419 * releases be processed correctly by Qt first.
3420 * Note: we assume that nobody will delete the menu item
3421 * corresponding to the key sequence, so that the pointer to
3422 * menu data posted along with the event will remain valid in
3423 * the event handler, at least until the main window is closed. */
3424 QApplication::postEvent(this, new ActivateActionEvent(pAction));
3425 return true;
3426 }
3427 }
3428 }
3429 return false;
3430}
3431
3432void UIActionPool::sltHandleMenuPrepare()
3433{
3434 /* Make sure menu is valid: */
3435 AssertPtrReturnVoid(sender());
3436 UIMenu *pMenu = qobject_cast<UIMenu*>(sender());
3437 AssertPtrReturnVoid(pMenu);
3438 /* Make sure action is valid: */
3439 AssertPtrReturnVoid(pMenu->menuAction());
3440 UIAction *pAction = qobject_cast<UIAction*>(pMenu->menuAction());
3441 AssertPtrReturnVoid(pAction);
3442
3443 /* Determine action index: */
3444 const int iIndex = m_pool.key(pAction);
3445
3446 /* Update menu if necessary: */
3447 updateMenu(iIndex);
3448
3449 /* Notify listeners about menu prepared: */
3450 emit sigNotifyAboutMenuPrepare(iIndex, pMenu);
3451}
3452
3453#ifdef VBOX_WS_MAC
3454void UIActionPool::sltActionHovered()
3455{
3456 /* Acquire sender action: */
3457 UIAction *pAction = qobject_cast<UIAction*>(sender());
3458 AssertPtrReturnVoid(pAction);
3459 //printf("Action hovered: {%s}\n", pAction->name().toUtf8().constData());
3460
3461 /* Notify listener about action hevering: */
3462 emit sigActionHovered(pAction);
3463}
3464#endif /* VBOX_WS_MAC */
3465
3466UIActionPool::UIActionPool(UIType enmType, bool fTemporary /* = false */)
3467 : m_enmType(enmType)
3468 , m_fTemporary(fTemporary)
3469{
3470}
3471
3472void UIActionPool::preparePool()
3473{
3474 /* Create 'Application' actions: */
3475 m_pool[UIActionIndex_M_Application] = new UIActionMenuApplication(this);
3476#ifdef VBOX_WS_MAC
3477 m_pool[UIActionIndex_M_Application_S_About] = new UIActionSimpleAbout(this);
3478#endif
3479 m_pool[UIActionIndex_M_Application_S_Preferences] = new UIActionSimplePreferences(this);
3480#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
3481 m_pool[UIActionIndex_M_Application_S_CheckForUpdates] = new UIActionSimpleCheckForUpdates(this);
3482#endif
3483 m_pool[UIActionIndex_M_Application_S_ResetWarnings] = new UIActionSimpleResetWarnings(this);
3484 m_pool[UIActionIndex_M_Application_S_Close] = new UIActionSimplePerformClose(this);
3485
3486#ifdef VBOX_WS_MAC
3487 /* Create 'Window' actions: */
3488 m_pool[UIActionIndex_M_Window] = new UIActionMenuWindow(this);
3489 m_pool[UIActionIndex_M_Window_S_Minimize] = new UIActionSimpleMinimize(this);
3490#endif
3491
3492 /* Create 'Help' actions: */
3493 m_pool[UIActionIndex_Menu_Help] = new UIActionMenuHelp(this);
3494 m_pool[UIActionIndex_Simple_Contents] = new UIActionSimpleContents(this);
3495 m_pool[UIActionIndex_Simple_OnlineDocumentation] = new UIActionSimpleOnlineDocumentation(this);
3496 m_pool[UIActionIndex_Simple_WebSite] = new UIActionSimpleWebSite(this);
3497 m_pool[UIActionIndex_Simple_BugTracker] = new UIActionSimpleBugTracker(this);
3498 m_pool[UIActionIndex_Simple_Forums] = new UIActionSimpleForums(this);
3499 m_pool[UIActionIndex_Simple_Oracle] = new UIActionSimpleOracle(this);
3500#ifndef VBOX_WS_MAC
3501 m_pool[UIActionIndex_Simple_About] = new UIActionSimpleAbout(this);
3502#endif
3503
3504 /* Create 'Log Viewer' actions: */
3505 m_pool[UIActionIndex_M_LogWindow] = new UIActionMenuSelectorLog(this);
3506 m_pool[UIActionIndex_M_Log] = new UIActionMenuSelectorLog(this);
3507 m_pool[UIActionIndex_M_Log_T_Find] = new UIActionMenuSelectorLogTogglePaneFind(this);
3508 m_pool[UIActionIndex_M_Log_T_Filter] = new UIActionMenuSelectorLogTogglePaneFilter(this);
3509 m_pool[UIActionIndex_M_Log_T_Bookmark] = new UIActionMenuSelectorLogTogglePaneBookmark(this);
3510 m_pool[UIActionIndex_M_Log_T_Preferences] = new UIActionMenuSelectorLogTogglePanePreferences(this);
3511 m_pool[UIActionIndex_M_Log_S_Refresh] = new UIActionMenuSelectorLogPerformRefresh(this);
3512 m_pool[UIActionIndex_M_Log_S_Reload] = new UIActionMenuSelectorLogPerformReload(this);
3513 m_pool[UIActionIndex_M_Log_S_Save] = new UIActionMenuSelectorLogPerformSave(this);
3514
3515 /* Create 'Performance Monitor' actions: */
3516 m_pool[UIActionIndex_M_Activity] = new UIActionMenuSelectorActivity(this);
3517 m_pool[UIActionIndex_M_Activity_S_Export] = new UIActionMenuSelectorActivityPerformExport(this);
3518 m_pool[UIActionIndex_M_Activity_S_ToVMActivityOverview] = new UIActionMenuSelectorActivityToVMActivityOverview(this);
3519
3520 /* Create 'File Manager' actions: */
3521 m_pool[UIActionIndex_M_FileManager] = new UIActionMenuFileManager(this);
3522 m_pool[UIActionIndex_M_FileManager_M_HostSubmenu] = new UIActionMenuFileManagerHostSubmenu(this);
3523 m_pool[UIActionIndex_M_FileManager_M_GuestSubmenu] = new UIActionMenuFileManagerGuestSubmenu(this);
3524 m_pool[UIActionIndex_M_FileManager_S_CopyToGuest] = new UIActionMenuFileManagerCopyToGuest(this);
3525 m_pool[UIActionIndex_M_FileManager_S_CopyToHost] = new UIActionMenuFileManagerCopyToHost(this);
3526 m_pool[UIActionIndex_M_FileManager_T_Preferences] = new UIActionMenuFileManagerPreferences(this);
3527 m_pool[UIActionIndex_M_FileManager_T_Log] = new UIActionMenuFileManagerLog(this);
3528 m_pool[UIActionIndex_M_FileManager_T_Operations] = new UIActionMenuFileManagerOperations(this);
3529 m_pool[UIActionIndex_M_FileManager_T_GuestSession] = new UIActionMenuFileManagerGuestSession(this);
3530 m_pool[UIActionIndex_M_FileManager_S_Host_GoUp] = new UIActionMenuFileManagerGoUp(this);
3531 m_pool[UIActionIndex_M_FileManager_S_Guest_GoUp] = new UIActionMenuFileManagerGoUp(this);
3532 m_pool[UIActionIndex_M_FileManager_S_Host_GoHome] = new UIActionMenuFileManagerGoHome(this);
3533 m_pool[UIActionIndex_M_FileManager_S_Guest_GoHome] = new UIActionMenuFileManagerGoHome(this);
3534 m_pool[UIActionIndex_M_FileManager_S_Host_GoForward] = new UIActionMenuFileManagerGoForward(this);
3535 m_pool[UIActionIndex_M_FileManager_S_Guest_GoForward] = new UIActionMenuFileManagerGoForward(this);
3536 m_pool[UIActionIndex_M_FileManager_S_Host_GoBackward] = new UIActionMenuFileManagerGoBackward(this);
3537 m_pool[UIActionIndex_M_FileManager_S_Guest_GoBackward] = new UIActionMenuFileManagerGoBackward(this);
3538 m_pool[UIActionIndex_M_FileManager_S_Host_Refresh] = new UIActionMenuFileManagerRefresh(this);
3539 m_pool[UIActionIndex_M_FileManager_S_Guest_Refresh] = new UIActionMenuFileManagerRefresh(this);
3540 m_pool[UIActionIndex_M_FileManager_S_Host_Delete] = new UIActionMenuFileManagerDelete(this);
3541 m_pool[UIActionIndex_M_FileManager_S_Guest_Delete] = new UIActionMenuFileManagerDelete(this);
3542 m_pool[UIActionIndex_M_FileManager_S_Host_Rename] = new UIActionMenuFileManagerRename(this);
3543 m_pool[UIActionIndex_M_FileManager_S_Guest_Rename] = new UIActionMenuFileManagerRename(this);
3544 m_pool[UIActionIndex_M_FileManager_S_Host_CreateNewDirectory] = new UIActionMenuFileManagerCreateNewDirectory(this);
3545 m_pool[UIActionIndex_M_FileManager_S_Guest_CreateNewDirectory] = new UIActionMenuFileManagerCreateNewDirectory(this);
3546 m_pool[UIActionIndex_M_FileManager_S_Host_Copy] = new UIActionMenuFileManagerCopy(this);
3547 m_pool[UIActionIndex_M_FileManager_S_Guest_Copy] = new UIActionMenuFileManagerCopy(this);
3548 m_pool[UIActionIndex_M_FileManager_S_Host_Cut] = new UIActionMenuFileManagerCut(this);
3549 m_pool[UIActionIndex_M_FileManager_S_Guest_Cut] = new UIActionMenuFileManagerCut(this);
3550 m_pool[UIActionIndex_M_FileManager_S_Host_Paste] = new UIActionMenuFileManagerPaste(this);
3551 m_pool[UIActionIndex_M_FileManager_S_Guest_Paste] = new UIActionMenuFileManagerPaste(this);
3552 m_pool[UIActionIndex_M_FileManager_S_Host_SelectAll] = new UIActionMenuFileManagerSelectAll(this);
3553 m_pool[UIActionIndex_M_FileManager_S_Guest_SelectAll] = new UIActionMenuFileManagerSelectAll(this);
3554 m_pool[UIActionIndex_M_FileManager_S_Host_InvertSelection] = new UIActionMenuFileManagerInvertSelection(this);
3555 m_pool[UIActionIndex_M_FileManager_S_Guest_InvertSelection] = new UIActionMenuFileManagerInvertSelection(this);
3556 m_pool[UIActionIndex_M_FileManager_S_Host_ShowProperties] = new UIActionMenuFileManagerShowProperties(this);
3557 m_pool[UIActionIndex_M_FileManager_S_Guest_ShowProperties] = new UIActionMenuFileManagerShowProperties(this);
3558
3559 /* Create VISO Creator actions: */
3560 m_pool[UIActionIndex_M_VISOCreator] = new UIActionMenuVISOCreator(this);
3561 m_pool[UIActionIndex_M_VISOCreator_ToggleSettingsDialog] = new UIActionMenuVISOCreatorToggleSettingsDialog(this);
3562 m_pool[UIActionIndex_M_VISOCreator_Add] = new UIActionMenuVISOCreatorAdd(this);
3563 m_pool[UIActionIndex_M_VISOCreator_Remove] = new UIActionMenuVISOCreatorRemove(this);
3564 m_pool[UIActionIndex_M_VISOCreator_Restore] = new UIActionMenuVISOCreatorRestore(this);
3565 m_pool[UIActionIndex_M_VISOCreator_CreateNewDirectory] = new UIActionMenuVISOCreatorCreateNewDirectory(this);
3566 m_pool[UIActionIndex_M_VISOCreator_Rename] = new UIActionMenuVISOCreatorRename(this);
3567 m_pool[UIActionIndex_M_VISOCreator_Reset] = new UIActionMenuVISOCreatorReset(this);
3568 m_pool[UIActionIndex_M_VISOCreator_Open] = new UIActionMenuVISOCreatorOpen(this);
3569 m_pool[UIActionIndex_M_VISOCreator_SaveAs] = new UIActionMenuVISOCreatorSaveAs(this);
3570 m_pool[UIActionIndex_M_VISOCreator_ImportISO] = new UIActionMenuVISOCreatorImportISO(this);
3571 m_pool[UIActionIndex_M_VISOCreator_RemoveISO] = new UIActionMenuVISOCreatorRemoveISO(this);
3572
3573 m_pool[UIActionIndex_M_VISOCreator_VisoContent_GoHome] = new UIActionMenuVISOCreatorGoHome(this);
3574 m_pool[UIActionIndex_M_VISOCreator_VisoContent_GoUp] = new UIActionMenuVISOCreatorGoUp(this);
3575 m_pool[UIActionIndex_M_VISOCreator_VisoContent_GoForward] = new UIActionMenuVISOCreatorGoForward(this);
3576 m_pool[UIActionIndex_M_VISOCreator_VisoContent_GoBackward] = new UIActionMenuVISOCreatorGoBackward(this);
3577 m_pool[UIActionIndex_M_VISOCreator_Host_GoHome] = new UIActionMenuVISOCreatorGoHome(this);
3578 m_pool[UIActionIndex_M_VISOCreator_Host_GoUp] = new UIActionMenuVISOCreatorGoUp(this);
3579 m_pool[UIActionIndex_M_VISOCreator_Host_GoForward] = new UIActionMenuVISOCreatorGoForward(this);
3580 m_pool[UIActionIndex_M_VISOCreator_Host_GoBackward] = new UIActionMenuVISOCreatorGoBackward(this);
3581
3582
3583 /* Medium Selector actions: */
3584 m_pool[UIActionIndex_M_MediumSelector] = new UIActionMenuMediumSelector(this);
3585 m_pool[UIActionIndex_M_MediumSelector_AddHD] = new UIActionMenuMediumSelectorAddHD(this);
3586 m_pool[UIActionIndex_M_MediumSelector_AddCD] = new UIActionMenuMediumSelectorAddCD(this);
3587 m_pool[UIActionIndex_M_MediumSelector_AddFD] = new UIActionMenuMediumSelectorAddFD(this);
3588 m_pool[UIActionIndex_M_MediumSelector_CreateHD] = new UIActionMenuMediumSelectorCreateHD(this);
3589 m_pool[UIActionIndex_M_MediumSelector_CreateCD] = new UIActionMenuMediumSelectorCreateCD(this);
3590 m_pool[UIActionIndex_M_MediumSelector_CreateFD] = new UIActionMenuMediumSelectorCreateFD(this);
3591 m_pool[UIActionIndex_M_MediumSelector_Refresh] = new UIActionMenuMediumSelectorRefresh(this);
3592
3593 /* Prepare update-handlers for known menus: */
3594#ifdef VBOX_WS_MAC
3595 m_menuUpdateHandlers[UIActionIndex_M_Application].ptf = &UIActionPool::updateMenuApplication;
3596 m_menuUpdateHandlers[UIActionIndex_M_Window].ptf = &UIActionPool::updateMenuWindow;
3597#endif
3598 m_menuUpdateHandlers[UIActionIndex_Menu_Help].ptf = &UIActionPool::updateMenuHelp;
3599 m_menuUpdateHandlers[UIActionIndex_M_LogWindow].ptf = &UIActionPool::updateMenuLogViewerWindow;
3600 m_menuUpdateHandlers[UIActionIndex_M_Log].ptf = &UIActionPool::updateMenuLogViewer;
3601 m_menuUpdateHandlers[UIActionIndex_M_Activity].ptf = &UIActionPool::updateMenuVMActivityMonitor;
3602 m_menuUpdateHandlers[UIActionIndex_M_FileManager].ptf = &UIActionPool::updateMenuFileManager;
3603
3604 /* Invalidate all known menus: */
3605#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
3606 QList<int> const updateHandlerKeys = m_menuUpdateHandlers.keys();
3607 m_invalidations.unite(QSet<int>(updateHandlerKeys.begin(), updateHandlerKeys.end()));
3608#else
3609 m_invalidations.unite(m_menuUpdateHandlers.keys().toSet());
3610#endif
3611
3612 /* Apply language settings: */
3613 retranslateUi();
3614}
3615
3616void UIActionPool::prepareConnections()
3617{
3618 /* 'Application' menu connections: */
3619#ifdef VBOX_WS_MAC
3620 connect(action(UIActionIndex_M_Application_S_About), &UIAction::triggered,
3621 &msgCenter(), &UIMessageCenter::sltShowHelpAboutDialog, Qt::UniqueConnection);
3622#endif
3623#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
3624 connect(action(UIActionIndex_M_Application_S_CheckForUpdates), &UIAction::triggered,
3625 gUpdateManager, &UIUpdateManager::sltForceCheck, Qt::UniqueConnection);
3626#endif
3627 connect(action(UIActionIndex_M_Application_S_ResetWarnings), &UIAction::triggered,
3628 &msgCenter(), &UIMessageCenter::sltResetSuppressedMessages, Qt::UniqueConnection);
3629
3630 /* 'Help' menu connections. Note that connections for UIActionIndex_Simple_Contents
3631 * are done in manager and runtime UIs separately in their respective classes: */
3632 connect(action(UIActionIndex_Simple_OnlineDocumentation), &UIAction::triggered,
3633 &msgCenter(), &UIMessageCenter::sltShowOnlineDocumentation, Qt::UniqueConnection);
3634 connect(action(UIActionIndex_Simple_WebSite), &UIAction::triggered,
3635 &msgCenter(), &UIMessageCenter::sltShowHelpWebDialog, Qt::UniqueConnection);
3636 connect(action(UIActionIndex_Simple_BugTracker), &UIAction::triggered,
3637 &msgCenter(), &UIMessageCenter::sltShowBugTracker, Qt::UniqueConnection);
3638 connect(action(UIActionIndex_Simple_Forums), &UIAction::triggered,
3639 &msgCenter(), &UIMessageCenter::sltShowForums, Qt::UniqueConnection);
3640 connect(action(UIActionIndex_Simple_Oracle), &UIAction::triggered,
3641 &msgCenter(), &UIMessageCenter::sltShowOracle, Qt::UniqueConnection);
3642#ifndef VBOX_WS_MAC
3643 connect(action(UIActionIndex_Simple_About), &UIAction::triggered,
3644 &msgCenter(), &UIMessageCenter::sltShowHelpAboutDialog, Qt::UniqueConnection);
3645#endif
3646}
3647
3648void UIActionPool::cleanupConnections()
3649{
3650 /* Nothing for now.. */
3651}
3652
3653void UIActionPool::cleanupPool()
3654{
3655 qDeleteAll(m_groupPool);
3656 qDeleteAll(m_pool);
3657}
3658
3659void UIActionPool::updateConfiguration()
3660{
3661 /* Recache common action restrictions: */
3662 // Nothing here for now..
3663
3664#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
3665 /* Recache update action restrictions: */
3666 bool fUpdateAllowed = gEDataManager->applicationUpdateEnabled();
3667 if (!fUpdateAllowed)
3668 {
3669 m_restrictedActionsMenuApplication[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::MenuApplicationActionType)
3670 (m_restrictedActionsMenuApplication[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::MenuApplicationActionType_CheckForUpdates);
3671 }
3672#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
3673
3674 /* Update menus: */
3675 updateMenus();
3676}
3677
3678void UIActionPool::updateMenu(int iIndex)
3679{
3680 /* Make sure index belongs to this class: */
3681 AssertReturnVoid(iIndex < UIActionIndex_Max);
3682
3683 /* If menu with such index is invalidated
3684 * and there is update-handler => handle it here: */
3685 if ( m_invalidations.contains(iIndex)
3686 && m_menuUpdateHandlers.contains(iIndex))
3687 (this->*(m_menuUpdateHandlers.value(iIndex).ptf))();
3688}
3689
3690void UIActionPool::updateShortcuts()
3691{
3692 gShortcutPool->applyShortcuts(this);
3693}
3694
3695bool UIActionPool::event(QEvent *pEvent)
3696{
3697 /* Depending on event-type: */
3698 switch ((UIEventTypeActionPool)pEvent->type())
3699 {
3700 case UIEventTypeActionPool_ActivateAction:
3701 {
3702 /* Process specific event: */
3703 ActivateActionEvent *pActionEvent = static_cast<ActivateActionEvent*>(pEvent);
3704 pActionEvent->action()->trigger();
3705 pEvent->accept();
3706 return true;
3707 }
3708 default:
3709 break;
3710 }
3711 /* Pass to the base-class: */
3712 return QObject::event(pEvent);
3713}
3714
3715void UIActionPool::retranslateUi()
3716{
3717 /* Translate all the actions: */
3718 foreach (const int iActionPoolKey, m_pool.keys())
3719 m_pool[iActionPoolKey]->retranslateUi();
3720 /* Update shortcuts: */
3721 updateShortcuts();
3722}
3723
3724bool UIActionPool::addAction(UIMenu *pMenu, UIAction *pAction, bool fReallyAdd /* = true */)
3725{
3726 /* Check if action is allowed: */
3727 const bool fIsActionAllowed = pAction->isAllowed();
3728
3729#ifdef VBOX_WS_MAC
3730 /* Check if menu is consumable: */
3731 const bool fIsMenuConsumable = pMenu->isConsumable();
3732 /* Check if menu is NOT yet consumed: */
3733 const bool fIsMenuConsumed = pMenu->isConsumed();
3734#endif
3735
3736 /* Make this action visible
3737 * depending on clearance state. */
3738 pAction->setVisible(fIsActionAllowed);
3739
3740#ifdef VBOX_WS_MAC
3741 /* If menu is consumable: */
3742 if (fIsMenuConsumable)
3743 {
3744 /* Add action only if menu was not yet consumed: */
3745 if (!fIsMenuConsumed)
3746 pMenu->addAction(pAction);
3747 }
3748 /* If menu is NOT consumable: */
3749 else
3750#endif
3751 {
3752 /* Add action only if is allowed: */
3753 if (fIsActionAllowed && fReallyAdd)
3754 pMenu->addAction(pAction);
3755 }
3756
3757 /* Return if action is allowed: */
3758 return fIsActionAllowed;
3759}
3760
3761bool UIActionPool::addMenu(QList<QMenu*> &menuList, UIAction *pAction, bool fReallyAdd /* = true */)
3762{
3763 /* Check if action is allowed: */
3764 const bool fIsActionAllowed = pAction->isAllowed();
3765
3766 /* Get action's menu: */
3767 UIMenu *pMenu = pAction->menu();
3768
3769#ifdef VBOX_WS_MAC
3770 /* Check if menu is consumable: */
3771 const bool fIsMenuConsumable = pMenu->isConsumable();
3772 /* Check if menu is NOT yet consumed: */
3773 const bool fIsMenuConsumed = pMenu->isConsumed();
3774#endif
3775
3776 /* Make this action visible
3777 * depending on clearance state. */
3778 pAction->setVisible( fIsActionAllowed
3779#ifdef VBOX_WS_MAC
3780 || fIsMenuConsumable
3781#endif
3782 );
3783
3784#ifdef VBOX_WS_MAC
3785 /* If menu is consumable: */
3786 if (fIsMenuConsumable)
3787 {
3788 /* Add action's menu only if menu was not yet consumed: */
3789 if (!fIsMenuConsumed)
3790 menuList << pMenu;
3791 }
3792 /* If menu is NOT consumable: */
3793 else
3794#endif
3795 {
3796 /* Add action only if is allowed: */
3797 if (fIsActionAllowed && fReallyAdd)
3798 menuList << pMenu;
3799 }
3800
3801 /* Return if action is allowed: */
3802 return fIsActionAllowed;
3803}
3804
3805void UIActionPool::updateMenuApplication()
3806{
3807 /* Get corresponding menu: */
3808 UIMenu *pMenu = action(UIActionIndex_M_Application)->menu();
3809 AssertPtrReturnVoid(pMenu);
3810#ifdef VBOX_WS_MAC
3811 AssertReturnVoid(pMenu->isConsumable());
3812#endif
3813 /* Clear contents: */
3814#ifdef VBOX_WS_MAC
3815 if (!pMenu->isConsumed())
3816#endif
3817 pMenu->clear();
3818
3819 /* Separator: */
3820 bool fSeparator = false;
3821
3822#ifdef VBOX_WS_MAC
3823 /* 'About' action: */
3824 fSeparator = addAction(pMenu, action(UIActionIndex_M_Application_S_About)) || fSeparator;
3825#endif
3826
3827 /* 'Preferences' action: */
3828 fSeparator = addAction(pMenu, action(UIActionIndex_M_Application_S_Preferences)) || fSeparator;
3829
3830#ifndef VBOX_WS_MAC
3831 /* Separator: */
3832 if (fSeparator)
3833 {
3834 pMenu->addSeparator();
3835 fSeparator = false;
3836 }
3837#endif
3838
3839 /* 'Reset Warnings' action: */
3840 fSeparator = addAction(pMenu, action(UIActionIndex_M_Application_S_ResetWarnings)) || fSeparator;
3841
3842#ifndef VBOX_WS_MAC
3843 /* Separator: */
3844 if (fSeparator)
3845 {
3846 pMenu->addSeparator();
3847 fSeparator = false;
3848 }
3849#endif
3850
3851 /* 'Close' action: */
3852 fSeparator = addAction(pMenu, action(UIActionIndex_M_Application_S_Close)) || fSeparator;
3853
3854 /* Mark menu as valid: */
3855 m_invalidations.remove(UIActionIndex_M_Application);
3856}
3857
3858#ifdef VBOX_WS_MAC
3859void UIActionPool::updateMenuWindow()
3860{
3861 /* Get corresponding menu: */
3862 UIMenu *pMenu = action(UIActionIndex_M_Window)->menu();
3863 AssertPtrReturnVoid(pMenu);
3864 /* Clear contents: */
3865 pMenu->clear();
3866
3867 /* Separator: */
3868 bool fSeparator = false;
3869
3870 /* 'Minimize' action: */
3871 fSeparator = addAction(pMenu, action(UIActionIndex_M_Window_S_Minimize)) || fSeparator;
3872
3873 /* Separator: */
3874 if (fSeparator)
3875 {
3876 pMenu->addSeparator();
3877 fSeparator = false;
3878 }
3879
3880 /* This menu always remains invalid.. */
3881}
3882#endif /* VBOX_WS_MAC */
3883
3884void UIActionPool::updateMenuHelp()
3885{
3886 /* Get corresponding menu: */
3887 UIMenu *pMenu = action(UIActionIndex_Menu_Help)->menu();
3888 AssertPtrReturnVoid(pMenu);
3889 /* Clear contents: */
3890 pMenu->clear();
3891
3892 /* Separator? */
3893 bool fSeparator = false;
3894
3895 /* 'Contents' action: */
3896 fSeparator = addAction(pMenu, action(UIActionIndex_Simple_Contents)) || fSeparator;
3897 /* 'Online Documentation' action: */
3898 fSeparator = addAction(pMenu, action(UIActionIndex_Simple_OnlineDocumentation)) || fSeparator;
3899 /* 'Web Site' action: */
3900 fSeparator = addAction(pMenu, action(UIActionIndex_Simple_WebSite)) || fSeparator;
3901 /* 'Bug Tracker' action: */
3902 fSeparator = addAction(pMenu, action(UIActionIndex_Simple_BugTracker)) || fSeparator;
3903 /* 'Forums' action: */
3904 fSeparator = addAction(pMenu, action(UIActionIndex_Simple_Forums)) || fSeparator;
3905 /* 'Oracle' action: */
3906 fSeparator = addAction(pMenu, action(UIActionIndex_Simple_Oracle)) || fSeparator;
3907
3908#ifndef VBOX_WS_MAC
3909 /* Separator? */
3910 if (fSeparator)
3911 {
3912 pMenu->addSeparator();
3913 fSeparator = false;
3914 }
3915
3916 /* 'About' action: */
3917 fSeparator = addAction(pMenu, action(UIActionIndex_Simple_About)) || fSeparator;
3918#endif
3919
3920 /* Mark menu as valid: */
3921 m_invalidations.remove(UIActionIndex_Menu_Help);
3922}
3923
3924void UIActionPool::updateMenuLogViewerWindow()
3925{
3926 /* Update corresponding menu: */
3927 updateMenuLogViewerWrapper(action(UIActionIndex_M_LogWindow)->menu());
3928
3929 /* Mark menu as valid: */
3930 m_invalidations.remove(UIActionIndex_M_LogWindow);
3931}
3932
3933void UIActionPool::updateMenuLogViewer()
3934{
3935 /* Update corresponding menu: */
3936 updateMenuLogViewerWrapper(action(UIActionIndex_M_Log)->menu());
3937
3938 /* Mark menu as valid: */
3939 m_invalidations.remove(UIActionIndex_M_Log);
3940}
3941
3942void UIActionPool::updateMenuLogViewerWrapper(UIMenu *pMenu)
3943{
3944 /* Clear contents: */
3945 pMenu->clear();
3946
3947 /* Separator? */
3948 bool fSeparator = false;
3949
3950 /* 'Save' action: */
3951 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_S_Save)) || fSeparator;
3952
3953 /* Separator? */
3954 if (fSeparator)
3955 {
3956 pMenu->addSeparator();
3957 fSeparator = false;
3958 }
3959
3960 /* 'Find' action: */
3961 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_T_Find)) || fSeparator;
3962 /* 'Filter' action: */
3963 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_T_Filter)) || fSeparator;
3964 /* 'Bookmarks' action: */
3965 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_T_Bookmark)) || fSeparator;
3966 /* 'Preferences' action: */
3967 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_T_Preferences)) || fSeparator;
3968
3969 /* Separator? */
3970 if (fSeparator)
3971 {
3972 pMenu->addSeparator();
3973 fSeparator = false;
3974 }
3975
3976 /* 'Refresh' action: */
3977 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_S_Refresh)) || fSeparator;
3978 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_S_Reload)) || fSeparator;
3979}
3980
3981void UIActionPool::updateMenuVMActivityMonitor()
3982{
3983 /* Get corresponding menu: */
3984 UIMenu *pMenu = action(UIActionIndex_M_Activity)->menu();
3985 AssertPtrReturnVoid(pMenu);
3986 /* Clear contents: */
3987 pMenu->clear();
3988
3989 /* 'Export' and 'Switch to VM Activity Overview" actions: */
3990 pMenu->addAction(action(UIActionIndex_M_Activity_S_Export));
3991 pMenu->addAction(action(UIActionIndex_M_Activity_S_ToVMActivityOverview));
3992
3993 /* Mark menu as valid: */
3994 m_invalidations.remove(UIActionIndex_M_Activity);
3995}
3996
3997void UIActionPool::updateMenuFileManager()
3998{
3999 updateMenuFileManagerWrapper(action(UIActionIndex_M_FileManager)->menu());
4000
4001 /* Mark menu as valid: */
4002 m_invalidations.remove(UIActionIndex_M_FileManager);
4003}
4004
4005void UIActionPool::updateMenuFileManagerWrapper(UIMenu *pMenu)
4006{
4007 addAction(pMenu, action(UIActionIndex_M_FileManager_T_Preferences));
4008 addAction(pMenu, action(UIActionIndex_M_FileManager_T_Operations));
4009 addAction(pMenu, action(UIActionIndex_M_FileManager_T_Log));
4010
4011 addAction(pMenu, action(UIActionIndex_M_FileManager_M_HostSubmenu));
4012 addAction(pMenu, action(UIActionIndex_M_FileManager_M_GuestSubmenu));
4013
4014 UIMenu *pHostSubmenu = action(UIActionIndex_M_FileManager_M_HostSubmenu)->menu();
4015 if (pHostSubmenu)
4016 {
4017 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_GoUp));
4018 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_GoHome));
4019 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_Refresh));
4020 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_Delete));
4021 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_Rename));
4022 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_CreateNewDirectory));
4023 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_Copy));
4024 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_Cut));
4025 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_Paste));
4026 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_SelectAll));
4027 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_InvertSelection));
4028 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_ShowProperties));
4029 }
4030
4031 UIMenu *pGuestSubmenu = action(UIActionIndex_M_FileManager_M_GuestSubmenu)->menu();
4032 if (pGuestSubmenu)
4033 {
4034 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Host_GoUp));
4035 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_GoHome));
4036 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_Refresh));
4037 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_Delete));
4038 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_Rename));
4039 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_CreateNewDirectory));
4040 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_Copy));
4041 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_Cut));
4042 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_Paste));
4043 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_SelectAll));
4044 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_InvertSelection));
4045 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_ShowProperties));
4046 }
4047}
4048
4049void UIActionPool::prepare()
4050{
4051 /* Prepare pool: */
4052 preparePool();
4053 /* Prepare connections: */
4054 prepareConnections();
4055
4056 /* Update configuration: */
4057 updateConfiguration();
4058 /* Update shortcuts: */
4059 updateShortcuts();
4060}
4061
4062void UIActionPool::cleanup()
4063{
4064 /* Cleanup connections: */
4065 cleanupConnections();
4066 /* Cleanup pool: */
4067 cleanupPool();
4068}
4069
4070
4071#include "UIActionPool.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