VirtualBox

Ignore:
Timestamp:
Aug 6, 2013 5:13:57 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Settings dialog: New validation stuff: Step 2 (Removing old validation stuff).

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.cpp

    r47559 r47563  
    2020#include "QIWidgetValidator.h"
    2121
    22 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    23 
    2422/* GUI includes: */
    2523#include "UISettingsPage.h"
     24
    2625
    2726UIPageValidator::UIPageValidator(QObject *pParent, UISettingsPage *pPage)
     
    3837}
    3938
    40 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    41 
    42 /* Qt includes: */
    43 #include <QLineEdit>
    44 #include <QComboBox>
    45 #include <QLabel>
    46 
    47 /* GUI includes: */
    48 #include "VBoxGlobal.h"
    49 
    50 /* Other VBox includes: */
    51 #include <iprt/assert.h>
    52 
    53 /** @class QIWidgetValidator
    54  *
    55  *  The QIWidgetValidator class is a widget validator. Its purpose is to
    56  *  answer the question: whether all relevant (grand) children of the given
    57  *  widget are valid or not. Relevant children are those widgets which
    58  *  receive some user input that can be checked for validity (i.e. they
    59  *  have a validator() method that returns a pointer to a QValidator instance
    60  *  used to validate widget's input). The QLineEdit class is an example of
    61  *  such a widget.
    62  *
    63  *  When a QIWidgetValidator instance is created it receives a pointer to
    64  *  a widget whose children should be checked for validity. The instance
    65  *  connects itself to signals emitted by input widgets when their contents
    66  *  changes, and emits its own signal, validityChanged() (common for all
    67  *  child widgets being observed), whenever the change happens.
    68  *
    69  *  Objects that want to know when the validity state changes should connect
    70  *  themselves to the validityChanged() signal and then use the isValid()
    71  *  method to determine whether all children are valid or not.
    72  *
    73  *  It is assumed that all children that require validity checks have been
    74  *  already added to the widget when it is passed to the QIWidgetValidator
    75  *  constructor. If other children (that need to be validated) are added
    76  *  later, it's necessary to call the rescan() method to rescan the widget
    77  *  hierarchy again, otherwise the results of validity checks are undefined.
    78  *
    79  *  It's also necessary to call the revalidate() method every time the
    80  *  enabled state of the child widget is changed, because QIWidgetValidator
    81  *  skips disabled widgets when it calculates the combined validity state.
    82  *
    83  *  This class is useful for example for QWizard dialogs, where a separate
    84  *  instance validates every page of the wizard that has children to validate,
    85  *  and the validityChanged() signal of every instance is connected to some
    86  *  signal of the QWizard subclass, that enables or disables the Next button,
    87  *  depending on the result of the validity check.
    88  *
    89  *  Currently, only QLineEdit and QComboBox classes and their successors are
    90  *  recognized by QIWidgetValidator. It uses the QLineEdit::hasAcceptableInput()
    91  *  and QCombobox::validator() methods to determine the validity state o
    92  *  the corresponding widgets (note that the QComboBox widget must be editable,
    93  *  otherwise it will be skipped).
    94  */
    95 
    96 /**
    97  *  Constructs a new instance that will check the validity of children
    98  *  of the given widget.
    99  *
    100  *  @param aWidget  Widget whose children should be checked.
    101  */
    102 QIWidgetValidator::QIWidgetValidator (QWidget *aWidget, QObject *aParent)
    103     : QObject (aParent)
    104     , mWidget (aWidget)
    105     , mOtherValid (true)
    106 {
    107     rescan();
    108 }
    109 
    110 /**
    111  *  Constructs a new instance that will check the validity of children
    112  *  of the given widget.
    113  *
    114  *  @param aCaption Caption to use for the warning message.
    115  *  @param aWidget  Widget whose children should be checked.
    116  */
    117 QIWidgetValidator::QIWidgetValidator (const QString &aCaption,
    118                                       QWidget *aWidget, QObject *aParent)
    119     : QObject (aParent)
    120     , mCaption (aCaption)
    121     , mWidget (aWidget)
    122     , mOtherValid (true)
    123 {
    124     rescan();
    125 }
    126 
    127 /**
    128  *  Destructs this validator instance.
    129  *  Before destruction, the #validityChanged() signal is emitted; the
    130  *  value of #isValid() is always true at this time.
    131  */
    132 QIWidgetValidator::~QIWidgetValidator()
    133 {
    134     mWidget = 0;
    135     doRevalidate();
    136 }
    137 
    138 //
    139 // Public members
    140 /////////////////////////////////////////////////////////////////////////////
    141 
    142 /** @fn QIWidgetValidator::widget() const
    143  *
    144  *  Returns a widget managed by this instance.
    145  */
    146 
    147 /**
    148  *  Returns true if all relevant children of the widget managed by this
    149  *  instance are valid AND if #isOtherValid() returns true; otherwise returns
    150  *  false. Disabled children and children without validation
    151  *  are skipped and don't affect the result.
    152  *
    153  *  The method emits the #isValidRequested() signal before calling
    154  *  #isOtherValid(), thus giving someone an opportunity to affect its result by
    155  *  calling #setOtherValid() from the signal handler. Note that #isOtherValid()
    156  *  returns true by default, until #setOtherValid( false ) is called.
    157  *
    158  *  @note If #isOtherValid() returns true this method does a hierarchy scan, so
    159  *  it's a good idea to store the returned value in a local variable if needed
    160  *  more than once within a context of a single check.
    161  */
    162 bool QIWidgetValidator::isValid() const
    163 {
    164     // wgt is null, we assume we're valid
    165     if (!mWidget)
    166         return true;
    167 
    168     QIWidgetValidator *that = const_cast <QIWidgetValidator *> (this);
    169     emit that->isValidRequested (that);
    170     if (!isOtherValid())
    171         return false;
    172 
    173     QValidator::State state = QValidator::Acceptable;
    174 
    175     foreach (Watched watched, mWatched)
    176     {
    177         if (QLineEdit *le = qobject_cast<QLineEdit*>(watched.widget))
    178         {
    179             Assert (le->validator());
    180             if (!le->validator() || !le->isEnabled())
    181                 continue;
    182             QString text = le->text();
    183             int pos;
    184             state = le->validator()->validate (text, pos);
    185         }
    186         else if (QComboBox *cb = qobject_cast<QComboBox*>(watched.widget))
    187         {
    188             Assert (cb->validator());
    189             if (!cb->validator() || !cb->isEnabled())
    190                 continue;
    191             QString text = cb->lineEdit()->text();
    192             int pos;
    193             state = cb->lineEdit()->validator()->validate (text, pos);
    194         }
    195 
    196         if (state != QValidator::Acceptable)
    197         {
    198             that->mLastInvalid = watched;
    199             that->mLastInvalid.state = state;
    200             return false;
    201         }
    202     }
    203 
    204     /* reset last invalid */
    205     that->mLastInvalid = Watched();
    206     return true;
    207 }
    208 
    209 /**
    210  *  Rescans all (grand) children of the managed widget and:
    211  *
    212  *  1) remembers all supported widgets with validators to speed up further
    213  *     validation;
    214  *
    215  *  2) connects itself to those that can be validated, in order to emit the
    216  *     validityChanged() signal to give its receiver an opportunity to do
    217  *     useful actions.
    218  *
    219  *  Must be called every time a child widget is added or removed.
    220  */
    221 void QIWidgetValidator::rescan()
    222 {
    223     if (!mWidget)
    224         return;
    225 
    226     mWatched.clear();
    227 
    228     Watched watched;
    229 
    230     QList<QWidget *> list = mWidget->findChildren<QWidget *>();
    231     QWidget *wgt;
    232 
    233     /* detect all widgets that support validation */
    234     QListIterator<QWidget *> it (list);
    235     while (it.hasNext())
    236     {
    237         wgt = it.next();
    238 
    239         if (QLineEdit *le = qobject_cast<QLineEdit *> (wgt))
    240         {
    241             if (!le->validator())
    242                 continue;
    243             /* disconnect to avoid duplicate connections */
    244             disconnect (le, SIGNAL (editingFinished ()),
    245                         this, SLOT (doRevalidate()));
    246             disconnect (le, SIGNAL (cursorPositionChanged (int, int)),
    247                         this, SLOT (doRevalidate()));
    248             disconnect (le, SIGNAL (textChanged (const QString &)),
    249                         this, SLOT (doRevalidate()));
    250             /* Use all signals which indicate some change in the text. The
    251              * textChanged signal isn't sufficient in Qt4. */
    252             connect (le, SIGNAL (textChanged (const QString &)),
    253                      this, SLOT (doRevalidate()));
    254             connect (le, SIGNAL (cursorPositionChanged (int, int)),
    255                      this, SLOT (doRevalidate()));
    256             connect (le, SIGNAL (editingFinished ()),
    257                      this, SLOT (doRevalidate()));
    258         }
    259         else if (QComboBox *cb = qobject_cast<QComboBox *> (wgt))
    260         {
    261 
    262             if (!cb->validator() || !cb->lineEdit())
    263                 continue;
    264             /* disconnect to avoid duplicate connections */
    265             disconnect (cb, SIGNAL (textChanged (const QString &)),
    266                         this, SLOT (doRevalidate()));
    267             connect (cb, SIGNAL (textChanged (const QString &)),
    268                      this, SLOT (doRevalidate()));
    269         }
    270 
    271         watched.widget = wgt;
    272 
    273         /* try to find a buddy widget in order to determine the title for
    274          * the watched widget which is used in the warning text */
    275         QListIterator<QWidget *> it2 (list);
    276         while (it2.hasNext())
    277         {
    278             wgt = it2.next();
    279             if (QLabel *label = qobject_cast<QLabel *> (wgt))
    280                 if (label->buddy() == watched.widget)
    281                 {
    282                     watched.buddy = label;
    283                     break;
    284                 }
    285         }
    286 
    287         /* memorize */
    288         mWatched << watched;
    289     }
    290 }
    291 
    292 /**
    293  *  Returns a message that describes the last detected error (invalid or
    294  *  incomplete input).
    295  *
    296  *  This message uses the caption text passed to the constructor as a page
    297  *  name to refer to. If the caption is NULL, this function will return a null
    298  *  string.
    299  *
    300  *  Also, if the failed widget has a buddy widget, this buddy widget's text
    301  *  will be used as a field name to refer to.
    302  */
    303 QString QIWidgetValidator::warningText() const
    304 {
    305     /* cannot generate an informative message if no caption provided */
    306     if (mCaption.isEmpty())
    307         return QString::null;
    308 
    309     if (mLastInvalid.state == QValidator::Acceptable)
    310         return QString::null;
    311 
    312     AssertReturn (mLastInvalid.widget, QString::null);
    313 
    314     QString title;
    315     if (mLastInvalid.buddy != NULL)
    316     {
    317         if (mLastInvalid.buddy->inherits ("QLabel"))
    318         {
    319             /* Remove '&' symbol from the buddy field name */
    320             title = VBoxGlobal::
    321                 removeAccelMark(qobject_cast<QLabel*>(mLastInvalid.buddy)->text());
    322 
    323             /* Remove ':' symbol from the buddy field name */
    324             title = title.remove (':');
    325         }
    326     }
    327 
    328     QString state;
    329     if (mLastInvalid.state == QValidator::Intermediate)
    330         state = tr ("not complete", "value state");
    331     else
    332         state = tr ("invalid", "value state");
    333 
    334     if (!title.isEmpty())
    335         return tr ("<qt>The value of the <b>%1</b> field "
    336                    "on the <b>%2</b> page is %3.</qt>")
    337             .arg (title, mCaption, state);
    338 
    339     return tr ("<qt>One of the values "
    340                "on the <b>%1</b> page is %2.</qt>")
    341         .arg (mCaption, state);
    342 }
    343 
    344 /** @fn QIWidgetValidator::setOtherValid()
    345  *
    346  *  Sets the generic validity flag to true or false depending on the
    347  *  argument.
    348  *
    349  *  @see #isOtherValid()
    350  */
    351 
    352 /** @fn QIWidgetValidator::isOtherValid()
    353  *
    354  *  Returns the current value of the generic validity flag.
    355  *  This generic validity flag is used by #isValid() to determine
    356  *  the overall validity of the managed widget. This flag is true by default,
    357  *  until #setOtherValid( false ) is called.
    358  */
    359 
    360 /** @fn QIWidgetValidator::validityChanged( const QIWidgetValidator * ) const
    361  *
    362  *  Emitted when any of the relevant children of the widget managed by this
    363  *  instance changes its validity state. The argument is this instance.
    364  */
    365 
    366 /** @fn QIWidgetValidator::isValidRequested( const QIWidgetValidator * ) const
    367  *
    368  *  Emitted whenever #sValid() is called, right before querying the generic
    369  *  validity value using the #isOtherValid() method.
    370  *  The argument is this instance.
    371  */
    372 
    373 /** @fn QIWidgetValidator::revalidate()
    374  *
    375  *  Emits the validityChanged() signal, from where receivers can use the
    376  *  isValid() method to check for validity.
    377  */
    378 
    379 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    380 
    381 /** @class QIULongValidator
    382  *
    383  *  The QIULongValidator class is a QIntValidator-like class to validate
    384  *  unsigned integer numbers. As opposed to QIntValidator, this class accepts
    385  *  all three integer number formats: decimal, hexadecimal (the string starts
    386  *  with "0x") and octal (the string starts with "0").
    387  */
    38839
    38940QValidator::State QIULongValidator::validate (QString &aInput, int &aPos) const
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.h

    r47559 r47563  
    2222/* Qt includes: */
    2323#include <QValidator>
    24 
    25 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    2624
    2725/* Forward declarations: */
     
    6765};
    6866
    69 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    70 
    71 /* General includes: */
    72 #include <limits.h>
    73 
    74 /* Qt includes: */
    75 #include <QPointer>
    76 
    77 class QIWidgetValidator : public QObject
    78 {
    79     Q_OBJECT
    80 
    81 public:
    82 
    83     QIWidgetValidator (QWidget *aWidget, QObject *aParent = 0);
    84     QIWidgetValidator (const QString &aCaption,
    85                        QWidget *aWidget, QObject *aParent = 0);
    86     ~QIWidgetValidator();
    87 
    88     QWidget *widget() const { return mWidget; }
    89     bool isValid() const;
    90     void rescan();
    91 
    92     void setCaption (const QString& aCaption) { mCaption = aCaption; }
    93     QString caption() const { return mCaption; }
    94 
    95     QString warningText() const;
    96 
    97     QString lastWarning() const { return mLastWarning; }
    98     void setLastWarning (const QString &aLastWarning) { mLastWarning = aLastWarning; }
    99 
    100     void setOtherValid (bool aValid) { mOtherValid = aValid; }
    101     bool isOtherValid() const { return mOtherValid; }
    102 
    103 signals:
    104 
    105     void validityChanged (const QIWidgetValidator *aValidator);
    106     void isValidRequested (QIWidgetValidator *aValidator);
    107 
    108 public slots:
    109 
    110     void revalidate() { doRevalidate(); }
    111 
    112 private:
    113 
    114     QString mLastWarning;
    115     QString mCaption;
    116     QWidget *mWidget;
    117     bool mOtherValid;
    118 
    119     struct Watched
    120     {
    121         Watched()
    122             : state (QValidator::Acceptable) {}
    123 
    124         QPointer<QWidget> widget;
    125         QPointer<QWidget> buddy;
    126         QValidator::State state;
    127     };
    128 
    129     QList <Watched> mWatched;
    130     Watched mLastInvalid;
    131 
    132 private slots:
    133 
    134     void doRevalidate() { emit validityChanged (this); }
    135 };
    136 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    137 
    13867class QIULongValidator : public QValidator
    13968{
     
    16594
    16695#endif // __QIWidgetValidator_h__
    167 
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp

    r47559 r47563  
    165165}
    166166
    167 #ifndef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    168 void UISettingsDialog::sltRevalidate(QIWidgetValidator *pValidator)
    169 {
    170     /* Get related settings page: */
    171     UISettingsPage *pSettingsPage = qobject_cast<UISettingsPage*>(pValidator->widget());
    172     AssertMsg(pSettingsPage, ("Validator should corresponds a page!\n"));
    173 
    174     /* Prepare empty warning & title: */
    175     QString strWarning;
    176     QString strTitle = m_pSelector->itemTextByPage(pSettingsPage);
    177 
    178     /* Recorrelate page with others before revalidation: */
    179     recorrelate(pSettingsPage);
    180 
    181     /* Revalidate the page: */
    182     bool fValid = pSettingsPage->revalidate(strWarning, strTitle);
    183 
    184     /* Compose a message: */
    185     strWarning = strWarning.isEmpty() ? QString() :
    186                  tr("On the <b>%1</b> page, %2").arg(strTitle, strWarning);
    187     pValidator->setLastWarning(strWarning);
    188     fValid ? setWarning(strWarning) : setError(strWarning);
    189 
    190     /* Remember validation status: */
    191     pValidator->setOtherValid(fValid);
    192 }
    193 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    194 
    195167void UISettingsDialog::sltCategoryChanged(int cId)
    196168{
     
    276248#endif /* VBOX_GUI_WITH_TOOLBAR_SETTINGS */
    277249
    278 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    279250    /* Retranslate all validators: */
    280251    foreach (UIPageValidator *pValidator, findChildren<UIPageValidator*>())
    281252        if (!pValidator->lastMessage().isEmpty())
    282             sltHandleValidityChange(pValidator);
    283 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    284     /* Get the list of validators: */
    285     QList<QIWidgetValidator*> validatorsList = findChildren<QIWidgetValidator*>();
    286     /* Retranslate all validators: */
    287     for (int i = 0; i < validatorsList.size(); ++i)
    288     {
    289         QIWidgetValidator *pValidator = validatorsList[i];
    290         pValidator->setCaption(m_pSelector->itemTextByPage(qobject_cast<UISettingsPage*>(pValidator->widget())));
    291     }
    292     /* Revalidate all pages to retranslate the warning messages also: */
    293     for (int i = 0; i < validatorsList.size(); ++i)
    294     {
    295         QIWidgetValidator *pValidator = validatorsList[i];
    296         if (!pValidator->isValid())
    297             sltRevalidate(pValidator);
    298     }
    299 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
     253            revalidate(pValidator);
     254    revalidate();
    300255}
    301256
     
    376331}
    377332
    378 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    379333void UISettingsDialog::revalidate(UIPageValidator *pValidator)
    380334{
     
    394348    {
    395349        pValidator->setLastMessage(tr("On the <b>%1</b> page, %2").arg(strPageTitle, strMessageText));
    396         printf("UISettingsDialog:  Page validation failed!\n");
     350        LogRel(("Settings Dialog:  Page validation FAILED: {%s}\n",
     351                pValidator->lastMessage().toUtf8().constData()));
    397352    }
    398353}
     
    413368            /* What page is it related to? */
    414369            UISettingsPage *pFailedSettingsPage = pValidator->page();
    415             printf("UISettingsDialog:  Dialog validation failed on page #%d (%s)\n"
    416 //                   "Message: %s\n"
    417                    , pFailedSettingsPage->id()
    418                    , gpConverter->toInternalString((MachineSettingsPageType)pFailedSettingsPage->id()).toAscii().constData()
    419 //                   , pValidator->lastMessage().toAscii().constData()
    420                    );
     370            LogRel(("Settings Dialog:  Dialog validation FAILED: Page *%s*\n",
     371                    gpConverter->toInternalString((MachineSettingsPageType)pFailedSettingsPage->id()).toUtf8().constData()));
    421372
    422373            /* Show error first: */
     
    459410    m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_fValid);
    460411}
    461 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    462 
    463 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
     412
    464413void UISettingsDialog::sltHandleValidityChange(UIPageValidator *pValidator)
    465414{
    466     printf("UISettingsDialog: Revalidation requested.\n");
    467 
    468415    /* Determine which settings-page had called for revalidation: */
    469     UISettingsPage *pSettingsPage = pValidator->page();
    470     const QString strPageName(gpConverter->toInternalString((MachineSettingsPageType)pSettingsPage->id()));
    471 
    472     /* Perform page revalidation: */
    473     printf("UISettingsDialog:  *%s* page revalidation in progress...\n",
    474            strPageName.toAscii().constData());
    475     revalidate(pValidator);
    476     printf("UISettingsDialog:  *%s* page revalidation complete!\n",
    477            strPageName.toAscii().constData());
    478 
    479     /* Perform inter-page recorrelation: */
    480     printf("UISettingsDialog:  *%s* page recorrelation in progress...\n",
    481            strPageName.toAscii().constData());
    482     recorrelate(pSettingsPage);
    483     printf("UISettingsDialog:  *%s* page recorrelation complete!\n",
    484            strPageName.toAscii().constData());
    485 
    486     /* Perform dialog revalidation: */
    487     printf("UISettingsDialog:  Dialog revalidation in progress...\n");
    488     revalidate();
    489     printf("UISettingsDialog:  Dialog revalidation complete!\n");
    490 
    491     printf("UISettingsDialog: Revalidation processed.\n");
    492 }
    493 
    494 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    495 
    496 void UISettingsDialog::sltHandleValidityChanged(const QIWidgetValidator * /* pValidator */)
    497 {
    498     /* Get validators list: */
    499     QList<QIWidgetValidator*> validatorsList(findChildren<QIWidgetValidator*>());
    500 
    501     /* Detect ERROR presence: */
    502     {
    503         setError(QString());
    504         QString strError;
    505         bool fNewValid = true;
    506         for (int i = 0; i < validatorsList.size(); ++i)
    507         {
    508             QIWidgetValidator *pValidator = validatorsList[i];
    509             fNewValid = pValidator->isValid();
    510             if (!fNewValid)
    511             {
    512                 strError = pValidator->warningText();
    513                 if (strError.isNull())
    514                     strError = pValidator->lastWarning();
    515                 break;
    516             }
    517         }
    518 
    519         /* Try to set the generic error message when invalid
    520          * but no specific message is provided: */
    521         if (m_strErrorString.isNull() && !strError.isNull())
    522             setError(strError);
    523 
    524         m_fValid = fNewValid;
    525         m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_fValid);
    526         m_pWarningPane->setWarningPixmap(m_errorIcon);
    527         m_pWarningPane->setWarningText(m_strErrorHint);
    528 #ifdef Q_WS_MAC
    529         m_pWarningPane->setToolTip(m_strErrorString);
    530 #endif /* Q_WS_MAC */
    531         if (m_fValid && m_pStatusBar->currentWidget() == m_pWarningPane)
    532             m_pStatusBar->setCurrentIndex(0);
    533         else if (!m_fValid && m_pStatusBar->currentIndex() == 0)
    534             m_pStatusBar->setCurrentWidget(m_pWarningPane);
    535 
    536         if (!m_fValid)
    537             return;
    538     }
    539 
    540     /* Detect WARNING presence: */
    541     {
    542         setWarning(QString());
    543         QString strWarning;
    544         bool fNewSilent = true;
    545         for (int i = 0; i < validatorsList.size(); ++i)
    546         {
    547             QIWidgetValidator *pValidator = validatorsList[i];
    548             if (!pValidator->warningText().isNull() || !pValidator->lastWarning().isNull())
    549             {
    550                 fNewSilent = false;
    551                 strWarning = pValidator->warningText();
    552                 if (strWarning.isNull())
    553                     strWarning = pValidator->lastWarning();
    554                 break;
    555             }
    556         }
    557 
    558         /* Try to set the generic error message when invalid
    559          * but no specific message is provided: */
    560         if (m_strWarningString.isNull() && !strWarning.isNull())
    561             setWarning(strWarning);
    562 
    563         m_fSilent = fNewSilent;
    564         m_pWarningPane->setWarningPixmap(m_warningIcon);
    565         m_pWarningPane->setWarningText(m_strWarningHint);
    566 #ifdef Q_WS_MAC
    567         m_pWarningPane->setToolTip(m_strWarningString);
    568 #endif /* Q_WS_MAC */
    569         if (m_fSilent && m_pStatusBar->currentWidget() == m_pWarningPane)
    570             m_pStatusBar->setCurrentIndex(0);
    571         else if (!m_fSilent && m_pStatusBar->currentIndex() == 0)
    572             m_pStatusBar->setCurrentWidget(m_pWarningPane);
    573     }
    574 }
    575 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
     416    if (UISettingsPage *pSettingsPage = pValidator->page())
     417    {
     418        /* Determine settings-page name: */
     419        const QString strPageName(gpConverter->toInternalString((MachineSettingsPageType)pSettingsPage->id()));
     420
     421        LogRel(("Settings Dialog: %s Page: Revalidation in progress..\n",
     422                strPageName.toUtf8().constData()));
     423
     424        /* Perform page revalidation: */
     425        revalidate(pValidator);
     426        /* Perform inter-page recorrelation: */
     427        recorrelate(pSettingsPage);
     428        /* Perform dialog revalidation: */
     429        revalidate();
     430
     431        LogRel(("Settings Dialog: %s Page: Revalidation complete.\n",
     432                strPageName.toUtf8().constData()));
     433    }
     434}
    576435
    577436void UISettingsDialog::sltUpdateWhatsThis(bool fGotFocus /* = false */)
     
    725584void UISettingsDialog::assignValidator(UISettingsPage *pPage)
    726585{
    727 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    728586    /* Assign validator: */
    729587    UIPageValidator *pValidator = new UIPageValidator(this, pPage);
    730588    connect(pValidator, SIGNAL(sigValidityChanged(UIPageValidator*)), this, SLOT(sltHandleValidityChange(UIPageValidator*)));
    731589    pPage->setValidator(pValidator);
    732 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    733     /* Assign validator: */
    734     QIWidgetValidator *pValidator = new QIWidgetValidator(m_pSelector->itemTextByPage(pPage), pPage, this);
    735     connect(pValidator, SIGNAL(validityChanged(const QIWidgetValidator*)), this, SLOT(sltHandleValidityChanged(const QIWidgetValidator*)));
    736     connect(pValidator, SIGNAL(isValidRequested(QIWidgetValidator*)), this, SLOT(sltRevalidate(QIWidgetValidator*)));
    737     pPage->setValidator(pValidator);
    738 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    739590
    740591    // TODO: Why here?
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h

    r47559 r47563  
    2727
    2828/* Forward declarations: */
    29 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    3029class UIPageValidator;
    31 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    32 class QIWidgetValidator;
    33 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    3430class QProgressBar;
    3531class QStackedWidget;
     
    5753
    5854protected slots:
    59 
    60 #ifndef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    61     /* Validation handler: */
    62     virtual void sltRevalidate(QIWidgetValidator *pValidator);
    63 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    6455
    6556    /* Category-change slot: */
     
    10495    /* Helpers: Validation stuff: */
    10596    virtual void recorrelate(UISettingsPage *pSettingsPage) { Q_UNUSED(pSettingsPage); }
    106 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    10797    void revalidate(UIPageValidator *pValidator);
    10898    void revalidate();
    109 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    11099
    111100    /* Protected variables: */
     
    115104private slots:
    116105
    117 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    118106    /* Handler: Validation stuff: */
    119107    void sltHandleValidityChange(UIPageValidator *pValidator);
    120 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    121     /* Slot to handle validity-changes: */
    122     void sltHandleValidityChanged(const QIWidgetValidator *pValidator);
    123 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    124108
    125109    /* Slot to update whats-this: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r47559 r47563  
    946946}
    947947
    948 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    949948void UISettingsDialogMachine::recorrelate(UISettingsPage *pSettingsPage)
    950949{
     
    991990    }
    992991}
    993 
    994 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    995 
    996 void UISettingsDialogMachine::recorrelate(UISettingsPage *pSettingsPage)
    997 {
    998     switch (pSettingsPage->id())
    999     {
    1000         case MachineSettingsPageType_General:
    1001         {
    1002             UIMachineSettingsGeneral *pGeneralPage = qobject_cast<UIMachineSettingsGeneral*>(pSettingsPage);
    1003             UIMachineSettingsSystem *pSystemPage = qobject_cast<UIMachineSettingsSystem*>(m_pSelector->idToPage(MachineSettingsPageType_System));
    1004             if (pGeneralPage && pSystemPage)
    1005                 pGeneralPage->setHWVirtExEnabled(pSystemPage->isHWVirtExEnabled());
    1006             break;
    1007         }
    1008         case MachineSettingsPageType_Display:
    1009         {
    1010             UIMachineSettingsDisplay *pDisplayPage = qobject_cast<UIMachineSettingsDisplay*>(pSettingsPage);
    1011             UIMachineSettingsGeneral *pGeneralPage = qobject_cast<UIMachineSettingsGeneral*>(m_pSelector->idToPage(MachineSettingsPageType_General));
    1012             if (pDisplayPage && pGeneralPage)
    1013                 pDisplayPage->setGuestOSType(pGeneralPage->guestOSType());
    1014             break;
    1015         }
    1016         case MachineSettingsPageType_System:
    1017         {
    1018             UIMachineSettingsSystem *pSystemPage = qobject_cast<UIMachineSettingsSystem*>(pSettingsPage);
    1019             UIMachineSettingsUSB *pUsbPage = qobject_cast<UIMachineSettingsUSB*>(m_pSelector->idToPage(MachineSettingsPageType_USB));
    1020             if (pSystemPage && pUsbPage)
    1021                 pSystemPage->setOHCIEnabled(pUsbPage->isOHCIEnabled());
    1022             break;
    1023         }
    1024         case MachineSettingsPageType_Storage:
    1025         {
    1026             UIMachineSettingsStorage *pStoragePage = qobject_cast<UIMachineSettingsStorage*>(pSettingsPage);
    1027             UIMachineSettingsSystem *pSystemPage = qobject_cast<UIMachineSettingsSystem*>(m_pSelector->idToPage(MachineSettingsPageType_System));
    1028             if (pStoragePage && pSystemPage)
    1029                 pStoragePage->setChipsetType(pSystemPage->chipsetType());
    1030             break;
    1031         }
    1032         default:
    1033             break;
    1034     }
    1035 }
    1036 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    1037992
    1038993void UISettingsDialogMachine::sltMarkLoaded()
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h

    r47559 r47563  
    3636
    3737/* Forward declarations: */
    38 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    3938class UIPageValidator;
    40 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    41 class QIWidgetValidator;
    42 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    4339class QShowEvent;
    4440
     
    9793
    9894    /* Validation stuff: */
    99 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    10095    virtual void setValidator(UIPageValidator* /* pValidator */) {}
    101 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    102     virtual void setValidator(QIWidgetValidator* /* pValidator */) {}
    103 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    10496    virtual bool revalidate(QString& /* strWarningText */, QString& /* strTitle */) { return true; }
    10597
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp

    r47559 r47563  
    160160}
    161161
    162 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    163162void UIGlobalSettingsInput::setValidator(UIPageValidator *pValidator)
    164 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    165 void UIGlobalSettingsInput::setValidator(QIWidgetValidator *pValidator)
    166 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    167163{
    168164    /* Configure validation: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h

    r47559 r47563  
    140140
    141141    /* API: Validation stuff: */
    142 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    143142    void setValidator(UIPageValidator *pValidator);
    144 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    145     void setValidator(QIWidgetValidator *pValidator);
    146 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    147143    bool revalidate(QString &strWarning, QString &strTitle);
    148144
     
    156152
    157153    /* Variable: Validation stuff: */
    158 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    159154    UIPageValidator *m_pValidator;
    160 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    161     QIWidgetValidator *m_pValidator;
    162 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    163155
    164156    /* Cache: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp

    r47559 r47563  
    372372}
    373373
    374 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    375374void UIGlobalSettingsNetwork::setValidator(UIPageValidator *pValidator)
    376 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    377 void UIGlobalSettingsNetwork::setValidator(QIWidgetValidator *pValidator)
    378 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    379375{
    380376    /* Configure validation: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h

    r47559 r47563  
    164164
    165165    /* API: Validation stuff: */
    166 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    167166    void setValidator(UIPageValidator *pValidator);
    168 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    169     void setValidator(QIWidgetValidator *pValidator);
    170 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    171167    bool revalidate(QString &strWarning, QString &strTitle);
    172168
     
    195191
    196192    /* Variable: Validation stuff: */
    197 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    198193    UIPageValidator *m_pValidator;
    199 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    200     QIWidgetValidator *m_pValidator;
    201 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    202194
    203195    /* Helper actions: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp

    r47559 r47563  
    104104}
    105105
    106 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    107106void UIGlobalSettingsProxy::setValidator(UIPageValidator *pValidator)
    108 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    109 void UIGlobalSettingsProxy::setValidator(QIWidgetValidator *pValidator)
    110 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    111107{
    112108    /* Configure validation: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.h

    r47559 r47563  
    6262
    6363    /* API: Validation stuff: */
    64 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    6564    void setValidator(UIPageValidator *pValidator);
    66 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    67     void setValidator(QIWidgetValidator *pValidator);
    68 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    6965
    7066    /* Helper: Navigation stuff: */
     
    8278
    8379    /* Variable: Validation stuff: */
    84 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    8580    UIPageValidator *m_pValidator;
    86 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    87     QIWidgetValidator *m_pValidator;
    88 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    8981
    9082    /* Cache: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r47559 r47563  
    7171    checkVRAMRequirements();
    7272
    73 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    7473    /* Revalidate if possible: */
    7574    if (m_pValidator)
    7675        m_pValidator->revalidate();
    77 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    7876}
    7977
     
    306304}
    307305
    308 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    309306void UIMachineSettingsDisplay::setValidator(UIPageValidator *pValidator)
    310 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    311 void UIMachineSettingsDisplay::setValidator(QIWidgetValidator *pValidator)
    312 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    313307{
    314308    /* Configure validation: */
     
    395389#endif /* VBOX_WITH_VIDEOHWACCEL */
    396390
    397 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    398391    /* Check VRDE server port: */
    399392    if (m_pEditorRemoteDisplayPort->text().trimmed().isEmpty())
     
    409402        return false;
    410403    }
    411 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    412404
    413405    return true;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h

    r47559 r47563  
    146146
    147147    /* API: Validation stuff: */
    148 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    149148    void setValidator(UIPageValidator *pValidator);
    150 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    151     void setValidator(QIWidgetValidator *pValidator);
    152 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    153149    bool revalidate(QString &strWarning, QString &strTitle);
    154150
     
    201197
    202198    /* Variable: Validation stuff: */
    203 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    204199    UIPageValidator *m_pValidator;
    205 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    206     QIWidgetValidator *m_pValidator;
    207 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    208200
    209201    /* Guest OS type id: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r47559 r47563  
    6363}
    6464
    65 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    6665void UIMachineSettingsGeneral::setHWVirtExEnabled(bool fEnabled)
    6766{
     
    7776        m_pValidator->revalidate();
    7877}
    79 
    80 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    81 
    82 void UIMachineSettingsGeneral::setHWVirtExEnabled(bool fEnabled)
    83 {
    84     m_fHWVirtExEnabled = fEnabled;
    85 }
    86 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    8778
    8879bool UIMachineSettingsGeneral::is64BitOSTypeSelected() const
     
    233224}
    234225
    235 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    236226void UIMachineSettingsGeneral::setValidator(UIPageValidator *pValidator)
    237 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    238 void UIMachineSettingsGeneral::setValidator(QIWidgetValidator *pValidator)
    239 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    240227{
    241228    /* Configure validation: */
    242229    m_pValidator = pValidator;
    243230    connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), m_pValidator, SLOT(revalidate()));
    244 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    245231    connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString&)), m_pValidator, SLOT(revalidate()));
    246 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    247232}
    248233
    249234bool UIMachineSettingsGeneral::revalidate(QString &strWarning, QString& /* strTitle */)
    250235{
    251 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
     236    /* VM name validation: */
    252237    if (m_pNameAndSystemEditor->name().trimmed().isEmpty())
    253238    {
     
    255240        return false;
    256241    }
    257 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
     242
     243    /* OS type & VT-x/AMD-v correlation: */
    258244    if (is64BitOSTypeSelected() && !m_fHWVirtExEnabled)
     245    {
    259246        strWarning = tr("you have selected a 64-bit guest OS type for this VM. As such guests "
    260247                        "require hardware virtualization (VT-x/AMD-V), this feature will be enabled "
    261248                        "automatically.");
     249        return true;
     250    }
     251
    262252    return true;
    263253}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h

    r47559 r47563  
    107107
    108108    /* API: Validation stuff: */
    109 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    110109    void setValidator(UIPageValidator *pValidator);
    111 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    112     void setValidator(QIWidgetValidator *pValidator);
    113 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    114110    bool revalidate(QString &strWarning, QString &strTitle);
    115111
     
    123119
    124120    /* Variable: Validation stuff: */
    125 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    126121    UIPageValidator *m_pValidator;
    127 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    128     QIWidgetValidator *m_pValidator;
    129 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    130122
    131123    /* Cache: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r47559 r47563  
    161161}
    162162
    163 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    164163void UIMachineSettingsNetwork::setValidator(UIPageValidator *pValidator)
    165 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    166 void UIMachineSettingsNetwork::setValidator(QIWidgetValidator *pValidator)
    167 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    168164{
    169165    /* Configure validation: */
     
    949945}
    950946
    951 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    952947void UIMachineSettingsNetworkPage::setValidator(UIPageValidator *pValidator)
    953 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    954 void UIMachineSettingsNetworkPage::setValidator(QIWidgetValidator *pValidator)
    955 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    956948{
    957949    /* Configure validation: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h

    r47559 r47563  
    110110
    111111    /* API: Validation stuff: */
    112 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    113112    void setValidator(UIPageValidator *pValidator);
    114 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    115     void setValidator(QIWidgetValidator *pValidator);
    116 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    117113    bool revalidate(QString &strWarning, QString &strTitle);
    118114
     
    162158
    163159    /* Variable: Validation stuff: */
    164 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    165160    UIPageValidator *m_pValidator;
    166 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    167     QIWidgetValidator *m_pValidator;
    168 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    169161
    170162    /* Other variables: */
     
    216208
    217209    /* API: Validation stuff: */
    218 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    219210    void setValidator(UIPageValidator *pValidator);
    220 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    221     void setValidator(QIWidgetValidator *pValidator);
    222 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    223211    bool revalidate(QString &strWarning, QString &strTitle);
    224212
     
    247235
    248236    /* Variable: Validation stuff: */
    249 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    250237    UIPageValidator *m_pValidator;
    251 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    252     QIWidgetValidator *m_pValidator;
    253 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    254238
    255239    /* Tab holder: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp

    r47559 r47563  
    114114}
    115115
    116 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    117116void UIMachineSettingsParallel::setValidator(UIPageValidator *pValidator)
    118 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    119 void UIMachineSettingsParallel::setValidator(QIWidgetValidator *pValidator)
    120 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    121117{
    122118    /* Configure validation: */
     
    179175    }
    180176
    181 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    182177    /* Revalidate if possible: */
    183178    if (m_pValidator)
    184179        m_pValidator->revalidate();
    185 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    186180}
    187181
     
    337331}
    338332
    339 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    340333void UIMachineSettingsParallelPage::setValidator(UIPageValidator *pValidator)
    341 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    342 void UIMachineSettingsParallelPage::setValidator(QIWidgetValidator *pValidator)
    343 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    344334{
    345335    /* Configure validation: */
     
    350340{
    351341    bool valid = true;
    352 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    353342    QList<QPair<QString, QString> > ports;
    354 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    355     QStringList ports;
    356 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    357343    QStringList paths;
    358344
     
    367353            continue;
    368354
    369 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    370355        /* Check the predefined port attributes uniqueness: */
    371356        {
     
    387372            ports << pair;
    388373        }
    389 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    390         /* Check the predefined port number unicity */
    391         if (!page->isUserDefined())
    392         {
    393             QString port = page->mCbNumber->currentText();
    394             valid = !ports.contains (port);
    395             if (!valid)
    396             {
    397                 aWarning = tr ("Duplicate port number selected ");
    398                 aTitle += ": " +
    399                     vboxGlobal().removeAccelMark (mTabWidget->tabText (mTabWidget->indexOf (tab)));
    400                 break;
    401             }
    402             ports << port;
    403         }
    404 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    405374
    406375        /* Check the port path emptiness & unicity */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.h

    r47559 r47563  
    8585
    8686    /* API: Validation stuff: */
    87 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    8887    void setValidator(UIPageValidator *pValidator);
    89 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    90     void setValidator(QIWidgetValidator *pValidator);
    91 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    9288
    9389    QWidget* setOrderAfter (QWidget *aAfter);
     
    108104
    109105    /* Variable: Validation stuff: */
    110 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    111106    UIPageValidator *m_pValidator;
    112 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    113     QIWidgetValidator *m_pValidator;
    114 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    115107
    116108    UIMachineSettingsParallelPage *m_pParent;
     
    147139
    148140    /* API: Validation stuff: */
    149 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    150141    void setValidator(UIPageValidator *pValidator);
    151 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    152     void setValidator(QIWidgetValidator *pValidator);
    153 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    154142    bool revalidate (QString &aWarning, QString &aTitle);
    155143
     
    161149
    162150    /* Variable: Validation stuff: */
    163 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    164151    UIPageValidator *m_pValidator;
    165 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    166     QIWidgetValidator *m_pValidator;
    167 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    168152
    169153    QITabWidget *mTabWidget;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp

    r47559 r47563  
    130130}
    131131
    132 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    133132void UIMachineSettingsSerial::setValidator(UIPageValidator *pValidator)
    134 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    135 void UIMachineSettingsSerial::setValidator(QIWidgetValidator *pValidator)
    136 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    137133{
    138134    /* Configure validation: */
     
    205201    }
    206202
    207 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    208203    /* Revalidate if possible: */
    209204    if (m_pValidator)
    210205        m_pValidator->revalidate();
    211 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    212206}
    213207
     
    381375}
    382376
    383 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    384377void UIMachineSettingsSerialPage::setValidator(UIPageValidator *pValidator)
    385 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    386 void UIMachineSettingsSerialPage::setValidator(QIWidgetValidator *pValidator)
    387 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    388378{
    389379    /* Configure validation: */
     
    394384{
    395385    bool valid = true;
    396 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    397386    QList<QPair<QString, QString> > ports;
    398 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    399     QStringList ports;
    400 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    401387    QStringList paths;
    402388
     
    411397            continue;
    412398
    413 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    414399        /* Check the predefined port attributes uniqueness: */
    415400        {
     
    431416            ports << pair;
    432417        }
    433 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    434         /* Check the predefined port number unicity */
    435         if (!page->isUserDefined())
    436         {
    437             QString port = page->mCbNumber->currentText();
    438             valid = !ports.contains (port);
    439             if (!valid)
    440             {
    441                 aWarning = tr ("duplicate port number specified.");
    442                 aTitle += ": " +
    443                     vboxGlobal().removeAccelMark (mTabWidget->tabText (mTabWidget->indexOf (tab)));
    444                 break;
    445             }
    446             ports << port;
    447         }
    448 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    449418
    450419        /* Check the port path emptiness & unicity */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h

    r47559 r47563  
    9191
    9292    /* API: Validation stuff: */
    93 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    9493    void setValidator(UIPageValidator *pValidator);
    95 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    96     void setValidator(QIWidgetValidator *pValidator);
    97 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    9894
    9995    QWidget* setOrderAfter (QWidget *aAfter);
     
    115111
    116112    /* Variable: Validation stuff: */
    117 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    118113    UIPageValidator *m_pValidator;
    119 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    120     QIWidgetValidator *m_pValidator;
    121 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    122114
    123115    UIMachineSettingsSerialPage *m_pParent;
     
    154146
    155147    /* API: Validation stuff: */
    156 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    157148    void setValidator(UIPageValidator *pValidator);
    158 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    159     void setValidator(QIWidgetValidator *pValidator);
    160 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    161149    bool revalidate (QString &aWarning, QString &aTitle);
    162150
     
    168156
    169157    /* Variable: Validation stuff: */
    170 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    171158    UIPageValidator *m_pValidator;
    172 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    173     QIWidgetValidator *m_pValidator;
    174 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    175159
    176160    QITabWidget *mTabWidget;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r47559 r47563  
    18861886}
    18871887
    1888 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    18891888void UIMachineSettingsStorage::setChipsetType(KChipsetType type)
    18901889{
     
    19011900        m_pValidator->revalidate();
    19021901}
    1903 
    1904 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    1905 
    1906 void UIMachineSettingsStorage::setChipsetType(KChipsetType type)
    1907 {
    1908     mStorageModel->setChipsetType(type);
    1909     updateActionsState();
    1910 }
    1911 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    19121902
    19131903/* Load data to cache from corresponding external object(s),
     
    21172107}
    21182108
    2119 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    21202109void UIMachineSettingsStorage::setValidator(UIPageValidator *pValidator)
    2121 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    2122 void UIMachineSettingsStorage::setValidator(QIWidgetValidator *pValidator)
    2123 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    21242110{
    21252111    /* Configure validation: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h

    r47559 r47563  
    674674
    675675    /* API: Validation stuff: */
    676 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    677676    void setValidator(UIPageValidator *pValidator);
    678 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    679     void setValidator(QIWidgetValidator *pValidator);
    680 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    681677    bool revalidate (QString &aWarning, QString &aTitle);
    682678
     
    762758
    763759    /* Variable: Validation stuff: */
    764 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    765760    UIPageValidator *m_pValidator;
    766 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    767     QIWidgetValidator *m_pValidator;
    768 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    769761
    770762    QString m_strMachineId;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r47559 r47563  
    5959}
    6060
    61 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    6261void UIMachineSettingsSystem::setOHCIEnabled(bool fEnabled)
    6362{
     
    7372        m_pValidator->revalidate();
    7473}
    75 
    76 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    77 
    78 void UIMachineSettingsSystem::setOHCIEnabled(bool fEnabled)
    79 {
    80     m_fOHCIEnabled = fEnabled;
    81 }
    82 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    8374
    8475/* Load data to cache from corresponding external object(s),
     
    297288}
    298289
    299 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    300290void UIMachineSettingsSystem::setValidator(UIPageValidator *pValidator)
    301 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    302 void UIMachineSettingsSystem::setValidator(QIWidgetValidator *pValidator)
    303 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    304291{
    305292    /* Configure validation: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r47559 r47563  
    153153
    154154    /* API: Validation stuff: */
    155 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    156155    void setValidator(UIPageValidator *pValidator);
    157 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    158     void setValidator(QIWidgetValidator *pValidator);
    159 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    160156    bool revalidate(QString &strWarning, QString &strTitle);
    161157
     
    205201
    206202    /* Variable: Validation stuff: */
    207 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    208203    UIPageValidator *m_pValidator;
    209 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    210     QIWidgetValidator *m_pValidator;
    211 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    212204
    213205    /* Variable: Boot-table stuff: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp

    r47559 r47563  
    564564}
    565565
    566 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    567566void UIMachineSettingsUSB::setValidator(UIPageValidator *pValidator)
    568 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    569 void UIMachineSettingsUSB::setValidator(QIWidgetValidator *pValidator)
    570 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    571567{
    572568    /* Configure validation: */
     
    867863        /* Revalidate if possible: */
    868864        if (m_pValidator)
    869         {
    870 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    871865            m_pValidator->revalidate();
    872 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    873             m_pValidator->rescan();
    874             m_pValidator->revalidate();
    875 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    876         }
    877866    }
    878867}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h

    r47559 r47563  
    143143
    144144    /* API: Validation stuff: */
    145 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    146145    void setValidator(UIPageValidator *pValidator);
    147 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    148     void setValidator(QIWidgetValidator *pValidator);
    149 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    150146    bool revalidate(QString &strWarningText, QString &strTitle);
    151147
     
    185181
    186182    /* Variable: Validation stuff: */
    187 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR
    188183    UIPageValidator *m_pValidator;
    189 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    190     QIWidgetValidator *m_pValidator;
    191 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */
    192184
    193185    /* Global data source: */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette