VirtualBox

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

Last change on this file since 103131 was 103059, checked in by vboxsync, 12 months ago

FE/Qt: UIActionPool: Make sure there is no that weird separator at the end of Help menu on macOS.

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