- Timestamp:
- Sep 2, 2008 10:08:52 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 35922
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxConsoleWnd.h
r12007 r12010 25 25 26 26 #include "COMDefs.h" 27 27 28 #include "QIWithRetranslateUI.h" 29 30 #include "VBoxProblemReporter.h" 28 31 29 32 /* Qt includes */ … … 32 35 #include <QColor> 33 36 #include <QDialog> 34 35 37 36 38 #ifdef VBOX_WITH_DEBUGGER_GUI … … 239 241 240 242 // Help actions 241 QAction *helpContentsAction; 242 QAction *helpWebAction; 243 QAction *helpRegisterAction; 244 QAction *helpUpdateAction; 245 QAction *helpAboutAction; 246 QAction *helpResetMessagesAction; 243 VBoxHelpActions mHelpActions; 247 244 248 245 // Machine popup menus -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h
r11399 r12010 198 198 }; 199 199 200 // VBoxGlobal 200 // VBoxGlobal class 201 201 //////////////////////////////////////////////////////////////////////////////// 202 202 -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxProblemReporter.h
r11228 r12010 30 30 #include <QObject> 31 31 32 class QAction; 33 class QMenu; 34 35 // VBoxHelpActions class 36 //////////////////////////////////////////////////////////////////////////////// 37 38 /** 39 * Help Menu action container. 40 * 41 * Contains actions for all help menu items and methods to insert them to a 42 * QMenu and to perform NLS string translation. 43 * 44 * Instances of this class are to be created as members of QWidget classes that 45 * need a Help menu. The containing class usually passes itself as an argument 46 * to the #setup() method and then calls #addTo() to add actions to its Help 47 * menu. The #retranslateUi() method is called when it is necessary to 48 * re-translate all action NLS according to the current language. 49 */ 50 struct VBoxHelpActions 51 { 52 VBoxHelpActions() 53 : contentsAction (NULL), webAction (NULL) 54 , resetMessagesAction (NULL), registerAction (NULL) 55 , updateAction (NULL), aboutAction (NULL) 56 {} 57 58 void setup (QObject *aParent); 59 void addTo (QMenu *aMenu); 60 void retranslateUi(); 61 62 QAction *contentsAction; 63 QAction *webAction; 64 QAction *resetMessagesAction; 65 QAction *registerAction; 66 QAction *updateAction; 67 QAction *aboutAction; 68 }; 69 70 // VBoxProblemReporter class 71 //////////////////////////////////////////////////////////////////////////////// 72 73 /** 74 * The VBoxProblemReporter class is a central place to handle all problem/error 75 * situations that happen during application runtime and require the user's 76 * attention. 77 * 78 * The role of this class is to describe the problem and/or the cause of the 79 * error to the user and give him the opportunity to select an action (when 80 * appropriate). 81 * 82 * Every problem sutiation has its own (correspondingly named) method in this 83 * class that takes a list of arguments necessary to describe the situation and 84 * to provide the appropriate actions. The method then returns the choice to the 85 * caller. 86 */ 32 87 class VBoxProblemReporter : public QObject 33 88 { … … 36 91 public: 37 92 38 enum Type { 93 enum Type 94 { 39 95 Info = 1, 40 96 Question, … … 44 100 GuruMeditation 45 101 }; 46 enum { 102 103 enum 104 { 47 105 AutoConfirmed = 0x8000 48 106 }; … … 339 397 }; 340 398 399 /** 400 * Shortcut to the static VBoxProblemReporter::instance() method, for 401 * convenience. 402 */ 341 403 inline VBoxProblemReporter &vboxProblem() { return VBoxProblemReporter::instance(); } 342 404 -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSelectorWnd.h
r11107 r12010 27 27 28 28 #include "QIWithRetranslateUI.h" 29 29 30 #include "VBoxGlobal.h" 31 #include "VBoxProblemReporter.h" 30 32 31 33 /* Qt includes */ … … 126 128 QAction *vmRefreshAction; 127 129 QAction *vmShowLogsAction; 128 QAction *helpContentsAction; 129 QAction *helpWebAction; 130 QAction *helpRegisterAction; 131 QAction *helpUpdateAction; 132 QAction *helpAboutAction; 133 QAction *helpResetMessagesAction; 130 131 VBoxHelpActions mHelpActions; 134 132 135 133 /* The vm list view/model */ -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleWnd.cpp
r12007 r12010 276 276 /* Help menu actions */ 277 277 278 helpContentsAction = new QAction (this); 279 helpContentsAction->setIcon (VBoxGlobal::iconSet (":/help_16px.png")); 280 helpWebAction = new QAction (this); 281 helpWebAction->setIcon (VBoxGlobal::iconSet (":/site_16px.png")); 282 helpRegisterAction = new QAction (this); 283 helpRegisterAction->setIcon (VBoxGlobal::iconSet (":/register_16px.png", 284 ":/register_disabled_16px.png")); 285 helpUpdateAction = new QAction (this); 286 helpUpdateAction->setIcon (VBoxGlobal::iconSet (":/refresh_16px.png", 287 ":/refresh_disabled_16px.png")); 288 helpAboutAction = new QAction (this); 289 helpAboutAction->setIcon (VBoxGlobal::iconSet (":/about_16px.png")); 290 helpResetMessagesAction = new QAction (this); 291 helpResetMessagesAction->setIcon (VBoxGlobal::iconSet (":/reset_16px.png")); 278 mHelpActions.setup (this); 292 279 293 280 ///// Menubar /////////////////////////////////////////////////////////// … … 385 372 mMainMenu->addMenu (mHelpMenu); 386 373 387 mHelpMenu->addAction (helpContentsAction); 388 mHelpMenu->addAction (helpWebAction); 389 mHelpMenu->addSeparator(); 390 #ifdef VBOX_WITH_REGISTRATION 391 mHelpMenu->addAction (helpRegisterAction); 392 helpRegisterAction->setEnabled (vboxGlobal().virtualBox(). 393 GetExtraData (VBoxDefs::GUI_RegistrationDlgWinID).isEmpty()); 394 #endif 395 mHelpMenu->addAction (helpUpdateAction); 396 helpUpdateAction->setEnabled (vboxGlobal().virtualBox(). 397 GetExtraData (VBoxDefs::GUI_UpdateDlgWinID).isEmpty()); 398 mHelpMenu->addAction (helpAboutAction); 399 mHelpMenu->addSeparator(); 400 mHelpMenu->addAction (helpResetMessagesAction); 374 mHelpActions.addTo (mHelpMenu); 401 375 402 376 ///// Status bar //////////////////////////////////////////////////////// … … 555 529 connect (mDevicesNetworkMenu, SIGNAL (aboutToHide()), 556 530 this, SLOT (clearStatusBar())); 557 558 connect (helpContentsAction, SIGNAL (triggered()),559 &vboxProblem(), SLOT (showHelpHelpDialog()));560 connect (helpWebAction, SIGNAL (triggered()),561 &vboxProblem(), SLOT (showHelpWebDialog()));562 connect (helpRegisterAction, SIGNAL (triggered()),563 &vboxGlobal(), SLOT (showRegistrationDialog()));564 connect (helpUpdateAction, SIGNAL (triggered()),565 &vboxGlobal(), SLOT (showUpdateDialog()));566 connect (&vboxGlobal(), SIGNAL (canShowRegDlg (bool)),567 helpRegisterAction, SLOT (setEnabled (bool)));568 connect (&vboxGlobal(), SIGNAL (canShowUpdDlg (bool)),569 helpUpdateAction, SLOT (setEnabled (bool)));570 connect (helpAboutAction, SIGNAL (triggered()),571 &vboxProblem(), SLOT (showHelpAboutDialog()));572 connect (helpResetMessagesAction, SIGNAL (triggered()),573 &vboxProblem(), SLOT (resetSuppressedMessages()));574 531 575 532 connect (fd_light, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)), … … 1591 1548 /* Help actions */ 1592 1549 1593 helpContentsAction->setText (tr ("&Contents...")); 1594 helpContentsAction->setShortcut (QKeySequence::HelpContents); 1595 helpContentsAction->setStatusTip (tr ("Show the online help contents")); 1596 1597 helpWebAction->setText (tr ("&VirtualBox Web Site...")); 1598 helpWebAction->setStatusTip ( 1599 tr ("Open the browser and go to the VirtualBox product web site")); 1600 1601 helpRegisterAction->setText (tr ("R&egister VirtualBox...")); 1602 helpRegisterAction->setStatusTip ( 1603 tr ("Open VirtualBox registration form")); 1604 1605 helpUpdateAction->setText (tr ("C&heck for a new version...")); 1606 helpUpdateAction->setStatusTip ( 1607 tr ("Check for a new VirtualBox version")); 1608 1609 helpAboutAction->setText (tr ("&About VirtualBox...")); 1610 helpAboutAction->setStatusTip (tr ("Show a dialog with product information")); 1611 1612 helpResetMessagesAction->setText (tr ("&Reset All Warnings")); 1613 helpResetMessagesAction->setStatusTip ( 1614 tr ("Cause all suppressed warnings and messages to be shown again")); 1550 mHelpActions.retranslateUi(); 1615 1551 1616 1552 /* Devices menu submenus */ -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp
r11955 r12010 4097 4097 } 4098 4098 4099 /** 4100 * Shows the VirtualBox registration dialog. 4101 * 4102 * @note that this method is not part of VBoxProblemReporter (like e.g. 4103 * VBoxProblemReporter::showHelpAboutDialog()) because it is tied to 4104 * VBoxCallback::OnExtraDataChange() handling performed by VBoxGlobal. 4105 * 4106 * @param aForce 4107 */ 4099 4108 void VBoxGlobal::showRegistrationDialog (bool aForce) 4100 4109 { … … 4134 4143 } 4135 4144 4145 /** 4146 * Shows the VirtualBox version check & update dialog. 4147 * 4148 * @note that this method is not part of VBoxProblemReporter (like e.g. 4149 * VBoxProblemReporter::showHelpAboutDialog()) because it is tied to 4150 * VBoxCallback::OnExtraDataChange() handling performed by VBoxGlobal. 4151 * 4152 * @param aForce 4153 */ 4136 4154 void VBoxGlobal::showUpdateDialog (bool aForce) 4137 4155 { -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxProblemReporter.cpp
r12009 r12010 42 42 # include <QPushButton> 43 43 #endif 44 #include <QAction> 45 #include <QMenu> 44 46 45 47 #include <iprt/err.h> … … 51 53 #endif 52 54 55 //////////////////////////////////////////////////////////////////////////////// 56 // VBoxProgressDialog class 57 //////////////////////////////////////////////////////////////////////////////// 58 53 59 /** 54 * 60 * A QProgressDialog enhancement that allows to: 55 61 * 56 * 57 * 2) effectively track the IProgress object completion58 * (w/o using IProgress::waitForCompletion() and w/o blocking the UI thread59 * in any otherway for too long).62 * 1) prevent closing the dialog when it has no cancel button; 63 * 2) effectively track the IProgress object completion (w/o using 64 * IProgress::waitForCompletion() and w/o blocking the UI thread in any other 65 * way for too long). 60 66 * 61 * 62 * constructor (to memorize COM errors if they happen), and therefore63 * must not be destroyed before the created VBoxProgressDialog instance64 * isdestroyed.67 * @note The CProgress instance is passed as a non-const reference to the 68 * constructor (to memorize COM errors if they happen), and therefore must 69 * not be destroyed before the created VBoxProgressDialog instance is 70 * destroyed. 65 71 */ 66 72 class VBoxProgressDialog : public QProgressDialog … … 187 193 const char *VBoxProgressDialog::sOpDescTpl = "%1... (%2/%3)"; 188 194 189 190 /** @class VBoxProblemReporter 191 * 192 * The VBoxProblemReporter class is a central place to handle all 193 * problem/error situations that happen during application 194 * runtime and require the user's attention. Its role is to 195 * describe the problem and/or the cause of the error to the user and give 196 * him the opportunity to select an action (when appropriate). 197 * 198 * Every problem sutiation has its own (correspondingly named) method in 199 * this class that takes a list of arguments necessary to describe the 200 * situation and to provide the appropriate actions. The method then 201 * returns the choice to the caller. 202 */ 195 //////////////////////////////////////////////////////////////////////////////// 196 // VBoxHelpActions class 197 //////////////////////////////////////////////////////////////////////////////// 198 199 void VBoxHelpActions::setup (QObject *aParent) 200 { 201 AssertReturnVoid (contentsAction == NULL); 202 203 contentsAction = new QAction (aParent); 204 contentsAction->setIcon (VBoxGlobal::iconSet (":/help_16px.png")); 205 206 webAction = new QAction (aParent); 207 webAction->setIcon (VBoxGlobal::iconSet (":/site_16px.png")); 208 209 resetMessagesAction = new QAction (aParent); 210 resetMessagesAction->setIcon (VBoxGlobal::iconSet (":/reset_16px.png")); 211 212 registerAction = new QAction (aParent); 213 registerAction->setIcon (VBoxGlobal::iconSet (":/register_16px.png", 214 ":/register_disabled_16px.png")); 215 updateAction = new QAction (aParent); 216 updateAction->setIcon (VBoxGlobal::iconSet (":/refresh_16px.png", 217 ":/refresh_disabled_16px.png")); 218 aboutAction = new QAction (aParent); 219 aboutAction->setIcon (VBoxGlobal::iconSet (":/about_16px.png")); 220 221 QObject::connect (contentsAction, SIGNAL (triggered()), 222 &vboxProblem(), SLOT (showHelpHelpDialog())); 223 QObject::connect (webAction, SIGNAL (triggered()), 224 &vboxProblem(), SLOT (showHelpWebDialog())); 225 QObject::connect (resetMessagesAction, SIGNAL (triggered()), 226 &vboxProblem(), SLOT (resetSuppressedMessages())); 227 QObject::connect (registerAction, SIGNAL (triggered()), 228 &vboxGlobal(), SLOT (showRegistrationDialog())); 229 QObject::connect (updateAction, SIGNAL (triggered()), 230 &vboxGlobal(), SLOT (showUpdateDialog())); 231 QObject::connect (aboutAction, SIGNAL (triggered()), 232 &vboxProblem(), SLOT (showHelpAboutDialog())); 233 234 QObject::connect (&vboxGlobal(), SIGNAL (canShowRegDlg (bool)), 235 registerAction, SLOT (setEnabled (bool))); 236 QObject::connect (&vboxGlobal(), SIGNAL (canShowUpdDlg (bool)), 237 updateAction, SLOT (setEnabled (bool))); 238 } 239 240 void VBoxHelpActions::addTo (QMenu *aMenu) 241 { 242 AssertReturnVoid (contentsAction != NULL); 243 244 aMenu->addAction (contentsAction); 245 aMenu->addAction (webAction); 246 aMenu->addSeparator(); 247 248 aMenu->addAction (resetMessagesAction); 249 aMenu->addSeparator(); 250 251 #ifdef VBOX_WITH_REGISTRATION 252 aMenu->addAction (registerAction); 253 registerAction->setEnabled (vboxGlobal().virtualBox(). 254 GetExtraData (VBoxDefs::GUI_RegistrationDlgWinID).isEmpty()); 255 #endif 256 257 aMenu->addAction (updateAction); 258 updateAction->setEnabled (vboxGlobal().virtualBox(). 259 GetExtraData (VBoxDefs::GUI_UpdateDlgWinID).isEmpty()); 260 261 aMenu->addSeparator(); 262 aMenu->addAction (aboutAction); 263 } 264 265 void VBoxHelpActions::retranslateUi() 266 { 267 AssertReturnVoid (contentsAction != NULL); 268 269 contentsAction->setText (VBoxProblemReporter::tr ("&Contents...")); 270 contentsAction->setShortcut (QKeySequence::HelpContents); 271 contentsAction->setStatusTip (VBoxProblemReporter::tr ( 272 "Show the online help contents")); 273 274 webAction->setText (VBoxProblemReporter::tr ("&VirtualBox Web Site...")); 275 webAction->setStatusTip (VBoxProblemReporter::tr ( 276 "Open the browser and go to the VirtualBox product web site")); 277 278 resetMessagesAction->setText (VBoxProblemReporter::tr ("&Reset All Warnings")); 279 resetMessagesAction->setStatusTip (VBoxProblemReporter::tr ( 280 "Cause all suppressed warnings and messages to be shown again")); 281 282 registerAction->setText (VBoxProblemReporter::tr ("R&egister VirtualBox...")); 283 registerAction->setStatusTip (VBoxProblemReporter::tr ( 284 "Open VirtualBox registration form")); 285 286 updateAction->setText (VBoxProblemReporter::tr ("C&heck for Updates...")); 287 updateAction->setStatusTip (VBoxProblemReporter::tr ( 288 "Check for a new VirtualBox version")); 289 290 aboutAction->setText (VBoxProblemReporter::tr ("&About VirtualBox...")); 291 aboutAction->setStatusTip (VBoxProblemReporter::tr ( 292 "Show a dialog with product information")); 293 } 294 295 //////////////////////////////////////////////////////////////////////////////// 296 // VBoxProblemReporter class 297 //////////////////////////////////////////////////////////////////////////////// 203 298 204 299 /** … … 2191 2286 } 2192 2287 2193 /** @fn vboxProblem2194 *2195 * Shortcut to the static VBoxProblemReporter::instance() method, for2196 * convenience.2197 */ -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSelectorWnd.cpp
r11978 r12010 438 438 ":/vm_show_logs_disabled_32px.png", "show_logs_disabled_16px.png")); 439 439 440 helpContentsAction = new QAction (this); 441 helpContentsAction->setIcon (VBoxGlobal::iconSet (":/help_16px.png")); 442 helpWebAction = new QAction (this); 443 helpWebAction->setIcon (VBoxGlobal::iconSet (":/site_16px.png")); 444 helpRegisterAction = new QAction (this); 445 helpRegisterAction->setIcon (VBoxGlobal::iconSet (":/register_16px.png", 446 ":/register_disabled_16px.png")); 447 helpUpdateAction = new QAction (this); 448 helpUpdateAction->setIcon (VBoxGlobal::iconSet (":/refresh_16px.png", 449 ":/refresh_disabled_16px.png")); 450 helpAboutAction = new QAction (this); 451 helpAboutAction->setIcon (VBoxGlobal::iconSet (":/about_16px.png")); 452 helpResetMessagesAction = new QAction (this); 453 helpResetMessagesAction->setIcon (VBoxGlobal::iconSet (":/reset_16px.png")); 440 mHelpActions.setup (this); 454 441 455 442 /* subwidgets */ … … 573 560 574 561 mHelpMenu = menuBar()->addMenu (QString::null); 575 mHelpMenu->addAction (helpContentsAction); 576 mHelpMenu->addAction (helpWebAction); 577 mHelpMenu->addSeparator(); 578 #ifdef VBOX_WITH_REGISTRATION 579 mHelpMenu->addAction (helpRegisterAction); 580 helpRegisterAction->setEnabled (vboxGlobal().virtualBox(). 581 GetExtraData (VBoxDefs::GUI_RegistrationDlgWinID).isEmpty()); 582 #endif 583 mHelpMenu->addAction (helpUpdateAction); 584 helpUpdateAction->setEnabled (vboxGlobal().virtualBox(). 585 GetExtraData (VBoxDefs::GUI_UpdateDlgWinID).isEmpty()); 586 mHelpMenu->addAction (helpAboutAction); 587 mHelpMenu->addSeparator(); 588 mHelpMenu->addAction (helpResetMessagesAction); 562 mHelpActions.addTo (mHelpMenu); 589 563 590 564 retranslateUi(); … … 660 634 connect (vmRefreshAction, SIGNAL (triggered()), this, SLOT (vmRefresh())); 661 635 connect (vmShowLogsAction, SIGNAL (triggered()), this, SLOT (vmShowLogs())); 662 663 connect (helpContentsAction, SIGNAL (triggered()),664 &vboxProblem(), SLOT (showHelpHelpDialog()));665 connect (helpWebAction, SIGNAL (triggered()),666 &vboxProblem(), SLOT (showHelpWebDialog()));667 connect (helpRegisterAction, SIGNAL (triggered()),668 &vboxGlobal(), SLOT (showRegistrationDialog()));669 connect (helpUpdateAction, SIGNAL (triggered()),670 &vboxGlobal(), SLOT (showUpdateDialog()));671 connect (&vboxGlobal(), SIGNAL (canShowRegDlg (bool)),672 helpRegisterAction, SLOT (setEnabled (bool)));673 connect (&vboxGlobal(), SIGNAL (canShowUpdDlg (bool)),674 helpUpdateAction, SLOT (setEnabled (bool)));675 connect (helpAboutAction, SIGNAL (triggered()),676 &vboxProblem(), SLOT (showHelpAboutDialog()));677 connect (helpResetMessagesAction, SIGNAL (triggered()),678 &vboxProblem(), SLOT (resetSuppressedMessages()));679 636 680 637 connect (mVMListView, SIGNAL (currentChanged()), … … 1226 1183 tr ("Show the log files of the selected virtual machine")); 1227 1184 1228 helpContentsAction->setText (tr ("&Contents...")); 1229 helpContentsAction->setShortcut (QKeySequence::HelpContents); 1230 helpContentsAction->setStatusTip (tr ("Show the online help contents")); 1231 1232 helpWebAction->setText (tr ("&VirtualBox Web Site...")); 1233 helpWebAction->setStatusTip ( 1234 tr ("Open the browser and go to the VirtualBox product web site")); 1235 1236 helpRegisterAction->setText (tr ("R&egister VirtualBox...")); 1237 helpRegisterAction->setStatusTip ( 1238 tr ("Open VirtualBox registration form")); 1239 1240 helpUpdateAction->setText (tr ("C&heck for update...")); 1241 helpUpdateAction->setStatusTip ( 1242 tr ("Check server for VirtualBox updates")); 1243 1244 helpAboutAction->setText (tr ("&About VirtualBox...")); 1245 helpAboutAction->setStatusTip (tr ("Show a dialog with product information")); 1246 1247 helpResetMessagesAction->setText (tr ("&Reset All Warnings")); 1248 helpResetMessagesAction->setStatusTip ( 1249 tr ("Cause all suppressed warnings and messages to be shown again")); 1185 mHelpActions.retranslateUi(); 1250 1186 1251 1187 mFileMenu->setTitle (tr("&File"));
Note:
See TracChangeset
for help on using the changeset viewer.