[26719] | 1 | /* $Id: VBoxHelpActions.cpp 35634 2011-01-19 16:13:31Z vboxsync $ */
|
---|
[382] | 2 | /** @file
|
---|
| 3 | *
|
---|
| 4 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
[17730] | 5 | * VBoxHelpActions class implementation
|
---|
[382] | 6 | */
|
---|
| 7 |
|
---|
| 8 | /*
|
---|
[28800] | 9 | * Copyright (C) 2009 Oracle Corporation
|
---|
[382] | 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
|
---|
[5999] | 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.
|
---|
[382] | 18 | */
|
---|
| 19 |
|
---|
[25526] | 20 | #ifdef VBOX_WITH_PRECOMPILED_HEADERS
|
---|
| 21 | # include "precomp.h"
|
---|
| 22 | #else /* !VBOX_WITH_PRECOMPILED_HEADERS */
|
---|
[17730] | 23 | #include "VBoxHelpActions.h"
|
---|
[35634] | 24 | #include "UIExtraDataEventHandler.h"
|
---|
| 25 | #include "UIIconPool.h"
|
---|
| 26 | #include "UISelectorShortcuts.h"
|
---|
[17730] | 27 | #include "VBoxGlobal.h"
|
---|
[382] | 28 | #include "VBoxProblemReporter.h"
|
---|
| 29 |
|
---|
[7369] | 30 | /* Qt includes */
|
---|
[12010] | 31 | #include <QMenu>
|
---|
[25526] | 32 | #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
|
---|
[382] | 33 |
|
---|
[12010] | 34 | void VBoxHelpActions::setup (QObject *aParent)
|
---|
| 35 | {
|
---|
| 36 | AssertReturnVoid (contentsAction == NULL);
|
---|
[382] | 37 |
|
---|
[12010] | 38 | contentsAction = new QAction (aParent);
|
---|
[30206] | 39 | contentsAction->setIcon(UIIconPool::defaultIcon(UIIconPool::DialogHelpIcon));
|
---|
[12010] | 40 |
|
---|
| 41 | webAction = new QAction (aParent);
|
---|
[30192] | 42 | webAction->setIcon (UIIconPool::iconSet (":/site_16px.png"));
|
---|
[12010] | 43 |
|
---|
| 44 | resetMessagesAction = new QAction (aParent);
|
---|
[30192] | 45 | resetMessagesAction->setIcon (UIIconPool::iconSet (":/reset_16px.png"));
|
---|
[12010] | 46 |
|
---|
| 47 | registerAction = new QAction (aParent);
|
---|
[30192] | 48 | registerAction->setIcon (UIIconPool::iconSet (":/register_16px.png",
|
---|
[12010] | 49 | ":/register_disabled_16px.png"));
|
---|
| 50 | updateAction = new QAction (aParent);
|
---|
[25635] | 51 | updateAction->setMenuRole(QAction::ApplicationSpecificRole);
|
---|
[30192] | 52 | updateAction->setIcon (UIIconPool::iconSet (":/refresh_16px.png",
|
---|
[12010] | 53 | ":/refresh_disabled_16px.png"));
|
---|
| 54 | aboutAction = new QAction (aParent);
|
---|
[12098] | 55 | aboutAction->setMenuRole (QAction::AboutRole);
|
---|
[30192] | 56 | aboutAction->setIcon (UIIconPool::iconSet (":/about_16px.png"));
|
---|
[12010] | 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 |
|
---|
[30677] | 71 | QObject::connect (gEDataEvents, SIGNAL(sigCanShowRegistrationDlg(bool)),
|
---|
| 72 | registerAction, SLOT(setEnabled(bool)));
|
---|
| 73 | QObject::connect (gEDataEvents, SIGNAL(sigCanShowUpdateDlg(bool)),
|
---|
| 74 | updateAction, SLOT(setEnabled(bool)));
|
---|
[12010] | 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 |
|
---|
[17071] | 98 | #ifndef Q_WS_MAC
|
---|
[12010] | 99 | aMenu->addSeparator();
|
---|
[17071] | 100 | #endif /* Q_WS_MAC */
|
---|
[12010] | 101 | aMenu->addAction (aboutAction);
|
---|
| 102 | }
|
---|
| 103 |
|
---|
| 104 | void VBoxHelpActions::retranslateUi()
|
---|
| 105 | {
|
---|
| 106 | AssertReturnVoid (contentsAction != NULL);
|
---|
| 107 |
|
---|
| 108 | contentsAction->setText (VBoxProblemReporter::tr ("&Contents..."));
|
---|
[35634] | 109 | contentsAction->setShortcut (gSS->keySequence(UISelectorShortcuts::HelpShortcut));
|
---|
[12010] | 110 | contentsAction->setStatusTip (VBoxProblemReporter::tr (
|
---|
| 111 | "Show the online help contents"));
|
---|
| 112 |
|
---|
| 113 | webAction->setText (VBoxProblemReporter::tr ("&VirtualBox Web Site..."));
|
---|
[35634] | 114 | webAction->setShortcut (gSS->keySequence(UISelectorShortcuts::WebShortcut));
|
---|
[12010] | 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"));
|
---|
[35634] | 119 | resetMessagesAction->setShortcut (gSS->keySequence(UISelectorShortcuts::ResetWarningsShortcut));
|
---|
[12010] | 120 | resetMessagesAction->setStatusTip (VBoxProblemReporter::tr (
|
---|
[24775] | 121 | "Go back to showing all suppressed warnings and messages"));
|
---|
[12010] | 122 |
|
---|
[35634] | 123 | #ifdef VBOX_WITH_REGISTRATION
|
---|
[12010] | 124 | registerAction->setText (VBoxProblemReporter::tr ("R&egister VirtualBox..."));
|
---|
[35634] | 125 | registerAction->setShortcut (gSS->keySequence(UISelectorShortcuts::RegisterShortcut));
|
---|
[12010] | 126 | registerAction->setStatusTip (VBoxProblemReporter::tr (
|
---|
| 127 | "Open VirtualBox registration form"));
|
---|
[35634] | 128 | #endif /* VBOX_WITH_REGISTRATION */
|
---|
[12010] | 129 |
|
---|
| 130 | updateAction->setText (VBoxProblemReporter::tr ("C&heck for Updates..."));
|
---|
[35634] | 131 | updateAction->setShortcut (gSS->keySequence(UISelectorShortcuts::UpdateShortcut));
|
---|
[12010] | 132 | updateAction->setStatusTip (VBoxProblemReporter::tr (
|
---|
| 133 | "Check for a new VirtualBox version"));
|
---|
| 134 |
|
---|
| 135 | aboutAction->setText (VBoxProblemReporter::tr ("&About VirtualBox..."));
|
---|
[35634] | 136 | aboutAction->setShortcut (gSS->keySequence(UISelectorShortcuts::AboutShortcut));
|
---|
[12010] | 137 | aboutAction->setStatusTip (VBoxProblemReporter::tr (
|
---|
| 138 | "Show a dialog with product information"));
|
---|
| 139 | }
|
---|
| 140 |
|
---|