Changeset 17730 in vbox for trunk/src/VBox/Frontends/VirtualBox/include/VBoxHelpActions.h
- Timestamp:
- Mar 12, 2009 11:10:44 AM (16 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxHelpActions.h
r17721 r17730 2 2 * 3 3 * VBox frontends: Qt GUI ("VirtualBox"): 4 * VBox ProblemReporterclass declaration4 * VBoxHelpActions class declaration 5 5 */ 6 6 7 7 /* 8 * Copyright (C) 200 6-2008Sun Microsystems, Inc.8 * Copyright (C) 2009 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 */ 22 22 23 #ifndef __VBox ProblemReporter_h__24 #define __VBox ProblemReporter_h__23 #ifndef __VBoxHelpActions_h__ 24 #define __VBoxHelpActions_h__ 25 25 26 #include "COMDefs.h" 27 #include "QIMessageBox.h" 28 29 /* Qt icludes */ 26 /* Qt includes */ 30 27 #include <QObject> 31 28 32 class VBoxMedium;29 class QMenu; 33 30 class QAction; 34 class QMenu;35 36 // VBoxHelpActions class37 ////////////////////////////////////////////////////////////////////////////////38 31 39 32 /** … … 69 62 }; 70 63 71 // VBoxProblemReporter class 72 //////////////////////////////////////////////////////////////////////////////// 64 #endif /* __VBoxHelpActions_h__ */ 73 65 74 /**75 * The VBoxProblemReporter class is a central place to handle all problem/error76 * situations that happen during application runtime and require the user's77 * attention.78 *79 * The role of this class is to describe the problem and/or the cause of the80 * error to the user and give him the opportunity to select an action (when81 * appropriate).82 *83 * Every problem sutiation has its own (correspondingly named) method in this84 * class that takes a list of arguments necessary to describe the situation and85 * to provide the appropriate actions. The method then returns the choice to the86 * caller.87 */88 class VBoxProblemReporter : public QObject89 {90 Q_OBJECT;91 92 public:93 94 enum Type95 {96 Info = 1,97 Question,98 Warning,99 Error,100 Critical,101 GuruMeditation102 };103 104 enum105 {106 AutoConfirmed = 0x8000107 };108 109 static VBoxProblemReporter &instance();110 111 bool isValid() const;112 113 // helpers114 115 int message (QWidget *aParent, Type aType, const QString &aMessage,116 const QString &aDetails = QString::null,117 const char *aAutoConfirmId = 0,118 int aButton1 = 0, int aButton2 = 0, int aButton3 = 0,119 const QString &aText1 = QString::null,120 const QString &aText2 = QString::null,121 const QString &aText3 = QString::null) const;122 123 int message (QWidget *aParent, Type aType, const QString &aMessage,124 const char *aAutoConfirmId,125 int aButton1 = 0, int aButton2 = 0, int aButton3 = 0,126 const QString &aText1 = QString::null,127 const QString &aText2 = QString::null,128 const QString &aText3 = QString::null) const129 {130 return message (aParent, aType, aMessage, QString::null, aAutoConfirmId,131 aButton1, aButton2, aButton3, aText1, aText2, aText3);132 }133 134 bool messageYesNo (QWidget *aParent, Type aType, const QString &aMessage,135 const QString &aDetails = QString::null,136 const char *aAutoConfirmId = 0,137 const QString &aYesText = QString::null,138 const QString &aNoText = QString::null) const139 {140 return (message (aParent, aType, aMessage, aDetails, aAutoConfirmId,141 QIMessageBox::Yes | QIMessageBox::Default,142 QIMessageBox::No | QIMessageBox::Escape,143 0,144 aYesText, aNoText, QString::null) &145 QIMessageBox::ButtonMask) == QIMessageBox::Yes;146 }147 148 bool messageYesNo (QWidget *aParent, Type aType, const QString &aMessage,149 const char *aAutoConfirmId,150 const QString &aYesText = QString::null,151 const QString &aNoText = QString::null) const152 {153 return messageYesNo (aParent, aType, aMessage, QString::null,154 aAutoConfirmId, aYesText, aNoText);155 }156 157 bool messageOkCancel (QWidget *aParent, Type aType, const QString &aMessage,158 const QString &aDetails = QString::null,159 const char *aAutoConfirmId = 0,160 const QString &aOkText = QString::null,161 const QString &aCancelText = QString::null) const162 {163 return (message (aParent, aType, aMessage, aDetails, aAutoConfirmId,164 QIMessageBox::Ok | QIMessageBox::Default,165 QIMessageBox::Cancel | QIMessageBox::Escape,166 0,167 aOkText, aCancelText, QString::null) &168 QIMessageBox::ButtonMask) == QIMessageBox::Ok;169 }170 171 bool messageOkCancel (QWidget *aParent, Type aType, const QString &aMessage,172 const char *aAutoConfirmId,173 const QString &aOkText = QString::null,174 const QString &aCancelText = QString::null) const175 {176 return messageOkCancel (aParent, aType, aMessage, QString::null,177 aAutoConfirmId, aOkText, aCancelText);178 }179 180 bool showModalProgressDialog (CProgress &aProgress, const QString &aTitle,181 QWidget *aParent, int aMinDuration = 2000);182 183 QWidget *mainWindowShown() const;184 185 /* Generic problem handlers */186 bool askForOverridingFileIfExists (const QString& path, QWidget *aParent = NULL) const;187 188 /* Special problem handlers */189 #ifdef Q_WS_X11190 void cannotFindLicenseFiles (const QString &aPath);191 void cannotOpenLicenseFile (QWidget *aParent, const QString &aPath);192 #endif193 194 void cannotOpenURL (const QString &aURL);195 void cannotCopyFile (const QString &aSrc, const QString &aDst, int aVRC);196 197 void cannotFindLanguage (const QString &aLangID, const QString &aNlsPath);198 void cannotLoadLanguage (const QString &aLangFile);199 200 void cannotInitCOM (HRESULT rc);201 void cannotCreateVirtualBox (const CVirtualBox &vbox);202 203 void cannotSaveGlobalSettings (const CVirtualBox &vbox,204 QWidget *parent = 0);205 206 void cannotLoadGlobalConfig (const CVirtualBox &vbox, const QString &error);207 void cannotSaveGlobalConfig (const CVirtualBox &vbox);208 void cannotSetSystemProperties (const CSystemProperties &props);209 void cannotAccessUSB (const COMBaseWithEI &aObj);210 211 void cannotCreateMachine (const CVirtualBox &vbox,212 QWidget *parent = 0);213 void cannotCreateMachine (const CVirtualBox &vbox, const CMachine &machine,214 QWidget *parent = 0);215 void cannotApplyMachineSettings (const CMachine &machine, const COMResult &res);216 void cannotSaveMachineSettings (const CMachine &machine,217 QWidget *parent = 0);218 void cannotLoadMachineSettings (const CMachine &machine,219 bool strict = true,220 QWidget *parent = 0);221 222 void cannotStartMachine (const CConsole &console);223 void cannotStartMachine (const CProgress &progress);224 void cannotPauseMachine (const CConsole &console);225 void cannotResumeMachine (const CConsole &console);226 void cannotACPIShutdownMachine (const CConsole &console);227 void cannotSaveMachineState (const CConsole &console);228 void cannotSaveMachineState (const CProgress &progress);229 void cannotTakeSnapshot (const CConsole &console);230 void cannotTakeSnapshot (const CProgress &progress);231 void cannotStopMachine (const CConsole &console);232 void cannotStopMachine (const CProgress &progress);233 void cannotDeleteMachine (const CVirtualBox &vbox, const CMachine &machine);234 void cannotDiscardSavedState (const CConsole &console);235 236 void cannotSendACPIToMachine();237 bool warnAboutVirtNotEnabled();238 239 void cannotSetSnapshotFolder (const CMachine &aMachine, const QString &aPath);240 void cannotDiscardSnapshot (const CConsole &aConsole,241 const QString &aSnapshotName);242 void cannotDiscardSnapshot (const CProgress &aProgress,243 const QString &aSnapshotName);244 void cannotDiscardCurrentState (const CConsole &console);245 void cannotDiscardCurrentState (const CProgress &progress);246 void cannotDiscardCurrentSnapshotAndState (const CConsole &console);247 void cannotDiscardCurrentSnapshotAndState (const CProgress &progress);248 249 void cannotFindMachineByName (const CVirtualBox &vbox, const QString &name);250 251 void cannotEnterSeamlessMode (ULONG aWidth, ULONG aHeight,252 ULONG aBpp, ULONG64 aMinVRAM);253 int cannotEnterFullscreenMode (ULONG aWidth, ULONG aHeight,254 ULONG aBpp, ULONG64 aMinVRAM);255 256 bool confirmMachineDeletion (const CMachine &machine);257 bool confirmDiscardSavedState (const CMachine &machine);258 259 bool confirmReleaseMedium (QWidget *aParent, const VBoxMedium &aMedium,260 const QString &aUsage);261 262 bool confirmRemoveMedium (QWidget *aParent, const VBoxMedium &aMedium);263 264 void sayCannotOverwriteHardDiskStorage (QWidget *aParent,265 const QString &aLocation);266 int confirmDeleteHardDiskStorage (QWidget *aParent,267 const QString &aLocation);268 void cannotDeleteHardDiskStorage (QWidget *aParent, const CHardDisk &aHD,269 const CProgress &aProgress);270 271 int confirmDetachSATASlots (QWidget *aParent);272 int confirmRunNewHDWzdOrVDM (QWidget* aParent);273 274 void cannotCreateHardDiskStorage (QWidget *aParent, const CVirtualBox &aVBox,275 const QString &aLocaiton,276 const CHardDisk &aHD,277 const CProgress &aProgress);278 void cannotAttachHardDisk (QWidget *aParent, const CMachine &aMachine,279 const QString &aLocation, KStorageBus aBus,280 LONG aChannel, LONG aDevice);281 void cannotDetachHardDisk (QWidget *aParent, const CMachine &aMachine,282 const QString &aLocation, KStorageBus aBus,283 LONG aChannel, LONG aDevice);284 285 void cannotMountMedium (QWidget *aParent, const CMachine &aMachine,286 const VBoxMedium &aMedium, const COMResult &aResult);287 void cannotUnmountMedium (QWidget *aParent, const CMachine &aMachine,288 const VBoxMedium &aMedium, const COMResult &aResult);289 void cannotOpenMedium (QWidget *aParent, const CVirtualBox &aVBox,290 VBoxDefs::MediaType aType, const QString &aLocation);291 void cannotCloseMedium (QWidget *aParent, const VBoxMedium &aMedium,292 const COMResult &aResult);293 294 void cannotOpenSession (const CSession &session);295 void cannotOpenSession (const CVirtualBox &vbox, const CMachine &machine,296 const CProgress &progress = CProgress());297 298 void cannotGetMediaAccessibility (const VBoxMedium &aMedium);299 300 #if defined Q_WS_WIN301 int confirmDeletingHostInterface (const QString &aName, QWidget *aParent = 0);302 void cannotCreateHostInterface (const CHost &aHost,303 QWidget *aParent = 0);304 void cannotCreateHostInterface (const CProgress &aProgress, const QString &aName,305 QWidget *aParent = 0);306 void cannotRemoveHostInterface (const CHost &aHost,307 const CHostNetworkInterface &aIface,308 QWidget *aParent = 0);309 void cannotRemoveHostInterface (const CProgress &aProgress,310 const CHostNetworkInterface &aIface,311 QWidget *aParent = 0);312 #endif313 314 void cannotAttachUSBDevice (const CConsole &console, const QString &device);315 void cannotAttachUSBDevice (const CConsole &console, const QString &device,316 const CVirtualBoxErrorInfo &error);317 void cannotDetachUSBDevice (const CConsole &console, const QString &device);318 void cannotDetachUSBDevice (const CConsole &console, const QString &device,319 const CVirtualBoxErrorInfo &error);320 321 void cannotCreateSharedFolder (QWidget *, const CMachine &,322 const QString &, const QString &);323 void cannotRemoveSharedFolder (QWidget *, const CMachine &,324 const QString &, const QString &);325 void cannotCreateSharedFolder (QWidget *, const CConsole &,326 const QString &, const QString &);327 void cannotRemoveSharedFolder (QWidget *, const CConsole &,328 const QString &, const QString &);329 330 int cannotFindGuestAdditions (const QString &aSrc1, const QString &aSrc2);331 void cannotDownloadGuestAdditions (const QString &aURL,332 const QString &aReason);333 bool confirmDownloadAdditions (const QString &aURL, ulong aSize);334 bool confirmMountAdditions (const QString &aURL, const QString &aSrc);335 void warnAboutTooOldAdditions (QWidget *, const QString &, const QString &);336 void warnAboutOldAdditions (QWidget *, const QString &, const QString &);337 void warnAboutNewAdditions (QWidget *, const QString &, const QString &);338 339 void cannotConnectRegister (QWidget *aParent,340 const QString &aURL,341 const QString &aReason);342 void showRegisterResult (QWidget *aParent,343 const QString &aResult);344 345 void showUpdateSuccess (QWidget *aParent,346 const QString &aVersion,347 const QString &aLink);348 void showUpdateFailure (QWidget *aParent,349 const QString &aReason);350 void showUpdateNotFound (QWidget *aParent);351 352 bool confirmInputCapture (bool *aAutoConfirmed = NULL);353 void remindAboutAutoCapture();354 void remindAboutMouseIntegration (bool aSupportsAbsolute);355 bool remindAboutPausedVMInput();356 357 int warnAboutAutoConvertedSettings (const QString &aFormatVersion,358 const QString &aFileList,359 bool aAfterRefresh);360 361 bool remindAboutInaccessibleMedia();362 363 bool confirmGoingFullscreen (const QString &aHotKey);364 bool confirmGoingSeamless (const QString &aHotKey);365 366 void remindAboutWrongColorDepth (ulong aRealBPP, ulong aWantedBPP);367 368 bool remindAboutGuruMeditation (const CConsole &aConsole,369 const QString &aLogFolder);370 371 bool confirmVMReset (QWidget *aParent);372 373 bool confirmHardDisklessMachine (QWidget *aParent);374 375 void cannotRunInSelectorMode();376 377 void cannotImportAppliance (CAppliance *aAppliance, QWidget *aParent = NULL) const;378 void cannotImportAppliance (const CProgress &aProgress, CAppliance *aAppliance, QWidget *aParent = NULL) const;379 380 void cannotExportAppliance (CAppliance *aAppliance, QWidget *aParent = NULL) const;381 void cannotExportAppliance (const CProgress &aProgress, CAppliance *aAppliance, QWidget *aParent = NULL) const;382 383 void showRuntimeError (const CConsole &console, bool fatal,384 const QString &errorID,385 const QString &errorMsg) const;386 387 static QString toAccusative (VBoxDefs::MediaType aType);388 389 static QString formatRC (HRESULT aRC);390 391 static QString formatErrorInfo (const COMErrorInfo &aInfo,392 HRESULT aWrapperRC = S_OK);393 394 static QString formatErrorInfo (const CVirtualBoxErrorInfo &aInfo)395 {396 return formatErrorInfo (COMErrorInfo (aInfo));397 }398 399 static QString formatErrorInfo (const COMBaseWithEI &aWrapper)400 {401 Assert (aWrapper.lastRC() != S_OK);402 return formatErrorInfo (aWrapper.errorInfo(), aWrapper.lastRC());403 }404 405 static QString formatErrorInfo (const COMResult &aRC)406 {407 Assert (aRC.rc() != S_OK);408 return formatErrorInfo (aRC.errorInfo(), aRC.rc());409 }410 411 public slots:412 413 void showHelpWebDialog();414 void showHelpAboutDialog();415 void showHelpHelpDialog();416 void resetSuppressedMessages();417 418 private:419 420 friend VBoxProblemReporter &vboxProblem();421 422 static QString doFormatErrorInfo (const COMErrorInfo &aInfo,423 HRESULT aWrapperRC = S_OK);424 };425 426 /**427 * Shortcut to the static VBoxProblemReporter::instance() method, for428 * convenience.429 */430 inline VBoxProblemReporter &vboxProblem() { return VBoxProblemReporter::instance(); }431 432 #endif // __VBoxProblemReporter_h__
Note:
See TracChangeset
for help on using the changeset viewer.