VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/VBoxHelpActions.cpp@ 30677

Last change on this file since 30677 was 30677, checked in by vboxsync, 14 years ago

FE/Qt4: Use new IEvent interface. Massive cleanup of the event handling in the GUI.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.0 KB
Line 
1/* $Id: VBoxHelpActions.cpp 30677 2010-07-06 16:39:25Z 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 "VBoxGlobal.h"
25#include "VBoxProblemReporter.h"
26#include "UIIconPool.h"
27#include "UIExtraDataEventHandler.h"
28
29/* Qt includes */
30#include <QMenu>
31#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
32
33void VBoxHelpActions::setup (QObject *aParent)
34{
35 AssertReturnVoid (contentsAction == NULL);
36
37 contentsAction = new QAction (aParent);
38 contentsAction->setIcon(UIIconPool::defaultIcon(UIIconPool::DialogHelpIcon));
39
40 webAction = new QAction (aParent);
41 webAction->setIcon (UIIconPool::iconSet (":/site_16px.png"));
42
43 resetMessagesAction = new QAction (aParent);
44 resetMessagesAction->setIcon (UIIconPool::iconSet (":/reset_16px.png"));
45
46 registerAction = new QAction (aParent);
47 registerAction->setIcon (UIIconPool::iconSet (":/register_16px.png",
48 ":/register_disabled_16px.png"));
49 updateAction = new QAction (aParent);
50 updateAction->setMenuRole(QAction::ApplicationSpecificRole);
51 updateAction->setIcon (UIIconPool::iconSet (":/refresh_16px.png",
52 ":/refresh_disabled_16px.png"));
53 aboutAction = new QAction (aParent);
54 aboutAction->setMenuRole (QAction::AboutRole);
55 aboutAction->setIcon (UIIconPool::iconSet (":/about_16px.png"));
56
57 QObject::connect (contentsAction, SIGNAL (triggered()),
58 &vboxProblem(), SLOT (showHelpHelpDialog()));
59 QObject::connect (webAction, SIGNAL (triggered()),
60 &vboxProblem(), SLOT (showHelpWebDialog()));
61 QObject::connect (resetMessagesAction, SIGNAL (triggered()),
62 &vboxProblem(), SLOT (resetSuppressedMessages()));
63 QObject::connect (registerAction, SIGNAL (triggered()),
64 &vboxGlobal(), SLOT (showRegistrationDialog()));
65 QObject::connect (updateAction, SIGNAL (triggered()),
66 &vboxGlobal(), SLOT (showUpdateDialog()));
67 QObject::connect (aboutAction, SIGNAL (triggered()),
68 &vboxProblem(), SLOT (showHelpAboutDialog()));
69
70 QObject::connect (gEDataEvents, SIGNAL(sigCanShowRegistrationDlg(bool)),
71 registerAction, SLOT(setEnabled(bool)));
72 QObject::connect (gEDataEvents, SIGNAL(sigCanShowUpdateDlg(bool)),
73 updateAction, SLOT(setEnabled(bool)));
74}
75
76void VBoxHelpActions::addTo (QMenu *aMenu)
77{
78 AssertReturnVoid (contentsAction != NULL);
79
80 aMenu->addAction (contentsAction);
81 aMenu->addAction (webAction);
82 aMenu->addSeparator();
83
84 aMenu->addAction (resetMessagesAction);
85 aMenu->addSeparator();
86
87#ifdef VBOX_WITH_REGISTRATION
88 aMenu->addAction (registerAction);
89 registerAction->setEnabled (vboxGlobal().virtualBox().
90 GetExtraData (VBoxDefs::GUI_RegistrationDlgWinID).isEmpty());
91#endif
92
93 aMenu->addAction (updateAction);
94 updateAction->setEnabled (vboxGlobal().virtualBox().
95 GetExtraData (VBoxDefs::GUI_UpdateDlgWinID).isEmpty());
96
97#ifndef Q_WS_MAC
98 aMenu->addSeparator();
99#endif /* Q_WS_MAC */
100 aMenu->addAction (aboutAction);
101}
102
103void VBoxHelpActions::retranslateUi()
104{
105 AssertReturnVoid (contentsAction != NULL);
106
107 contentsAction->setText (VBoxProblemReporter::tr ("&Contents..."));
108 contentsAction->setShortcut (QKeySequence::HelpContents);
109 contentsAction->setStatusTip (VBoxProblemReporter::tr (
110 "Show the online help contents"));
111
112 webAction->setText (VBoxProblemReporter::tr ("&VirtualBox Web Site..."));
113 webAction->setStatusTip (VBoxProblemReporter::tr (
114 "Open the browser and go to the VirtualBox product web site"));
115
116 resetMessagesAction->setText (VBoxProblemReporter::tr ("&Reset All Warnings"));
117 resetMessagesAction->setStatusTip (VBoxProblemReporter::tr (
118 "Go back to showing all suppressed warnings and messages"));
119
120 registerAction->setText (VBoxProblemReporter::tr ("R&egister VirtualBox..."));
121 registerAction->setStatusTip (VBoxProblemReporter::tr (
122 "Open VirtualBox registration form"));
123
124 updateAction->setText (VBoxProblemReporter::tr ("C&heck for Updates..."));
125 updateAction->setStatusTip (VBoxProblemReporter::tr (
126 "Check for a new VirtualBox version"));
127
128 aboutAction->setText (VBoxProblemReporter::tr ("&About VirtualBox..."));
129 aboutAction->setStatusTip (VBoxProblemReporter::tr (
130 "Show a dialog with product information"));
131}
132
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use