VirtualBox

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

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

FE/Qt: bugref:10496, bugref:9072. Some renaming.

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