Changeset 85053 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 3, 2020 11:33:19 AM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
r85044 r85053 17 17 18 18 /* Qt includes: */ 19 #include <QButtonGroup> 19 20 #include <QCheckBox> 20 21 #include <QDir> 22 #include <QGridLayout> 23 #include <QHBoxLayout> 21 24 #include <QLabel> 22 #include <Q HBoxLayout>25 #include <QRadioButton> 23 26 #include <QVBoxLayout> 24 27 … … 177 180 178 181 UIWizardNewVMPageNameType::UIWizardNewVMPageNameType(const QString &strGroup) 179 : m_pNameAndSystemEditor(0) 180 , m_pUnattendedCheckBox(0) 181 , m_pStartHeadlessCheckBox(0) 182 : m_pButtonSimple(0) 183 , m_pButtonUnattended(0) 182 184 , m_pISOSelectorLabel(0) 183 185 , m_pISOFilePathSelector(0) 186 , m_pStartHeadlessLabel(0) 187 , m_pStartHeadlessCheckBox(0) 188 , m_pNameAndSystemEditor(0) 184 189 , m_strGroup(strGroup) 185 190 { … … 267 272 bool UIWizardNewVMPageNameType::checkISOFile() const 268 273 { 269 if (m_p UnattendedCheckBox && m_pUnattendedCheckBox->isChecked())274 if (m_pButtonUnattended && m_pButtonUnattended->isChecked()) 270 275 { 271 276 QString strISOFilePath = m_pISOFilePathSelector ? m_pISOFilePathSelector->path() : QString(); … … 379 384 bool UIWizardNewVMPageNameType::isUnattendedEnabled() const 380 385 { 381 if (!m_p UnattendedCheckBox)386 if (!m_pButtonUnattended) 382 387 return false; 383 return m_p UnattendedCheckBox->isChecked();388 return m_pButtonUnattended->isChecked(); 384 389 } 385 390 … … 405 410 { 406 411 QGridLayout *pMainLayout = new QGridLayout(this); 407 if (!pMainLayout) 408 return; 409 410 411 m_pLabel = new QIRichTextLabel(this); 412 m_pUnattendedCheckBox = new QCheckBox; 413 if (m_pUnattendedCheckBox) 414 { 415 m_pUnattendedCheckBox->setLayoutDirection(Qt::RightToLeft); 416 //m_pUnattendedCheckBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); 417 connect(m_pUnattendedCheckBox, &QCheckBox::toggled, this, &UIWizardNewVMPageBasicNameType::sltUnattendedCheckBoxToggle); 418 } 419 m_pStartHeadlessCheckBox = new QCheckBox; 420 if (m_pStartHeadlessCheckBox) 421 { 422 m_pStartHeadlessCheckBox->setLayoutDirection(Qt::RightToLeft); 423 m_pStartHeadlessCheckBox->setEnabled(false); 424 } 425 426 m_pISOSelectorLabel = new QLabel; 427 if (m_pISOSelectorLabel) 428 { 429 m_pISOSelectorLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); 430 m_pISOSelectorLabel->setEnabled(false); 431 } 432 433 m_pISOFilePathSelector = new UIFilePathSelector; 434 if (m_pISOFilePathSelector) 435 { 436 m_pISOFilePathSelector->setResetEnabled(false); 437 m_pISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open); 438 m_pISOFilePathSelector->setFileDialogFilters("*.iso *.ISO"); 439 m_pISOFilePathSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); 440 m_pISOFilePathSelector->setEnabled(false); 441 connect(m_pISOFilePathSelector, &UIFilePathSelector::pathChanged, this, &UIWizardNewVMPageBasicNameType::sltISOPathChanged); 442 } 443 444 m_pNameAndSystemEditor = new UINameAndSystemEditor(this, true, true, true); 445 446 pMainLayout->addWidget(m_pLabel, 0, 0, 1, 4); 447 pMainLayout->addWidget(m_pUnattendedCheckBox, 1, 0, 1, 1, Qt::AlignLeft); 448 pMainLayout->addWidget(m_pStartHeadlessCheckBox, 2, 1, 1, 1, Qt::AlignLeft); 449 450 pMainLayout->addWidget(m_pISOSelectorLabel, 3, 1, 1, 1, Qt::AlignLeft); 451 pMainLayout->addWidget(m_pISOFilePathSelector, 3, 2, 1, 3, Qt::AlignLeft); 452 pMainLayout->addWidget(m_pNameAndSystemEditor, 4, 0, 1, 5); 453 454 /* Setup connections: */ 455 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigNameChanged, this, &UIWizardNewVMPageBasicNameType::sltNameChanged); 456 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigPathChanged, this, &UIWizardNewVMPageBasicNameType::sltPathChanged); 457 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged, this, &UIWizardNewVMPageBasicNameType::sltOsTypeChanged); 458 459 /* Register fields: */ 460 registerField("name*", m_pNameAndSystemEditor, "name", SIGNAL(sigNameChanged(const QString &))); 461 registerField("type", m_pNameAndSystemEditor, "type", SIGNAL(sigOsTypeChanged())); 462 registerField("machineFilePath", this, "machineFilePath"); 463 registerField("machineFolder", this, "machineFolder"); 464 registerField("machineBaseName", this, "machineBaseName"); 465 registerField("guestOSFamiyId", this, "guestOSFamiyId"); 466 registerField("ISOFilePath", this, "ISOFilePath"); 467 registerField("isUnattendedEnabled", this, "isUnattendedEnabled"); 468 registerField("startHeadless", this, "startHeadless"); 469 registerField("detectedOSTypeId", this, "detectedOSTypeId"); 412 if (pMainLayout) 413 { 414 m_pLabel1 = new QIRichTextLabel(this); 415 if (m_pLabel1) 416 pMainLayout->addWidget(m_pLabel1, 0, 0, 1, 3); 417 418 QButtonGroup *pButtonGroup = new QButtonGroup(this); 419 if (pButtonGroup) 420 { 421 m_pButtonSimple = new QRadioButton(this); 422 if (m_pButtonSimple) 423 { 424 m_pButtonSimple->setChecked(true); 425 pMainLayout->addWidget(m_pButtonSimple, 1, 0, 1, 3); 426 } 427 m_pButtonUnattended = new QRadioButton(this); 428 if (m_pButtonUnattended) 429 { 430 QStyleOptionButton options; 431 options.initFrom(m_pButtonUnattended); 432 const int iWidth = m_pButtonUnattended->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, 433 &options, m_pButtonUnattended); 434 pMainLayout->setColumnMinimumWidth(0, iWidth); 435 pMainLayout->addWidget(m_pButtonUnattended, 2, 0, 1, 3); 436 } 437 438 pButtonGroup->addButton(m_pButtonSimple); 439 pButtonGroup->addButton(m_pButtonUnattended); 440 connect(pButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked), 441 this, &UIWizardNewVMPageBasicNameType::sltUnattendedCheckBoxToggle); 442 } 443 444 m_pISOSelectorLabel = new QLabel; 445 if (m_pISOSelectorLabel) 446 { 447 m_pISOSelectorLabel->setAlignment(Qt::AlignRight); 448 m_pISOSelectorLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 449 m_pISOSelectorLabel->setEnabled(false); 450 pMainLayout->addWidget(m_pISOSelectorLabel, 3, 1); 451 } 452 m_pISOFilePathSelector = new UIFilePathSelector; 453 if (m_pISOFilePathSelector) 454 { 455 m_pISOFilePathSelector->setResetEnabled(false); 456 m_pISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open); 457 m_pISOFilePathSelector->setFileDialogFilters("*.iso *.ISO"); 458 m_pISOFilePathSelector->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 459 m_pISOFilePathSelector->setEnabled(false); 460 connect(m_pISOFilePathSelector, &UIFilePathSelector::pathChanged, this, &UIWizardNewVMPageBasicNameType::sltISOPathChanged); 461 pMainLayout->addWidget(m_pISOFilePathSelector, 3, 2); 462 } 463 464 m_pStartHeadlessLabel = new QLabel; 465 if (m_pStartHeadlessLabel) 466 { 467 m_pStartHeadlessLabel->setAlignment(Qt::AlignRight); 468 m_pStartHeadlessLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 469 m_pStartHeadlessLabel->setEnabled(false); 470 pMainLayout->addWidget(m_pStartHeadlessLabel, 4, 1); 471 } 472 m_pStartHeadlessCheckBox = new QCheckBox; 473 if (m_pStartHeadlessCheckBox) 474 { 475 m_pStartHeadlessCheckBox->setEnabled(false); 476 pMainLayout->addWidget(m_pStartHeadlessCheckBox, 4, 2); 477 } 478 479 m_pLabel2 = new QIRichTextLabel(this); 480 if (m_pLabel2) 481 pMainLayout->addWidget(m_pLabel2, 5, 0, 1, 3); 482 483 m_pNameAndSystemEditor = new UINameAndSystemEditor(this, true, true, true); 484 if (m_pNameAndSystemEditor) 485 { 486 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigNameChanged, this, &UIWizardNewVMPageBasicNameType::sltNameChanged); 487 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigPathChanged, this, &UIWizardNewVMPageBasicNameType::sltPathChanged); 488 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged, this, &UIWizardNewVMPageBasicNameType::sltOsTypeChanged); 489 pMainLayout->addWidget(m_pNameAndSystemEditor, 6, 1, 1, 2); 490 } 491 492 /* Register fields: */ 493 registerField("name*", m_pNameAndSystemEditor, "name", SIGNAL(sigNameChanged(const QString &))); 494 registerField("type", m_pNameAndSystemEditor, "type", SIGNAL(sigOsTypeChanged())); 495 registerField("machineFilePath", this, "machineFilePath"); 496 registerField("machineFolder", this, "machineFolder"); 497 registerField("machineBaseName", this, "machineBaseName"); 498 registerField("guestOSFamiyId", this, "guestOSFamiyId"); 499 registerField("ISOFilePath", this, "ISOFilePath"); 500 registerField("isUnattendedEnabled", this, "isUnattendedEnabled"); 501 registerField("startHeadless", this, "startHeadless"); 502 registerField("detectedOSTypeId", this, "detectedOSTypeId"); 503 } 470 504 } 471 505 … … 516 550 } 517 551 518 void UIWizardNewVMPageBasicNameType::sltUnattendedCheckBoxToggle(bool fEnabled) 519 { 552 void UIWizardNewVMPageBasicNameType::sltUnattendedCheckBoxToggle() 553 { 554 const bool fEnabled = m_pButtonUnattended->isChecked(); 520 555 if (m_pISOSelectorLabel) 521 556 m_pISOSelectorLabel->setEnabled(fEnabled); 522 557 if (m_pISOFilePathSelector) 523 558 m_pISOFilePathSelector->setEnabled(fEnabled); 559 if (m_pStartHeadlessLabel) 560 m_pStartHeadlessLabel->setEnabled(fEnabled); 524 561 if (m_pStartHeadlessCheckBox) 525 562 m_pStartHeadlessCheckBox->setEnabled(fEnabled); … … 535 572 setTitle(UIWizardNewVM::tr("Name and operating system")); 536 573 537 if (m_pLabel) 538 m_pLabel->setText(UIWizardNewVM::tr("Please choose a descriptive name and destination folder for the new virtual machine " 539 "and select the type of operating system you intend to install on it. " 540 "The name you choose will be used throughout VirtualBox " 541 "to identify this machine.")); 542 543 544 if (m_pUnattendedCheckBox) 545 { 546 m_pUnattendedCheckBox->setText(UIWizardNewVM::tr("Unattended Install")); 547 m_pUnattendedCheckBox->setToolTip(UIWizardNewVM::tr("When checkedan unattended guest OS will be initialized after this wizard is closed")); 548 } 574 if (m_pLabel1) 575 m_pLabel1->setText(UIWizardNewVM::tr("Please choose whether you want to leave newly created VM empty or use operating " 576 "system image medium for unattended installation. You can additionally specify " 577 "whether newly created machine should be started in headless mode if you are sure " 578 "your interference will not be necessary.")); 579 580 if (m_pButtonSimple) 581 { 582 m_pButtonSimple->setText(UIWizardNewVM::tr("Leave Empty")); 583 m_pButtonSimple->setToolTip(UIWizardNewVM::tr("When checked, no guest OS will be installed after this wizard is closed")); 584 } 585 if (m_pButtonUnattended) 586 { 587 m_pButtonUnattended->setText(UIWizardNewVM::tr("Unattended Install")); 588 m_pButtonUnattended->setToolTip(UIWizardNewVM::tr("When checked, an unattended guest OS will be initialized after this wizard is closed")); 589 } 590 549 591 if (m_pISOSelectorLabel) 550 m_pISOSelectorLabel->setText(UIWizardNewVM::tr("Installation medium:")); 592 m_pISOSelectorLabel->setText(UIWizardNewVM::tr("Image:")); 593 594 if (m_pStartHeadlessLabel) 595 m_pStartHeadlessLabel->setText(UIWizardNewVM::tr("Options:")); 551 596 if (m_pStartHeadlessCheckBox) 552 597 { 553 598 m_pStartHeadlessCheckBox->setText(UIWizardNewVM::tr("Start VM Headless")); 554 m_pStartHeadlessCheckBox->setToolTip(UIWizardNewVM::tr("When checked the unattended install will start the virtual machine headless")); 599 m_pStartHeadlessCheckBox->setToolTip(UIWizardNewVM::tr("When checked, the unattended install will start the virtual machine headless")); 600 } 601 602 if (m_pLabel2) 603 m_pLabel2->setText(UIWizardNewVM::tr("Please choose a descriptive name and destination folder for the new virtual machine " 604 "and select the type of operating system you intend to install on it. " 605 "The name you choose will be used throughout VirtualBox " 606 "to identify this machine.")); 607 608 if ( m_pNameAndSystemEditor 609 && m_pISOSelectorLabel 610 && m_pStartHeadlessLabel) 611 { 612 int iMinWidthHint = 0; 613 iMinWidthHint = qMax(iMinWidthHint, m_pISOSelectorLabel->minimumSizeHint().width()); 614 iMinWidthHint = qMax(iMinWidthHint, m_pStartHeadlessLabel->minimumSizeHint().width()); 615 m_pNameAndSystemEditor->setMinimumLayoutIndent(iMinWidthHint); 555 616 } 556 617 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h
r85044 r85053 26 26 27 27 /* Forward declarations: */ 28 class UINameAndSystemEditor;29 28 class QCheckBox; 30 29 class QLabel; 30 class QRadioButton; 31 31 class QIRichTextLabel; 32 32 class UIFilePathSelector; 33 class UINameAndSystemEditor; 33 34 34 35 /* 1st page of the New Virtual Machine wizard (base part): */ … … 74 75 bool checkISOFile() const; 75 76 77 /** Holds the simple variant button instance. */ 78 QRadioButton *m_pButtonSimple; 79 /** Holds the unattended variant button instance. */ 80 QRadioButton *m_pButtonUnattended; 81 82 /** Holds the ISO selector label instance. */ 83 QLabel *m_pISOSelectorLabel; 84 /** Holds the ISO selector editor instance. */ 85 UIFilePathSelector *m_pISOFilePathSelector; 86 87 /** Holds the headless start label instance. */ 88 QLabel *m_pStartHeadlessLabel; 89 /** Holds the headless start checkbox instance. */ 90 QCheckBox *m_pStartHeadlessCheckBox; 76 91 77 92 /** Provides a path selector and a line edit field for path and name entry. */ 78 93 UINameAndSystemEditor *m_pNameAndSystemEditor; 79 QCheckBox *m_pUnattendedCheckBox;80 QCheckBox *m_pStartHeadlessCheckBox;81 QLabel *m_pISOSelectorLabel;82 UIFilePathSelector *m_pISOFilePathSelector;83 94 QString m_strDetectedOSTypeId; 84 95 … … 139 150 void sltOsTypeChanged(); 140 151 void sltISOPathChanged(const QString &strPath); 141 void sltUnattendedCheckBoxToggle( bool fEnabled);152 void sltUnattendedCheckBoxToggle(); 142 153 143 154 private: … … 155 166 156 167 /* Widgets: */ 157 QIRichTextLabel *m_pLabel ;158 168 QIRichTextLabel *m_pLabel1; 169 QIRichTextLabel *m_pLabel2; 159 170 }; 160 171
Note:
See TracChangeset
for help on using the changeset viewer.