Changeset 47563 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Aug 6, 2013 5:13:57 PM (11 years ago)
- 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 20 20 #include "QIWidgetValidator.h" 21 21 22 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR23 24 22 /* GUI includes: */ 25 23 #include "UISettingsPage.h" 24 26 25 27 26 UIPageValidator::UIPageValidator(QObject *pParent, UISettingsPage *pPage) … … 38 37 } 39 38 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 QIWidgetValidator54 *55 * The QIWidgetValidator class is a widget validator. Its purpose is to56 * answer the question: whether all relevant (grand) children of the given57 * widget are valid or not. Relevant children are those widgets which58 * receive some user input that can be checked for validity (i.e. they59 * have a validator() method that returns a pointer to a QValidator instance60 * used to validate widget's input). The QLineEdit class is an example of61 * such a widget.62 *63 * When a QIWidgetValidator instance is created it receives a pointer to64 * a widget whose children should be checked for validity. The instance65 * connects itself to signals emitted by input widgets when their contents66 * changes, and emits its own signal, validityChanged() (common for all67 * child widgets being observed), whenever the change happens.68 *69 * Objects that want to know when the validity state changes should connect70 * 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 been74 * already added to the widget when it is passed to the QIWidgetValidator75 * constructor. If other children (that need to be validated) are added76 * later, it's necessary to call the rescan() method to rescan the widget77 * hierarchy again, otherwise the results of validity checks are undefined.78 *79 * It's also necessary to call the revalidate() method every time the80 * enabled state of the child widget is changed, because QIWidgetValidator81 * skips disabled widgets when it calculates the combined validity state.82 *83 * This class is useful for example for QWizard dialogs, where a separate84 * instance validates every page of the wizard that has children to validate,85 * and the validityChanged() signal of every instance is connected to some86 * 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 are90 * recognized by QIWidgetValidator. It uses the QLineEdit::hasAcceptableInput()91 * and QCombobox::validator() methods to determine the validity state o92 * 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 children98 * 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 children112 * 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; the130 * value of #isValid() is always true at this time.131 */132 QIWidgetValidator::~QIWidgetValidator()133 {134 mWidget = 0;135 doRevalidate();136 }137 138 //139 // Public members140 /////////////////////////////////////////////////////////////////////////////141 142 /** @fn QIWidgetValidator::widget() const143 *144 * Returns a widget managed by this instance.145 */146 147 /**148 * Returns true if all relevant children of the widget managed by this149 * instance are valid AND if #isOtherValid() returns true; otherwise returns150 * false. Disabled children and children without validation151 * are skipped and don't affect the result.152 *153 * The method emits the #isValidRequested() signal before calling154 * #isOtherValid(), thus giving someone an opportunity to affect its result by155 * 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, so159 * it's a good idea to store the returned value in a local variable if needed160 * more than once within a context of a single check.161 */162 bool QIWidgetValidator::isValid() const163 {164 // wgt is null, we assume we're valid165 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 further213 * validation;214 *215 * 2) connects itself to those that can be validated, in order to emit the216 * validityChanged() signal to give its receiver an opportunity to do217 * 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. The251 * 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 for274 * 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 or294 * incomplete input).295 *296 * This message uses the caption text passed to the constructor as a page297 * name to refer to. If the caption is NULL, this function will return a null298 * string.299 *300 * Also, if the failed widget has a buddy widget, this buddy widget's text301 * will be used as a field name to refer to.302 */303 QString QIWidgetValidator::warningText() const304 {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 else332 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 the347 * 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 determine356 * 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 * ) const361 *362 * Emitted when any of the relevant children of the widget managed by this363 * instance changes its validity state. The argument is this instance.364 */365 366 /** @fn QIWidgetValidator::isValidRequested( const QIWidgetValidator * ) const367 *368 * Emitted whenever #sValid() is called, right before querying the generic369 * 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 the376 * isValid() method to check for validity.377 */378 379 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */380 381 /** @class QIULongValidator382 *383 * The QIULongValidator class is a QIntValidator-like class to validate384 * unsigned integer numbers. As opposed to QIntValidator, this class accepts385 * all three integer number formats: decimal, hexadecimal (the string starts386 * with "0x") and octal (the string starts with "0").387 */388 39 389 40 QValidator::State QIULongValidator::validate (QString &aInput, int &aPos) const -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.h
r47559 r47563 22 22 /* Qt includes: */ 23 23 #include <QValidator> 24 25 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR26 24 27 25 /* Forward declarations: */ … … 67 65 }; 68 66 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 QObject78 {79 Q_OBJECT80 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 Watched120 {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 138 67 class QIULongValidator : public QValidator 139 68 { … … 165 94 166 95 #endif // __QIWidgetValidator_h__ 167 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r47559 r47563 165 165 } 166 166 167 #ifndef VBOX_WITH_NEW_SETTINGS_VALIDATOR168 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 195 167 void UISettingsDialog::sltCategoryChanged(int cId) 196 168 { … … 276 248 #endif /* VBOX_GUI_WITH_TOOLBAR_SETTINGS */ 277 249 278 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR279 250 /* Retranslate all validators: */ 280 251 foreach (UIPageValidator *pValidator, findChildren<UIPageValidator*>()) 281 252 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(); 300 255 } 301 256 … … 376 331 } 377 332 378 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR379 333 void UISettingsDialog::revalidate(UIPageValidator *pValidator) 380 334 { … … 394 348 { 395 349 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())); 397 352 } 398 353 } … … 413 368 /* What page is it related to? */ 414 369 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())); 421 372 422 373 /* Show error first: */ … … 459 410 m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_fValid); 460 411 } 461 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 462 463 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 412 464 413 void UISettingsDialog::sltHandleValidityChange(UIPageValidator *pValidator) 465 414 { 466 printf("UISettingsDialog: Revalidation requested.\n");467 468 415 /* 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 } 576 435 577 436 void UISettingsDialog::sltUpdateWhatsThis(bool fGotFocus /* = false */) … … 725 584 void UISettingsDialog::assignValidator(UISettingsPage *pPage) 726 585 { 727 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR728 586 /* Assign validator: */ 729 587 UIPageValidator *pValidator = new UIPageValidator(this, pPage); 730 588 connect(pValidator, SIGNAL(sigValidityChanged(UIPageValidator*)), this, SLOT(sltHandleValidityChange(UIPageValidator*))); 731 589 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 */739 590 740 591 // TODO: Why here? -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h
r47559 r47563 27 27 28 28 /* Forward declarations: */ 29 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR30 29 class UIPageValidator; 31 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */32 class QIWidgetValidator;33 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */34 30 class QProgressBar; 35 31 class QStackedWidget; … … 57 53 58 54 protected slots: 59 60 #ifndef VBOX_WITH_NEW_SETTINGS_VALIDATOR61 /* Validation handler: */62 virtual void sltRevalidate(QIWidgetValidator *pValidator);63 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */64 55 65 56 /* Category-change slot: */ … … 104 95 /* Helpers: Validation stuff: */ 105 96 virtual void recorrelate(UISettingsPage *pSettingsPage) { Q_UNUSED(pSettingsPage); } 106 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR107 97 void revalidate(UIPageValidator *pValidator); 108 98 void revalidate(); 109 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */110 99 111 100 /* Protected variables: */ … … 115 104 private slots: 116 105 117 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR118 106 /* Handler: Validation stuff: */ 119 107 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 */124 108 125 109 /* Slot to update whats-this: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r47559 r47563 946 946 } 947 947 948 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR949 948 void UISettingsDialogMachine::recorrelate(UISettingsPage *pSettingsPage) 950 949 { … … 991 990 } 992 991 } 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 */1037 992 1038 993 void UISettingsDialogMachine::sltMarkLoaded() -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h
r47559 r47563 36 36 37 37 /* Forward declarations: */ 38 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR39 38 class UIPageValidator; 40 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */41 class QIWidgetValidator;42 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */43 39 class QShowEvent; 44 40 … … 97 93 98 94 /* Validation stuff: */ 99 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR100 95 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 */104 96 virtual bool revalidate(QString& /* strWarningText */, QString& /* strTitle */) { return true; } 105 97 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
r47559 r47563 160 160 } 161 161 162 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR163 162 void UIGlobalSettingsInput::setValidator(UIPageValidator *pValidator) 164 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */165 void UIGlobalSettingsInput::setValidator(QIWidgetValidator *pValidator)166 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */167 163 { 168 164 /* Configure validation: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h
r47559 r47563 140 140 141 141 /* API: Validation stuff: */ 142 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR143 142 void setValidator(UIPageValidator *pValidator); 144 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */145 void setValidator(QIWidgetValidator *pValidator);146 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */147 143 bool revalidate(QString &strWarning, QString &strTitle); 148 144 … … 156 152 157 153 /* Variable: Validation stuff: */ 158 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR159 154 UIPageValidator *m_pValidator; 160 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */161 QIWidgetValidator *m_pValidator;162 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */163 155 164 156 /* Cache: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp
r47559 r47563 372 372 } 373 373 374 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR375 374 void UIGlobalSettingsNetwork::setValidator(UIPageValidator *pValidator) 376 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */377 void UIGlobalSettingsNetwork::setValidator(QIWidgetValidator *pValidator)378 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */379 375 { 380 376 /* Configure validation: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h
r47559 r47563 164 164 165 165 /* API: Validation stuff: */ 166 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR167 166 void setValidator(UIPageValidator *pValidator); 168 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */169 void setValidator(QIWidgetValidator *pValidator);170 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */171 167 bool revalidate(QString &strWarning, QString &strTitle); 172 168 … … 195 191 196 192 /* Variable: Validation stuff: */ 197 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR198 193 UIPageValidator *m_pValidator; 199 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */200 QIWidgetValidator *m_pValidator;201 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */202 194 203 195 /* Helper actions: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp
r47559 r47563 104 104 } 105 105 106 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR107 106 void UIGlobalSettingsProxy::setValidator(UIPageValidator *pValidator) 108 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */109 void UIGlobalSettingsProxy::setValidator(QIWidgetValidator *pValidator)110 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */111 107 { 112 108 /* Configure validation: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.h
r47559 r47563 62 62 63 63 /* API: Validation stuff: */ 64 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR65 64 void setValidator(UIPageValidator *pValidator); 66 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */67 void setValidator(QIWidgetValidator *pValidator);68 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */69 65 70 66 /* Helper: Navigation stuff: */ … … 82 78 83 79 /* Variable: Validation stuff: */ 84 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR85 80 UIPageValidator *m_pValidator; 86 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */87 QIWidgetValidator *m_pValidator;88 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */89 81 90 82 /* Cache: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r47559 r47563 71 71 checkVRAMRequirements(); 72 72 73 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR74 73 /* Revalidate if possible: */ 75 74 if (m_pValidator) 76 75 m_pValidator->revalidate(); 77 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */78 76 } 79 77 … … 306 304 } 307 305 308 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR309 306 void UIMachineSettingsDisplay::setValidator(UIPageValidator *pValidator) 310 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */311 void UIMachineSettingsDisplay::setValidator(QIWidgetValidator *pValidator)312 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */313 307 { 314 308 /* Configure validation: */ … … 395 389 #endif /* VBOX_WITH_VIDEOHWACCEL */ 396 390 397 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR398 391 /* Check VRDE server port: */ 399 392 if (m_pEditorRemoteDisplayPort->text().trimmed().isEmpty()) … … 409 402 return false; 410 403 } 411 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */412 404 413 405 return true; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r47559 r47563 146 146 147 147 /* API: Validation stuff: */ 148 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR149 148 void setValidator(UIPageValidator *pValidator); 150 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */151 void setValidator(QIWidgetValidator *pValidator);152 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */153 149 bool revalidate(QString &strWarning, QString &strTitle); 154 150 … … 201 197 202 198 /* Variable: Validation stuff: */ 203 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR204 199 UIPageValidator *m_pValidator; 205 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */206 QIWidgetValidator *m_pValidator;207 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */208 200 209 201 /* Guest OS type id: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r47559 r47563 63 63 } 64 64 65 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR66 65 void UIMachineSettingsGeneral::setHWVirtExEnabled(bool fEnabled) 67 66 { … … 77 76 m_pValidator->revalidate(); 78 77 } 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 */87 78 88 79 bool UIMachineSettingsGeneral::is64BitOSTypeSelected() const … … 233 224 } 234 225 235 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR236 226 void UIMachineSettingsGeneral::setValidator(UIPageValidator *pValidator) 237 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */238 void UIMachineSettingsGeneral::setValidator(QIWidgetValidator *pValidator)239 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */240 227 { 241 228 /* Configure validation: */ 242 229 m_pValidator = pValidator; 243 230 connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), m_pValidator, SLOT(revalidate())); 244 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR245 231 connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString&)), m_pValidator, SLOT(revalidate())); 246 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */247 232 } 248 233 249 234 bool UIMachineSettingsGeneral::revalidate(QString &strWarning, QString& /* strTitle */) 250 235 { 251 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 236 /* VM name validation: */ 252 237 if (m_pNameAndSystemEditor->name().trimmed().isEmpty()) 253 238 { … … 255 240 return false; 256 241 } 257 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 242 243 /* OS type & VT-x/AMD-v correlation: */ 258 244 if (is64BitOSTypeSelected() && !m_fHWVirtExEnabled) 245 { 259 246 strWarning = tr("you have selected a 64-bit guest OS type for this VM. As such guests " 260 247 "require hardware virtualization (VT-x/AMD-V), this feature will be enabled " 261 248 "automatically."); 249 return true; 250 } 251 262 252 return true; 263 253 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h
r47559 r47563 107 107 108 108 /* API: Validation stuff: */ 109 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR110 109 void setValidator(UIPageValidator *pValidator); 111 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */112 void setValidator(QIWidgetValidator *pValidator);113 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */114 110 bool revalidate(QString &strWarning, QString &strTitle); 115 111 … … 123 119 124 120 /* Variable: Validation stuff: */ 125 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR126 121 UIPageValidator *m_pValidator; 127 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */128 QIWidgetValidator *m_pValidator;129 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */130 122 131 123 /* Cache: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r47559 r47563 161 161 } 162 162 163 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR164 163 void UIMachineSettingsNetwork::setValidator(UIPageValidator *pValidator) 165 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */166 void UIMachineSettingsNetwork::setValidator(QIWidgetValidator *pValidator)167 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */168 164 { 169 165 /* Configure validation: */ … … 949 945 } 950 946 951 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR952 947 void UIMachineSettingsNetworkPage::setValidator(UIPageValidator *pValidator) 953 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */954 void UIMachineSettingsNetworkPage::setValidator(QIWidgetValidator *pValidator)955 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */956 948 { 957 949 /* Configure validation: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h
r47559 r47563 110 110 111 111 /* API: Validation stuff: */ 112 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR113 112 void setValidator(UIPageValidator *pValidator); 114 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */115 void setValidator(QIWidgetValidator *pValidator);116 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */117 113 bool revalidate(QString &strWarning, QString &strTitle); 118 114 … … 162 158 163 159 /* Variable: Validation stuff: */ 164 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR165 160 UIPageValidator *m_pValidator; 166 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */167 QIWidgetValidator *m_pValidator;168 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */169 161 170 162 /* Other variables: */ … … 216 208 217 209 /* API: Validation stuff: */ 218 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR219 210 void setValidator(UIPageValidator *pValidator); 220 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */221 void setValidator(QIWidgetValidator *pValidator);222 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */223 211 bool revalidate(QString &strWarning, QString &strTitle); 224 212 … … 247 235 248 236 /* Variable: Validation stuff: */ 249 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR250 237 UIPageValidator *m_pValidator; 251 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */252 QIWidgetValidator *m_pValidator;253 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */254 238 255 239 /* Tab holder: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp
r47559 r47563 114 114 } 115 115 116 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR117 116 void UIMachineSettingsParallel::setValidator(UIPageValidator *pValidator) 118 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */119 void UIMachineSettingsParallel::setValidator(QIWidgetValidator *pValidator)120 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */121 117 { 122 118 /* Configure validation: */ … … 179 175 } 180 176 181 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR182 177 /* Revalidate if possible: */ 183 178 if (m_pValidator) 184 179 m_pValidator->revalidate(); 185 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */186 180 } 187 181 … … 337 331 } 338 332 339 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR340 333 void UIMachineSettingsParallelPage::setValidator(UIPageValidator *pValidator) 341 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */342 void UIMachineSettingsParallelPage::setValidator(QIWidgetValidator *pValidator)343 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */344 334 { 345 335 /* Configure validation: */ … … 350 340 { 351 341 bool valid = true; 352 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR353 342 QList<QPair<QString, QString> > ports; 354 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */355 QStringList ports;356 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */357 343 QStringList paths; 358 344 … … 367 353 continue; 368 354 369 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR370 355 /* Check the predefined port attributes uniqueness: */ 371 356 { … … 387 372 ports << pair; 388 373 } 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 */405 374 406 375 /* Check the port path emptiness & unicity */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.h
r47559 r47563 85 85 86 86 /* API: Validation stuff: */ 87 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR88 87 void setValidator(UIPageValidator *pValidator); 89 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */90 void setValidator(QIWidgetValidator *pValidator);91 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */92 88 93 89 QWidget* setOrderAfter (QWidget *aAfter); … … 108 104 109 105 /* Variable: Validation stuff: */ 110 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR111 106 UIPageValidator *m_pValidator; 112 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */113 QIWidgetValidator *m_pValidator;114 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */115 107 116 108 UIMachineSettingsParallelPage *m_pParent; … … 147 139 148 140 /* API: Validation stuff: */ 149 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR150 141 void setValidator(UIPageValidator *pValidator); 151 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */152 void setValidator(QIWidgetValidator *pValidator);153 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */154 142 bool revalidate (QString &aWarning, QString &aTitle); 155 143 … … 161 149 162 150 /* Variable: Validation stuff: */ 163 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR164 151 UIPageValidator *m_pValidator; 165 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */166 QIWidgetValidator *m_pValidator;167 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */168 152 169 153 QITabWidget *mTabWidget; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
r47559 r47563 130 130 } 131 131 132 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR133 132 void UIMachineSettingsSerial::setValidator(UIPageValidator *pValidator) 134 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */135 void UIMachineSettingsSerial::setValidator(QIWidgetValidator *pValidator)136 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */137 133 { 138 134 /* Configure validation: */ … … 205 201 } 206 202 207 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR208 203 /* Revalidate if possible: */ 209 204 if (m_pValidator) 210 205 m_pValidator->revalidate(); 211 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */212 206 } 213 207 … … 381 375 } 382 376 383 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR384 377 void UIMachineSettingsSerialPage::setValidator(UIPageValidator *pValidator) 385 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */386 void UIMachineSettingsSerialPage::setValidator(QIWidgetValidator *pValidator)387 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */388 378 { 389 379 /* Configure validation: */ … … 394 384 { 395 385 bool valid = true; 396 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR397 386 QList<QPair<QString, QString> > ports; 398 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */399 QStringList ports;400 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */401 387 QStringList paths; 402 388 … … 411 397 continue; 412 398 413 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR414 399 /* Check the predefined port attributes uniqueness: */ 415 400 { … … 431 416 ports << pair; 432 417 } 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 */449 418 450 419 /* Check the port path emptiness & unicity */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h
r47559 r47563 91 91 92 92 /* API: Validation stuff: */ 93 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR94 93 void setValidator(UIPageValidator *pValidator); 95 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */96 void setValidator(QIWidgetValidator *pValidator);97 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */98 94 99 95 QWidget* setOrderAfter (QWidget *aAfter); … … 115 111 116 112 /* Variable: Validation stuff: */ 117 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR118 113 UIPageValidator *m_pValidator; 119 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */120 QIWidgetValidator *m_pValidator;121 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */122 114 123 115 UIMachineSettingsSerialPage *m_pParent; … … 154 146 155 147 /* API: Validation stuff: */ 156 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR157 148 void setValidator(UIPageValidator *pValidator); 158 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */159 void setValidator(QIWidgetValidator *pValidator);160 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */161 149 bool revalidate (QString &aWarning, QString &aTitle); 162 150 … … 168 156 169 157 /* Variable: Validation stuff: */ 170 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR171 158 UIPageValidator *m_pValidator; 172 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */173 QIWidgetValidator *m_pValidator;174 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */175 159 176 160 QITabWidget *mTabWidget; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r47559 r47563 1886 1886 } 1887 1887 1888 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR1889 1888 void UIMachineSettingsStorage::setChipsetType(KChipsetType type) 1890 1889 { … … 1901 1900 m_pValidator->revalidate(); 1902 1901 } 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 */1912 1902 1913 1903 /* Load data to cache from corresponding external object(s), … … 2117 2107 } 2118 2108 2119 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR2120 2109 void UIMachineSettingsStorage::setValidator(UIPageValidator *pValidator) 2121 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */2122 void UIMachineSettingsStorage::setValidator(QIWidgetValidator *pValidator)2123 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */2124 2110 { 2125 2111 /* Configure validation: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r47559 r47563 674 674 675 675 /* API: Validation stuff: */ 676 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR677 676 void setValidator(UIPageValidator *pValidator); 678 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */679 void setValidator(QIWidgetValidator *pValidator);680 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */681 677 bool revalidate (QString &aWarning, QString &aTitle); 682 678 … … 762 758 763 759 /* Variable: Validation stuff: */ 764 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR765 760 UIPageValidator *m_pValidator; 766 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */767 QIWidgetValidator *m_pValidator;768 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */769 761 770 762 QString m_strMachineId; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r47559 r47563 59 59 } 60 60 61 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR62 61 void UIMachineSettingsSystem::setOHCIEnabled(bool fEnabled) 63 62 { … … 73 72 m_pValidator->revalidate(); 74 73 } 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 */83 74 84 75 /* Load data to cache from corresponding external object(s), … … 297 288 } 298 289 299 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR300 290 void UIMachineSettingsSystem::setValidator(UIPageValidator *pValidator) 301 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */302 void UIMachineSettingsSystem::setValidator(QIWidgetValidator *pValidator)303 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */304 291 { 305 292 /* Configure validation: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
r47559 r47563 153 153 154 154 /* API: Validation stuff: */ 155 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR156 155 void setValidator(UIPageValidator *pValidator); 157 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */158 void setValidator(QIWidgetValidator *pValidator);159 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */160 156 bool revalidate(QString &strWarning, QString &strTitle); 161 157 … … 205 201 206 202 /* Variable: Validation stuff: */ 207 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR208 203 UIPageValidator *m_pValidator; 209 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */210 QIWidgetValidator *m_pValidator;211 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */212 204 213 205 /* Variable: Boot-table stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r47559 r47563 564 564 } 565 565 566 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR567 566 void UIMachineSettingsUSB::setValidator(UIPageValidator *pValidator) 568 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */569 void UIMachineSettingsUSB::setValidator(QIWidgetValidator *pValidator)570 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */571 567 { 572 568 /* Configure validation: */ … … 867 863 /* Revalidate if possible: */ 868 864 if (m_pValidator) 869 {870 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR871 865 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 }877 866 } 878 867 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h
r47559 r47563 143 143 144 144 /* API: Validation stuff: */ 145 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR146 145 void setValidator(UIPageValidator *pValidator); 147 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */148 void setValidator(QIWidgetValidator *pValidator);149 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */150 146 bool revalidate(QString &strWarningText, QString &strTitle); 151 147 … … 185 181 186 182 /* Variable: Validation stuff: */ 187 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR188 183 UIPageValidator *m_pValidator; 189 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */190 QIWidgetValidator *m_pValidator;191 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */192 184 193 185 /* Global data source: */
Note:
See TracChangeset
for help on using the changeset viewer.