Changeset 47559 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 6, 2013 1:58:47 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
r44528 r47559 20 20 #include "QIWidgetValidator.h" 21 21 22 /* Qt includes */ 22 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 23 24 /* GUI includes: */ 25 #include "UISettingsPage.h" 26 27 UIPageValidator::UIPageValidator(QObject *pParent, UISettingsPage *pPage) 28 : QObject(pParent) 29 , m_pPage(pPage) 30 , m_fIsValid(true) 31 { 32 } 33 34 void UIPageValidator::revalidate() 35 { 36 /* Notify listener(s) about validity change: */ 37 emit sigValidityChanged(this); 38 } 39 40 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 41 42 /* Qt includes: */ 23 43 #include <QLineEdit> 24 44 #include <QComboBox> 25 45 #include <QLabel> 26 46 47 /* GUI includes: */ 48 #include "VBoxGlobal.h" 49 50 /* Other VBox includes: */ 27 51 #include <iprt/assert.h> 28 29 #include "VBoxGlobal.h"30 52 31 53 /** @class QIWidgetValidator … … 355 377 */ 356 378 379 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 357 380 358 381 /** @class QIULongValidator -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.h
r44528 r47559 20 20 #define __QIWidgetValidator_h__ 21 21 22 /* Qt includes: */ 23 #include <QValidator> 24 25 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 26 27 /* Forward declarations: */ 28 class UISettingsPage; 29 30 /* Page validator prototype: */ 31 class UIPageValidator : public QObject 32 { 33 Q_OBJECT; 34 35 signals: 36 37 /* Notifier: Validation stuff: */ 38 void sigValidityChanged(UIPageValidator *pValidator); 39 40 public: 41 42 /* Constructor: */ 43 UIPageValidator(QObject *pParent, UISettingsPage *pPage); 44 45 /* API: Page stuff: */ 46 UISettingsPage* page() const { return m_pPage; } 47 48 /* API: Validity stuff: */ 49 bool isValid() const { return m_fIsValid; } 50 void setValid(bool fIsValid) { m_fIsValid = fIsValid; } 51 52 /* API: Message stuff: */ 53 QString lastMessage() const { return m_strLastMessage; } 54 void setLastMessage(const QString &strLastMessage) { m_strLastMessage = strLastMessage; } 55 56 public slots: 57 58 /* API/Handler: Validation stuff: */ 59 void revalidate(); 60 61 private: 62 63 /* Variables: */ 64 UISettingsPage *m_pPage; 65 bool m_fIsValid; 66 QString m_strLastMessage; 67 }; 68 69 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 70 71 /* General includes: */ 22 72 #include <limits.h> 23 73 24 /* Qt includes */ 25 #include <QObject> 26 #include <QValidator> 27 #include <QList> 74 /* Qt includes: */ 28 75 #include <QPointer> 29 76 … … 87 134 void doRevalidate() { emit validityChanged (this); } 88 135 }; 136 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 89 137 90 138 class QIULongValidator : public QValidator -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r45198 r47559 35 35 #include "UIToolBar.h" 36 36 #include "UIIconPool.h" 37 #include "UIConverter.h" 37 38 #ifdef Q_WS_MAC 38 39 # include "VBoxUtils.h" … … 164 165 } 165 166 167 #ifndef VBOX_WITH_NEW_SETTINGS_VALIDATOR 166 168 void UISettingsDialog::sltRevalidate(QIWidgetValidator *pValidator) 167 169 { … … 189 191 pValidator->setOtherValid(fValid); 190 192 } 193 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 191 194 192 195 void UISettingsDialog::sltCategoryChanged(int cId) … … 273 276 #endif /* VBOX_GUI_WITH_TOOLBAR_SETTINGS */ 274 277 278 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 279 /* Retranslate all validators: */ 280 foreach (UIPageValidator *pValidator, findChildren<UIPageValidator*>()) 281 if (!pValidator->lastMessage().isEmpty()) 282 sltHandleValidityChange(pValidator); 283 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 275 284 /* Get the list of validators: */ 276 285 QList<QIWidgetValidator*> validatorsList = findChildren<QIWidgetValidator*>(); … … 288 297 sltRevalidate(pValidator); 289 298 } 299 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 290 300 } 291 301 … … 365 375 assignValidator(pSettingsPage); 366 376 } 377 378 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 379 void UISettingsDialog::revalidate(UIPageValidator *pValidator) 380 { 381 /* Perform page revalidation: */ 382 UISettingsPage *pSettingsPage = pValidator->page(); 383 QString strPageTitle = m_pSelector->itemTextByPage(pSettingsPage); 384 QString strMessageText; 385 bool fIsValid = pSettingsPage->revalidate(strMessageText, strPageTitle); 386 387 /* Remember revalidation result: */ 388 pValidator->setValid(fIsValid); 389 390 /* Remember warning/error message: */ 391 if (strMessageText.isEmpty()) 392 pValidator->setLastMessage(QString()); 393 else 394 { 395 pValidator->setLastMessage(tr("On the <b>%1</b> page, %2").arg(strPageTitle, strMessageText)); 396 printf("UISettingsDialog: Page validation failed!\n"); 397 } 398 } 399 400 void UISettingsDialog::revalidate() 401 { 402 /* Perform dialog revalidation: */ 403 m_fValid = true; 404 m_fSilent = true; 405 406 /* Enumerating all the validators we have: */ 407 QList<UIPageValidator*> validators(findChildren<UIPageValidator*>()); 408 foreach (UIPageValidator *pValidator, validators) 409 { 410 /* Is current validator have something to say? */ 411 if (!pValidator->lastMessage().isEmpty()) 412 { 413 /* What page is it related to? */ 414 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 ); 421 422 /* Show error first: */ 423 if (!pValidator->isValid()) 424 { 425 m_fValid = false; 426 setError(pValidator->lastMessage()); 427 m_pWarningPane->setWarningPixmap(m_errorIcon); 428 m_pWarningPane->setWarningText(m_strErrorHint); 429 #ifdef Q_WS_MAC 430 m_pWarningPane->setToolTip(m_strErrorString); 431 #endif /* Q_WS_MAC */ 432 } 433 /* Show warning if message is not an error: */ 434 else 435 { 436 m_fSilent = false; 437 setWarning(pValidator->lastMessage()); 438 m_pWarningPane->setWarningPixmap(m_warningIcon); 439 m_pWarningPane->setWarningText(m_strWarningHint); 440 #ifdef Q_WS_MAC 441 m_pWarningPane->setToolTip(m_strWarningString); 442 #endif /* Q_WS_MAC */ 443 } 444 445 /* Stop dialog revalidation on first error/warning: */ 446 if (!m_fValid || !m_fSilent) 447 break; 448 } 449 } 450 451 /* Make sure message-pane visible if necessary: */ 452 if ((!m_fValid || !m_fSilent) && m_pStatusBar->currentIndex() == 0) 453 m_pStatusBar->setCurrentWidget(m_pWarningPane); 454 /* Make sure whats-this-pane visible otherwise: */ 455 else if (m_fValid && m_fSilent && m_pStatusBar->currentWidget() == m_pWarningPane) 456 m_pStatusBar->setCurrentIndex(0); 457 458 /* Lock/unlock settings-page OK button according global validity status: */ 459 m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_fValid); 460 } 461 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 462 463 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 464 void UISettingsDialog::sltHandleValidityChange(UIPageValidator *pValidator) 465 { 466 printf("UISettingsDialog: Revalidation requested.\n"); 467 468 /* 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 */ 367 495 368 496 void UISettingsDialog::sltHandleValidityChanged(const QIWidgetValidator * /* pValidator */) … … 445 573 } 446 574 } 575 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 447 576 448 577 void UISettingsDialog::sltUpdateWhatsThis(bool fGotFocus /* = false */) … … 596 725 void UISettingsDialog::assignValidator(UISettingsPage *pPage) 597 726 { 727 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 728 /* Assign validator: */ 729 UIPageValidator *pValidator = new UIPageValidator(this, pPage); 730 connect(pValidator, SIGNAL(sigValidityChanged(UIPageValidator*)), this, SLOT(sltHandleValidityChange(UIPageValidator*))); 731 pPage->setValidator(pValidator); 732 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 733 /* Assign validator: */ 598 734 QIWidgetValidator *pValidator = new QIWidgetValidator(m_pSelector->itemTextByPage(pPage), pPage, this); 599 735 connect(pValidator, SIGNAL(validityChanged(const QIWidgetValidator*)), this, SLOT(sltHandleValidityChanged(const QIWidgetValidator*))); 600 736 connect(pValidator, SIGNAL(isValidRequested(QIWidgetValidator*)), this, SLOT(sltRevalidate(QIWidgetValidator*))); 601 737 pPage->setValidator(pValidator); 738 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 739 740 // TODO: Why here? 741 /* Configure navigation (tab-order): */ 602 742 pPage->setOrderAfter(m_pSelector->widget()); 603 743 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h
r44528 r47559 27 27 28 28 /* Forward declarations: */ 29 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 30 class UIPageValidator; 31 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 29 32 class QIWidgetValidator; 33 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 30 34 class QProgressBar; 31 35 class QStackedWidget; … … 54 58 protected slots: 55 59 60 #ifndef VBOX_WITH_NEW_SETTINGS_VALIDATOR 56 61 /* Validation handler: */ 57 62 virtual void sltRevalidate(QIWidgetValidator *pValidator); 63 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 58 64 59 65 /* Category-change slot: */ … … 96 102 UISettingsPage* pSettingsPage = 0, int iParentId = -1); 97 103 98 /* Settings page correlator: */104 /* Helpers: Validation stuff: */ 99 105 virtual void recorrelate(UISettingsPage *pSettingsPage) { Q_UNUSED(pSettingsPage); } 106 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 107 void revalidate(UIPageValidator *pValidator); 108 void revalidate(); 109 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 100 110 101 111 /* Protected variables: */ … … 105 115 private slots: 106 116 117 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 118 /* Handler: Validation stuff: */ 119 void sltHandleValidityChange(UIPageValidator *pValidator); 120 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 107 121 /* Slot to handle validity-changes: */ 108 122 void sltHandleValidityChanged(const QIWidgetValidator *pValidator); 123 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 109 124 110 125 /* Slot to update whats-this: */ … … 120 135 void showEvent(QShowEvent *pEvent); 121 136 137 /* Helper: Validation stuff: */ 122 138 void assignValidator(UISettingsPage *pPage); 123 139 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r47401 r47559 946 946 } 947 947 948 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 949 void UISettingsDialogMachine::recorrelate(UISettingsPage *pSettingsPage) 950 { 951 switch (pSettingsPage->id()) 952 { 953 /* General page correlations: */ 954 case MachineSettingsPageType_General: 955 { 956 /* Make changes on 'general' page influent 'display' page: */ 957 UIMachineSettingsGeneral *pGeneralPage = qobject_cast<UIMachineSettingsGeneral*>(pSettingsPage); 958 UIMachineSettingsDisplay *pDisplayPage = qobject_cast<UIMachineSettingsDisplay*>(m_pSelector->idToPage(MachineSettingsPageType_Display)); 959 if (pGeneralPage && pDisplayPage) 960 pDisplayPage->setGuestOSType(pGeneralPage->guestOSType()); 961 break; 962 } 963 /* System page correlations: */ 964 case MachineSettingsPageType_System: 965 { 966 /* Make changes on 'system' page influent 'general' and 'storage' page: */ 967 UIMachineSettingsSystem *pSystemPage = qobject_cast<UIMachineSettingsSystem*>(pSettingsPage); 968 UIMachineSettingsGeneral *pGeneralPage = qobject_cast<UIMachineSettingsGeneral*>(m_pSelector->idToPage(MachineSettingsPageType_General)); 969 UIMachineSettingsStorage *pStoragePage = qobject_cast<UIMachineSettingsStorage*>(m_pSelector->idToPage(MachineSettingsPageType_Storage)); 970 if (pSystemPage) 971 { 972 if (pGeneralPage) 973 pGeneralPage->setHWVirtExEnabled(pSystemPage->isHWVirtExEnabled()); 974 if (pStoragePage) 975 pStoragePage->setChipsetType(pSystemPage->chipsetType()); 976 } 977 break; 978 } 979 /* USB page correlations: */ 980 case MachineSettingsPageType_USB: 981 { 982 /* Make changes on 'usb' page influent 'system' page: */ 983 UIMachineSettingsUSB *pUsbPage = qobject_cast<UIMachineSettingsUSB*>(pSettingsPage); 984 UIMachineSettingsSystem *pSystemPage = qobject_cast<UIMachineSettingsSystem*>(m_pSelector->idToPage(MachineSettingsPageType_System)); 985 if (pUsbPage && pSystemPage) 986 pSystemPage->setOHCIEnabled(pUsbPage->isOHCIEnabled()); 987 break; 988 } 989 default: 990 break; 991 } 992 } 993 994 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 995 948 996 void UISettingsDialogMachine::recorrelate(UISettingsPage *pSettingsPage) 949 997 { … … 986 1034 } 987 1035 } 1036 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 988 1037 989 1038 void UISettingsDialogMachine::sltMarkLoaded() -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h
r44528 r47559 36 36 37 37 /* Forward declarations: */ 38 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 39 class UIPageValidator; 40 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 38 41 class QIWidgetValidator; 42 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 39 43 class QShowEvent; 40 44 … … 93 97 94 98 /* Validation stuff: */ 99 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 100 virtual void setValidator(UIPageValidator* /* pValidator */) {} 101 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 95 102 virtual void setValidator(QIWidgetValidator* /* pValidator */) {} 103 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 96 104 virtual bool revalidate(QString& /* strWarningText */, QString& /* strTitle */) { return true; } 97 105 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
r47188 r47559 160 160 } 161 161 162 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 163 void UIGlobalSettingsInput::setValidator(UIPageValidator *pValidator) 164 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 162 165 void UIGlobalSettingsInput::setValidator(QIWidgetValidator *pValidator) 163 { 166 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 167 { 168 /* Configure validation: */ 164 169 m_pValidator = pValidator; 165 170 connect(m_pSelectorModel, SIGNAL(sigRevalidationRequired()), m_pValidator, SLOT(revalidate())); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h
r47189 r47559 139 139 void saveFromCacheTo(QVariant &data); 140 140 141 /* Helpers: Validation stuff: */ 141 /* API: Validation stuff: */ 142 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 143 void setValidator(UIPageValidator *pValidator); 144 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 142 145 void setValidator(QIWidgetValidator *pValidator); 146 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 143 147 bool revalidate(QString &strWarning, QString &strTitle); 144 148 … … 151 155 private: 152 156 157 /* Variable: Validation stuff: */ 158 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 159 UIPageValidator *m_pValidator; 160 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 161 QIWidgetValidator *m_pValidator; 162 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 163 153 164 /* Cache: */ 154 QIWidgetValidator *m_pValidator;155 165 UISettingsCacheGlobalInput m_cache; 156 166 QTabWidget *m_pTabWidget; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp
r47191 r47559 275 275 m_pInterfacesTree->setCurrentItem(m_pInterfacesTree->topLevelItem(0)); 276 276 sltUpdateCurrentItem(); 277 278 /* Revalidate if possible: */ 279 if (m_pValidator) 280 m_pValidator->revalidate(); 277 281 } 278 282 … … 368 372 } 369 373 370 /* Validation assignments: */ 374 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 375 void UIGlobalSettingsNetwork::setValidator(UIPageValidator *pValidator) 376 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 371 377 void UIGlobalSettingsNetwork::setValidator(QIWidgetValidator *pValidator) 372 { 378 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 379 { 380 /* Configure validation: */ 373 381 m_pValidator = pValidator; 374 382 } … … 499 507 pItem->updateInfo(); 500 508 sltUpdateCurrentItem(); 501 m_pValidator->revalidate();502 509 m_fChanged = true; 510 511 /* Revalidate if possible: */ 512 if (m_pValidator) 513 m_pValidator->revalidate(); 503 514 } 504 515 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h
r47191 r47559 163 163 void saveFromCacheTo(QVariant &data); 164 164 165 /* Validation stuff: */ 165 /* API: Validation stuff: */ 166 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 167 void setValidator(UIPageValidator *pValidator); 168 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 166 169 void setValidator(QIWidgetValidator *pValidator); 170 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 167 171 bool revalidate(QString &strWarning, QString &strTitle); 168 172 … … 190 194 void removeListItem(UIHostInterfaceItem *pItem); 191 195 192 /* Validator: */ 196 /* Variable: Validation stuff: */ 197 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 198 UIPageValidator *m_pValidator; 199 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 193 200 QIWidgetValidator *m_pValidator; 201 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 194 202 195 203 /* Helper actions: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp
r47196 r47559 71 71 m_pPortEditor->setText(m_cache.m_strProxyPort); 72 72 sltProxyToggled(); 73 74 /* Revalidate if possible: */ 75 if (m_pValidator) 76 m_pValidator->revalidate(); 73 77 } 74 78 … … 100 104 } 101 105 106 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 107 void UIGlobalSettingsProxy::setValidator(UIPageValidator *pValidator) 108 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 102 109 void UIGlobalSettingsProxy::setValidator(QIWidgetValidator *pValidator) 110 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 103 111 { 104 112 /* Configure validation: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.h
r47196 r47559 61 61 void saveFromCacheTo(QVariant &data); 62 62 63 /* Helper: Validation stuff: */ 63 /* API: Validation stuff: */ 64 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 65 void setValidator(UIPageValidator *pValidator); 66 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 64 67 void setValidator(QIWidgetValidator *pValidator); 68 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 65 69 66 70 /* Helper: Navigation stuff: */ … … 78 82 79 83 /* Variable: Validation stuff: */ 84 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 85 UIPageValidator *m_pValidator; 86 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 80 87 QIWidgetValidator *m_pValidator; 88 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 81 89 82 90 /* Cache: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r46841 r47559 70 70 /* Recheck video RAM requirement: */ 71 71 checkVRAMRequirements(); 72 73 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 74 /* Revalidate if possible: */ 75 if (m_pValidator) 76 m_pValidator->revalidate(); 77 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 72 78 } 73 79 … … 300 306 } 301 307 308 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 309 void UIMachineSettingsDisplay::setValidator(UIPageValidator *pValidator) 310 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 302 311 void UIMachineSettingsDisplay::setValidator(QIWidgetValidator *pValidator) 303 { 312 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 313 { 314 /* Configure validation: */ 304 315 m_pValidator = pValidator; 305 316 connect(m_pCheckbox3D, SIGNAL(stateChanged(int)), m_pValidator, SLOT(revalidate())); … … 383 394 } 384 395 #endif /* VBOX_WITH_VIDEOHWACCEL */ 396 397 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 398 /* Check VRDE server port: */ 399 if (m_pEditorRemoteDisplayPort->text().trimmed().isEmpty()) 400 { 401 strWarning = tr("server port value was not specified."); 402 return false; 403 } 404 405 /* Check VRDE server timeout: */ 406 if (m_pEditorRemoteDisplayTimeout->text().trimmed().isEmpty()) 407 { 408 strWarning = tr("authentication timeout value was not specified."); 409 return false; 410 } 411 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 385 412 386 413 return true; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r47276 r47559 146 146 147 147 /* API: Validation stuff: */ 148 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 149 void setValidator(UIPageValidator *pValidator); 150 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 148 151 void setValidator(QIWidgetValidator *pValidator); 152 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 149 153 bool revalidate(QString &strWarning, QString &strTitle); 150 154 … … 196 200 static int calculateQuality(int iFrameWidth, int iFrameHeight, int iFrameRate, int iBitRate); 197 201 198 /* Validation stuff: */ 202 /* Variable: Validation stuff: */ 203 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 204 UIPageValidator *m_pValidator; 205 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 199 206 QIWidgetValidator *m_pValidator; 207 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 208 200 209 /* Guest OS type id: */ 201 210 CGuestOSType m_guestOSType; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r46141 r47559 29 29 30 30 UIMachineSettingsGeneral::UIMachineSettingsGeneral() 31 : m Validator(0)31 : m_pValidator(0) 32 32 , m_fHWVirtExEnabled(false) 33 33 { … … 63 63 } 64 64 65 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 65 66 void UIMachineSettingsGeneral::setHWVirtExEnabled(bool fEnabled) 66 67 { 68 /* Make sure hardware virtualization extension has changed: */ 69 if (m_fHWVirtExEnabled == fEnabled) 70 return; 71 72 /* Update hardware virtualization extension value: */ 67 73 m_fHWVirtExEnabled = fEnabled; 68 } 74 75 /* Revalidate if possible: */ 76 if (m_pValidator) 77 m_pValidator->revalidate(); 78 } 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 */ 69 87 70 88 bool UIMachineSettingsGeneral::is64BitOSTypeSelected() const … … 138 156 139 157 /* Revalidate if possible: */ 140 if (m Validator)141 m Validator->revalidate();158 if (m_pValidator) 159 m_pValidator->revalidate(); 142 160 } 143 161 … … 215 233 } 216 234 217 void UIMachineSettingsGeneral::setValidator (QIWidgetValidator *aVal) 218 { 219 mValidator = aVal; 220 connect (m_pNameAndSystemEditor, SIGNAL (sigOsTypeChanged()), mValidator, SLOT (revalidate())); 235 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 236 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 { 241 /* Configure validation: */ 242 m_pValidator = pValidator; 243 connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), m_pValidator, SLOT(revalidate())); 244 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 245 connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString&)), m_pValidator, SLOT(revalidate())); 246 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 221 247 } 222 248 223 249 bool UIMachineSettingsGeneral::revalidate(QString &strWarning, QString& /* strTitle */) 224 250 { 251 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 252 if (m_pNameAndSystemEditor->name().trimmed().isEmpty()) 253 { 254 strWarning = tr("you have not specified name for this VM."); 255 return false; 256 } 257 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 225 258 if (is64BitOSTypeSelected() && !m_fHWVirtExEnabled) 226 259 strWarning = tr("you have selected a 64-bit guest OS type for this VM. As such guests " -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h
r43459 r47559 106 106 void saveFromCacheTo(QVariant &data); 107 107 108 void setValidator (QIWidgetValidator *aVal); 108 /* API: Validation stuff: */ 109 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 110 void setValidator(UIPageValidator *pValidator); 111 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 112 void setValidator(QIWidgetValidator *pValidator); 113 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 109 114 bool revalidate(QString &strWarning, QString &strTitle); 110 115 … … 117 122 void polishPage(); 118 123 119 QIWidgetValidator *mValidator; 120 bool m_fHWVirtExEnabled; 124 /* Variable: Validation stuff: */ 125 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 126 UIPageValidator *m_pValidator; 127 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 128 QIWidgetValidator *m_pValidator; 129 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 121 130 122 131 /* Cache: */ 132 bool m_fHWVirtExEnabled; 123 133 UICacheSettingsMachineGeneral m_cache; 124 134 }; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r43459 r47559 161 161 } 162 162 163 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 164 void UIMachineSettingsNetwork::setValidator(UIPageValidator *pValidator) 165 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 163 166 void UIMachineSettingsNetwork::setValidator(QIWidgetValidator *pValidator) 164 { 167 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 168 { 169 /* Configure validation: */ 165 170 m_pValidator = pValidator; 166 171 connect(m_pMACEditor, SIGNAL(textEdited(const QString &)), m_pValidator, SLOT(revalidate())); … … 356 361 /* Update availability: */ 357 362 m_pAdapterOptionsContainer->setEnabled(m_pEnableAdapterCheckBox->isChecked()); 363 358 364 /* Revalidate if possible: */ 359 365 if (m_pValidator) … … 943 949 } 944 950 951 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 952 void UIMachineSettingsNetworkPage::setValidator(UIPageValidator *pValidator) 953 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 945 954 void UIMachineSettingsNetworkPage::setValidator(QIWidgetValidator *pValidator) 946 { 955 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 956 { 957 /* Configure validation: */ 947 958 m_pValidator = pValidator; 948 959 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h
r44528 r47559 109 109 void uploadAdapterCache(UICacheSettingsMachineNetworkAdapter &adapterCache); 110 110 111 /* Validation stuff: */ 111 /* API: Validation stuff: */ 112 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 113 void setValidator(UIPageValidator *pValidator); 114 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 112 115 void setValidator(QIWidgetValidator *pValidator); 116 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 113 117 bool revalidate(QString &strWarning, QString &strTitle); 114 118 … … 157 161 UIMachineSettingsNetworkPage *m_pParent; 158 162 159 /* Validator: */ 163 /* Variable: Validation stuff: */ 164 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 165 UIPageValidator *m_pValidator; 166 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 160 167 QIWidgetValidator *m_pValidator; 168 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 161 169 162 170 /* Other variables: */ … … 207 215 bool changed() const { return m_cache.wasChanged(); } 208 216 209 /* Validation stuff: */ 217 /* API: Validation stuff: */ 218 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 219 void setValidator(UIPageValidator *pValidator); 220 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 210 221 void setValidator(QIWidgetValidator *pValidator); 222 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 211 223 bool revalidate(QString &strWarning, QString &strTitle); 212 224 … … 234 246 static void updateGenericProperties(CNetworkAdapter &adapter, const QString &strPropText); 235 247 236 /* Validator: */ 248 /* Variable: Validation stuff: */ 249 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 250 UIPageValidator *m_pValidator; 251 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 237 252 QIWidgetValidator *m_pValidator; 253 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 238 254 239 255 /* Tab holder: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp
r44528 r47559 33 33 UIMachineSettingsParallel::UIMachineSettingsParallel(UIMachineSettingsParallelPage *pParent) 34 34 : QIWithRetranslateUI<QWidget> (0) 35 , m_pValidator(0) 35 36 , m_pParent(pParent) 36 , mValidator(0)37 37 , m_iSlot(-1) 38 38 { … … 114 114 } 115 115 116 void UIMachineSettingsParallel::setValidator (QIWidgetValidator *aVal) 117 { 118 Assert (aVal); 119 mValidator = aVal; 120 connect (mLeIRQ, SIGNAL (textChanged (const QString &)), 121 mValidator, SLOT (revalidate())); 122 connect (mLeIOPort, SIGNAL (textChanged (const QString &)),123 mValidator, SLOT (revalidate()));124 connect (mLePath, SIGNAL (textChanged (const QString &)),125 mValidator, SLOT(revalidate()));126 mValidator->revalidate();116 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 117 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 { 122 /* Configure validation: */ 123 m_pValidator = pValidator; 124 connect(mLeIRQ, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate())); 125 connect(mLeIOPort, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate())); 126 connect(mLePath, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate())); 127 127 } 128 128 … … 160 160 if (aOn) 161 161 mCbNumberActivated (mCbNumber->currentText()); 162 if (mValidator) 163 mValidator->revalidate(); 162 163 /* Revalidate if possible: */ 164 if (m_pValidator) 165 m_pValidator->revalidate(); 164 166 } 165 167 … … 176 178 mLeIOPort->setText ("0x" + QString::number (IOBase, 16).toUpper()); 177 179 } 180 181 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 182 /* Revalidate if possible: */ 183 if (m_pValidator) 184 m_pValidator->revalidate(); 185 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 178 186 } 179 187 … … 181 189 /* UIMachineSettingsParallelPage stuff */ 182 190 UIMachineSettingsParallelPage::UIMachineSettingsParallelPage() 183 : m Validator(0)191 : m_pValidator(0) 184 192 , mTabWidget(0) 185 193 { … … 256 264 257 265 /* Setup page validation: */ 258 pPage->setValidator(m Validator);266 pPage->setValidator(m_pValidator); 259 267 260 268 /* Setup tab order: */ … … 269 277 270 278 /* Revalidate if possible: */ 271 if (m Validator)272 m Validator->revalidate();279 if (m_pValidator) 280 m_pValidator->revalidate(); 273 281 } 274 282 … … 329 337 } 330 338 331 void UIMachineSettingsParallelPage::setValidator (QIWidgetValidator *aVal) 332 { 333 mValidator = aVal; 339 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 340 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 { 345 /* Configure validation: */ 346 m_pValidator = pValidator; 334 347 } 335 348 … … 337 350 { 338 351 bool valid = true; 352 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 353 QList<QPair<QString, QString> > ports; 354 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 339 355 QStringList ports; 356 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 340 357 QStringList paths; 341 358 … … 347 364 static_cast<UIMachineSettingsParallel*> (tab); 348 365 366 if (!page->mGbParallel->isChecked()) 367 continue; 368 369 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 370 /* Check the predefined port attributes uniqueness: */ 371 { 372 QString strIRQ = page->mLeIRQ->text(); 373 QString strIOPort = page->mLeIOPort->text(); 374 QPair<QString, QString> pair(strIRQ, strIOPort); 375 valid = !strIRQ.isEmpty() && !strIOPort.isEmpty() && !ports.contains(pair); 376 if (!valid) 377 { 378 if (strIRQ.isEmpty()) 379 aWarning = tr("IRC not specified."); 380 else if (strIOPort.isEmpty()) 381 aWarning = tr("IO port not specified."); 382 else 383 aWarning = tr ("duplicate port attributes specified."); 384 aTitle += ": " + 385 vboxGlobal().removeAccelMark(mTabWidget->tabText(mTabWidget->indexOf(tab))); 386 } 387 ports << pair; 388 } 389 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 349 390 /* Check the predefined port number unicity */ 350 if ( page->mGbParallel->isChecked() &&!page->isUserDefined())391 if (!page->isUserDefined()) 351 392 { 352 393 QString port = page->mCbNumber->currentText(); … … 361 402 ports << port; 362 403 } 404 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 363 405 364 406 /* Check the port path emptiness & unicity */ 365 if (page->mGbParallel->isChecked())366 407 { 367 408 QString path = page->mLePath->text(); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.h
r44528 r47559 84 84 void uploadPortData(UICacheSettingsMachineParallelPort &portCache); 85 85 86 void setValidator (QIWidgetValidator *aVal); 86 /* API: Validation stuff: */ 87 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 88 void setValidator(UIPageValidator *pValidator); 89 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 90 void setValidator(QIWidgetValidator *pValidator); 91 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 87 92 88 93 QWidget* setOrderAfter (QWidget *aAfter); … … 102 107 private: 103 108 109 /* Variable: Validation stuff: */ 110 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 111 UIPageValidator *m_pValidator; 112 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 113 QIWidgetValidator *m_pValidator; 114 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 115 104 116 UIMachineSettingsParallelPage *m_pParent; 105 QIWidgetValidator *mValidator;106 117 int m_iSlot; 107 118 }; … … 135 146 bool changed() const { return m_cache.wasChanged(); } 136 147 137 void setValidator (QIWidgetValidator *aVal); 148 /* API: Validation stuff: */ 149 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 150 void setValidator(UIPageValidator *pValidator); 151 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 152 void setValidator(QIWidgetValidator *pValidator); 153 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 138 154 bool revalidate (QString &aWarning, QString &aTitle); 139 155 … … 144 160 void polishPage(); 145 161 146 QIWidgetValidator *mValidator; 162 /* Variable: Validation stuff: */ 163 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 164 UIPageValidator *m_pValidator; 165 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 166 QIWidgetValidator *m_pValidator; 167 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 168 147 169 QITabWidget *mTabWidget; 148 170 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
r44528 r47559 34 34 UIMachineSettingsSerial::UIMachineSettingsSerial(UIMachineSettingsSerialPage *pParent) 35 35 : QIWithRetranslateUI<QWidget> (0) 36 , m_pValidator(0) 36 37 , m_pParent(pParent) 37 , mValidator(0)38 38 , m_iSlot(-1) 39 39 { … … 130 130 } 131 131 132 void UIMachineSettingsSerial::setValidator (QIWidgetValidator *aVal) 133 { 134 Assert (aVal); 135 mValidator = aVal; 136 connect (mLeIRQ, SIGNAL (textChanged (const QString &)), 137 mValidator, SLOT (revalidate())); 138 connect (mLeIOPort, SIGNAL (textChanged (const QString &)),139 mValidator, SLOT (revalidate()));140 connect (mLePath, SIGNAL (textChanged (const QString &)),141 mValidator, SLOT(revalidate()));142 mValidator->revalidate();132 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 133 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 { 138 /* Configure validation: */ 139 m_pValidator = pValidator; 140 connect(mLeIRQ, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate())); 141 connect(mLeIOPort, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate())); 142 connect(mLePath, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate())); 143 143 } 144 144 … … 186 186 mCbModeActivated (mCbMode->currentText()); 187 187 } 188 if (mValidator) 189 mValidator->revalidate(); 188 189 /* Revalidate if possible: */ 190 if (m_pValidator) 191 m_pValidator->revalidate(); 190 192 } 191 193 … … 202 204 mLeIOPort->setText ("0x" + QString::number (IOBase, 16).toUpper()); 203 205 } 206 207 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 208 /* Revalidate if possible: */ 209 if (m_pValidator) 210 m_pValidator->revalidate(); 211 #endif /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 204 212 } 205 213 … … 209 217 mCbPipe->setEnabled (mode == KPortMode_HostPipe); 210 218 mLePath->setEnabled (mode != KPortMode_Disconnected); 211 if (mValidator) 212 mValidator->revalidate(); 219 220 /* Revalidate if possible: */ 221 if (m_pValidator) 222 m_pValidator->revalidate(); 213 223 } 214 224 … … 216 226 /* UIMachineSettingsSerialPage stuff */ 217 227 UIMachineSettingsSerialPage::UIMachineSettingsSerialPage() 218 : m Validator(0)228 : m_pValidator(0) 219 229 , mTabWidget(0) 220 230 { … … 293 303 294 304 /* Setup page validation: */ 295 pPage->setValidator(m Validator);305 pPage->setValidator(m_pValidator); 296 306 297 307 /* Setup tab order: */ … … 306 316 307 317 /* Revalidate if possible: */ 308 if (m Validator)309 m Validator->revalidate();318 if (m_pValidator) 319 m_pValidator->revalidate(); 310 320 } 311 321 … … 371 381 } 372 382 373 void UIMachineSettingsSerialPage::setValidator (QIWidgetValidator * aVal) 374 { 375 mValidator = aVal; 383 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 384 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 { 389 /* Configure validation: */ 390 m_pValidator = pValidator; 376 391 } 377 392 … … 379 394 { 380 395 bool valid = true; 396 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 397 QList<QPair<QString, QString> > ports; 398 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 381 399 QStringList ports; 400 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 382 401 QStringList paths; 383 402 … … 392 411 continue; 393 412 413 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 414 /* Check the predefined port attributes uniqueness: */ 415 { 416 QString strIRQ = page->mLeIRQ->text(); 417 QString strIOPort = page->mLeIOPort->text(); 418 QPair<QString, QString> pair(strIRQ, strIOPort); 419 valid = !strIRQ.isEmpty() && !strIOPort.isEmpty() && !ports.contains(pair); 420 if (!valid) 421 { 422 if (strIRQ.isEmpty()) 423 aWarning = tr("IRC not specified."); 424 else if (strIOPort.isEmpty()) 425 aWarning = tr("IO port not specified."); 426 else 427 aWarning = tr ("duplicate port attributes specified."); 428 aTitle += ": " + 429 vboxGlobal().removeAccelMark(mTabWidget->tabText(mTabWidget->indexOf(tab))); 430 } 431 ports << pair; 432 } 433 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 394 434 /* Check the predefined port number unicity */ 395 435 if (!page->isUserDefined()) … … 399 439 if (!valid) 400 440 { 401 aWarning = tr (" Duplicate port number selected");441 aWarning = tr ("duplicate port number specified."); 402 442 aTitle += ": " + 403 443 vboxGlobal().removeAccelMark (mTabWidget->tabText (mTabWidget->indexOf (tab))); … … 406 446 ports << port; 407 447 } 448 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 408 449 409 450 /* Check the port path emptiness & unicity */ … … 421 462 { 422 463 aWarning = path.isEmpty() ? 423 tr (" Port path not specified") :424 tr (" Duplicate port path entered");464 tr ("port path not specified.") : 465 tr ("duplicate port path entered."); 425 466 aTitle += ": " + 426 467 vboxGlobal().removeAccelMark (mTabWidget->tabText (mTabWidget->indexOf (tab))); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h
r44528 r47559 90 90 void uploadPortData(UICacheSettingsMachineSerialPort &data); 91 91 92 void setValidator (QIWidgetValidator *aVal); 92 /* API: Validation stuff: */ 93 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 94 void setValidator(UIPageValidator *pValidator); 95 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 96 void setValidator(QIWidgetValidator *pValidator); 97 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 93 98 94 99 QWidget* setOrderAfter (QWidget *aAfter); … … 109 114 private: 110 115 116 /* Variable: Validation stuff: */ 117 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 118 UIPageValidator *m_pValidator; 119 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 120 QIWidgetValidator *m_pValidator; 121 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 122 111 123 UIMachineSettingsSerialPage *m_pParent; 112 QIWidgetValidator *mValidator;113 124 int m_iSlot; 114 125 }; … … 142 153 bool changed() const { return m_cache.wasChanged(); } 143 154 144 void setValidator (QIWidgetValidator *aVal); 155 /* API: Validation stuff: */ 156 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 157 void setValidator(UIPageValidator *pValidator); 158 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 159 void setValidator(QIWidgetValidator *pValidator); 160 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 145 161 bool revalidate (QString &aWarning, QString &aTitle); 146 162 … … 151 167 void polishPage(); 152 168 153 QIWidgetValidator *mValidator; 169 /* Variable: Validation stuff: */ 170 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 171 UIPageValidator *m_pValidator; 172 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 173 QIWidgetValidator *m_pValidator; 174 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 175 154 176 QITabWidget *mTabWidget; 155 177 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r47184 r47559 1719 1719 */ 1720 1720 UIMachineSettingsStorage::UIMachineSettingsStorage() 1721 : m Validator(0)1721 : m_pValidator(0) 1722 1722 , mStorageModel(0) 1723 1723 , mAddCtrAction(0), mDelCtrAction(0) … … 1886 1886 } 1887 1887 1888 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 1888 1889 void UIMachineSettingsStorage::setChipsetType(KChipsetType type) 1889 1890 { 1891 /* Make sure chipset type has changed: */ 1892 if (mStorageModel->chipsetType() == type) 1893 return; 1894 1895 /* Update chipset type value: */ 1890 1896 mStorageModel->setChipsetType(type); 1891 1897 updateActionsState(); 1892 } 1898 1899 /* Revalidate if possible: */ 1900 if (m_pValidator) 1901 m_pValidator->revalidate(); 1902 } 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 */ 1893 1912 1894 1913 /* Load data to cache from corresponding external object(s), … … 2029 2048 2030 2049 /* Revalidate if possible: */ 2031 if (m Validator)2032 m Validator->revalidate();2050 if (m_pValidator) 2051 m_pValidator->revalidate(); 2033 2052 } 2034 2053 … … 2098 2117 } 2099 2118 2100 void UIMachineSettingsStorage::setValidator (QIWidgetValidator *aVal) 2101 { 2102 mValidator = aVal; 2119 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 2120 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 { 2125 /* Configure validation: */ 2126 m_pValidator = pValidator; 2103 2127 } 2104 2128 … … 2269 2293 { 2270 2294 mStorageModel->setData (attIndex, attMediumId, StorageModel::R_AttMediumId); 2271 if (mValidator) mValidator->revalidate(); 2295 2296 /* Revalidate if possible: */ 2297 if (m_pValidator) 2298 m_pValidator->revalidate(); 2272 2299 } 2273 2300 } … … 2288 2315 { 2289 2316 mStorageModel->setData (attIndex, UIMedium().id(), StorageModel::R_AttMediumId); 2290 if (mValidator) mValidator->revalidate(); 2317 2318 /* Revalidate if possible: */ 2319 if (m_pValidator) 2320 m_pValidator->revalidate(); 2291 2321 } 2292 2322 } … … 2337 2367 mStorageModel->delController (QUuid (mStorageModel->data (index, StorageModel::R_ItemId).toString())); 2338 2368 emit storageChanged(); 2339 if (mValidator) mValidator->revalidate(); 2369 2370 /* Revalidate if possible: */ 2371 if (m_pValidator) 2372 m_pValidator->revalidate(); 2340 2373 } 2341 2374 … … 2416 2449 QUuid (mStorageModel->data (index, StorageModel::R_ItemId).toString())); 2417 2450 emit storageChanged(); 2418 if (mValidator) mValidator->revalidate(); 2451 2452 /* Revalidate if possible: */ 2453 if (m_pValidator) 2454 m_pValidator->revalidate(); 2419 2455 } 2420 2456 … … 2542 2578 } 2543 2579 2544 if (mValidator) mValidator->revalidate(); 2580 /* Revalidate if possible: */ 2581 if (m_pValidator) 2582 m_pValidator->revalidate(); 2545 2583 2546 2584 mIsLoadingInProgress = false; … … 3077 3115 mStorageModel->sort(); 3078 3116 emit storageChanged(); 3079 if (mValidator) 3080 mValidator->revalidate(); 3117 3118 /* Revalidate if possible: */ 3119 if (m_pValidator) 3120 m_pValidator->revalidate(); 3081 3121 } 3082 3122 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r44528 r47559 673 673 bool changed() const { return m_cache.wasChanged(); } 674 674 675 void setValidator (QIWidgetValidator *aVal); 675 /* API: Validation stuff: */ 676 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 677 void setValidator(UIPageValidator *pValidator); 678 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 679 void setValidator(QIWidgetValidator *pValidator); 680 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 676 681 bool revalidate (QString &aWarning, QString &aTitle); 677 682 … … 756 761 void polishPage(); 757 762 758 QIWidgetValidator *mValidator; 763 /* Variable: Validation stuff: */ 764 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 765 UIPageValidator *m_pValidator; 766 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 767 QIWidgetValidator *m_pValidator; 768 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 759 769 760 770 QString m_strMachineId; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r47289 r47559 59 59 } 60 60 61 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 61 62 void UIMachineSettingsSystem::setOHCIEnabled(bool fEnabled) 62 63 { 64 /* Make sure OHCI status has changed: */ 65 if (m_fOHCIEnabled == fEnabled) 66 return; 67 68 /* Update OHCI status value: */ 63 69 m_fOHCIEnabled = fEnabled; 64 } 70 71 /* Revalidate if possible: */ 72 if (m_pValidator) 73 m_pValidator->revalidate(); 74 } 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 */ 65 83 66 84 /* Load data to cache from corresponding external object(s), … … 279 297 } 280 298 299 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 300 void UIMachineSettingsSystem::setValidator(UIPageValidator *pValidator) 301 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 281 302 void UIMachineSettingsSystem::setValidator(QIWidgetValidator *pValidator) 303 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 282 304 { 283 305 /* Configure validation: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
r47278 r47559 152 152 void saveFromCacheTo(QVariant &data); 153 153 154 /* Helpers: Validation stuff: */ 154 /* API: Validation stuff: */ 155 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 156 void setValidator(UIPageValidator *pValidator); 157 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 155 158 void setValidator(QIWidgetValidator *pValidator); 159 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 156 160 bool revalidate(QString &strWarning, QString &strTitle); 157 161 … … 201 205 202 206 /* Variable: Validation stuff: */ 207 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 208 UIPageValidator *m_pValidator; 209 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 203 210 QIWidgetValidator *m_pValidator; 211 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 204 212 205 213 /* Variable: Boot-table stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r47401 r47559 140 140 UIMachineSettingsUSB::UIMachineSettingsUSB(UISettingsPageType type) 141 141 : UISettingsPage(type) 142 , m Validator(0)142 , m_pValidator(0) 143 143 , m_pToolBar(0) 144 144 , mNewAction(0), mAddAction(0), mEdtAction(0), mDelAction(0) … … 387 387 388 388 /* Revalidate if possible: */ 389 if (m Validator)390 m Validator->revalidate();389 if (m_pValidator) 390 m_pValidator->revalidate(); 391 391 } 392 392 … … 564 564 } 565 565 566 void UIMachineSettingsUSB::setValidator (QIWidgetValidator *aVal) 567 { 568 mValidator = aVal; 569 connect (mGbUSB, SIGNAL (stateChanged (int)), mValidator, SLOT (revalidate())); 570 connect(mCbUSB2, SIGNAL(stateChanged(int)), mValidator, SLOT(revalidate())); 566 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 567 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 { 572 /* Configure validation: */ 573 m_pValidator = pValidator; 574 connect(mGbUSB, SIGNAL(stateChanged(int)), m_pValidator, SLOT(revalidate())); 575 connect(mCbUSB2, SIGNAL(stateChanged(int)), m_pValidator, SLOT(revalidate())); 571 576 } 572 577 … … 712 717 713 718 /* Revalidate if possible: */ 714 if (m Validator)715 m Validator->revalidate();719 if (m_pValidator) 720 m_pValidator->revalidate(); 716 721 } 717 722 … … 760 765 761 766 /* Revalidate if possible: */ 762 if (m Validator)763 m Validator->revalidate();767 if (m_pValidator) 768 m_pValidator->revalidate(); 764 769 } 765 770 … … 860 865 if (!mTwFilters->topLevelItemCount()) 861 866 { 862 if (mValidator) 863 { 864 mValidator->rescan(); 865 mValidator->revalidate(); 867 /* Revalidate if possible: */ 868 if (m_pValidator) 869 { 870 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 871 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 */ 866 876 } 867 877 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h
r44528 r47559 142 142 bool changed() const { return m_cache.wasChanged(); } 143 143 144 void setValidator (QIWidgetValidator *aVal); 144 /* API: Validation stuff: */ 145 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 146 void setValidator(UIPageValidator *pValidator); 147 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 148 void setValidator(QIWidgetValidator *pValidator); 149 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 145 150 bool revalidate(QString &strWarningText, QString &strTitle); 146 151 … … 179 184 void polishPage(); 180 185 186 /* Variable: Validation stuff: */ 187 #ifdef VBOX_WITH_NEW_SETTINGS_VALIDATOR 188 UIPageValidator *m_pValidator; 189 #else /* VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 190 QIWidgetValidator *m_pValidator; 191 #endif /* !VBOX_WITH_NEW_SETTINGS_VALIDATOR */ 192 181 193 /* Global data source: */ 182 194 CSystemProperties m_properties; … … 188 200 189 201 /* Other variables: */ 190 QIWidgetValidator *mValidator;191 202 UIToolBar *m_pToolBar; 192 203 QAction *mNewAction;
Note:
See TracChangeset
for help on using the changeset viewer.