Changeset 71459 in vbox
- Timestamp:
- Mar 22, 2018 2:41:03 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 121428
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r69553 r71459 5 5 6 6 /* 7 * Copyright (C) 2006-201 7Oracle Corporation7 * Copyright (C) 2006-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 28 28 # ifdef VBOX_WS_MAC 29 29 # include <QPushButton> 30 # endif /* VBOX_WS_MAC */30 # endif 31 31 32 32 /* GUI includes: */ 33 # include "QIMessageBox.h" 33 34 # include "VBoxGlobal.h" 34 35 # include "UIConverter.h" … … 47 48 # include "UIDownloaderUserManual.h" 48 49 # endif /* VBOX_OSE */ 49 # include "UIMachine.h"50 50 # include "VBoxAboutDlg.h" 51 51 # include "UIHostComboEditor.h" 52 52 # ifdef VBOX_WS_MAC 53 53 # include "VBoxUtils-darwin.h" 54 # endif /* VBOX_WS_MAC */54 # endif 55 55 # ifdef VBOX_WS_WIN 56 56 # include <Htmlhelp.h> 57 # endif /* VBOX_WS_WIN */57 # endif 58 58 59 59 /* COM includes: */ … … 91 91 92 92 /* static */ 93 UIMessageCenter * UIMessageCenter::m_spInstance = 0;94 UIMessageCenter * UIMessageCenter::instance() { return m_spInstance; }93 UIMessageCenter *UIMessageCenter::s_pInstance = 0; 94 UIMessageCenter *UIMessageCenter::instance() { return s_pInstance; } 95 95 96 96 /* static */ … … 98 98 { 99 99 /* Make sure instance is NOT created yet: */ 100 if ( m_spInstance)100 if (s_pInstance) 101 101 { 102 102 AssertMsgFailed(("UIMessageCenter instance is already created!")); … … 107 107 new UIMessageCenter; 108 108 /* Prepare instance: */ 109 m_spInstance->prepare();109 s_pInstance->prepare(); 110 110 } 111 111 … … 114 114 { 115 115 /* Make sure instance is NOT destroyed yet: */ 116 if (! m_spInstance)116 if (!s_pInstance) 117 117 { 118 118 AssertMsgFailed(("UIMessageCenter instance is already destroyed!")); … … 121 121 122 122 /* Cleanup instance: */ 123 m_spInstance->cleanup();123 s_pInstance->cleanup(); 124 124 /* Destroy instance: */ 125 delete m_spInstance; 126 } 127 128 bool UIMessageCenter::warningShown(const QString &strWarningName) const 129 { 130 return m_warnings.contains(strWarningName); 125 delete s_pInstance; 131 126 } 132 127 … … 139 134 } 140 135 141 int UIMessageCenter::message(QWidget *pParent, MessageType type, 136 bool UIMessageCenter::warningShown(const QString &strWarningName) const 137 { 138 return m_warnings.contains(strWarningName); 139 } 140 141 int UIMessageCenter::message(QWidget *pParent, MessageType enmType, 142 142 const QString &strMessage, 143 143 const QString &strDetails, … … 155 155 /* We have to throw a blocking signal 156 156 * to show a message-box in the GUI thread: */ 157 emit sigToShowMessageBox(pParent, type,157 emit sigToShowMessageBox(pParent, enmType, 158 158 strMessage, strDetails, 159 159 iButton1, iButton2, iButton3, … … 164 164 } 165 165 /* In usual case we can chow a message-box directly: */ 166 return showMessageBox(pParent, type,166 return showMessageBox(pParent, enmType, 167 167 strMessage, strDetails, 168 168 iButton1, iButton2, iButton3, … … 171 171 } 172 172 173 void UIMessageCenter::error(QWidget *pParent, MessageType type,173 void UIMessageCenter::error(QWidget *pParent, MessageType enmType, 174 174 const QString &strMessage, 175 175 const QString &strDetails, 176 176 const char *pcszAutoConfirmId /* = 0*/) const 177 177 { 178 message(pParent, type, strMessage, strDetails, pcszAutoConfirmId,178 message(pParent, enmType, strMessage, strDetails, pcszAutoConfirmId, 179 179 AlertButton_Ok | AlertButtonOption_Default | AlertButtonOption_Escape); 180 180 } 181 181 182 bool UIMessageCenter::errorWithQuestion(QWidget *pParent, MessageType type,182 bool UIMessageCenter::errorWithQuestion(QWidget *pParent, MessageType enmType, 183 183 const QString &strMessage, 184 184 const QString &strDetails, … … 187 187 const QString &strCancelButtonText /* = QString()*/) const 188 188 { 189 return (message(pParent, type, strMessage, strDetails, pcszAutoConfirmId,189 return (message(pParent, enmType, strMessage, strDetails, pcszAutoConfirmId, 190 190 AlertButton_Ok | AlertButtonOption_Default, 191 191 AlertButton_Cancel | AlertButtonOption_Escape, … … 197 197 } 198 198 199 void UIMessageCenter::alert(QWidget *pParent, MessageType type,199 void UIMessageCenter::alert(QWidget *pParent, MessageType enmType, 200 200 const QString &strMessage, 201 201 const char *pcszAutoConfirmId /* = 0*/) const 202 202 { 203 error(pParent, type, strMessage, QString(), pcszAutoConfirmId);204 } 205 206 int UIMessageCenter::question(QWidget *pParent, MessageType type,203 error(pParent, enmType, strMessage, QString(), pcszAutoConfirmId); 204 } 205 206 int UIMessageCenter::question(QWidget *pParent, MessageType enmType, 207 207 const QString &strMessage, 208 208 const char *pcszAutoConfirmId/* = 0*/, … … 214 214 const QString &strButtonText3 /* = QString()*/) const 215 215 { 216 return message(pParent, type, strMessage, QString(), pcszAutoConfirmId,216 return message(pParent, enmType, strMessage, QString(), pcszAutoConfirmId, 217 217 iButton1, iButton2, iButton3, strButtonText1, strButtonText2, strButtonText3); 218 218 } 219 219 220 bool UIMessageCenter::questionBinary(QWidget *pParent, MessageType type,220 bool UIMessageCenter::questionBinary(QWidget *pParent, MessageType enmType, 221 221 const QString &strMessage, 222 222 const char *pcszAutoConfirmId /* = 0*/, … … 226 226 { 227 227 return fDefaultFocusForOk ? 228 ((question(pParent, type, strMessage, pcszAutoConfirmId,228 ((question(pParent, enmType, strMessage, pcszAutoConfirmId, 229 229 AlertButton_Ok | AlertButtonOption_Default, 230 230 AlertButton_Cancel | AlertButtonOption_Escape, … … 234 234 QString() /* third button */) & 235 235 AlertButtonMask) == AlertButton_Ok) : 236 ((question(pParent, type, strMessage, pcszAutoConfirmId,236 ((question(pParent, enmType, strMessage, pcszAutoConfirmId, 237 237 AlertButton_Ok, 238 238 AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape, … … 244 244 } 245 245 246 int UIMessageCenter::questionTrinary(QWidget *pParent, MessageType type,246 int UIMessageCenter::questionTrinary(QWidget *pParent, MessageType enmType, 247 247 const QString &strMessage, 248 248 const char *pcszAutoConfirmId /* = 0*/, … … 251 251 const QString &strCancelButtonText /* = QString()*/) const 252 252 { 253 return question(pParent, type, strMessage, pcszAutoConfirmId,253 return question(pParent, enmType, strMessage, pcszAutoConfirmId, 254 254 AlertButton_Choice1, 255 255 AlertButton_Choice2 | AlertButtonOption_Default, … … 260 260 } 261 261 262 int UIMessageCenter::messageWithOption(QWidget *pParent, MessageType type,262 int UIMessageCenter::messageWithOption(QWidget *pParent, MessageType enmType, 263 263 const QString &strMessage, 264 264 const QString &strOptionText, … … 278 278 QString strTitle; 279 279 AlertIconType icon; 280 switch ( type)280 switch (enmType) 281 281 { 282 282 default: … … 1097 1097 } 1098 1098 1099 void UIMessageCenter::cannotAttachDevice(const CMachine &machine, UIMediumType type,1099 void UIMessageCenter::cannotAttachDevice(const CMachine &machine, UIMediumType enmType, 1100 1100 const QString &strLocation, const StorageSlot &storageSlot, 1101 1101 QWidget *pParent /* = 0*/) 1102 1102 { 1103 1103 QString strMessage; 1104 switch ( type)1104 switch (enmType) 1105 1105 { 1106 1106 case UIMediumType_HardDisk: … … 1353 1353 } 1354 1354 1355 void UIMessageCenter::cannotDetachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent /* = 0*/) const1355 void UIMessageCenter::cannotDetachDevice(const CMachine &machine, UIMediumType enmType, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent /* = 0*/) const 1356 1356 { 1357 1357 /* Prepare the message: */ 1358 1358 QString strMessage; 1359 switch ( type)1359 switch (enmType) 1360 1360 { 1361 1361 case UIMediumType_HardDisk: … … 1438 1438 } 1439 1439 1440 void UIMessageCenter::cannotOpenMedium(const CVirtualBox &vbox, UIMediumType /* type */, const QString &strLocation, QWidget *pParent /* = 0*/) const1440 void UIMessageCenter::cannotOpenMedium(const CVirtualBox &vbox, UIMediumType, const QString &strLocation, QWidget *pParent /* = 0*/) const 1441 1441 { 1442 1442 /* Show the error: */ … … 1778 1778 CConsole console1 = console; 1779 1779 KMachineState state = console1.GetState(); 1780 MessageType type;1780 MessageType enmType; 1781 1781 QString severity; 1782 1782 … … 1794 1794 if (fFatal) 1795 1795 { 1796 type = MessageType_Critical;1796 enmType = MessageType_Critical; 1797 1797 severity = tr("<nobr>Fatal Error</nobr>", "runtime error info"); 1798 1798 autoConfimId += "fatal."; … … 1800 1800 else if (state == KMachineState_Paused) 1801 1801 { 1802 type = MessageType_Error;1802 enmType = MessageType_Error; 1803 1803 severity = tr("<nobr>Non-Fatal Error</nobr>", "runtime error info"); 1804 1804 autoConfimId += "error."; … … 1806 1806 else 1807 1807 { 1808 type = MessageType_Warning;1808 enmType = MessageType_Warning; 1809 1809 severity = tr("<nobr>Warning</nobr>", "runtime error info"); 1810 1810 autoConfimId += "warning."; … … 1829 1829 1830 1830 /* Show the error: */ 1831 if ( type == MessageType_Critical)1831 if (enmType == MessageType_Critical) 1832 1832 { 1833 error(0, type,1833 error(0, enmType, 1834 1834 tr("<p>A fatal error has occurred during virtual machine execution! " 1835 1835 "The virtual machine will be powered off. Please copy the following error message " … … 1837 1837 formatted, autoConfimId.data()); 1838 1838 } 1839 else if ( type == MessageType_Error)1839 else if (enmType == MessageType_Error) 1840 1840 { 1841 error(0, type,1841 error(0, enmType, 1842 1842 tr("<p>An error has occurred during virtual machine execution! " 1843 1843 "The error details are shown below. You may try to correct the error " … … 1847 1847 else 1848 1848 { 1849 error(0, type,1849 error(0, enmType, 1850 1850 tr("<p>The virtual machine execution may run into an error condition as described below. " 1851 1851 "We suggest that you take an appropriate action to avert the error.</p>"), … … 2628 2628 } 2629 2629 2630 void UIMessageCenter::sltShowMessageBox(QWidget *pParent, MessageType type,2630 void UIMessageCenter::sltShowMessageBox(QWidget *pParent, MessageType enmType, 2631 2631 const QString &strMessage, const QString &strDetails, 2632 2632 int iButton1, int iButton2, int iButton3, … … 2635 2635 { 2636 2636 /* Now we can show a message-box directly: */ 2637 showMessageBox(pParent, type,2637 showMessageBox(pParent, enmType, 2638 2638 strMessage, strDetails, 2639 2639 iButton1, iButton2, iButton3, … … 2645 2645 { 2646 2646 /* Assign instance: */ 2647 m_spInstance = this;2647 s_pInstance = this; 2648 2648 } 2649 2649 … … 2651 2651 { 2652 2652 /* Unassign instance: */ 2653 m_spInstance = 0;2653 s_pInstance = 0; 2654 2654 } 2655 2655 … … 2696 2696 } 2697 2697 2698 int UIMessageCenter::showMessageBox(QWidget *pParent, MessageType type,2698 int UIMessageCenter::showMessageBox(QWidget *pParent, MessageType enmType, 2699 2699 const QString &strMessage, const QString &strDetails, 2700 2700 int iButton1, int iButton2, int iButton3, … … 2730 2730 QString title; 2731 2731 AlertIconType icon; 2732 switch ( type)2732 switch (enmType) 2733 2733 { 2734 2734 default: -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r70474 r71459 5 5 6 6 /* 7 * Copyright (C) 2006-201 7Oracle Corporation7 * Copyright (C) 2006-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef __ UIMessageCenter_h__19 #define __ UIMessageCenter_h__18 #ifndef ___UIMessageCenter_h___ 19 #define ___UIMessageCenter_h___ 20 20 21 21 /* Qt includes: */ … … 23 23 24 24 /* GUI includes: */ 25 #include "QIMessageBox.h"26 25 #include "UIMediumDefs.h" 27 26 … … 35 34 #ifdef VBOX_WITH_DRAG_AND_DROP 36 35 class CGuest; 37 #endif /* VBOX_WITH_DRAG_AND_DROP */ 38 39 /* Possible message types: */ 36 #endif 37 38 39 /** Possible message types. */ 40 40 enum MessageType 41 41 { … … 49 49 Q_DECLARE_METATYPE(MessageType); 50 50 51 /* Global message-center object: */ 52 class UIMessageCenter: public QObject 51 52 /** Singleton QObject extension 53 * providing GUI with corresponding messages. */ 54 class UIMessageCenter : public QObject 53 55 { 54 56 Q_OBJECT; … … 56 58 signals: 57 59 58 /* Notifier: Interthreading stuff: */ 59 void sigToShowMessageBox(QWidget *pParent, MessageType type, 60 /** Asks to show message-box. 61 * @param pParent Brings the message-box parent. 62 * @param enmType Brings the message-box type. 63 * @param strMessage Brings the message. 64 * @param strDetails Brings the details. 65 * @param iButton1 Brings the button 1 type. 66 * @param iButton2 Brings the button 2 type. 67 * @param iButton3 Brings the button 3 type. 68 * @param strButtonText1 Brings the button 1 text. 69 * @param strButtonText2 Brings the button 2 text. 70 * @param strButtonText3 Brings the button 3 text. 71 * @param strAutoConfirmId Brings whether this message can be auto-confirmed. */ 72 void sigToShowMessageBox(QWidget *pParent, MessageType enmType, 60 73 const QString &strMessage, const QString &strDetails, 61 74 int iButton1, int iButton2, int iButton3, … … 65 78 public: 66 79 67 /* Static API: Create/destroy stuff:*/80 /** Creates message-center singleton. */ 68 81 static void create(); 82 /** Destroys message-center singleton. */ 69 83 static void destroy(); 70 84 71 /* API: Warning registration stuff: */ 85 /** Defines whether warning with particular @a strWarningName is @a fShown. */ 86 void setWarningShown(const QString &strWarningName, bool fShown) const; 87 /** Returns whether warning with particular @a strWarningName is shown. */ 72 88 bool warningShown(const QString &strWarningName) const; 73 void setWarningShown(const QString &strWarningName, bool fWarningShown) const; 74 75 /* API: Main message function, used directly only in exceptional cases: */ 76 int message(QWidget *pParent, MessageType type, 77 const QString &strMessage, 78 const QString &strDetails, 89 90 /** Shows a general type of 'Message'. 91 * @param pParent Brings the message-box parent. 92 * @param enmType Brings the message-box type. 93 * @param strMessage Brings the message. 94 * @param strDetails Brings the details. 95 * @param pcszAutoConfirmId Brings the auto-confirm ID. 96 * @param iButton1 Brings the button 1 type. 97 * @param iButton2 Brings the button 2 type. 98 * @param iButton3 Brings the button 3 type. 99 * @param strButtonText1 Brings the button 1 text. 100 * @param strButtonText2 Brings the button 2 text. 101 * @param strButtonText3 Brings the button 3 text. */ 102 int message(QWidget *pParent, MessageType enmType, 103 const QString &strMessage, const QString &strDetails, 79 104 const char *pcszAutoConfirmId = 0, 80 105 int iButton1 = 0, int iButton2 = 0, int iButton3 = 0, … … 83 108 const QString &strButtonText3 = QString()) const; 84 109 85 /* API: Wrapper to 'message' function. 86 * Provides single OK button: */ 87 void error(QWidget *pParent, MessageType type, 110 /** Shows an 'Error' type of 'Message'. 111 * Provides single Ok button. 112 * @param pParent Brings the message-box parent. 113 * @param enmType Brings the message-box type. 114 * @param strMessage Brings the message. 115 * @param strDetails Brings the details. 116 * @param pcszAutoConfirmId Brings the auto-confirm ID. */ 117 void error(QWidget *pParent, MessageType enmType, 88 118 const QString &strMessage, 89 119 const QString &strDetails, 90 120 const char *pcszAutoConfirmId = 0) const; 91 121 92 /* API: Wrapper to 'message' function, 93 * Error with question providing two buttons (OK and Cancel by default): */ 94 bool errorWithQuestion(QWidget *pParent, MessageType type, 122 /** Shows an 'Error with Question' type of 'Message'. 123 * Provides Ok and Cancel buttons (called same way by default). 124 * @param pParent Brings the message-box parent. 125 * @param enmType Brings the message-box type. 126 * @param strMessage Brings the message. 127 * @param strDetails Brings the details. 128 * @param pcszAutoConfirmId Brings the auto-confirm ID. 129 * @param strOkButtonText Brings the Ok button text. 130 * @param strCancelButtonText Brings the Cancel button text. */ 131 bool errorWithQuestion(QWidget *pParent, MessageType enmType, 95 132 const QString &strMessage, 96 133 const QString &strDetails, … … 99 136 const QString &strCancelButtonText = QString()) const; 100 137 101 /* API: Wrapper to 'error' function. 102 * Omits details: */ 103 void alert(QWidget *pParent, MessageType type, 138 /** Shows an 'Alert' type of 'Error'. 139 * Omit details. 140 * @param pParent Brings the message-box parent. 141 * @param enmType Brings the message-box type. 142 * @param strMessage Brings the message. 143 * @param pcszAutoConfirmId Brings the auto-confirm ID. */ 144 void alert(QWidget *pParent, MessageType enmType, 104 145 const QString &strMessage, 105 146 const char *pcszAutoConfirmId = 0) const; 106 147 107 /* API: Wrapper to 'message' function. 108 * Omits details, provides two or three buttons: */ 109 int question(QWidget *pParent, MessageType type, 148 /** Shows a 'Question' type of 'Message'. 149 * Omit details. 150 * @param pParent Brings the message-box parent. 151 * @param enmType Brings the message-box type. 152 * @param strMessage Brings the message. 153 * @param pcszAutoConfirmId Brings the auto-confirm ID. 154 * @param iButton1 Brings the button 1 type. 155 * @param iButton2 Brings the button 2 type. 156 * @param iButton3 Brings the button 3 type. 157 * @param strButtonText1 Brings the button 1 text. 158 * @param strButtonText2 Brings the button 2 text. 159 * @param strButtonText3 Brings the button 3 text. */ 160 int question(QWidget *pParent, MessageType enmType, 110 161 const QString &strMessage, 111 162 const char *pcszAutoConfirmId = 0, … … 115 166 const QString &strButtonText3 = QString()) const; 116 167 117 /* API: Wrapper to 'question' function, 118 * Question providing two buttons (OK and Cancel by default): */ 119 bool questionBinary(QWidget *pParent, MessageType type, 168 /** Shows a 'Binary' type of 'Question'. 169 * Omit details. Provides Ok and Cancel buttons (called same way by default). 170 * @param pParent Brings the message-box parent. 171 * @param enmType Brings the message-box type. 172 * @param strMessage Brings the message. 173 * @param pcszAutoConfirmId Brings the auto-confirm ID. 174 * @param strOkButtonText Brings the button 1 text. 175 * @param strCancelButtonText Brings the button 2 text. 176 * @param fDefaultFocusForOk Brings whether Ok button should be focused initially. */ 177 bool questionBinary(QWidget *pParent, MessageType enmType, 120 178 const QString &strMessage, 121 179 const char *pcszAutoConfirmId = 0, … … 124 182 bool fDefaultFocusForOk = true) const; 125 183 126 /* API: Wrapper to 'question' function, 127 * Question providing three buttons (Yes, No and Cancel by default): */ 128 int questionTrinary(QWidget *pParent, MessageType type, 184 /** Shows a 'Trinary' type of 'Question'. 185 * Omit details. Provides Yes, No and Cancel buttons (called same way by default). 186 * @param pParent Brings the message-box parent. 187 * @param enmType Brings the message-box type. 188 * @param strMessage Brings the message. 189 * @param pcszAutoConfirmId Brings the auto-confirm ID. 190 * @param strChoice1ButtonText Brings the button 1 text. 191 * @param strChoice2ButtonText Brings the button 2 text. 192 * @param strCancelButtonText Brings the button 3 text. */ 193 int questionTrinary(QWidget *pParent, MessageType enmType, 129 194 const QString &strMessage, 130 195 const char *pcszAutoConfirmId = 0, … … 133 198 const QString &strCancelButtonText = QString()) const; 134 199 135 /* API: One more main function: */ 136 int messageWithOption(QWidget *pParent, MessageType type, 200 /** Shows a general type of 'Message with Option'. 201 * @param pParent Brings the message-box parent. 202 * @param enmType Brings the message-box type. 203 * @param strMessage Brings the message. 204 * @param strOptionText Brings the option text. 205 * @param fDefaultOptionValue Brings the default option value. 206 * @param iButton1 Brings the button 1 type. 207 * @param iButton2 Brings the button 2 type. 208 * @param iButton3 Brings the button 3 type. 209 * @param strButtonText1 Brings the button 1 text. 210 * @param strButtonText2 Brings the button 2 text. 211 * @param strButtonText3 Brings the button 3 text. */ 212 int messageWithOption(QWidget *pParent, MessageType enmType, 137 213 const QString &strMessage, 138 214 const QString &strOptionText, … … 143 219 const QString &strButtonText3 = QString()) const; 144 220 145 /* API: Progress-dialog stuff: */ 146 bool showModalProgressDialog(CProgress &progress, const QString &strTitle, 221 /** Shows modal progress-dialog. 222 * @param comProgress Brings the progress this dialog is based on. 223 * @param strTitle Brings the title. 224 * @param strImage Brings the image. 225 * @param pParent Brings the parent. 226 * @param cMinDuration Brings the minimum diration to show this dialog after expiring it. */ 227 bool showModalProgressDialog(CProgress &comProgress, const QString &strTitle, 147 228 const QString &strImage = "", QWidget *pParent = 0, 148 229 int cMinDuration = 2000); … … 390 471 private slots: 391 472 392 /* Handler: Interthreading stuff: */ 393 void sltShowMessageBox(QWidget *pParent, MessageType type, 473 /** Shows message-box. 474 * @param pParent Brings the message-box parent. 475 * @param enmType Brings the message-box type. 476 * @param strMessage Brings the message. 477 * @param strDetails Brings the details. 478 * @param iButton1 Brings the button 1 type. 479 * @param iButton2 Brings the button 2 type. 480 * @param iButton3 Brings the button 3 type. 481 * @param strButtonText1 Brings the button 1 text. 482 * @param strButtonText2 Brings the button 2 text. 483 * @param strButtonText3 Brings the button 3 text. 484 * @param strAutoConfirmId Brings whether this message can be auto-confirmed. */ 485 void sltShowMessageBox(QWidget *pParent, MessageType enmType, 394 486 const QString &strMessage, const QString &strDetails, 395 487 int iButton1, int iButton2, int iButton3, … … 399 491 private: 400 492 401 /* Constructor/destructor:*/493 /** Constructs message-center. */ 402 494 UIMessageCenter(); 495 /** Destructs message-center. */ 403 496 ~UIMessageCenter(); 404 497 405 /* Helpers: Prepare/cleanup stuff:*/498 /** Prepares all. */ 406 499 void prepare(); 500 /** Cleanups all. */ 407 501 void cleanup(); 408 502 409 /* Helper: Message-box stuff: */ 503 /** Shows message-box. 504 * @param pParent Brings the message-box parent. 505 * @param enmType Brings the message-box type. 506 * @param strMessage Brings the message. 507 * @param strDetails Brings the details. 508 * @param iButton1 Brings the button 1 type. 509 * @param iButton2 Brings the button 2 type. 510 * @param iButton3 Brings the button 3 type. 511 * @param strButtonText1 Brings the button 1 text. 512 * @param strButtonText2 Brings the button 2 text. 513 * @param strButtonText3 Brings the button 3 text. 514 * @param strAutoConfirmId Brings whether this message can be auto-confirmed. */ 410 515 int showMessageBox(QWidget *pParent, MessageType type, 411 516 const QString &strMessage, const QString &strDetails, … … 414 519 const QString &strAutoConfirmId) const; 415 520 416 /* Variables:*/521 /** Holds the list of shown warnings. */ 417 522 mutable QStringList m_warnings; 418 523 419 /* API: Instance stuff: */ 420 static UIMessageCenter* m_spInstance; 421 static UIMessageCenter* instance(); 422 friend UIMessageCenter& msgCenter(); 524 /** Holds the singleton message-center instance. */ 525 static UIMessageCenter *s_pInstance; 526 /** Returns the singleton message-center instance. */ 527 static UIMessageCenter *instance(); 528 /** Allows for shortcut access. */ 529 friend UIMessageCenter &msgCenter(); 423 530 }; 424 531 425 /* Shortcut to the static UIMessageCenter::instance() method: */ 426 inline UIMessageCenter& msgCenter() { return *UIMessageCenter::instance(); } 427 428 #endif // __UIMessageCenter_h__ 532 /** Singleton Message Center 'official' name. */ 533 inline UIMessageCenter &msgCenter() { return *UIMessageCenter::instance(); } 534 535 536 #endif /* !___UIMessageCenter_h___ */ 537
Note:
See TracChangeset
for help on using the changeset viewer.