VirtualBox

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

Last change on this file since 100347 was 100323, checked in by vboxsync, 19 months ago

FE/Qt: bugref:9080. Adding navigation actions to the content browser's toolbar.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 136.4 KB
Line 
1/* $Id: UIActionPool.cpp 100323 2023-06-28 12:23:10Z 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 Options' action class. */
1313class UIActionMenuSelectorLogTogglePaneOptions : public UIActionToggle
1314{
1315 Q_OBJECT;
1316
1317public:
1318
1319 /** Constructs action passing @a pParent to the base-class. */
1320 UIActionMenuSelectorLogTogglePaneOptions(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("ToggleLogOptions");
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", "&Options"));
1346 setShortcutScope(QApplication::translate("UIActionPool", "Log Viewer"));
1347 setStatusTip(QApplication::translate("UIActionPool", "Open pane with log viewer options"));
1348 setToolTip( QApplication::translate("UIActionPool", "Open Options 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 Options' panel in file manager. */
1644class UIActionMenuFileManagerOptions : public UIActionToggle
1645{
1646 Q_OBJECT;
1647
1648public:
1649
1650 /** Constructs action passing @a pParent to the base-class. */
1651 UIActionMenuFileManagerOptions(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", "Options"));
1677 setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
1678 setStatusTip(QApplication::translate("UIActionPool", "Open panel with file manager options"));
1679 setToolTip( QApplication::translate("UIActionPool", "Open Options 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 UIActionMenuVISOCreatorCreateNewDirectory : public UIActionSimple
2486{
2487 Q_OBJECT;
2488
2489public:
2490 /** Constructs action passing @a pParent to the base-class. */
2491 UIActionMenuVISOCreatorCreateNewDirectory(UIActionPool *pParent)
2492 : UIActionSimple(pParent,
2493 ":/file_manager_new_directory_24px.png",
2494 ":/file_manager_new_directory_16px.png",
2495 ":/file_manager_new_directory_disabled_24px.png",
2496 ":/file_manager_new_directory_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("VISONewDirectory");
2507 }
2508
2509 /** Handles translation event. */
2510 virtual void retranslateUi() RT_OVERRIDE
2511 {
2512 setName(QApplication::translate("UIActionPool", "&New Directory"));
2513 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2514 setStatusTip(QApplication::translate("UIActionPool", "Create a new directory under the current location"));
2515 setToolTip(QApplication::translate("UIActionPool", "Create New Directory")
2516 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2517 }
2518};
2519
2520class UIActionMenuVISOCreatorRename : public UIActionSimple
2521{
2522 Q_OBJECT;
2523
2524public:
2525 /** Constructs action passing @a pParent to the base-class. */
2526 UIActionMenuVISOCreatorRename(UIActionPool *pParent)
2527 : UIActionSimple(pParent,
2528 ":/file_manager_rename_24px.png",
2529 ":/file_manager_rename_16px.png",
2530 ":/file_manager_rename_disabled_24px.png",
2531 ":/file_manager_rename_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("VISORenameItem");
2542 }
2543
2544 /** Handles translation event. */
2545 virtual void retranslateUi() RT_OVERRIDE
2546 {
2547 setName(QApplication::translate("UIActionPool", "&Rename"));
2548 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2549 setStatusTip(QApplication::translate("UIActionPool", "Rename the selected object"));
2550 setToolTip(QApplication::translate("UIActionPool", "Rename Selected VISO File Object")
2551 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2552 }
2553};
2554
2555class UIActionMenuVISOCreatorReset : public UIActionSimple
2556{
2557 Q_OBJECT;
2558
2559public:
2560 /** Constructs action passing @a pParent to the base-class. */
2561 UIActionMenuVISOCreatorReset(UIActionPool *pParent)
2562 : UIActionSimple(pParent,
2563 ":/cd_remove_16px.png", ":/cd_remove_disabled_16px.png")
2564 {
2565 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2566 }
2567
2568protected:
2569
2570 /** Returns shortcut extra-data ID. */
2571 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2572 {
2573 return QString("VISOReset");
2574 }
2575
2576 /** Handles translation event. */
2577 virtual void retranslateUi() RT_OVERRIDE
2578 {
2579 setName(QApplication::translate("UIActionPool", "R&eset"));
2580 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2581 setStatusTip(QApplication::translate("UIActionPool", "Reset the VISO content."));
2582 setToolTip(QApplication::translate("UIActionPool", "Reset the VISO content.")
2583 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2584 }
2585};
2586
2587class UIActionMenuVISOCreatorOpen : public UIActionSimple
2588{
2589 Q_OBJECT;
2590
2591public:
2592 /** Constructs action passing @a pParent to the base-class. */
2593 UIActionMenuVISOCreatorOpen(UIActionPool *pParent)
2594 : UIActionSimple(pParent,
2595 ":/cd_remove_16px.png", ":/cd_remove_32px.png")
2596 {
2597 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2598 }
2599
2600protected:
2601
2602 /** Returns shortcut extra-data ID. */
2603 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2604 {
2605 return QString("VISOOpen");
2606 }
2607
2608 /** Handles translation event. */
2609 virtual void retranslateUi() RT_OVERRIDE
2610 {
2611 setName(QApplication::translate("UIActionPool", "Open"));
2612 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2613 setStatusTip(QApplication::translate("UIActionPool", "Open the VISO content."));
2614 setToolTip(QApplication::translate("UIActionPool", "Open the VISO content.")
2615 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2616 }
2617};
2618
2619
2620class UIActionMenuVISOCreatorImportISO : public UIActionSimple
2621{
2622 Q_OBJECT;
2623
2624public:
2625 /** Constructs action passing @a pParent to the base-class. */
2626 UIActionMenuVISOCreatorImportISO(UIActionPool *pParent)
2627 : UIActionSimple(pParent,
2628 ":/cd_add_16px.png", ":/cd_add_32px.png", ":/cd_add_disabled_16px.png", ":/cd_add_disabled_32px.png")
2629 {
2630 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2631 }
2632
2633protected:
2634
2635 /** Returns shortcut extra-data ID. */
2636 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2637 {
2638 return QString("ISOImport");
2639 }
2640
2641 /** Handles translation event. */
2642 virtual void retranslateUi() RT_OVERRIDE
2643 {
2644 setName(QApplication::translate("UIActionPool", "ISOImport"));
2645 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2646 setStatusTip(QApplication::translate("UIActionPool", "Import ISO into the VISO content."));
2647 setToolTip(QApplication::translate("UIActionPool", "Import Selected ISO(s) into the VISO content.")
2648 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2649 }
2650};
2651
2652/** Simple action extension, used as 'Perform GoUp' in VISO creator action class. */
2653class UIActionMenuVISOCreatorGoUp : public UIActionSimple
2654{
2655 Q_OBJECT;
2656
2657public:
2658
2659 /** Constructs action passing @a pParent to the base-class. */
2660 UIActionMenuVISOCreatorGoUp(UIActionPool *pParent)
2661 : UIActionSimple(pParent,
2662 ":/file_manager_go_up_24px.png", ":/file_manager_go_up_16px.png",
2663 ":/file_manager_go_up_disabled_24px.png", ":/file_manager_go_up_disabled_16px.png")
2664 {}
2665
2666protected:
2667
2668 /** Returns shortcut extra-data ID. */
2669 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2670 {
2671 return QString("VISOCreatorGoUp");
2672 }
2673
2674 /** Returns default shortcut. */
2675 virtual QKeySequence defaultShortcut(UIActionPoolType) const RT_OVERRIDE
2676 {
2677 return QKeySequence();
2678 }
2679
2680 /** Handles translation event. */
2681 virtual void retranslateUi() RT_OVERRIDE
2682 {
2683 setName(QApplication::translate("UIActionPool", "Go Up"));
2684 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2685 setStatusTip(QApplication::translate("UIActionPool", "Go one level up to parent folder"));
2686 setToolTip( QApplication::translate("UIActionPool", "Go One Level Up")
2687 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2688 }
2689};
2690
2691/** Simple action extension, used as 'Perform GoHome' in VISO creator action class. */
2692class UIActionMenuVISOCreatorGoHome : public UIActionSimple
2693{
2694 Q_OBJECT;
2695
2696public:
2697
2698 /** Constructs action passing @a pParent to the base-class. */
2699 UIActionMenuVISOCreatorGoHome(UIActionPool *pParent)
2700 : UIActionSimple(pParent,
2701 ":/file_manager_go_home_24px.png", ":/file_manager_go_home_16px.png",
2702 ":/file_manager_go_home_disabled_24px.png", ":/file_manager_go_home_disabled_16px.png")
2703 {}
2704
2705protected:
2706
2707 /** Returns shortcut extra-data ID. */
2708 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2709 {
2710 return QString("VISOCreatorGoHome");
2711 }
2712
2713 /** Returns default shortcut. */
2714 virtual QKeySequence defaultShortcut(UIActionPoolType) const RT_OVERRIDE
2715 {
2716 return QKeySequence();
2717 }
2718
2719 /** Handles translation event. */
2720 virtual void retranslateUi() RT_OVERRIDE
2721 {
2722 setName(QApplication::translate("UIActionPool", "Go Home"));
2723 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2724 setStatusTip(QApplication::translate("UIActionPool", "Go to home folder"));
2725 setToolTip( QApplication::translate("UIActionPool", "Go to Home Folder")
2726 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2727 }
2728};
2729
2730/** Simple action extension, used as 'Perform GoForward' in VISO creator action class. */
2731class UIActionMenuVISOCreatorGoForward : public UIActionSimple
2732{
2733 Q_OBJECT;
2734
2735public:
2736
2737 /** Constructs action passing @a pParent to the base-class. */
2738 UIActionMenuVISOCreatorGoForward(UIActionPool *pParent)
2739 : UIActionSimple(pParent,
2740 ":/file_manager_go_forward_24px.png", ":/file_manager_go_forward_16px.png",
2741 ":/file_manager_go_forward_disabled_24px.png", ":/file_manager_go_forward_disabled_16px.png")
2742 {}
2743
2744protected:
2745
2746 /** Returns shortcut extra-data ID. */
2747 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2748 {
2749 return QString("VISOCreatorGoForward");
2750 }
2751
2752 /** Returns default shortcut. */
2753 virtual QKeySequence defaultShortcut(UIActionPoolType) const RT_OVERRIDE
2754 {
2755 return QKeySequence();
2756 }
2757
2758 /** Handles translation event. */
2759 virtual void retranslateUi() RT_OVERRIDE
2760 {
2761 setName(QApplication::translate("UIActionPool", "Go Forward"));
2762 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2763 setStatusTip(QApplication::translate("UIActionPool", "Go forward"));
2764 setToolTip( QApplication::translate("UIActionPool", "Go Forward")
2765 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2766 }
2767};
2768
2769/** Simple action extension, used as 'Perform GoBackward' in VISO creator action class. */
2770class UIActionMenuVISOCreatorGoBackward : public UIActionSimple
2771{
2772 Q_OBJECT;
2773
2774public:
2775
2776 /** Constructs action passing @a pParent to the base-class. */
2777 UIActionMenuVISOCreatorGoBackward(UIActionPool *pParent)
2778 : UIActionSimple(pParent,
2779 ":/file_manager_go_backward_24px.png", ":/file_manager_go_backward_16px.png",
2780 ":/file_manager_go_backward_disabled_24px.png", ":/file_manager_go_backward_disabled_16px.png")
2781 {}
2782
2783protected:
2784
2785 /** Returns shortcut extra-data ID. */
2786 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2787 {
2788 return QString("VISOCreatorGoBackward");
2789 }
2790
2791 /** Returns default shortcut. */
2792 virtual QKeySequence defaultShortcut(UIActionPoolType) const RT_OVERRIDE
2793 {
2794 return QKeySequence();
2795 }
2796
2797 /** Handles translation event. */
2798 virtual void retranslateUi() RT_OVERRIDE
2799 {
2800 setName(QApplication::translate("UIActionPool", "Go Backward"));
2801 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
2802 setStatusTip(QApplication::translate("UIActionPool", "Go forward"));
2803 setToolTip( QApplication::translate("UIActionPool", "Go Backward")
2804 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2805 }
2806};
2807
2808/** Menu action extension, used as 'Menu Selector' menu class. */
2809class UIActionMenuMediumSelector : public UIActionMenu
2810{
2811 Q_OBJECT;
2812
2813public:
2814
2815 /** Constructs action passing @a pParent to the base-class. */
2816 UIActionMenuMediumSelector(UIActionPool *pParent)
2817 : UIActionMenu(pParent)
2818 {}
2819
2820protected:
2821
2822 /** Returns shortcut extra-data ID. */
2823 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2824 {
2825 return QString("MediumSelector");
2826 }
2827
2828 /** Handles translation event. */
2829 virtual void retranslateUi() RT_OVERRIDE
2830 {
2831 setName(QApplication::translate("UIActionPool", "&Medium Selector"));
2832 }
2833};
2834
2835/** Simple action extension, used as 'Add' action class. */
2836class UIActionMenuMediumSelectorAddHD : public UIActionSimple
2837{
2838 Q_OBJECT;
2839
2840public:
2841
2842 /** Constructs action passing @a pParent to the base-class. */
2843 UIActionMenuMediumSelectorAddHD(UIActionPool *pParent)
2844 : UIActionSimple(pParent, ":/hd_add_32px.png", ":/hd_add_16px.png",
2845 ":/hd_add_disabled_32px.png", ":/hd_add_disabled_16px.png")
2846 {
2847 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2848 }
2849
2850protected:
2851
2852 /** Returns shortcut extra-data ID. */
2853 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2854 {
2855 return QString("MediumSelectorAddHD");
2856 }
2857
2858 /** Handles translation event. */
2859 virtual void retranslateUi() RT_OVERRIDE
2860 {
2861 setName(QApplication::translate("UIActionPool", "&Add..."));
2862 setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
2863 setStatusTip(QApplication::translate("UIActionPool", "Add existing disk image file"));
2864 setToolTip( QApplication::translate("UIActionPool", "Add Disk Image File")
2865 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2866 }
2867};
2868
2869/** Simple action extension, used as 'Add' action class. */
2870class UIActionMenuMediumSelectorAddCD : public UIActionSimple
2871{
2872 Q_OBJECT;
2873
2874public:
2875
2876 /** Constructs action passing @a pParent to the base-class. */
2877 UIActionMenuMediumSelectorAddCD(UIActionPool *pParent)
2878 : UIActionSimple(pParent, ":/cd_add_32px.png", ":/cd_add_16px.png",
2879 ":/cd_add_disabled_32px.png", ":/cd_add_disabled_16px.png")
2880 {
2881 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2882 }
2883
2884protected:
2885
2886 /** Returns shortcut extra-data ID. */
2887 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2888 {
2889 return QString("MediumSelectorAddCD");
2890 }
2891
2892 /** Handles translation event. */
2893 virtual void retranslateUi() RT_OVERRIDE
2894 {
2895 setName(QApplication::translate("UIActionPool", "&Add..."));
2896 setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
2897 setStatusTip(QApplication::translate("UIActionPool", "Add existing disk image file"));
2898 setToolTip( QApplication::translate("UIActionPool", "Add Disk Image File")
2899 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2900 }
2901};
2902
2903/** Simple action extension, used as 'Add' action class. */
2904class UIActionMenuMediumSelectorAddFD : public UIActionSimple
2905{
2906 Q_OBJECT;
2907
2908public:
2909
2910 /** Constructs action passing @a pParent to the base-class. */
2911 UIActionMenuMediumSelectorAddFD(UIActionPool *pParent)
2912 : UIActionSimple(pParent, ":/fd_add_32px.png", ":/fd_add_16px.png",
2913 ":/fd_add_disabled_32px.png", ":/fd_add_disabled_16px.png")
2914 {
2915 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2916 }
2917
2918protected:
2919
2920 /** Returns shortcut extra-data ID. */
2921 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2922 {
2923 return QString("MediumSelectorAddFD");
2924 }
2925
2926 /** Handles translation event. */
2927 virtual void retranslateUi() RT_OVERRIDE
2928 {
2929 setName(QApplication::translate("UIActionPool", "&Add..."));
2930 setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
2931 setStatusTip(QApplication::translate("UIActionPool", "Add existing disk image file"));
2932 setToolTip( QApplication::translate("UIActionPool", "Add Disk Image File")
2933 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2934 }
2935};
2936
2937/** Simple action extension, used as 'Create' action class. */
2938class UIActionMenuMediumSelectorCreateHD : public UIActionSimple
2939{
2940 Q_OBJECT;
2941
2942public:
2943
2944 /** Constructs action passing @a pParent to the base-class. */
2945 UIActionMenuMediumSelectorCreateHD(UIActionPool *pParent)
2946 : UIActionSimple(pParent, ":/hd_create_32px.png", ":/hd_create_16px.png",
2947 ":/hd_create_disabled_32px.png", ":/hd_create_disabled_16px.png")
2948 {
2949 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2950 }
2951
2952protected:
2953
2954 /** Returns shortcut extra-data ID. */
2955 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2956 {
2957 return QString("MediumSelectorCreateHD");
2958 }
2959
2960 /** Handles translation event. */
2961 virtual void retranslateUi() RT_OVERRIDE
2962 {
2963 setName(QApplication::translate("UIActionPool", "&Create..."));
2964 setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
2965 setStatusTip(QApplication::translate("UIActionPool", "Create a new disk image file"));
2966 setToolTip( QApplication::translate("UIActionPool", "Create Disk Image File")
2967 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
2968 }
2969};
2970
2971/** Simple action extension, used as 'Create' action class. */
2972class UIActionMenuMediumSelectorCreateCD : public UIActionSimple
2973{
2974 Q_OBJECT;
2975
2976public:
2977
2978 /** Constructs action passing @a pParent to the base-class. */
2979 UIActionMenuMediumSelectorCreateCD(UIActionPool *pParent)
2980 : UIActionSimple(pParent, ":/cd_create_32px.png", ":/cd_create_16px.png",
2981 ":/cd_create_disabled_32px.png", ":/cd_create_disabled_16px.png")
2982 {
2983 setShortcutContext(Qt::WidgetWithChildrenShortcut);
2984 }
2985
2986protected:
2987
2988 /** Returns shortcut extra-data ID. */
2989 virtual QString shortcutExtraDataID() const RT_OVERRIDE
2990 {
2991 return QString("MediumSelectorCreateCD");
2992 }
2993
2994 /** Handles translation event. */
2995 virtual void retranslateUi() RT_OVERRIDE
2996 {
2997 setName(QApplication::translate("UIActionPool", "&Create..."));
2998 setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
2999 setStatusTip(QApplication::translate("UIActionPool", "Create a new disk image file"));
3000 setToolTip( QApplication::translate("UIActionPool", "Create Disk Image File")
3001 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
3002 }
3003};
3004
3005/** Simple action extension, used as 'Create' action class. */
3006class UIActionMenuMediumSelectorCreateFD : public UIActionSimple
3007{
3008 Q_OBJECT;
3009
3010public:
3011
3012 /** Constructs action passing @a pParent to the base-class. */
3013 UIActionMenuMediumSelectorCreateFD(UIActionPool *pParent)
3014 : UIActionSimple(pParent, ":/fd_create_32px.png", ":/fd_create_16px.png",
3015 ":/fd_create_disabled_32px.png", ":/fd_create_disabled_16px.png")
3016 {
3017 setShortcutContext(Qt::WidgetWithChildrenShortcut);
3018 }
3019
3020protected:
3021
3022 /** Returns shortcut extra-data ID. */
3023 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3024 {
3025 return QString("MediumSelectorCreateFD");
3026 }
3027
3028 /** Handles translation event. */
3029 virtual void retranslateUi() RT_OVERRIDE
3030 {
3031 setName(QApplication::translate("UIActionPool", "&Create..."));
3032 setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
3033 setStatusTip(QApplication::translate("UIActionPool", "Create a new disk image file"));
3034 setToolTip( QApplication::translate("UIActionPool", "Create Disk Image File")
3035 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
3036 }
3037};
3038
3039/** Simple action extension, used as 'Create' action class. */
3040class UIActionMenuMediumSelectorRefresh : public UIActionSimple
3041{
3042 Q_OBJECT;
3043
3044public:
3045
3046 /** Constructs action passing @a pParent to the base-class. */
3047 UIActionMenuMediumSelectorRefresh(UIActionPool *pParent)
3048 : UIActionSimple(pParent, ":/refresh_32px.png", ":/refresh_16px.png",
3049 ":/refresh_disabled_32px.png", ":/refresh_disabled_16px.png")
3050 {
3051 setShortcutContext(Qt::WidgetWithChildrenShortcut);
3052 }
3053
3054protected:
3055
3056 /** Returns shortcut extra-data ID. */
3057 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3058 {
3059 return QString("MediumSelectorRefresh");
3060 }
3061
3062 /** Handles translation event. */
3063 virtual void retranslateUi() RT_OVERRIDE
3064 {
3065 setName(QApplication::translate("UIActionPool", "&Refresh..."));
3066 setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
3067 setStatusTip(QApplication::translate("UIActionPool", "Refresh disk images"));
3068 setToolTip( QApplication::translate("UIActionPool", "Refresh Disk Images")
3069 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
3070 }
3071};
3072
3073/** Menu action extension, used as 'Activity' menu class. */
3074class UIActionMenuSelectorActivity : public UIActionMenu
3075{
3076 Q_OBJECT;
3077
3078public:
3079
3080 /** Constructs action passing @a pParent to the base-class. */
3081 UIActionMenuSelectorActivity(UIActionPool *pParent)
3082 : UIActionMenu(pParent)
3083 {}
3084
3085protected:
3086
3087 /** Returns shortcut extra-data ID. */
3088 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3089 {
3090 return QString("VMActivityMonitorMenu");
3091 }
3092
3093 /** Handles translation event. */
3094 virtual void retranslateUi() RT_OVERRIDE
3095 {
3096 setName(QApplication::translate("UIActionPool", "&Activity"));
3097 }
3098};
3099
3100/** Simple action extension, used as 'Perform Export' action class. */
3101class UIActionMenuSelectorActivityPerformExport : public UIActionSimple
3102{
3103 Q_OBJECT;
3104
3105public:
3106
3107 /** Constructs action passing @a pParent to the base-class. */
3108 UIActionMenuSelectorActivityPerformExport(UIActionPool *pParent)
3109 : UIActionSimple(pParent,
3110 ":/performance_monitor_export_32px.png", ":/performance_monitor_export_16px.png",
3111 ":/performance_monitor_export_disabled_32px.png", ":/performance_monitor_export_disabled_16px.png")
3112 {
3113 setShortcutContext(Qt::WidgetWithChildrenShortcut);
3114 }
3115
3116protected:
3117
3118 /** Returns shortcut extra-data ID. */
3119 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3120 {
3121 return QString("VMActivityMonitorExportCharts");
3122 }
3123
3124 /** Handles translation event. */
3125 virtual void retranslateUi() RT_OVERRIDE
3126 {
3127 setName(QApplication::translate("UIActionPool", "&Export..."));
3128 setShortcutScope(QApplication::translate("UIActionPool", "VM Activity Monitor"));
3129 setStatusTip(QApplication::translate("UIActionPool", "Export the chart data into a text file"));
3130 setToolTip( QApplication::translate("UIActionPool", "Export Data to File")
3131 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
3132 }
3133};
3134
3135/** Simple action extension, used as 'To VM Activity Overview' action class. */
3136class UIActionMenuSelectorActivityToVMActivityOverview : public UIActionSimple
3137{
3138 Q_OBJECT;
3139
3140public:
3141
3142 /** Constructs action passing @a pParent to the base-class. */
3143 UIActionMenuSelectorActivityToVMActivityOverview(UIActionPool *pParent)
3144 : UIActionSimple(pParent,
3145 ":/resources_monitor_24px.png", ":/resource_monitor_16px.png",
3146 ":/resource_monitor_disabled_24px.png", ":/resource_monitor_disabled_16px.png")
3147 {
3148 setShortcutContext(Qt::WidgetWithChildrenShortcut);
3149 }
3150
3151protected:
3152
3153 /** Returns shortcut extra-data ID. */
3154 virtual QString shortcutExtraDataID() const RT_OVERRIDE
3155 {
3156 return QString("ToVMActivityOverview");
3157 }
3158
3159 /** Handles translation event. */
3160 virtual void retranslateUi() RT_OVERRIDE
3161 {
3162 setName(QApplication::translate("UIActionPool", "&Activity Overview..."));
3163 setShortcutScope(QApplication::translate("UIActionPool", "Activity Monitor"));
3164 setStatusTip(QApplication::translate("UIActionPool", "Navigate to the vm activity overview"));
3165 setToolTip( QApplication::translate("UIActionPool", "Navigate to VM Activity Overview")
3166 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
3167 }
3168};
3169
3170
3171/*********************************************************************************************************************************
3172* Class UIActionPool implementation. *
3173*********************************************************************************************************************************/
3174
3175/* static */
3176UIActionPool *UIActionPool::create(UIActionPoolType enmType)
3177{
3178 UIActionPool *pActionPool = 0;
3179 switch (enmType)
3180 {
3181 case UIActionPoolType_Manager: pActionPool = new UIActionPoolManager; break;
3182 case UIActionPoolType_Runtime: pActionPool = new UIActionPoolRuntime; break;
3183 default: AssertFailedReturn(0);
3184 }
3185 AssertPtrReturn(pActionPool, 0);
3186 pActionPool->prepare();
3187 return pActionPool;
3188}
3189
3190/* static */
3191void UIActionPool::destroy(UIActionPool *pActionPool)
3192{
3193 AssertPtrReturnVoid(pActionPool);
3194 pActionPool->cleanup();
3195 delete pActionPool;
3196}
3197
3198/* static */
3199void UIActionPool::createTemporary(UIActionPoolType enmType)
3200{
3201 UIActionPool *pActionPool = 0;
3202 switch (enmType)
3203 {
3204 case UIActionPoolType_Manager: pActionPool = new UIActionPoolManager(true); break;
3205 case UIActionPoolType_Runtime: pActionPool = new UIActionPoolRuntime(true); break;
3206 default: AssertFailedReturnVoid();
3207 }
3208 AssertPtrReturnVoid(pActionPool);
3209 pActionPool->prepare();
3210 pActionPool->cleanup();
3211 delete pActionPool;
3212}
3213
3214UIActionPoolManager *UIActionPool::toManager()
3215{
3216 return qobject_cast<UIActionPoolManager*>(this);
3217}
3218
3219UIActionPoolRuntime *UIActionPool::toRuntime()
3220{
3221 return qobject_cast<UIActionPoolRuntime*>(this);
3222}
3223
3224UIAction *UIActionPool::action(int iIndex) const
3225{
3226 AssertReturn(m_pool.contains(iIndex), 0);
3227 return m_pool.value(iIndex);
3228}
3229
3230QList<UIAction*> UIActionPool::actions() const
3231{
3232 return m_pool.values();
3233}
3234
3235QActionGroup *UIActionPool::actionGroup(int iIndex) const
3236{
3237 AssertReturn(m_groupPool.contains(iIndex), 0);
3238 return m_groupPool.value(iIndex);
3239}
3240
3241bool UIActionPool::isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType enmType) const
3242{
3243 foreach (const UIExtraDataMetaDefs::MenuType &enmRestriction, m_restrictedMenus.values())
3244 if (enmRestriction & enmType)
3245 return false;
3246 return true;
3247}
3248
3249void UIActionPool::setRestrictionForMenuBar(UIActionRestrictionLevel enmLevel, UIExtraDataMetaDefs::MenuType enmRestriction)
3250{
3251 m_restrictedMenus[enmLevel] = enmRestriction;
3252 updateMenus();
3253}
3254
3255bool UIActionPool::isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType enmType) const
3256{
3257 foreach (const UIExtraDataMetaDefs::MenuApplicationActionType &enmRestriction, m_restrictedActionsMenuApplication.values())
3258 if (enmRestriction & enmType)
3259 return false;
3260 return true;
3261}
3262
3263void UIActionPool::setRestrictionForMenuApplication(UIActionRestrictionLevel enmLevel, UIExtraDataMetaDefs::MenuApplicationActionType enmRestriction)
3264{
3265 m_restrictedActionsMenuApplication[enmLevel] = enmRestriction;
3266 m_invalidations << UIActionIndex_M_Application;
3267}
3268
3269#ifdef VBOX_WS_MAC
3270bool UIActionPool::isAllowedInMenuWindow(UIExtraDataMetaDefs::MenuWindowActionType enmType) const
3271{
3272 foreach (const UIExtraDataMetaDefs::MenuWindowActionType &enmRestriction, m_restrictedActionsMenuWindow.values())
3273 if (enmRestriction & enmType)
3274 return false;
3275 return true;
3276}
3277
3278void UIActionPool::setRestrictionForMenuWindow(UIActionRestrictionLevel enmLevel, UIExtraDataMetaDefs::MenuWindowActionType enmRestriction)
3279{
3280 m_restrictedActionsMenuWindow[enmLevel] = enmRestriction;
3281 m_invalidations << UIActionIndex_M_Window;
3282}
3283#endif /* VBOX_WS_MAC */
3284
3285bool UIActionPool::isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType enmType) const
3286{
3287 foreach (const UIExtraDataMetaDefs::MenuHelpActionType &enmRestriction, m_restrictedActionsMenuHelp.values())
3288 if (enmRestriction & enmType)
3289 return false;
3290 return true;
3291}
3292
3293void UIActionPool::setRestrictionForMenuHelp(UIActionRestrictionLevel enmLevel, UIExtraDataMetaDefs::MenuHelpActionType enmRestriction)
3294{
3295 m_restrictedActionsMenuHelp[enmLevel] = enmRestriction;
3296 m_invalidations << UIActionIndex_Menu_Help;
3297}
3298
3299bool UIActionPool::processHotKey(const QKeySequence &key)
3300{
3301 /* Iterate through the whole list of keys: */
3302 foreach (const int &iKey, m_pool.keys())
3303 {
3304 /* Get current action: */
3305 UIAction *pAction = m_pool.value(iKey);
3306 /* Skip menus/separators: */
3307 if (pAction->type() == UIActionType_Menu)
3308 continue;
3309 /* Get the hot-key of the current action: */
3310 const QString strHotKey = gShortcutPool->shortcut(this, pAction).primaryToPortableText();
3311 if (pAction->isEnabled() && pAction->isAllowed() && !strHotKey.isEmpty())
3312 {
3313 if (key.matches(QKeySequence(strHotKey)) == QKeySequence::ExactMatch)
3314 {
3315 /* We asynchronously post a special event instead of calling
3316 * pAction->trigger() directly, to let key presses and
3317 * releases be processed correctly by Qt first.
3318 * Note: we assume that nobody will delete the menu item
3319 * corresponding to the key sequence, so that the pointer to
3320 * menu data posted along with the event will remain valid in
3321 * the event handler, at least until the main window is closed. */
3322 QApplication::postEvent(this, new ActivateActionEvent(pAction));
3323 return true;
3324 }
3325 }
3326 }
3327 return false;
3328}
3329
3330void UIActionPool::sltHandleMenuPrepare()
3331{
3332 /* Make sure menu is valid: */
3333 AssertPtrReturnVoid(sender());
3334 UIMenu *pMenu = qobject_cast<UIMenu*>(sender());
3335 AssertPtrReturnVoid(pMenu);
3336 /* Make sure action is valid: */
3337 AssertPtrReturnVoid(pMenu->menuAction());
3338 UIAction *pAction = qobject_cast<UIAction*>(pMenu->menuAction());
3339 AssertPtrReturnVoid(pAction);
3340
3341 /* Determine action index: */
3342 const int iIndex = m_pool.key(pAction);
3343
3344 /* Update menu if necessary: */
3345 updateMenu(iIndex);
3346
3347 /* Notify listeners about menu prepared: */
3348 emit sigNotifyAboutMenuPrepare(iIndex, pMenu);
3349}
3350
3351#ifdef VBOX_WS_MAC
3352void UIActionPool::sltActionHovered()
3353{
3354 /* Acquire sender action: */
3355 UIAction *pAction = qobject_cast<UIAction*>(sender());
3356 AssertPtrReturnVoid(pAction);
3357 //printf("Action hovered: {%s}\n", pAction->name().toUtf8().constData());
3358
3359 /* Notify listener about action hevering: */
3360 emit sigActionHovered(pAction);
3361}
3362#endif /* VBOX_WS_MAC */
3363
3364UIActionPool::UIActionPool(UIActionPoolType enmType, bool fTemporary /* = false */)
3365 : m_enmType(enmType)
3366 , m_fTemporary(fTemporary)
3367{
3368}
3369
3370void UIActionPool::preparePool()
3371{
3372 /* Create 'Application' actions: */
3373 m_pool[UIActionIndex_M_Application] = new UIActionMenuApplication(this);
3374#ifdef VBOX_WS_MAC
3375 m_pool[UIActionIndex_M_Application_S_About] = new UIActionSimpleAbout(this);
3376#endif
3377 m_pool[UIActionIndex_M_Application_S_Preferences] = new UIActionSimplePreferences(this);
3378#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
3379 m_pool[UIActionIndex_M_Application_S_CheckForUpdates] = new UIActionSimpleCheckForUpdates(this);
3380#endif
3381 m_pool[UIActionIndex_M_Application_S_ResetWarnings] = new UIActionSimpleResetWarnings(this);
3382 m_pool[UIActionIndex_M_Application_S_Close] = new UIActionSimplePerformClose(this);
3383
3384#ifdef VBOX_WS_MAC
3385 /* Create 'Window' actions: */
3386 m_pool[UIActionIndex_M_Window] = new UIActionMenuWindow(this);
3387 m_pool[UIActionIndex_M_Window_S_Minimize] = new UIActionSimpleMinimize(this);
3388#endif
3389
3390 /* Create 'Help' actions: */
3391 m_pool[UIActionIndex_Menu_Help] = new UIActionMenuHelp(this);
3392 m_pool[UIActionIndex_Simple_Contents] = new UIActionSimpleContents(this);
3393 m_pool[UIActionIndex_Simple_WebSite] = new UIActionSimpleWebSite(this);
3394 m_pool[UIActionIndex_Simple_BugTracker] = new UIActionSimpleBugTracker(this);
3395 m_pool[UIActionIndex_Simple_Forums] = new UIActionSimpleForums(this);
3396 m_pool[UIActionIndex_Simple_Oracle] = new UIActionSimpleOracle(this);
3397 m_pool[UIActionIndex_Simple_OnlineDocumentation] = new UIActionSimpleOnlineDocumentation(this);
3398#ifndef VBOX_WS_MAC
3399 m_pool[UIActionIndex_Simple_About] = new UIActionSimpleAbout(this);
3400#endif
3401
3402 /* Create 'Log Viewer' actions: */
3403 m_pool[UIActionIndex_M_LogWindow] = new UIActionMenuSelectorLog(this);
3404 m_pool[UIActionIndex_M_Log] = new UIActionMenuSelectorLog(this);
3405 m_pool[UIActionIndex_M_Log_T_Find] = new UIActionMenuSelectorLogTogglePaneFind(this);
3406 m_pool[UIActionIndex_M_Log_T_Filter] = new UIActionMenuSelectorLogTogglePaneFilter(this);
3407 m_pool[UIActionIndex_M_Log_T_Bookmark] = new UIActionMenuSelectorLogTogglePaneBookmark(this);
3408 m_pool[UIActionIndex_M_Log_T_Options] = new UIActionMenuSelectorLogTogglePaneOptions(this);
3409 m_pool[UIActionIndex_M_Log_S_Refresh] = new UIActionMenuSelectorLogPerformRefresh(this);
3410 m_pool[UIActionIndex_M_Log_S_Reload] = new UIActionMenuSelectorLogPerformReload(this);
3411 m_pool[UIActionIndex_M_Log_S_Save] = new UIActionMenuSelectorLogPerformSave(this);
3412
3413 /* Create 'Performance Monitor' actions: */
3414 m_pool[UIActionIndex_M_Activity] = new UIActionMenuSelectorActivity(this);
3415 m_pool[UIActionIndex_M_Activity_S_Export] = new UIActionMenuSelectorActivityPerformExport(this);
3416 m_pool[UIActionIndex_M_Activity_S_ToVMActivityOverview] = new UIActionMenuSelectorActivityToVMActivityOverview(this);
3417
3418 /* Create 'File Manager' actions: */
3419 m_pool[UIActionIndex_M_FileManager] = new UIActionMenuFileManager(this);
3420 m_pool[UIActionIndex_M_FileManager_M_HostSubmenu] = new UIActionMenuFileManagerHostSubmenu(this);
3421 m_pool[UIActionIndex_M_FileManager_M_GuestSubmenu] = new UIActionMenuFileManagerGuestSubmenu(this);
3422 m_pool[UIActionIndex_M_FileManager_S_CopyToGuest] = new UIActionMenuFileManagerCopyToGuest(this);
3423 m_pool[UIActionIndex_M_FileManager_S_CopyToHost] = new UIActionMenuFileManagerCopyToHost(this);
3424 m_pool[UIActionIndex_M_FileManager_T_Options] = new UIActionMenuFileManagerOptions(this);
3425 m_pool[UIActionIndex_M_FileManager_T_Log] = new UIActionMenuFileManagerLog(this);
3426 m_pool[UIActionIndex_M_FileManager_T_Operations] = new UIActionMenuFileManagerOperations(this);
3427 m_pool[UIActionIndex_M_FileManager_T_GuestSession] = new UIActionMenuFileManagerGuestSession(this);
3428 m_pool[UIActionIndex_M_FileManager_S_Host_GoUp] = new UIActionMenuFileManagerGoUp(this);
3429 m_pool[UIActionIndex_M_FileManager_S_Guest_GoUp] = new UIActionMenuFileManagerGoUp(this);
3430 m_pool[UIActionIndex_M_FileManager_S_Host_GoHome] = new UIActionMenuFileManagerGoHome(this);
3431 m_pool[UIActionIndex_M_FileManager_S_Guest_GoHome] = new UIActionMenuFileManagerGoHome(this);
3432 m_pool[UIActionIndex_M_FileManager_S_Host_GoForward] = new UIActionMenuFileManagerGoForward(this);
3433 m_pool[UIActionIndex_M_FileManager_S_Guest_GoForward] = new UIActionMenuFileManagerGoForward(this);
3434 m_pool[UIActionIndex_M_FileManager_S_Host_GoBackward] = new UIActionMenuFileManagerGoBackward(this);
3435 m_pool[UIActionIndex_M_FileManager_S_Guest_GoBackward] = new UIActionMenuFileManagerGoBackward(this);
3436 m_pool[UIActionIndex_M_FileManager_S_Host_Refresh] = new UIActionMenuFileManagerRefresh(this);
3437 m_pool[UIActionIndex_M_FileManager_S_Guest_Refresh] = new UIActionMenuFileManagerRefresh(this);
3438 m_pool[UIActionIndex_M_FileManager_S_Host_Delete] = new UIActionMenuFileManagerDelete(this);
3439 m_pool[UIActionIndex_M_FileManager_S_Guest_Delete] = new UIActionMenuFileManagerDelete(this);
3440 m_pool[UIActionIndex_M_FileManager_S_Host_Rename] = new UIActionMenuFileManagerRename(this);
3441 m_pool[UIActionIndex_M_FileManager_S_Guest_Rename] = new UIActionMenuFileManagerRename(this);
3442 m_pool[UIActionIndex_M_FileManager_S_Host_CreateNewDirectory] = new UIActionMenuFileManagerCreateNewDirectory(this);
3443 m_pool[UIActionIndex_M_FileManager_S_Guest_CreateNewDirectory] = new UIActionMenuFileManagerCreateNewDirectory(this);
3444 m_pool[UIActionIndex_M_FileManager_S_Host_Copy] = new UIActionMenuFileManagerCopy(this);
3445 m_pool[UIActionIndex_M_FileManager_S_Guest_Copy] = new UIActionMenuFileManagerCopy(this);
3446 m_pool[UIActionIndex_M_FileManager_S_Host_Cut] = new UIActionMenuFileManagerCut(this);
3447 m_pool[UIActionIndex_M_FileManager_S_Guest_Cut] = new UIActionMenuFileManagerCut(this);
3448 m_pool[UIActionIndex_M_FileManager_S_Host_Paste] = new UIActionMenuFileManagerPaste(this);
3449 m_pool[UIActionIndex_M_FileManager_S_Guest_Paste] = new UIActionMenuFileManagerPaste(this);
3450 m_pool[UIActionIndex_M_FileManager_S_Host_SelectAll] = new UIActionMenuFileManagerSelectAll(this);
3451 m_pool[UIActionIndex_M_FileManager_S_Guest_SelectAll] = new UIActionMenuFileManagerSelectAll(this);
3452 m_pool[UIActionIndex_M_FileManager_S_Host_InvertSelection] = new UIActionMenuFileManagerInvertSelection(this);
3453 m_pool[UIActionIndex_M_FileManager_S_Guest_InvertSelection] = new UIActionMenuFileManagerInvertSelection(this);
3454 m_pool[UIActionIndex_M_FileManager_S_Host_ShowProperties] = new UIActionMenuFileManagerShowProperties(this);
3455 m_pool[UIActionIndex_M_FileManager_S_Guest_ShowProperties] = new UIActionMenuFileManagerShowProperties(this);
3456
3457 /* Create VISO Creator actions: */
3458 m_pool[UIActionIndex_M_VISOCreator] = new UIActionMenuVISOCreator(this);
3459 m_pool[UIActionIndex_M_VISOCreator_ToggleSettingsDialog] = new UIActionMenuVISOCreatorToggleSettingsDialog(this);
3460 m_pool[UIActionIndex_M_VISOCreator_Add] = new UIActionMenuVISOCreatorAdd(this);
3461 m_pool[UIActionIndex_M_VISOCreator_Remove] = new UIActionMenuVISOCreatorRemove(this);
3462 m_pool[UIActionIndex_M_VISOCreator_CreateNewDirectory] = new UIActionMenuVISOCreatorCreateNewDirectory(this);
3463 m_pool[UIActionIndex_M_VISOCreator_Rename] = new UIActionMenuVISOCreatorRename(this);
3464 m_pool[UIActionIndex_M_VISOCreator_Reset] = new UIActionMenuVISOCreatorReset(this);
3465 m_pool[UIActionIndex_M_VISOCreator_Open] = new UIActionMenuVISOCreatorOpen(this);
3466 m_pool[UIActionIndex_M_VISOCreator_ImportISO] = new UIActionMenuVISOCreatorImportISO(this);
3467
3468 m_pool[UIActionIndex_M_VISOCreator_VisoContent_GoHome] = new UIActionMenuVISOCreatorGoHome(this);
3469 m_pool[UIActionIndex_M_VISOCreator_VisoContent_GoUp] = new UIActionMenuVISOCreatorGoUp(this);
3470 m_pool[UIActionIndex_M_VISOCreator_VisoContent_GoForward] = new UIActionMenuVISOCreatorGoForward(this);
3471 m_pool[UIActionIndex_M_VISOCreator_VisoContent_GoBackward] = new UIActionMenuVISOCreatorGoBackward(this);
3472 m_pool[UIActionIndex_M_VISOCreator_Host_GoHome] = new UIActionMenuVISOCreatorGoHome(this);
3473 m_pool[UIActionIndex_M_VISOCreator_Host_GoUp] = new UIActionMenuVISOCreatorGoUp(this);
3474 m_pool[UIActionIndex_M_VISOCreator_Host_GoForward] = new UIActionMenuVISOCreatorGoForward(this);
3475 m_pool[UIActionIndex_M_VISOCreator_Host_GoBackward] = new UIActionMenuVISOCreatorGoBackward(this);
3476
3477
3478 /* Medium Selector actions: */
3479 m_pool[UIActionIndex_M_MediumSelector] = new UIActionMenuMediumSelector(this);
3480 m_pool[UIActionIndex_M_MediumSelector_AddHD] = new UIActionMenuMediumSelectorAddHD(this);
3481 m_pool[UIActionIndex_M_MediumSelector_AddCD] = new UIActionMenuMediumSelectorAddCD(this);
3482 m_pool[UIActionIndex_M_MediumSelector_AddFD] = new UIActionMenuMediumSelectorAddFD(this);
3483 m_pool[UIActionIndex_M_MediumSelector_CreateHD] = new UIActionMenuMediumSelectorCreateHD(this);
3484 m_pool[UIActionIndex_M_MediumSelector_CreateCD] = new UIActionMenuMediumSelectorCreateCD(this);
3485 m_pool[UIActionIndex_M_MediumSelector_CreateFD] = new UIActionMenuMediumSelectorCreateFD(this);
3486 m_pool[UIActionIndex_M_MediumSelector_Refresh] = new UIActionMenuMediumSelectorRefresh(this);
3487
3488 /* Prepare update-handlers for known menus: */
3489#ifdef VBOX_WS_MAC
3490 m_menuUpdateHandlers[UIActionIndex_M_Application].ptf = &UIActionPool::updateMenuApplication;
3491 m_menuUpdateHandlers[UIActionIndex_M_Window].ptf = &UIActionPool::updateMenuWindow;
3492#endif
3493 m_menuUpdateHandlers[UIActionIndex_Menu_Help].ptf = &UIActionPool::updateMenuHelp;
3494 m_menuUpdateHandlers[UIActionIndex_M_LogWindow].ptf = &UIActionPool::updateMenuLogViewerWindow;
3495 m_menuUpdateHandlers[UIActionIndex_M_Log].ptf = &UIActionPool::updateMenuLogViewer;
3496 m_menuUpdateHandlers[UIActionIndex_M_Activity].ptf = &UIActionPool::updateMenuVMActivityMonitor;
3497 m_menuUpdateHandlers[UIActionIndex_M_FileManager].ptf = &UIActionPool::updateMenuFileManager;
3498
3499 /* Invalidate all known menus: */
3500#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
3501 QList<int> const updateHandlerKeys = m_menuUpdateHandlers.keys();
3502 m_invalidations.unite(QSet<int>(updateHandlerKeys.begin(), updateHandlerKeys.end()));
3503#else
3504 m_invalidations.unite(m_menuUpdateHandlers.keys().toSet());
3505#endif
3506
3507 /* Apply language settings: */
3508 retranslateUi();
3509}
3510
3511void UIActionPool::prepareConnections()
3512{
3513 /* 'Application' menu connections: */
3514#ifdef VBOX_WS_MAC
3515 connect(action(UIActionIndex_M_Application_S_About), &UIAction::triggered,
3516 &msgCenter(), &UIMessageCenter::sltShowHelpAboutDialog, Qt::UniqueConnection);
3517#endif
3518#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
3519 connect(action(UIActionIndex_M_Application_S_CheckForUpdates), &UIAction::triggered,
3520 gUpdateManager, &UIUpdateManager::sltForceCheck, Qt::UniqueConnection);
3521#endif
3522 connect(action(UIActionIndex_M_Application_S_ResetWarnings), &UIAction::triggered,
3523 &msgCenter(), &UIMessageCenter::sltResetSuppressedMessages, Qt::UniqueConnection);
3524
3525 /* 'Help' menu connections. Note that connections for UIActionIndex_Simple_Contents is done
3526 * in manager and runtime uis separately in their respective classes: */
3527 connect(action(UIActionIndex_Simple_WebSite), &UIAction::triggered,
3528 &msgCenter(), &UIMessageCenter::sltShowHelpWebDialog, Qt::UniqueConnection);
3529 connect(action(UIActionIndex_Simple_BugTracker), &UIAction::triggered,
3530 &msgCenter(), &UIMessageCenter::sltShowBugTracker, Qt::UniqueConnection);
3531 connect(action(UIActionIndex_Simple_Forums), &UIAction::triggered,
3532 &msgCenter(), &UIMessageCenter::sltShowForums, Qt::UniqueConnection);
3533 connect(action(UIActionIndex_Simple_Oracle), &UIAction::triggered,
3534 &msgCenter(), &UIMessageCenter::sltShowOracle, Qt::UniqueConnection);
3535 connect(action(UIActionIndex_Simple_OnlineDocumentation), &UIAction::triggered,
3536 &msgCenter(), &UIMessageCenter::sltShowOnlineDocumentation, Qt::UniqueConnection);
3537#ifndef VBOX_WS_MAC
3538 connect(action(UIActionIndex_Simple_About), &UIAction::triggered,
3539 &msgCenter(), &UIMessageCenter::sltShowHelpAboutDialog, Qt::UniqueConnection);
3540#endif
3541}
3542
3543void UIActionPool::cleanupConnections()
3544{
3545 /* Nothing for now.. */
3546}
3547
3548void UIActionPool::cleanupPool()
3549{
3550 qDeleteAll(m_groupPool);
3551 qDeleteAll(m_pool);
3552}
3553
3554void UIActionPool::updateConfiguration()
3555{
3556 /* Recache common action restrictions: */
3557 // Nothing here for now..
3558
3559#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
3560 /* Recache update action restrictions: */
3561 bool fUpdateAllowed = gEDataManager->applicationUpdateEnabled();
3562 if (!fUpdateAllowed)
3563 {
3564 m_restrictedActionsMenuApplication[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::MenuApplicationActionType)
3565 (m_restrictedActionsMenuApplication[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::MenuApplicationActionType_CheckForUpdates);
3566 }
3567#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
3568
3569 /* Update menus: */
3570 updateMenus();
3571}
3572
3573void UIActionPool::updateMenu(int iIndex)
3574{
3575 /* Make sure index belongs to this class: */
3576 AssertReturnVoid(iIndex < UIActionIndex_Max);
3577
3578 /* If menu with such index is invalidated
3579 * and there is update-handler => handle it here: */
3580 if ( m_invalidations.contains(iIndex)
3581 && m_menuUpdateHandlers.contains(iIndex))
3582 (this->*(m_menuUpdateHandlers.value(iIndex).ptf))();
3583}
3584
3585void UIActionPool::updateShortcuts()
3586{
3587 gShortcutPool->applyShortcuts(this);
3588}
3589
3590bool UIActionPool::event(QEvent *pEvent)
3591{
3592 /* Depending on event-type: */
3593 switch ((UIEventType)pEvent->type())
3594 {
3595 case ActivateActionEventType:
3596 {
3597 /* Process specific event: */
3598 ActivateActionEvent *pActionEvent = static_cast<ActivateActionEvent*>(pEvent);
3599 pActionEvent->action()->trigger();
3600 pEvent->accept();
3601 return true;
3602 }
3603 default:
3604 break;
3605 }
3606 /* Pass to the base-class: */
3607 return QObject::event(pEvent);
3608}
3609
3610void UIActionPool::retranslateUi()
3611{
3612 /* Translate all the actions: */
3613 foreach (const int iActionPoolKey, m_pool.keys())
3614 m_pool[iActionPoolKey]->retranslateUi();
3615 /* Update shortcuts: */
3616 updateShortcuts();
3617}
3618
3619bool UIActionPool::addAction(UIMenu *pMenu, UIAction *pAction, bool fReallyAdd /* = true */)
3620{
3621 /* Check if action is allowed: */
3622 const bool fIsActionAllowed = pAction->isAllowed();
3623
3624#ifdef VBOX_WS_MAC
3625 /* Check if menu is consumable: */
3626 const bool fIsMenuConsumable = pMenu->isConsumable();
3627 /* Check if menu is NOT yet consumed: */
3628 const bool fIsMenuConsumed = pMenu->isConsumed();
3629#endif
3630
3631 /* Make this action visible
3632 * depending on clearance state. */
3633 pAction->setVisible(fIsActionAllowed);
3634
3635#ifdef VBOX_WS_MAC
3636 /* If menu is consumable: */
3637 if (fIsMenuConsumable)
3638 {
3639 /* Add action only if menu was not yet consumed: */
3640 if (!fIsMenuConsumed)
3641 pMenu->addAction(pAction);
3642 }
3643 /* If menu is NOT consumable: */
3644 else
3645#endif
3646 {
3647 /* Add action only if is allowed: */
3648 if (fIsActionAllowed && fReallyAdd)
3649 pMenu->addAction(pAction);
3650 }
3651
3652 /* Return if action is allowed: */
3653 return fIsActionAllowed;
3654}
3655
3656bool UIActionPool::addMenu(QList<QMenu*> &menuList, UIAction *pAction, bool fReallyAdd /* = true */)
3657{
3658 /* Check if action is allowed: */
3659 const bool fIsActionAllowed = pAction->isAllowed();
3660
3661 /* Get action's menu: */
3662 UIMenu *pMenu = pAction->menu();
3663
3664#ifdef VBOX_WS_MAC
3665 /* Check if menu is consumable: */
3666 const bool fIsMenuConsumable = pMenu->isConsumable();
3667 /* Check if menu is NOT yet consumed: */
3668 const bool fIsMenuConsumed = pMenu->isConsumed();
3669#endif
3670
3671 /* Make this action visible
3672 * depending on clearance state. */
3673 pAction->setVisible( fIsActionAllowed
3674#ifdef VBOX_WS_MAC
3675 || fIsMenuConsumable
3676#endif
3677 );
3678
3679#ifdef VBOX_WS_MAC
3680 /* If menu is consumable: */
3681 if (fIsMenuConsumable)
3682 {
3683 /* Add action's menu only if menu was not yet consumed: */
3684 if (!fIsMenuConsumed)
3685 menuList << pMenu;
3686 }
3687 /* If menu is NOT consumable: */
3688 else
3689#endif
3690 {
3691 /* Add action only if is allowed: */
3692 if (fIsActionAllowed && fReallyAdd)
3693 menuList << pMenu;
3694 }
3695
3696 /* Return if action is allowed: */
3697 return fIsActionAllowed;
3698}
3699
3700void UIActionPool::updateMenuApplication()
3701{
3702 /* Get corresponding menu: */
3703 UIMenu *pMenu = action(UIActionIndex_M_Application)->menu();
3704 AssertPtrReturnVoid(pMenu);
3705#ifdef VBOX_WS_MAC
3706 AssertReturnVoid(pMenu->isConsumable());
3707#endif
3708 /* Clear contents: */
3709#ifdef VBOX_WS_MAC
3710 if (!pMenu->isConsumed())
3711#endif
3712 pMenu->clear();
3713
3714 /* Separator: */
3715 bool fSeparator = false;
3716
3717#ifdef VBOX_WS_MAC
3718 /* 'About' action: */
3719 fSeparator = addAction(pMenu, action(UIActionIndex_M_Application_S_About)) || fSeparator;
3720#endif
3721
3722 /* 'Preferences' action: */
3723 fSeparator = addAction(pMenu, action(UIActionIndex_M_Application_S_Preferences)) || fSeparator;
3724
3725#ifndef VBOX_WS_MAC
3726 /* Separator: */
3727 if (fSeparator)
3728 {
3729 pMenu->addSeparator();
3730 fSeparator = false;
3731 }
3732#endif
3733
3734 /* 'Reset Warnings' action: */
3735 fSeparator = addAction(pMenu, action(UIActionIndex_M_Application_S_ResetWarnings)) || fSeparator;
3736
3737#ifndef VBOX_WS_MAC
3738 /* Separator: */
3739 if (fSeparator)
3740 {
3741 pMenu->addSeparator();
3742 fSeparator = false;
3743 }
3744#endif
3745
3746 /* 'Close' action: */
3747 fSeparator = addAction(pMenu, action(UIActionIndex_M_Application_S_Close)) || fSeparator;
3748
3749 /* Mark menu as valid: */
3750 m_invalidations.remove(UIActionIndex_M_Application);
3751}
3752
3753#ifdef VBOX_WS_MAC
3754void UIActionPool::updateMenuWindow()
3755{
3756 /* Get corresponding menu: */
3757 UIMenu *pMenu = action(UIActionIndex_M_Window)->menu();
3758 AssertPtrReturnVoid(pMenu);
3759 /* Clear contents: */
3760 pMenu->clear();
3761
3762 /* Separator: */
3763 bool fSeparator = false;
3764
3765 /* 'Minimize' action: */
3766 fSeparator = addAction(pMenu, action(UIActionIndex_M_Window_S_Minimize)) || fSeparator;
3767
3768 /* Separator: */
3769 if (fSeparator)
3770 {
3771 pMenu->addSeparator();
3772 fSeparator = false;
3773 }
3774
3775 /* This menu always remains invalid.. */
3776}
3777#endif /* VBOX_WS_MAC */
3778
3779void UIActionPool::updateMenuHelp()
3780{
3781 /* Get corresponding menu: */
3782 UIMenu *pMenu = action(UIActionIndex_Menu_Help)->menu();
3783 AssertPtrReturnVoid(pMenu);
3784 /* Clear contents: */
3785 pMenu->clear();
3786
3787 /* Separator? */
3788 bool fSeparator = false;
3789
3790 /* 'Contents' action: */
3791 fSeparator = addAction(pMenu, action(UIActionIndex_Simple_Contents)) || fSeparator;
3792 /* 'Online Documentation' action: */
3793 fSeparator = addAction(pMenu, action(UIActionIndex_Simple_OnlineDocumentation)) || fSeparator;
3794 /* 'Web Site' action: */
3795 fSeparator = addAction(pMenu, action(UIActionIndex_Simple_WebSite)) || fSeparator;
3796 /* 'Bug Tracker' action: */
3797 fSeparator = addAction(pMenu, action(UIActionIndex_Simple_BugTracker)) || fSeparator;
3798 /* 'Forums' action: */
3799 fSeparator = addAction(pMenu, action(UIActionIndex_Simple_Forums)) || fSeparator;
3800 /* 'Oracle' action: */
3801 fSeparator = addAction(pMenu, action(UIActionIndex_Simple_Oracle)) || fSeparator;
3802
3803 /* Separator? */
3804 if (fSeparator)
3805 {
3806 pMenu->addSeparator();
3807 fSeparator = false;
3808 }
3809
3810#ifndef VBOX_WS_MAC
3811 /* 'About' action: */
3812 fSeparator = addAction(pMenu, action(UIActionIndex_Simple_About)) || fSeparator;
3813#endif
3814
3815 /* Mark menu as valid: */
3816 m_invalidations.remove(UIActionIndex_Menu_Help);
3817}
3818
3819void UIActionPool::updateMenuLogViewerWindow()
3820{
3821 /* Update corresponding menu: */
3822 updateMenuLogViewerWrapper(action(UIActionIndex_M_LogWindow)->menu());
3823
3824 /* Mark menu as valid: */
3825 m_invalidations.remove(UIActionIndex_M_LogWindow);
3826}
3827
3828void UIActionPool::updateMenuLogViewer()
3829{
3830 /* Update corresponding menu: */
3831 updateMenuLogViewerWrapper(action(UIActionIndex_M_Log)->menu());
3832
3833 /* Mark menu as valid: */
3834 m_invalidations.remove(UIActionIndex_M_Log);
3835}
3836
3837void UIActionPool::updateMenuLogViewerWrapper(UIMenu *pMenu)
3838{
3839 /* Clear contents: */
3840 pMenu->clear();
3841
3842 /* Separator? */
3843 bool fSeparator = false;
3844
3845 /* 'Save' action: */
3846 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_S_Save)) || fSeparator;
3847
3848 /* Separator? */
3849 if (fSeparator)
3850 {
3851 pMenu->addSeparator();
3852 fSeparator = false;
3853 }
3854
3855 /* 'Find' action: */
3856 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_T_Find)) || fSeparator;
3857 /* 'Filter' action: */
3858 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_T_Filter)) || fSeparator;
3859 /* 'Bookmarks' action: */
3860 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_T_Bookmark)) || fSeparator;
3861 /* 'Options' action: */
3862 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_T_Options)) || fSeparator;
3863
3864 /* Separator? */
3865 if (fSeparator)
3866 {
3867 pMenu->addSeparator();
3868 fSeparator = false;
3869 }
3870
3871 /* 'Refresh' action: */
3872 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_S_Refresh)) || fSeparator;
3873 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_S_Reload)) || fSeparator;
3874}
3875
3876void UIActionPool::updateMenuVMActivityMonitor()
3877{
3878 /* Get corresponding menu: */
3879 UIMenu *pMenu = action(UIActionIndex_M_Activity)->menu();
3880 AssertPtrReturnVoid(pMenu);
3881 /* Clear contents: */
3882 pMenu->clear();
3883
3884 /* 'Export' and 'Switch to VM Activity Overview" actions: */
3885 pMenu->addAction(action(UIActionIndex_M_Activity_S_Export));
3886 pMenu->addAction(action(UIActionIndex_M_Activity_S_ToVMActivityOverview));
3887
3888 /* Mark menu as valid: */
3889 m_invalidations.remove(UIActionIndex_M_Activity);
3890}
3891
3892void UIActionPool::updateMenuFileManager()
3893{
3894 updateMenuFileManagerWrapper(action(UIActionIndex_M_FileManager)->menu());
3895
3896 /* Mark menu as valid: */
3897 m_invalidations.remove(UIActionIndex_M_FileManager);
3898}
3899
3900void UIActionPool::updateMenuFileManagerWrapper(UIMenu *pMenu)
3901{
3902 addAction(pMenu, action(UIActionIndex_M_FileManager_T_Options));
3903 addAction(pMenu, action(UIActionIndex_M_FileManager_T_Operations));
3904 addAction(pMenu, action(UIActionIndex_M_FileManager_T_Log));
3905
3906 addAction(pMenu, action(UIActionIndex_M_FileManager_M_HostSubmenu));
3907 addAction(pMenu, action(UIActionIndex_M_FileManager_M_GuestSubmenu));
3908
3909 UIMenu *pHostSubmenu = action(UIActionIndex_M_FileManager_M_HostSubmenu)->menu();
3910 if (pHostSubmenu)
3911 {
3912 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_GoUp));
3913 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_GoHome));
3914 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_Refresh));
3915 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_Delete));
3916 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_Rename));
3917 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_CreateNewDirectory));
3918 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_Copy));
3919 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_Cut));
3920 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_Paste));
3921 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_SelectAll));
3922 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_InvertSelection));
3923 addAction(pHostSubmenu, action(UIActionIndex_M_FileManager_S_Host_ShowProperties));
3924 }
3925
3926 UIMenu *pGuestSubmenu = action(UIActionIndex_M_FileManager_M_GuestSubmenu)->menu();
3927 if (pGuestSubmenu)
3928 {
3929 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Host_GoUp));
3930 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_GoHome));
3931 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_Refresh));
3932 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_Delete));
3933 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_Rename));
3934 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_CreateNewDirectory));
3935 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_Copy));
3936 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_Cut));
3937 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_Paste));
3938 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_SelectAll));
3939 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_InvertSelection));
3940 addAction(pGuestSubmenu, action(UIActionIndex_M_FileManager_S_Guest_ShowProperties));
3941 }
3942}
3943
3944void UIActionPool::prepare()
3945{
3946 /* Prepare pool: */
3947 preparePool();
3948 /* Prepare connections: */
3949 prepareConnections();
3950
3951 /* Update configuration: */
3952 updateConfiguration();
3953 /* Update shortcuts: */
3954 updateShortcuts();
3955}
3956
3957void UIActionPool::cleanup()
3958{
3959 /* Cleanup connections: */
3960 cleanupConnections();
3961 /* Cleanup pool: */
3962 cleanupPool();
3963}
3964
3965
3966#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