1 | /* $Id: VBoxHelpActions.cpp 35634 2011-01-19 16:13:31Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
5 | * VBoxHelpActions class implementation
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2009 Oracle Corporation
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | * available from http://www.virtualbox.org. This file is free software;
|
---|
13 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | * General Public License (GPL) as published by the Free Software
|
---|
15 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | */
|
---|
19 |
|
---|
20 | #ifdef VBOX_WITH_PRECOMPILED_HEADERS
|
---|
21 | # include "precomp.h"
|
---|
22 | #else /* !VBOX_WITH_PRECOMPILED_HEADERS */
|
---|
23 | #include "VBoxHelpActions.h"
|
---|
24 | #include "UIExtraDataEventHandler.h"
|
---|
25 | #include "UIIconPool.h"
|
---|
26 | #include "UISelectorShortcuts.h"
|
---|
27 | #include "VBoxGlobal.h"
|
---|
28 | #include "VBoxProblemReporter.h"
|
---|
29 |
|
---|
30 | /* Qt includes */
|
---|
31 | #include <QMenu>
|
---|
32 | #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
|
---|
33 |
|
---|
34 | void VBoxHelpActions::setup (QObject *aParent)
|
---|
35 | {
|
---|
36 | AssertReturnVoid (contentsAction == NULL);
|
---|
37 |
|
---|
38 | contentsAction = new QAction (aParent);
|
---|
39 | contentsAction->setIcon(UIIconPool::defaultIcon(UIIconPool::DialogHelpIcon));
|
---|
40 |
|
---|
41 | webAction = new QAction (aParent);
|
---|
42 | webAction->setIcon (UIIconPool::iconSet (":/site_16px.png"));
|
---|
43 |
|
---|
44 | resetMessagesAction = new QAction (aParent);
|
---|
45 | resetMessagesAction->setIcon (UIIconPool::iconSet (":/reset_16px.png"));
|
---|
46 |
|
---|
47 | registerAction = new QAction (aParent);
|
---|
48 | registerAction->setIcon (UIIconPool::iconSet (":/register_16px.png",
|
---|
49 | ":/register_disabled_16px.png"));
|
---|
50 | updateAction = new QAction (aParent);
|
---|
51 | updateAction->setMenuRole(QAction::ApplicationSpecificRole);
|
---|
52 | updateAction->setIcon (UIIconPool::iconSet (":/refresh_16px.png",
|
---|
53 | ":/refresh_disabled_16px.png"));
|
---|
54 | aboutAction = new QAction (aParent);
|
---|
55 | aboutAction->setMenuRole (QAction::AboutRole);
|
---|
56 | aboutAction->setIcon (UIIconPool::iconSet (":/about_16px.png"));
|
---|
57 |
|
---|
58 | QObject::connect (contentsAction, SIGNAL (triggered()),
|
---|
59 | &vboxProblem(), SLOT (showHelpHelpDialog()));
|
---|
60 | QObject::connect (webAction, SIGNAL (triggered()),
|
---|
61 | &vboxProblem(), SLOT (showHelpWebDialog()));
|
---|
62 | QObject::connect (resetMessagesAction, SIGNAL (triggered()),
|
---|
63 | &vboxProblem(), SLOT (resetSuppressedMessages()));
|
---|
64 | QObject::connect (registerAction, SIGNAL (triggered()),
|
---|
65 | &vboxGlobal(), SLOT (showRegistrationDialog()));
|
---|
66 | QObject::connect (updateAction, SIGNAL (triggered()),
|
---|
67 | &vboxGlobal(), SLOT (showUpdateDialog()));
|
---|
68 | QObject::connect (aboutAction, SIGNAL (triggered()),
|
---|
69 | &vboxProblem(), SLOT (showHelpAboutDialog()));
|
---|
70 |
|
---|
71 | QObject::connect (gEDataEvents, SIGNAL(sigCanShowRegistrationDlg(bool)),
|
---|
72 | registerAction, SLOT(setEnabled(bool)));
|
---|
73 | QObject::connect (gEDataEvents, SIGNAL(sigCanShowUpdateDlg(bool)),
|
---|
74 | updateAction, SLOT(setEnabled(bool)));
|
---|
75 | }
|
---|
76 |
|
---|
77 | void VBoxHelpActions::addTo (QMenu *aMenu)
|
---|
78 | {
|
---|
79 | AssertReturnVoid (contentsAction != NULL);
|
---|
80 |
|
---|
81 | aMenu->addAction (contentsAction);
|
---|
82 | aMenu->addAction (webAction);
|
---|
83 | aMenu->addSeparator();
|
---|
84 |
|
---|
85 | aMenu->addAction (resetMessagesAction);
|
---|
86 | aMenu->addSeparator();
|
---|
87 |
|
---|
88 | #ifdef VBOX_WITH_REGISTRATION
|
---|
89 | aMenu->addAction (registerAction);
|
---|
90 | registerAction->setEnabled (vboxGlobal().virtualBox().
|
---|
91 | GetExtraData (VBoxDefs::GUI_RegistrationDlgWinID).isEmpty());
|
---|
92 | #endif
|
---|
93 |
|
---|
94 | aMenu->addAction (updateAction);
|
---|
95 | updateAction->setEnabled (vboxGlobal().virtualBox().
|
---|
96 | GetExtraData (VBoxDefs::GUI_UpdateDlgWinID).isEmpty());
|
---|
97 |
|
---|
98 | #ifndef Q_WS_MAC
|
---|
99 | aMenu->addSeparator();
|
---|
100 | #endif /* Q_WS_MAC */
|
---|
101 | aMenu->addAction (aboutAction);
|
---|
102 | }
|
---|
103 |
|
---|
104 | void VBoxHelpActions::retranslateUi()
|
---|
105 | {
|
---|
106 | AssertReturnVoid (contentsAction != NULL);
|
---|
107 |
|
---|
108 | contentsAction->setText (VBoxProblemReporter::tr ("&Contents..."));
|
---|
109 | contentsAction->setShortcut (gSS->keySequence(UISelectorShortcuts::HelpShortcut));
|
---|
110 | contentsAction->setStatusTip (VBoxProblemReporter::tr (
|
---|
111 | "Show the online help contents"));
|
---|
112 |
|
---|
113 | webAction->setText (VBoxProblemReporter::tr ("&VirtualBox Web Site..."));
|
---|
114 | webAction->setShortcut (gSS->keySequence(UISelectorShortcuts::WebShortcut));
|
---|
115 | webAction->setStatusTip (VBoxProblemReporter::tr (
|
---|
116 | "Open the browser and go to the VirtualBox product web site"));
|
---|
117 |
|
---|
118 | resetMessagesAction->setText (VBoxProblemReporter::tr ("&Reset All Warnings"));
|
---|
119 | resetMessagesAction->setShortcut (gSS->keySequence(UISelectorShortcuts::ResetWarningsShortcut));
|
---|
120 | resetMessagesAction->setStatusTip (VBoxProblemReporter::tr (
|
---|
121 | "Go back to showing all suppressed warnings and messages"));
|
---|
122 |
|
---|
123 | #ifdef VBOX_WITH_REGISTRATION
|
---|
124 | registerAction->setText (VBoxProblemReporter::tr ("R&egister VirtualBox..."));
|
---|
125 | registerAction->setShortcut (gSS->keySequence(UISelectorShortcuts::RegisterShortcut));
|
---|
126 | registerAction->setStatusTip (VBoxProblemReporter::tr (
|
---|
127 | "Open VirtualBox registration form"));
|
---|
128 | #endif /* VBOX_WITH_REGISTRATION */
|
---|
129 |
|
---|
130 | updateAction->setText (VBoxProblemReporter::tr ("C&heck for Updates..."));
|
---|
131 | updateAction->setShortcut (gSS->keySequence(UISelectorShortcuts::UpdateShortcut));
|
---|
132 | updateAction->setStatusTip (VBoxProblemReporter::tr (
|
---|
133 | "Check for a new VirtualBox version"));
|
---|
134 |
|
---|
135 | aboutAction->setText (VBoxProblemReporter::tr ("&About VirtualBox..."));
|
---|
136 | aboutAction->setShortcut (gSS->keySequence(UISelectorShortcuts::AboutShortcut));
|
---|
137 | aboutAction->setStatusTip (VBoxProblemReporter::tr (
|
---|
138 | "Show a dialog with product information"));
|
---|
139 | }
|
---|
140 |
|
---|