Changeset 90236 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 19, 2021 11:13:47 AM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h
r90033 r90236 123 123 void setNameFieldValidator(const QString &strValidator); 124 124 125 /** Passes the @p fError to QILineEdit::mark(bool) effectively changing the background color. */125 /** Passes the @p fError to QILineEdit::mark(bool) effectively marking it for error. */ 126 126 void markNameEditor(bool fError); 127 127 /** Passes the @p fError and @a strErrorMessage to UIFilePathSelector::mark(bool) -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIHostnameDomainNameEditor.cpp
r90193 r90236 56 56 return m_pHostnameLineEdit && m_pHostnameLineEdit->hasAcceptableInput() && 57 57 m_pDomainNameLineEdit && m_pDomainNameLineEdit->hasAcceptableInput(); 58 } 59 60 void UIHostnameDomainNameEditor::mark() 61 { 62 if (m_pHostnameLineEdit) 63 m_pHostnameLineEdit->mark(!m_pHostnameLineEdit->hasAcceptableInput(), 64 tr("Hostname should be at least 2 character lomg. Allowed characters are alphanumerics, \"-\" and \".\"")); 65 if (m_pDomainNameLineEdit) 66 m_pDomainNameLineEdit->mark(!m_pDomainNameLineEdit->hasAcceptableInput(), 67 tr("Domain name should be at least 2 character lomg. Allowed characters are alphanumerics, \"-\" and \".\"")); 58 68 } 59 69 … … 120 130 121 131 pLayout->addWidget(pLineEdit, iRow, 1, 1, 3); 122 // QRegularExpression hostNameRegex("^[a-zA-Z0-9-.]{2,}\\.[a-zA-Z0-9-.]+$");^[a-zA-Z0-9-.]{2,}\.[a-zA-Z0-9-.]+$123 /* Host name and domain should be strings of minimum length of 2 and composed of alpha numerics, '-', and '.': */124 m_pHostnameLineEdit->setValidator(new QRegularExpressionValidator(QRegularExpression("^[a-zA-Z0-9-.]{2,}"), this));125 126 132 pLabel->setBuddy(pLineEdit); 127 133 ++iRow; … … 140 146 addLineEdit(iRow, m_pHostnameLabel, m_pHostnameLineEdit, pMainLayout); 141 147 addLineEdit(iRow, m_pDomainNameLabel, m_pDomainNameLineEdit, pMainLayout); 148 149 // QRegularExpression hostNameRegex("^[a-zA-Z0-9-.]{2,}\\.[a-zA-Z0-9-.]+$");^[a-zA-Z0-9-.]{2,}\.[a-zA-Z0-9-.]+$ 150 /* Host name and domain should be strings of minimum length of 2 and composed of alpha numerics, '-', and '.': */ 151 m_pHostnameLineEdit->setValidator(new QRegularExpressionValidator(QRegularExpression("^[a-zA-Z0-9-.]{2,}"), this)); 152 m_pDomainNameLineEdit->setValidator(new QRegularExpressionValidator(QRegularExpression("^[a-zA-Z0-9-.]{2,}"), this)); 142 153 143 154 connect(m_pHostnameLineEdit, &QILineEdit::textChanged, -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIHostnameDomainNameEditor.h
r90157 r90236 57 57 58 58 bool isComplete() const; 59 void mark(); 59 60 60 61 protected: -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.cpp
r90232 r90236 28 28 #include "UIFilePathSelector.h" 29 29 #include "UIUserNamePasswordEditor.h" 30 #include "UIVirtualCPUEditor.h" 30 31 #include "UIWizardNewVM.h" 31 32 #include "UIWizardNewVMEditors.h" 32 #include "UI VirtualCPUEditor.h"33 #include "UIWizardNewVMUnattendedPageBasic.h" 33 34 34 35 /* Other VBox includes: */ … … 178 179 } 179 180 180 void UIGAInstallationGroupBox::mark(bool fError, const QString &strErrorMessage /* = QString() */) 181 { 182 if (m_pGAISOFilePathSelector) 183 m_pGAISOFilePathSelector->mark(fError, strErrorMessage); 184 } 185 181 void UIGAInstallationGroupBox::mark() 182 { 183 bool fError = !UIWizardNewVMUnattendedPage::checkGAISOFile(path()); 184 if (m_pGAISOFilePathSelector) 185 m_pGAISOFilePathSelector->mark(fError, tr("Invalid Guest Additions installation media")); 186 } 187 188 bool UIGAInstallationGroupBox::isComplete() const 189 { 190 if (!isChecked()) 191 return true; 192 return UIWizardNewVMUnattendedPage::checkGAISOFile(path()); 193 } 186 194 187 195 void UIGAInstallationGroupBox::sltToggleWidgetsEnabled(bool fEnabled) … … 249 257 this, &UIAdditionalUnattendedOptions::sigStartHeadlessChanged); 250 258 251 252 259 retranslateUi(); 253 260 } … … 306 313 return m_pHostnameDomainNameEditor->isComplete(); 307 314 return false; 315 } 316 317 void UIAdditionalUnattendedOptions::mark() 318 { 319 if (m_pHostnameDomainNameEditor) 320 m_pHostnameDomainNameEditor->mark(); 308 321 } 309 322 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.h
r90232 r90236 90 90 QString path() const; 91 91 void setPath(const QString &strPath, bool fRefreshText = true); 92 void mark(bool fError, const QString &strErrorMessage = QString()); 92 void mark(); 93 bool isComplete() const; 93 94 /** @} */ 94 95 … … 128 129 QString hostnameDomainName() const; 129 130 bool isComplete() const; 131 void mark(); 130 132 void disableEnableProductKeyWidgets(bool fEnabled); 131 133 /** @} */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
r90233 r90236 403 403 updateHostnameDomainNameFromMachineName(); 404 404 405 if (m_pGAInstallationISOContainer && !m_userModifiedParameters.contains("InstallGuestAdditions")) 406 { 407 m_pGAInstallationISOContainer->blockSignals(true); 408 m_pGAInstallationISOContainer->setChecked(pWizard->installGuestAdditions()); 409 m_pGAInstallationISOContainer->blockSignals(false); 410 } 405 411 406 412 setOSTypeDependedValues(); … … 418 424 void UIWizardNewVMPageExpert::markWidgets() const 419 425 { 420 // UIWizardNewVMPageBaseNameOSType::markWidgets(); 421 // UIWizardNewVMPageBaseUnattended::markWidgets(); 426 if (m_pNameAndSystemEditor) 427 { 428 m_pNameAndSystemEditor->markNameEditor(m_pNameAndSystemEditor->name().isEmpty()); 429 m_pNameAndSystemEditor->markImageEditor(!UIWizardNewVMNameOSTypePage::checkISOFile(m_pNameAndSystemEditor), 430 UIWizardNewVM::tr("Invalid file path or unreadable file")); 431 } 432 UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard()); 433 if (pWizard && pWizard->installGuestAdditions() && m_pGAInstallationISOContainer) 434 m_pGAInstallationISOContainer->mark(); 435 if (isUnattendedEnabled()) 436 m_pAdditionalOptionsContainer->mark(); 422 437 } 423 438 … … 498 513 bool UIWizardNewVMPageExpert::isComplete() const 499 514 { 500 //markWidgets();515 markWidgets(); 501 516 bool fIsComplete = true; 502 // m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType, QIcon()); 503 // m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Unattended, QIcon()); 504 // m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Disk, QIcon()); 505 // m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Hardware, QIcon()); 506 507 // if (!UIWizardPage::isComplete()) 508 // { 509 // m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType, 510 // UIIconPool::iconSet(":/status_error_16px.png"), 511 // UIWizardNewVM::tr("A valid VM name is required")); 512 // fIsComplete = false; 513 // } 514 515 // if (m_pDiskExisting && m_pDiskExisting->isChecked() && uiCommon().medium(m_pDiskSelector->id()).isNull()) 516 // { 517 // m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Disk, 518 // UIIconPool::iconSet(":/status_error_16px.png"), UIWizardNewVM::tr("No valid disk is selected")); 519 // fIsComplete = false; 520 // } 521 522 // if (m_pDiskNew && m_pDiskNew->isChecked()) 523 // { 524 // qulonglong uSize = field("mediumSize").toULongLong(); 525 // if (uSize <= 0) 526 // { 527 // m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Disk, 528 // UIIconPool::iconSet(":/status_error_16px.png"), UIWizardNewVM::tr("Invalid disk size")); 529 // fIsComplete = false; 530 // } 531 // } 532 533 // /* Check unattended install related stuff: */ 534 // if (isUnattendedEnabled()) 535 // { 536 // /* Check the installation medium: */ 537 // if (!checkISOFile()) 538 // { 539 // m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType, 540 // UIIconPool::iconSet(":/status_error_16px.png"), 541 // UIWizardNewVM::tr("Invalid path or unreadable ISO file")); 542 // fIsComplete = false; 543 // } 544 // /* Check the GA installation medium: */ 545 // if (m_pGAInstallationISOContainer && m_pGAInstallationISOContainer->isChecked() && !checkGAISOFile()) 546 // { 547 // m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Unattended, 548 // UIIconPool::iconSet(":/status_error_16px.png"), 549 // UIWizardNewVM::tr("Invalid path or unreadable ISO file")); 550 551 // fIsComplete = false; 552 // } 553 // if (m_pUserNamePasswordGroupBox) 554 // { 555 // if (!m_pUserNamePasswordGroupBox->isComplete()) 556 // { 557 // m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Unattended, 558 // UIIconPool::iconSet(":/status_error_16px.png"), 559 // UIWizardNewVM::tr("Invalid username and/or password")); 560 // fIsComplete = false; 561 // } 562 // } 563 // } 517 m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType, QIcon()); 518 m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Unattended, QIcon()); 519 m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Disk, QIcon()); 520 m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Hardware, QIcon()); 521 522 UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard()); 523 AssertReturn(pWizard, false); 524 525 /* Check unattended install related stuff: */ 526 if (isUnattendedEnabled()) 527 { 528 /* Check the installation medium: */ 529 if (!UIWizardNewVMNameOSTypePage::checkISOFile(m_pNameAndSystemEditor)) 530 { 531 m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType, 532 UIIconPool::iconSet(":/status_error_16px.png"), 533 UIWizardNewVM::tr("Invalid path or unreadable ISO file")); 534 fIsComplete = false; 535 } 536 /* Check the GA installation medium: */ 537 if (m_pGAInstallationISOContainer && !m_pGAInstallationISOContainer->isComplete()) 538 { 539 m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Unattended, 540 UIIconPool::iconSet(":/status_error_16px.png"), 541 UIWizardNewVM::tr("Invalid path or unreadable ISO file")); 542 543 fIsComplete = false; 544 } 545 if (m_pUserNamePasswordGroupBox) 546 { 547 if (!m_pUserNamePasswordGroupBox->isComplete()) 548 { 549 m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Unattended, 550 UIIconPool::iconSet(":/status_error_16px.png"), 551 UIWizardNewVM::tr("Invalid username and/or password")); 552 fIsComplete = false; 553 } 554 } 555 if (m_pAdditionalOptionsContainer) 556 { 557 if (!m_pAdditionalOptionsContainer->isComplete()) 558 { 559 m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Unattended, 560 UIIconPool::iconSet(":/status_error_16px.png"), 561 UIWizardNewVM::tr("Invalid hostname or domain name")); 562 fIsComplete = false; 563 } 564 } 565 } 566 567 if (m_pNameAndSystemEditor) 568 { 569 if (m_pNameAndSystemEditor->name().isEmpty()) 570 { 571 m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType, 572 UIIconPool::iconSet(":/status_error_16px.png"), 573 UIWizardNewVM::tr("Virtual machine name is invalid")); 574 fIsComplete = false; 575 } 576 if (!UIWizardNewVMNameOSTypePage::checkISOFile(m_pNameAndSystemEditor)) 577 { 578 m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType, 579 UIIconPool::iconSet(":/status_error_16px.png"), 580 UIWizardNewVM::tr("Invalid ISO file")); 581 fIsComplete = false; 582 } 583 } 584 585 if (m_pDiskExisting && m_pDiskExisting->isChecked() && uiCommon().medium(m_pDiskSelector->id()).isNull()) 586 { 587 m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Disk, 588 UIIconPool::iconSet(":/status_error_16px.png"), UIWizardNewVM::tr("No valid disk is selected")); 589 fIsComplete = false; 590 } 591 592 if (m_pDiskNew && m_pDiskNew->isChecked()) 593 { 594 qulonglong uSize = pWizard->mediumSize(); 595 if (uSize <= 0) 596 { 597 m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Disk, 598 UIIconPool::iconSet(":/status_error_16px.png"), UIWizardNewVM::tr("Invalid disk size")); 599 fIsComplete = false; 600 } 601 } 602 564 603 565 604 // return !mediumFormat().isNull() && -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMUnattendedPageBasic.cpp
r90232 r90236 255 255 UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard()); 256 256 if (pWizard && pWizard->installGuestAdditions() && m_pGAInstallationISOContainer) 257 m_pGAInstallationISOContainer->mark( !UIWizardNewVMUnattendedPage::checkGAISOFile(m_pGAInstallationISOContainer->path()));258 } 257 m_pGAInstallationISOContainer->mark(); 258 }
Note:
See TracChangeset
for help on using the changeset viewer.