Changeset 100959 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 23, 2023 5:08:38 PM (20 months ago)
- svn:sync-xref-src-repo-rev:
- 158897
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 9 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r100956 r100959 879 879 src/settings/UISettingsDialogSpecific.h \ 880 880 src/settings/UISettingsPage.h \ 881 src/settings/UISettingsPageValidator.h \ 881 882 src/settings/UISettingsSelector.h \ 882 883 src/settings/UISettingsSerializer.h \ … … 1461 1462 src/settings/UISettingsDialogSpecific.cpp \ 1462 1463 src/settings/UISettingsPage.cpp \ 1464 src/settings/UISettingsPageValidator.cpp \ 1463 1465 src/settings/UISettingsSelector.cpp \ 1464 1466 src/settings/UISettingsSerializer.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.cpp
r98103 r100959 28 28 /* GUI includes: */ 29 29 #include "QIWidgetValidator.h" 30 #include "UISettingsPage.h" 30 31 /* Other VBox includes: */ 32 #include "iprt/assert.h" 31 33 32 34 … … 40 42 , m_enmState(QValidator::Invalid) 41 43 { 42 /* Prepare: */43 44 prepare(); 44 45 } … … 80 81 * Class QObjectValidatorGroup implementation. * 81 82 *********************************************************************************************************************************/ 83 84 QObjectValidatorGroup::QObjectValidatorGroup(QObject *pParent) 85 : QObject(pParent) 86 , m_fResult(false) 87 { 88 } 82 89 83 90 void QObjectValidatorGroup::addObjectValidator(QObjectValidator *pObjectValidator) … … 135 142 136 143 /********************************************************************************************************************************* 137 * Class UIPageValidator implementation. *138 *********************************************************************************************************************************/139 140 QPixmap UIPageValidator::warningPixmap() const141 {142 return m_pPage->warningPixmap();143 }144 145 QString UIPageValidator::internalName() const146 {147 return m_pPage->internalName();148 }149 150 void UIPageValidator::setLastMessage(const QString &strLastMessage)151 {152 /* Remember new message: */153 m_strLastMessage = strLastMessage;154 155 /* Should we show corresponding warning icon? */156 if (m_strLastMessage.isEmpty())157 emit sigHideWarningIcon();158 else159 emit sigShowWarningIcon();160 }161 162 void UIPageValidator::revalidate()163 {164 /* Notify listener(s) about validity change: */165 emit sigValidityChanged(this);166 }167 168 169 /*********************************************************************************************************************************170 144 * Class QIULongValidator implementation. * 171 145 *********************************************************************************************************************************/ -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.h
r98103 r100959 34 34 /* Qt includes: */ 35 35 #include <QMap> 36 #include <QPixmap>37 36 #include <QValidator> 38 37 … … 40 39 #include "UILibraryDefs.h" 41 40 42 /* Forward declarations: */43 class QPixmap;44 class QString;45 class UISettingsPage;46 41 47 48 /** QObject extension, 42 /** QObject sub-class, 49 43 * providing passed QObject with validation routine. */ 50 44 class SHARED_LIBRARY_STUFF QObjectValidator : public QObject … … 85 79 86 80 87 /** QObject extension,81 /** QObject sub-class, 88 82 * which can group various QObjectValidator instances to operate on. */ 89 83 class SHARED_LIBRARY_STUFF QObjectValidatorGroup : public QObject … … 99 93 100 94 /** Constructs validation group passing @a pParent to the base-class. */ 101 QObjectValidatorGroup(QObject *pParent) 102 : QObject(pParent) 103 , m_fResult(false) 104 {} 95 QObjectValidatorGroup(QObject *pParent); 105 96 106 97 /** Adds @a pObjectValidator. … … 127 118 /** Holds validation result. */ 128 119 bool m_fResult; 129 };130 131 132 /** Page validator prototype. */133 class SHARED_LIBRARY_STUFF UIPageValidator : public QObject134 {135 Q_OBJECT;136 137 signals:138 139 /** Notifies about validity change for @a pValidator. */140 void sigValidityChanged(UIPageValidator *pValidator);141 142 /** Asks listener to show warning icon. */143 void sigShowWarningIcon();144 /** Asks listener to hide warning icon. */145 void sigHideWarningIcon();146 147 public:148 149 /** Constructs page validator for a certain @a pPage,150 * passing @a pParent to the base-class. */151 UIPageValidator(QObject *pParent, UISettingsPage *pPage)152 : QObject(pParent)153 , m_pPage(pPage)154 , m_fIsValid(true)155 {}156 157 /** Returns page. */158 UISettingsPage *page() const { return m_pPage; }159 /** Returns warning pixmap. */160 QPixmap warningPixmap() const;161 /** Returns internal name. */162 QString internalName() const;163 164 /** Returns whether validator is valid. */165 bool isValid() const { return m_fIsValid; }166 /** Defines whether validator @a fIsValid. */167 void setValid(bool fIsValid) { m_fIsValid = fIsValid; }168 169 /** Returns last message. */170 QString lastMessage() const { return m_strLastMessage; }171 /** Defines @a strLastMessage. */172 void setLastMessage(const QString &strLastMessage);173 174 public slots:175 176 /** Performs revalidation. */177 void revalidate();178 179 private:180 181 /** Holds the validated page. */182 UISettingsPage *m_pPage;183 184 /** Holds whether the page is valid. */185 bool m_fIsValid;186 187 /** Holds the last message. */188 QString m_strLastMessage;189 120 }; 190 121 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r100925 r100959 47 47 #include "UISettingsDialog.h" 48 48 #include "UISettingsPage.h" 49 #include "UISettingsPageValidator.h" 49 50 #include "UISettingsSelector.h" 50 51 #include "UISettingsSerializer.h" … … 96 97 save(); 97 98 98 /* Close if the ere is no ongoing serialization: */99 /* Close if there is no ongoing serialization: */ 99 100 if (!isSerializationInProgress()) 100 101 close(); … … 103 104 void UISettingsDialog::reject() 104 105 { 105 /* Close if the ere is no ongoing serialization: */106 /* Close if there is no ongoing serialization: */ 106 107 if (!isSerializationInProgress()) 107 108 close(); … … 198 199 199 200 /* Retranslate all validators: */ 200 foreach (UI PageValidator *pValidator, findChildren<UIPageValidator*>())201 foreach (UISettingsPageValidator *pValidator, findChildren<UISettingsPageValidator*>()) 201 202 if (!pValidator->lastMessage().isEmpty()) 202 203 revalidate(pValidator); … … 344 345 m_pSerializeProcess = new UISettingsSerializer(this, UISettingsSerializer::Load, 345 346 data, m_pSelector->settingPages()); 346 AssertPtrReturnVoid(m_pSerializeProcess);347 if (m_pSerializeProcess) 347 348 { 348 349 /* Configure settings loader: */ … … 374 375 new UISettingsSerializerProgress(this, UISettingsSerializer::Save, 375 376 data, m_pSelector->settingPages()); 376 AssertPtrReturnVoid(static_cast<UISettingsSerializerProgress*>(pDlgSerializeProgress));377 if (pDlgSerializeProgress) 377 378 { 378 379 /* Make the 'settings saver' temporary parent for all sub-dialogs: */ … … 432 433 { 433 434 pSettingsPage->setId(cId); 434 assignValidator(pSettingsPage); 435 436 /* Create validator: */ 437 UISettingsPageValidator *pValidator = new UISettingsPageValidator(this, pSettingsPage); 438 connect(pValidator, &UISettingsPageValidator::sigValidityChanged, this, &UISettingsDialog::sltHandleValidityChange); 439 pSettingsPage->setValidator(pValidator); 440 m_pWarningPane->registerValidator(pValidator); 441 442 /* Update navigation (tab-order): */ 443 pSettingsPage->setOrderAfter(m_pSelector->widget()); 435 444 } 436 445 } … … 441 450 } 442 451 443 void UISettingsDialog::revalidate(UI PageValidator *pValidator)452 void UISettingsDialog::revalidate(UISettingsPageValidator *pValidator) 444 453 { 445 454 /* Perform page revalidation: */ … … 487 496 488 497 /* Enumerating all the validators we have: */ 489 QList<UI PageValidator*> validators(findChildren<UIPageValidator*>());490 foreach (UI PageValidator *pValidator, validators)498 QList<UISettingsPageValidator*> validators(findChildren<UISettingsPageValidator*>()); 499 foreach (UISettingsPageValidator *pValidator, validators) 491 500 { 492 501 /* Is current validator have something to say? */ … … 536 545 } 537 546 538 void UISettingsDialog::sltHandleValidityChange(UI PageValidator *pValidator)547 void UISettingsDialog::sltHandleValidityChange(UISettingsPageValidator *pValidator) 539 548 { 540 549 /* Determine which settings-page had called for revalidation: */ … … 559 568 } 560 569 561 void UISettingsDialog::sltHandleWarningPaneHovered(UI PageValidator *pValidator)570 void UISettingsDialog::sltHandleWarningPaneHovered(UISettingsPageValidator *pValidator) 562 571 { 563 572 LogRelFlow(("Settings Dialog: Warning-icon hovered: %s.\n", pValidator->internalName().toUtf8().constData())); … … 565 574 /* Show corresponding popup: */ 566 575 if (!m_fValid || !m_fSilent) 567 {568 576 popupCenter().popup(m_pStack, "SettingsDialogWarning", 569 577 pValidator->lastMessage()); 570 } 571 } 572 573 void UISettingsDialog::sltHandleWarningPaneUnhovered(UIPageValidator *pValidator) 578 } 579 580 void UISettingsDialog::sltHandleWarningPaneUnhovered(UISettingsPageValidator *pValidator) 574 581 { 575 582 LogRelFlow(("Settings Dialog: Warning-icon unhovered: %s.\n", pValidator->internalName().toUtf8().constData())); … … 732 739 { 733 740 /* Delete serializer if exists: */ 734 if (serializeProcess()) 735 { 736 delete m_pSerializeProcess; 737 m_pSerializeProcess = 0; 738 } 741 delete m_pSerializeProcess; 742 m_pSerializeProcess = 0; 739 743 740 744 /* Recall popup-pane if any: */ … … 744 748 delete m_pSelector; 745 749 } 746 747 void UISettingsDialog::assignValidator(UISettingsPage *pPage)748 {749 /* Assign validator: */750 UIPageValidator *pValidator = new UIPageValidator(this, pPage);751 connect(pValidator, &UIPageValidator::sigValidityChanged, this, &UISettingsDialog::sltHandleValidityChange);752 pPage->setValidator(pValidator);753 m_pWarningPane->registerValidator(pValidator);754 755 /// @todo Why here?756 /* Configure navigation (tab-order): */757 pPage->setOrderAfter(m_pSelector->widget());758 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h
r100925 r100959 49 49 class QVariant; 50 50 class QIDialogButtonBox; 51 class UI PageValidator;51 class UISettingsPageValidator; 52 52 class UISettingsPage; 53 53 class UISettingsSelector; … … 160 160 161 161 /** Validates data correctness using certain @a pValidator. */ 162 void revalidate(UI PageValidator *pValidator);162 void revalidate(UISettingsPageValidator *pValidator); 163 163 /** Validates data correctness. */ 164 164 void revalidate(); … … 178 178 179 179 /** Handles validity change for certain @a pValidator. */ 180 void sltHandleValidityChange(UI PageValidator *pValidator);180 void sltHandleValidityChange(UISettingsPageValidator *pValidator); 181 181 182 182 /** Handles hover enter for warning pane specified by @a pValidator. */ 183 void sltHandleWarningPaneHovered(UI PageValidator *pValidator);183 void sltHandleWarningPaneHovered(UISettingsPageValidator *pValidator); 184 184 /** Handles hover leave for warning pane specified by @a pValidator. */ 185 void sltHandleWarningPaneUnhovered(UI PageValidator *pValidator);185 void sltHandleWarningPaneUnhovered(UISettingsPageValidator *pValidator); 186 186 187 187 private: … … 201 201 void cleanup(); 202 202 /** @} */ 203 204 /** Assigns validater for passed @a pPage. */205 void assignValidator(UISettingsPage *pPage);206 203 207 204 /** Holds configuration access level. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.cpp
r98103 r100959 29 29 #include "UIConverter.h" 30 30 #include "UISettingsPage.h" 31 #include " QIWidgetValidator.h"31 #include "UISettingsPageValidator.h" 32 32 33 33 … … 55 55 } 56 56 57 void UISettingsPage::setValidator(UI PageValidator *pValidator)57 void UISettingsPage::setValidator(UISettingsPageValidator *pValidator) 58 58 { 59 59 /* Make sure validator is not yet assigned: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h
r98103 r100959 53 53 class QVariant; 54 54 class QWidget; 55 class UI PageValidator;55 class UISettingsPageValidator; 56 56 57 57 /* Using declarations: */ … … 135 135 136 136 /** Defines @a pValidator. */ 137 void setValidator(UI PageValidator *pValidator);137 void setValidator(UISettingsPageValidator *pValidator); 138 138 /** Defines whether @a fIsValidatorBlocked which means not used at all. */ 139 139 void setValidatorBlocked(bool fIsValidatorBlocked) { m_fIsValidatorBlocked = fIsValidatorBlocked; } … … 207 207 208 208 /** Holds the first TAB-orer widget reference. */ 209 QWidget *m_pFirstWidget;209 QWidget *m_pFirstWidget; 210 210 /** Holds the page validator. */ 211 UI PageValidator *m_pValidator;211 UISettingsPageValidator *m_pValidator; 212 212 213 213 /** Holds whether page validation is blocked. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPageValidator.cpp
r100947 r100959 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - Qt extensions: QIWidgetValidator class implementation.3 * VBox Qt GUI - Qt extensions: UISettingsPageValidator class implementation. 4 4 */ 5 5 … … 27 27 28 28 /* GUI includes: */ 29 #include "QIWidgetValidator.h"30 29 #include "UISettingsPage.h" 30 #include "UISettingsPageValidator.h" 31 31 32 32 33 /********************************************************************************************************************************* 34 * Class QObjectValidator implementation. * 35 *********************************************************************************************************************************/ 36 37 QObjectValidator::QObjectValidator(QValidator *pValidator, QObject *pParent /* = 0 */) 33 UISettingsPageValidator::UISettingsPageValidator(QObject *pParent, UISettingsPage *pPage) 38 34 : QObject(pParent) 39 , m_p Validator(pValidator)40 , m_ enmState(QValidator::Invalid)35 , m_pPage(pPage) 36 , m_fIsValid(true) 41 37 { 42 /* Prepare: */43 prepare();44 38 } 45 39 46 void QObjectValidator::sltValidate(QString strInput /* = QString() */) 47 { 48 /* Make sure validator assigned: */ 49 AssertPtrReturnVoid(m_pValidator); 50 51 /* Validate: */ 52 int iPosition = 0; 53 const QValidator::State enmState = m_pValidator->validate(strInput, iPosition); 54 55 /* If validity state changed: */ 56 if (m_enmState != enmState) 57 { 58 /* Update last validity state: */ 59 m_enmState = enmState; 60 61 /* Notifies listener(s) about validity change: */ 62 emit sigValidityChange(m_enmState); 63 } 64 } 65 66 void QObjectValidator::prepare() 67 { 68 /* Make sure validator assigned: */ 69 AssertPtrReturnVoid(m_pValidator); 70 71 /* Register validator as child: */ 72 m_pValidator->setParent(this); 73 74 /* Validate: */ 75 sltValidate(); 76 } 77 78 79 /********************************************************************************************************************************* 80 * Class QObjectValidatorGroup implementation. * 81 *********************************************************************************************************************************/ 82 83 void QObjectValidatorGroup::addObjectValidator(QObjectValidator *pObjectValidator) 84 { 85 /* Make sure object-validator passed: */ 86 AssertPtrReturnVoid(pObjectValidator); 87 88 /* Register object-validator as child: */ 89 pObjectValidator->setParent(this); 90 91 /* Insert object-validator to internal map: */ 92 m_group.insert(pObjectValidator, toResult(pObjectValidator->state())); 93 94 /* Attach object-validator to group: */ 95 connect(pObjectValidator, &QObjectValidator::sigValidityChange, 96 this, &QObjectValidatorGroup::sltValidate); 97 } 98 99 void QObjectValidatorGroup::sltValidate(QValidator::State enmState) 100 { 101 /* Determine sender object-validator: */ 102 QObjectValidator *pObjectValidatorSender = qobject_cast<QObjectValidator*>(sender()); 103 /* Make sure that is one of our senders: */ 104 AssertReturnVoid(pObjectValidatorSender && m_group.contains(pObjectValidatorSender)); 105 106 /* Update internal map: */ 107 m_group[pObjectValidatorSender] = toResult(enmState); 108 109 /* Enumerate all the registered object-validators: */ 110 bool fResult = true; 111 foreach (QObjectValidator *pObjectValidator, m_group.keys()) 112 if (!toResult(pObjectValidator->state())) 113 { 114 fResult = false; 115 break; 116 } 117 118 /* If validity state changed: */ 119 if (m_fResult != fResult) 120 { 121 /* Update last validity state: */ 122 m_fResult = fResult; 123 124 /* Notifies listener(s) about validity change: */ 125 emit sigValidityChange(m_fResult); 126 } 127 } 128 129 /* static */ 130 bool QObjectValidatorGroup::toResult(QValidator::State enmState) 131 { 132 return enmState == QValidator::Acceptable; 133 } 134 135 136 /********************************************************************************************************************************* 137 * Class UIPageValidator implementation. * 138 *********************************************************************************************************************************/ 139 140 QPixmap UIPageValidator::warningPixmap() const 40 QPixmap UISettingsPageValidator::warningPixmap() const 141 41 { 142 42 return m_pPage->warningPixmap(); 143 43 } 144 44 145 QString UI PageValidator::internalName() const45 QString UISettingsPageValidator::internalName() const 146 46 { 147 47 return m_pPage->internalName(); 148 48 } 149 49 150 void UI PageValidator::setLastMessage(const QString &strLastMessage)50 void UISettingsPageValidator::setLastMessage(const QString &strLastMessage) 151 51 { 152 52 /* Remember new message: */ … … 160 60 } 161 61 162 void UI PageValidator::revalidate()62 void UISettingsPageValidator::revalidate() 163 63 { 164 64 /* Notify listener(s) about validity change: */ 165 65 emit sigValidityChanged(this); 166 66 } 167 168 169 /*********************************************************************************************************************************170 * Class QIULongValidator implementation. *171 *********************************************************************************************************************************/172 173 QValidator::State QIULongValidator::validate(QString &strInput, int &iPosition) const174 {175 Q_UNUSED(iPosition);176 177 /* Get the stripped string: */178 QString strStripped = strInput.trimmed();179 180 /* 'Intermediate' for empty string or started from '0x': */181 if (strStripped.isEmpty() ||182 strStripped.toUpper() == QString("0x").toUpper())183 return Intermediate;184 185 /* Convert to ulong: */186 bool fOk;187 ulong uEntered = strInput.toULong(&fOk, 0);188 189 /* 'Invalid' if failed to convert: */190 if (!fOk)191 return Invalid;192 193 /* 'Acceptable' if fits the bounds: */194 if (uEntered >= m_uBottom && uEntered <= m_uTop)195 return Acceptable;196 197 /* 'Invalid' if more than top, 'Intermediate' if less than bottom: */198 return uEntered > m_uTop ? Invalid : Intermediate;199 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPageValidator.h
r100947 r100959 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - Qt extensions: QIWidgetValidator class declaration.3 * VBox Qt GUI - Qt extensions: UISettingsPageValidator class declaration. 4 4 */ 5 5 … … 26 26 */ 27 27 28 #ifndef FEQT_INCLUDED_SRC_ extensions_QIWidgetValidator_h29 #define FEQT_INCLUDED_SRC_ extensions_QIWidgetValidator_h28 #ifndef FEQT_INCLUDED_SRC_settings_UISettingsPageValidator_h 29 #define FEQT_INCLUDED_SRC_settings_UISettingsPageValidator_h 30 30 #ifndef RT_WITHOUT_PRAGMA_ONCE 31 31 # pragma once … … 33 33 34 34 /* Qt includes: */ 35 #include <Q Map>35 #include <QObject> 36 36 #include <QPixmap> 37 #include <QValidator>38 37 39 38 /* GUI includes: */ … … 41 40 42 41 /* Forward declarations: */ 43 class QPixmap;44 42 class QString; 45 43 class UISettingsPage; 46 44 47 48 /** QObject extension, 49 * providing passed QObject with validation routine. */ 50 class SHARED_LIBRARY_STUFF QObjectValidator : public QObject 51 { 52 Q_OBJECT; 53 54 signals: 55 56 /** Notifies listener(s) about validity changed to @a enmState. */ 57 void sigValidityChange(QValidator::State enmState); 58 59 public: 60 61 /** Constructs object validator passing @a pParent to the base-class. 62 * @param pValidator Brings the validator passed on to the OObject 63 * children and used to perform validation itself. */ 64 QObjectValidator(QValidator *pValidator, QObject *pParent = 0); 65 66 /** Returns last validation state. */ 67 QValidator::State state() const { return m_enmState; } 68 69 public slots: 70 71 /** Performs validation: */ 72 void sltValidate(QString strInput = QString()); 73 74 private: 75 76 /** Prepare routine. */ 77 void prepare(); 78 79 /** Holds the validator reference. */ 80 QValidator *m_pValidator; 81 82 /** Holds the validation state. */ 83 QValidator::State m_enmState; 84 }; 85 86 87 /** QObject extension, 88 * which can group various QObjectValidator instances to operate on. */ 89 class SHARED_LIBRARY_STUFF QObjectValidatorGroup : public QObject 90 { 91 Q_OBJECT; 92 93 signals: 94 95 /** Notifies listener(s) about validity changed to @a fValid. */ 96 void sigValidityChange(bool fValid); 97 98 public: 99 100 /** Constructs validation group passing @a pParent to the base-class. */ 101 QObjectValidatorGroup(QObject *pParent) 102 : QObject(pParent) 103 , m_fResult(false) 104 {} 105 106 /** Adds @a pObjectValidator. 107 * @note The ownership of @a pObjectValidator is transferred to the group, 108 * and it's the group's responsibility to delete it. */ 109 void addObjectValidator(QObjectValidator *pObjectValidator); 110 111 /** Returns last validation result. */ 112 bool result() const { return m_fResult; } 113 114 private slots: 115 116 /** Performs validation for a passed @a enmState. */ 117 void sltValidate(QValidator::State enmState); 118 119 private: 120 121 /** Converts QValidator::State to bool result. */ 122 static bool toResult(QValidator::State enmState); 123 124 /** Holds object-validators and their states. */ 125 QMap<QObjectValidator*, bool> m_group; 126 127 /** Holds validation result. */ 128 bool m_fResult; 129 }; 130 131 132 /** Page validator prototype. */ 133 class SHARED_LIBRARY_STUFF UIPageValidator : public QObject 45 /** QObject sub-class, 46 * used as settings-page validator. */ 47 class SHARED_LIBRARY_STUFF UISettingsPageValidator : public QObject 134 48 { 135 49 Q_OBJECT; … … 138 52 139 53 /** Notifies about validity change for @a pValidator. */ 140 void sigValidityChanged(UI PageValidator *pValidator);54 void sigValidityChanged(UISettingsPageValidator *pValidator); 141 55 142 56 /** Asks listener to show warning icon. */ … … 149 63 /** Constructs page validator for a certain @a pPage, 150 64 * passing @a pParent to the base-class. */ 151 UIPageValidator(QObject *pParent, UISettingsPage *pPage) 152 : QObject(pParent) 153 , m_pPage(pPage) 154 , m_fIsValid(true) 155 {} 65 UISettingsPageValidator(QObject *pParent, UISettingsPage *pPage); 156 66 157 67 /** Returns page. */ 158 68 UISettingsPage *page() const { return m_pPage; } 69 159 70 /** Returns warning pixmap. */ 160 71 QPixmap warningPixmap() const; … … 183 94 184 95 /** Holds whether the page is valid. */ 185 bool m_fIsValid;96 bool m_fIsValid; 186 97 187 98 /** Holds the last message. */ 188 QString m_strLastMessage;99 QString m_strLastMessage; 189 100 }; 190 101 191 192 /** QValidator extension, 193 * for long number validations. */ 194 class SHARED_LIBRARY_STUFF QIULongValidator : public QValidator 195 { 196 public: 197 198 /** Constructs long validator passing @a pParent to the base-class. */ 199 QIULongValidator(QObject *pParent) 200 : QValidator(pParent) 201 , m_uBottom(0), m_uTop(ULONG_MAX) 202 {} 203 204 /** Constructs long validator passing @a pParent to the base-class. 205 * @param uMinimum Holds the minimum valid border. 206 * @param uMaximum Holds the maximum valid border. */ 207 QIULongValidator(ulong uMinimum, ulong uMaximum, 208 QObject *pParent) 209 : QValidator(pParent) 210 , m_uBottom(uMinimum), m_uTop(uMaximum) 211 {} 212 213 /** Destructs long validator. */ 214 virtual ~QIULongValidator() {} 215 216 /** Performs validation for @a strInput at @a iPosition. */ 217 State validate(QString &strInput, int &iPosition) const; 218 219 /** Defines @a uBottom. */ 220 void setBottom(ulong uBottom) { setRange(uBottom, m_uTop); } 221 /** Defines @a uTop. */ 222 void setTop(ulong uTop) { setRange(m_uBottom, uTop); } 223 /** Defines range based on passed @a uBottom and @a uTop. */ 224 void setRange(ulong uBottom, ulong uTop) { m_uBottom = uBottom; m_uTop = uTop; } 225 /** Returns bottom. */ 226 ulong bottom() const { return m_uBottom; } 227 /** Returns top. */ 228 ulong top() const { return m_uTop; } 229 230 private: 231 232 /** Holds the bottom. */ 233 ulong m_uBottom; 234 /** Holds the top. */ 235 ulong m_uTop; 236 }; 237 238 239 #endif /* !FEQT_INCLUDED_SRC_extensions_QIWidgetValidator_h */ 102 #endif /* !FEQT_INCLUDED_SRC_settings_UISettingsPageValidator_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIWarningPane.cpp
r98103 r100959 33 33 34 34 /* GUI includes: */ 35 #include " QIWidgetValidator.h"35 #include "UISettingsPageValidator.h" 36 36 #include "UIWarningPane.h" 37 37 … … 57 57 } 58 58 59 void UIWarningPane::registerValidator(UI PageValidator *pValidator)59 void UIWarningPane::registerValidator(UISettingsPageValidator *pValidator) 60 60 { 61 61 /* Make sure validator exists: */ … … 79 79 pIconLabel->installEventFilter(this); 80 80 pIconLabel->setPixmap(pValidator->warningPixmap()); 81 connect(pValidator, &UI PageValidator::sigShowWarningIcon, pIconLabel, &QLabel::show);82 connect(pValidator, &UI PageValidator::sigHideWarningIcon, pIconLabel, &QLabel::hide);81 connect(pValidator, &UISettingsPageValidator::sigShowWarningIcon, pIconLabel, &QLabel::show); 82 connect(pValidator, &UISettingsPageValidator::sigHideWarningIcon, pIconLabel, &QLabel::hide); 83 83 84 84 /* Add icon-label into list: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIWarningPane.h
r98103 r100959 46 46 class QTimer; 47 47 class QWidget; 48 class UI PageValidator;48 class UISettingsPageValidator; 49 49 50 50 /** QWidget subclass used a settings dialog warning-pane. */ … … 57 57 /** Notifies about hover enter event. 58 58 * @param pValidator Brings the validator reference. */ 59 void sigHoverEnter(UI PageValidator *pValidator);59 void sigHoverEnter(UISettingsPageValidator *pValidator); 60 60 /** Notifies about hover leave event. 61 61 * @param pValidator Brings the validator reference. */ 62 void sigHoverLeave(UI PageValidator *pValidator);62 void sigHoverLeave(UISettingsPageValidator *pValidator); 63 63 64 64 public: … … 71 71 72 72 /** Registers corresponding @a pValidator. */ 73 void registerValidator(UI PageValidator *pValidator);73 void registerValidator(UISettingsPageValidator *pValidator); 74 74 75 75 protected: … … 94 94 95 95 /** Holds the page validators list. */ 96 QList<UI PageValidator*> m_validators;96 QList<UISettingsPageValidator*> m_validators; 97 97 /** Holds the page icons list. */ 98 QList<QLabel*> m_icons;98 QList<QLabel*> m_icons; 99 99 /** Holds the icons hovered-states list. */ 100 QList<bool> m_hovered;100 QList<bool> m_hovered; 101 101 102 102 /** Holds the hover timer instance. */
Note:
See TracChangeset
for help on using the changeset viewer.