Changeset 47615 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 8, 2013 4:10:59 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp
r47609 r47615 91 91 { 92 92 /* Make sure parent is set! */ 93 AssertMsg(pParent, ("Parent is NULL! "));93 AssertMsg(pParent, ("Parent is NULL!\n")); 94 94 if (!pParent) 95 95 return; … … 109 109 { 110 110 /* Make sure parent is set! */ 111 AssertMsg(pParent, ("Parent is NULL! "));111 AssertMsg(pParent, ("Parent is NULL!\n")); 112 112 if (!pParent) 113 113 return; … … 127 127 { 128 128 /* Make sure parent is set! */ 129 AssertMsg(pParent, ("Parent is NULL! "));129 AssertMsg(pParent, ("Parent is NULL!\n")); 130 130 if (!pParent) 131 131 return; … … 151 151 void UIPopupCenter::message(QWidget *pParent, const QString &strPopupPaneID, 152 152 const QString &strMessage, const QString &strDetails, 153 int iButton1 /*= 0*/, int iButton2 /*= 0*/,154 153 const QString &strButtonText1 /*= QString()*/, 155 154 const QString &strButtonText2 /*= QString()*/, … … 158 157 showPopupPane(pParent, strPopupPaneID, 159 158 strMessage, strDetails, 160 iButton1, iButton2,161 159 strButtonText1, strButtonText2, 162 160 fProposeAutoConfirmation); 163 161 } 164 162 165 void UIPopupCenter::error(QWidget *pParent, const QString &strPopupPaneID, 166 const QString &strMessage, const QString &strDetails, 163 void UIPopupCenter::popup(QWidget *pParent, const QString &strPopupPaneID, 164 const QString &strMessage) 165 { 166 message(pParent, strPopupPaneID, strMessage, QString()); 167 } 168 169 void UIPopupCenter::alert(QWidget *pParent, const QString &strPopupPaneID, 170 const QString &strMessage, 167 171 bool fProposeAutoConfirmation /*= false*/) 168 172 { 169 message(pParent, strPopupPaneID, 170 strMessage, strDetails, 171 AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape /* 1st button */, 172 0 /* 2nd button */, 173 message(pParent, strPopupPaneID, strMessage, QString(), 173 174 QApplication::translate("UIMessageCenter", "Close") /* 1st button text */, 174 175 QString() /* 2nd button text */, … … 176 177 } 177 178 178 void UIPopupCenter::alert(QWidget *pParent, const QString &strPopupPaneID,179 const QString &strMessage,180 bool fProposeAutoConfirmation /*= false*/)181 {182 error(pParent, strPopupPaneID,183 strMessage, QString(),184 fProposeAutoConfirmation);185 }186 187 179 void UIPopupCenter::question(QWidget *pParent, const QString &strPopupPaneID, 188 180 const QString &strMessage, 189 int iButton1 /*= 0*/, int iButton2 /*= 0*/,190 181 const QString &strButtonText1 /*= QString()*/, 191 182 const QString &strButtonText2 /*= QString()*/, 192 183 bool fProposeAutoConfirmation /*= false*/) 193 184 { 194 message(pParent, strPopupPaneID, 195 strMessage, QString(), 196 iButton1, iButton2, 185 message(pParent, strPopupPaneID, strMessage, QString(), 197 186 strButtonText1, strButtonText2, 198 187 fProposeAutoConfirmation); 199 188 } 200 189 201 void UIPopupCenter::questionBinary(QWidget *pParent, const QString &strPopupPaneID,202 const QString &strMessage,203 const QString &strOkButtonText /*= QString()*/,204 const QString &strCancelButtonText /*= QString()*/,205 bool fProposeAutoConfirmation /*= false*/)206 {207 question(pParent, strPopupPaneID,208 strMessage,209 AlertButton_Ok | AlertButtonOption_Default,210 AlertButton_Cancel | AlertButtonOption_Escape,211 strOkButtonText,212 strCancelButtonText,213 fProposeAutoConfirmation);214 }215 216 190 void UIPopupCenter::recall(QWidget *pParent, const QString &strPopupPaneID) 217 191 { … … 221 195 void UIPopupCenter::showPopupPane(QWidget *pParent, const QString &strPopupPaneID, 222 196 const QString &strMessage, const QString &strDetails, 223 int iButton1, int iButton2, 224 QString strButtonText1, QString strButtonText2, 225 bool fProposeAutoConfirmation) 226 { 227 /* Make sure parent is set! */ 228 AssertMsg(pParent, ("Parent is NULL!")); 229 if (!pParent) 230 return; 231 232 /* Make sure at least one button is valid: */ 233 if (iButton1 == 0 && iButton2 == 0) 234 { 197 QString strButtonText1 /*= QString()*/, QString strButtonText2 /*= QString()*/, 198 bool fProposeAutoConfirmation /*= false*/) 199 { 200 /* Make sure parent is set! */ 201 AssertMsg(pParent, ("Parent is NULL!\n")); 202 if (!pParent) 203 return; 204 205 /* Prepare buttons: */ 206 int iButton1 = 0; 207 int iButton2 = 0; 208 /* Make sure single button is properly configured: */ 209 if (!strButtonText1.isEmpty() && strButtonText2.isEmpty()) 235 210 iButton1 = AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape; 236 strButtonText1 = QApplication::translate("UIMessageCenter", "Close"); 211 else if (strButtonText1.isEmpty() && !strButtonText2.isEmpty()) 212 iButton2 = AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape; 213 /* Make sure buttons are unique if set both: */ 214 else if (!strButtonText1.isEmpty() && !strButtonText2.isEmpty()) 215 { 216 iButton1 = AlertButton_Ok | AlertButtonOption_Default; 217 iButton2 = AlertButton_Cancel | AlertButtonOption_Escape; 218 /* If user made a mistake in button names, we will fix that: */ 219 if (strButtonText1 == strButtonText2) 220 { 221 strButtonText1 = QApplication::translate("UIMessageCenter", "Ok"); 222 strButtonText1 = QApplication::translate("UIMessageCenter", "Cancel"); 223 } 237 224 } 238 225 239 226 /* Check if popup-pane was auto-confirmed before: */ 240 if ( fProposeAutoConfirmation)227 if ((iButton1 || iButton2) && fProposeAutoConfirmation) 241 228 { 242 229 QStringList confirmedPopupList = vboxGlobal().virtualBox().GetExtraData(GUI_SuppressMessages).split(','); … … 285 272 /* Compose button description map: */ 286 273 QMap<int, QString> buttonDescriptions; 287 if (iButton1 != 0 && !buttonDescriptions.contains(iButton1))274 if (iButton1 != 0) 288 275 buttonDescriptions[iButton1] = strButtonText1; 289 if (iButton2 != 0 && !buttonDescriptions.contains(iButton2))276 if (iButton2 != 0) 290 277 buttonDescriptions[iButton2] = strButtonText2; 291 278 /* Create new one: */ … … 298 285 { 299 286 /* Make sure parent is set! */ 300 AssertMsg(pParent, ("Parent is NULL! "));287 AssertMsg(pParent, ("Parent is NULL!\n")); 301 288 if (!pParent) 302 289 return; … … 336 323 if (!m_stacks.contains(strPopupStackID)) 337 324 { 338 AssertMsgFailed(("Popup-stack already destroyed! "));325 AssertMsgFailed(("Popup-stack already destroyed!\n")); 339 326 return; 340 327 } … … 351 338 { 352 339 /* Make sure parent is set! */ 353 AssertMsg(pParent, ("Parent is NULL! "));340 AssertMsg(pParent, ("Parent is NULL!\n")); 354 341 if (!pParent) 355 342 return QString(); … … 367 354 { 368 355 /* Make sure parent is set! */ 369 AssertMsg(pParent, ("Parent is NULL! "));356 AssertMsg(pParent, ("Parent is NULL!\n")); 370 357 if (!pParent) 371 358 return; … … 395 382 { 396 383 /* Make sure parent is set! */ 397 AssertMsg(pParent, ("Parent is NULL! "));384 AssertMsg(pParent, ("Parent is NULL!\n")); 398 385 if (!pParent) 399 386 return; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.h
r47523 r47615 58 58 59 59 /* API: Main message function. 60 * Provides one-two buttons.61 * Used directly only in exceptional cases:*/60 * Provides up to two buttons. 61 * Its interface, do NOT use it directly! */ 62 62 void message(QWidget *pParent, const QString &strPopupPaneID, 63 63 const QString &strMessage, const QString &strDetails, 64 int iButton1 = 0, int iButton2 = 0,65 64 const QString &strButtonText1 = QString(), 66 65 const QString &strButtonText2 = QString(), … … 68 67 69 68 /* API: Wrapper to 'message' function. 70 * Provides single OK button: */ 71 void error(QWidget *pParent, const QString &strPopupPaneID, 72 const QString &strMessage, const QString &strDetails, 73 bool fProposeAutoConfirmation = false); 69 * Omits details, provides no buttons: */ 70 void popup(QWidget *pParent, const QString &strPopupPaneID, 71 const QString &strMessage); 74 72 75 /* API: Wrapper to ' error' function.76 * Omits details : */73 /* API: Wrapper to 'message' function. 74 * Omits details, provides one button: */ 77 75 void alert(QWidget *pParent, const QString &strPopupPaneID, 78 76 const QString &strMessage, … … 80 78 81 79 /* API: Wrapper to 'message' function. 82 * Omits details, provides up to two buttons. 83 * Used directly only in exceptional cases: */ 80 * Omits details, provides up to two buttons: */ 84 81 void question(QWidget *pParent, const QString &strPopupPaneID, 85 82 const QString &strMessage, 86 int iButton1 = 0, int iButton2 = 0,87 83 const QString &strButtonText1 = QString(), 88 84 const QString &strButtonText2 = QString(), 89 85 bool fProposeAutoConfirmation = false); 90 91 /* API: Wrapper to 'question' function,92 * Question providing two buttons (OK and Cancel by default): */93 void questionBinary(QWidget *pParent, const QString &strPopupPaneID,94 const QString &strMessage,95 const QString &strOkButtonText = QString(),96 const QString &strCancelButtonText = QString(),97 bool fProposeAutoConfirmation = false);98 86 99 87 /* API: Recall function, … … 131 119 void showPopupPane(QWidget *pParent, const QString &strPopupPaneID, 132 120 const QString &strMessage, const QString &strDetails, 133 int iButton1, int iButton2, 134 QString strButtonText1, QString strButtonText2, 135 bool fProposeAutoConfirmation); 121 QString strButtonText1 = QString(), QString strButtonText2 = QString(), 122 bool fProposeAutoConfirmation = false); 136 123 void hidePopupPane(QWidget *pParent, const QString &strPopupPaneID); 137 124
Note:
See TracChangeset
for help on using the changeset viewer.