VirtualBox

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

Last change on this file was 105801, checked in by vboxsync, 2 months ago

FE/Qt: Action pool: No need to override empty shortcuts with empty shortcuts.

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