- Timestamp:
- Mar 28, 2013 11:39:58 AM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r45193 r45225 71 71 #include <iprt/path.h> 72 72 73 bool UIMessageCenter::isAnyWarningShown() 74 { 75 /* Check if at least one warning is alive! 76 * All warnings are stored in m_warnings list as live pointers, 77 * this is why if some warning was deleted from another place, 78 * its pointer here will equal NULL... */ 79 for (int i = 0; i < m_warnings.size(); ++i) 80 if (m_warnings[i]) 81 return true; 82 return false; 83 } 84 85 bool UIMessageCenter::isAlreadyShown(const QString &strWarningName) const 86 { 87 return m_strShownWarnings.contains(strWarningName); 88 } 89 90 void UIMessageCenter::setShownStatus(const QString &strWarningName) 91 { 92 if (!m_strShownWarnings.contains(strWarningName)) 93 m_strShownWarnings.append(strWarningName); 94 } 95 96 void UIMessageCenter::clearShownStatus(const QString &strWarningName) 97 { 98 if (m_strShownWarnings.contains(strWarningName)) 99 m_strShownWarnings.removeAll(strWarningName); 100 } 101 102 void UIMessageCenter::closeAllWarnings() 103 { 104 /* Broadcast signal to perform emergent 105 * closing + deleting all the opened warnings. */ 106 emit sigToCloseAllWarnings(); 73 bool UIMessageCenter::warningShown(const QString &strWarningName) const 74 { 75 return m_warnings.contains(strWarningName); 76 } 77 78 void UIMessageCenter::setWarningShown(const QString &strWarningName, bool fWarningShown) 79 { 80 if (fWarningShown && !m_warnings.contains(strWarningName)) 81 m_warnings.append(strWarningName); 82 else if (!fWarningShown && m_warnings.contains(strWarningName)) 83 m_warnings.removeAll(strWarningName); 107 84 } 108 85 … … 249 226 pBox->setDetailsText(strDetails); 250 227 251 /* Add to warnings: */252 m_warnings << pBox;253 254 228 /* Show box: */ 255 229 int rc = pBox->exec(); … … 258 232 if (!pBox) 259 233 return rc; 260 261 /* Remove from warnings: */262 m_warnings.removeAll(pBox);263 234 264 235 /* Cleanup confirmation: */ … … 373 344 pBox->setDetailsText(strDetails); 374 345 375 /* Add to warnings: */376 m_warnings << pBox;377 378 346 /* Show box: */ 379 347 int rc = pBox->exec(); … … 382 350 if (!pBox) 383 351 return rc; 384 385 /* Remove from warnings: */386 m_warnings.removeAll(pBox);387 352 388 353 /* Save option: */ … … 826 791 void UIMessageCenter::warnAboutStateChange(QWidget *pParent) 827 792 { 828 if ( isAlreadyShown("warnAboutStateChange"))793 if (warningShown("warnAboutStateChange")) 829 794 return; 830 set ShownStatus("warnAboutStateChange");795 setWarningShown("warnAboutStateChange", true); 831 796 832 797 message(pParent ? pParent : mainWindowShown(), Warning, … … 835 800 "All other changes will be lost if you close this window now.")); 836 801 837 clearShownStatus("warnAboutStateChange");802 setWarningShown("warnAboutStateChange", false); 838 803 } 839 804 … … 2110 2075 void UIMessageCenter::remindAboutMouseIntegration(bool fSupportsAbsolute) 2111 2076 { 2112 if ( isAlreadyShown("remindAboutMouseIntegration"))2077 if (warningShown("remindAboutMouseIntegration")) 2113 2078 return; 2114 set ShownStatus("remindAboutMouseIntegration");2079 setWarningShown("remindAboutMouseIntegration", true); 2115 2080 2116 2081 static const char *kNames [2] = … … 2165 2130 } 2166 2131 2167 clearShownStatus("remindAboutMouseIntegration");2132 setWarningShown("remindAboutMouseIntegration", false); 2168 2133 } 2169 2134 … … 3273 3238 void UIMessageCenter::sltRemindAboutUnsupportedUSB2(const QString &strExtPackName, QWidget *pParent) 3274 3239 { 3275 if ( isAlreadyShown("sltRemindAboutUnsupportedUSB2"))3240 if (warningShown("sltRemindAboutUnsupportedUSB2")) 3276 3241 return; 3277 set ShownStatus("sltRemindAboutUnsupportedUSB2");3242 setWarningShown("sltRemindAboutUnsupportedUSB2", true); 3278 3243 3279 3244 message(pParent ? pParent : mainMachineWindowShown(), Warning, … … 3285 3250 .arg(strExtPackName)); 3286 3251 3287 clearShownStatus("sltRemindAboutUnsupportedUSB2");3252 setWarningShown("sltRemindAboutUnsupportedUSB2", false); 3288 3253 } 3289 3254 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r45193 r45225 74 74 }; 75 75 76 bool isAnyWarningShown(); 77 bool isAlreadyShown(const QString &strGuardBlockName) const; 78 void setShownStatus(const QString &strGuardBlockName); 79 void clearShownStatus(const QString &strGuardBlockName); 80 void closeAllWarnings(); 76 /* API: Shown warning registration stuff: */ 77 bool warningShown(const QString &strWarningName) const; 78 void setWarningShown(const QString &strWarningName, bool fWarningShown); 81 79 82 80 int message(QWidget *pParent, Type type, const QString &strMessage, … … 502 500 HRESULT wrapperRC = S_OK); 503 501 504 QStringList m_strShownWarnings;505 mutable QList<QPointer<QIMessageBox> >m_warnings;502 /* Variables: */ 503 QStringList m_warnings; 506 504 }; 507 505
Note:
See TracChangeset
for help on using the changeset viewer.