- Timestamp:
- Jul 3, 2020 6:10:45 AM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 5 edited
-
Makefile.kmk (modified) (2 diffs)
-
src/wizards/newvm/UIWizardNewVM.cpp (modified) (2 diffs)
-
src/wizards/newvm/UIWizardNewVMPageBasicNameType.cpp (modified) (11 diffs)
-
src/wizards/newvm/UIWizardNewVMPageBasicNameType.h (modified) (7 diffs)
-
src/wizards/newvm/UIWizardNewVMPageBasicUnattended.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r85035 r85042 651 651 src/wizards/newvm/UIWizardNewVM.h \ 652 652 src/wizards/newvm/UIWizardNewVMPageBasicUserNameHostname.h \ 653 src/wizards/newvm/UIWizardNewVMPageBasicUnattended.h \654 653 src/wizards/newvm/UIWizardNewVMPageBasicNameType.h \ 655 654 src/wizards/newvm/UIWizardNewVMPageBasicGAInstall.h \ … … 1117 1116 src/wizards/newvm/UIWizardNewVM.cpp \ 1118 1117 src/wizards/newvm/UIWizardNewVMPageBasicUserNameHostname.cpp \ 1119 src/wizards/newvm/UIWizardNewVMPageBasicUnattended.cpp \1120 1118 src/wizards/newvm/UIWizardNewVMPageBasicNameType.cpp \ 1121 1119 src/wizards/newvm/UIWizardNewVMPageBasicGAInstall.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
r85001 r85042 78 78 case WizardMode_Basic: 79 79 { 80 UIWizardNewVMPageBasicUnattended *pUnattendedPage =81 new UIWizardNewVMPageBasicUnattended;82 connect(pUnattendedPage, &UIWizardNewVMPageBasicUnattended::sigDetectedOSTypeChanged,83 this, &UIWizardNewVM::sltHandleDetectedOSTypeChange);84 setPage(PageUnattended, pUnattendedPage);80 // UIWizardNewVMPageBasicUnattended *pUnattendedPage = 81 // new UIWizardNewVMPageBasicUnattended; 82 // connect(pUnattendedPage, &UIWizardNewVMPageBasicUnattended::sigDetectedOSTypeChanged, 83 // this, &UIWizardNewVM::sltHandleDetectedOSTypeChange); 84 // setPage(PageUnattended, pUnattendedPage); 85 85 setPage(PageNameType, new UIWizardNewVMPageBasicNameType(m_strGroup)); 86 86 setPage(PageUserNameHostname, new UIWizardNewVMPageBasicUserNameHostname); … … 531 531 m_unattendedInstallData.m_strPassword = getStringFieldValue("password"); 532 532 m_unattendedInstallData.m_strDetectedOSTypeId = getStringFieldValue("detectedOSTypeId"); 533 m_unattendedInstallData.m_strDetectedOSVersion = getStringFieldValue("detectedOSVersion");534 m_unattendedInstallData.m_strDetectedOSFlavor = getStringFieldValue("detectedOSFlavor");535 m_unattendedInstallData.m_strDetectedOSLanguages = getStringFieldValue("detectedOSLanguages");536 m_unattendedInstallData.m_strDetectedOSHints = getStringFieldValue("detectedOSHints");533 // m_unattendedInstallData.m_strDetectedOSVersion = getStringFieldValue("detectedOSVersion"); 534 // m_unattendedInstallData.m_strDetectedOSFlavor = getStringFieldValue("detectedOSFlavor"); 535 // m_unattendedInstallData.m_strDetectedOSLanguages = getStringFieldValue("detectedOSLanguages"); 536 // m_unattendedInstallData.m_strDetectedOSHints = getStringFieldValue("detectedOSHints"); 537 537 m_unattendedInstallData.m_strProductKey = getStringFieldValue("productKey"); 538 538 m_unattendedInstallData.m_strGuestAdditionsISOPath = getStringFieldValue("guestAdditionsISOPath"); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicNameType.cpp
r85001 r85042 17 17 18 18 /* Qt includes: */ 19 #include <QCheckBox> 19 20 #include <QDir> 20 #include <QL ineEdit>21 #include <QLabel> 21 22 #include <QHBoxLayout> 22 23 #include <QVBoxLayout> … … 25 26 #include "QIRichTextLabel.h" 26 27 #include "UICommon.h" 28 #include "UIFilePathSelector.h" 27 29 #include "UIMessageCenter.h" 28 30 #include "UINameAndSystemEditor.h" … … 33 35 #include "CHost.h" 34 36 #include "CSystemProperties.h" 35 37 #include "CUnattended.h" 36 38 37 39 /* Defines some patterns to guess the right OS type. Should be in sync with … … 176 178 UIWizardNewVMPageNameType::UIWizardNewVMPageNameType(const QString &strGroup) 177 179 : m_pNameAndSystemEditor(0) 180 , m_pUnattendedCheckBox(0) 181 , m_pStartHeadlessCheckBox(0) 182 , m_pISOSelectorLabel(0) 183 , m_pISOFilePathSelector(0) 178 184 , m_strGroup(strGroup) 179 180 185 { 181 186 CHost host = uiCommon().host(); … … 212 217 } 213 218 219 bool UIWizardNewVMPageNameType::determineOSType(const QString &strISOPath) 220 { 221 QFileInfo isoFileInfo(strISOPath); 222 if (!isoFileInfo.exists()) 223 { 224 m_strDetectedOSTypeId.clear(); 225 // m_strDetectedOSVersion.clear(); 226 // m_strDetectedOSFlavor.clear(); 227 // m_strDetectedOSLanguages.clear(); 228 // m_strDetectedOSHints.clear(); 229 // updateStatusLabel(); 230 return false; 231 } 232 233 CUnattended comUnatteded = uiCommon().virtualBox().CreateUnattendedInstaller(); 234 comUnatteded.SetIsoPath(strISOPath); 235 comUnatteded.DetectIsoOS(); 236 237 m_strDetectedOSTypeId = comUnatteded.GetDetectedOSTypeId(); 238 // m_strDetectedOSVersion = comUnatteded.GetDetectedOSVersion(); 239 // m_strDetectedOSFlavor = comUnatteded.GetDetectedOSFlavor(); 240 // m_strDetectedOSLanguages = comUnatteded.GetDetectedOSLanguages(); 241 // m_strDetectedOSHints = comUnatteded.GetDetectedOSHints(); 242 243 //updateStatusLabel(); 244 return true; 245 } 246 214 247 void UIWizardNewVMPageNameType::composeMachineFilePath() 215 248 { … … 232 265 } 233 266 267 bool UIWizardNewVMPageNameType::checkISOFile() const 268 { 269 if (m_pUnattendedCheckBox && m_pUnattendedCheckBox->isChecked()) 270 { 271 QString strISOFilePath = m_pISOFilePathSelector ? m_pISOFilePathSelector->path() : QString(); 272 if (!QFileInfo(strISOFilePath).exists()) 273 return false; 274 } 275 return true; 276 } 277 234 278 bool UIWizardNewVMPageNameType::createMachineFolder() 235 279 { … … 326 370 } 327 371 372 QString UIWizardNewVMPageNameType::ISOFilePath() const 373 { 374 if (!m_pISOFilePathSelector) 375 return QString(); 376 return m_pISOFilePathSelector->path(); 377 } 378 379 bool UIWizardNewVMPageNameType::isUnattendedEnabled() const 380 { 381 if (!m_pUnattendedCheckBox) 382 return false; 383 return m_pUnattendedCheckBox->isChecked(); 384 } 385 386 bool UIWizardNewVMPageNameType::startHeadless() const 387 { 388 if (!m_pStartHeadlessCheckBox) 389 return false; 390 return m_pStartHeadlessCheckBox->isChecked(); 391 } 392 393 const QString &UIWizardNewVMPageNameType::detectedOSTypeId() const 394 { 395 return m_strDetectedOSTypeId; 396 } 397 328 398 UIWizardNewVMPageBasicNameType::UIWizardNewVMPageBasicNameType(const QString &strGroup) 329 399 : UIWizardNewVMPageNameType(strGroup) 330 400 { 331 /* Create widgets: */ 332 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 333 { 334 m_pLabel = new QIRichTextLabel(this); 335 m_pNameAndSystemEditor = new UINameAndSystemEditor(this, true, true, true); 336 pMainLayout->addWidget(m_pLabel); 337 pMainLayout->addWidget(m_pNameAndSystemEditor); 338 pMainLayout->addStretch(); 339 } 401 prepare(); 402 } 403 404 void UIWizardNewVMPageBasicNameType::prepare() 405 { 406 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); 340 453 341 454 /* Setup connections: */ … … 351 464 registerField("machineBaseName", this, "machineBaseName"); 352 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"); 353 470 } 354 471 … … 367 484 } 368 485 486 bool UIWizardNewVMPageBasicNameType::isComplete() const 487 { 488 if (m_pNameAndSystemEditor->name().isEmpty()) 489 return false; 490 return checkISOFile(); 491 } 492 369 493 void UIWizardNewVMPageBasicNameType::sltNameChanged(const QString &strNewName) 370 494 { … … 385 509 } 386 510 511 void UIWizardNewVMPageBasicNameType::sltISOPathChanged(const QString &strPath) 512 { 513 determineOSType(strPath); 514 setTypeByISODetectedOSType(m_strDetectedOSTypeId); 515 emit completeChanged(); 516 } 517 518 void UIWizardNewVMPageBasicNameType::sltUnattendedCheckBoxToggle(bool fEnabled) 519 { 520 if (m_pISOSelectorLabel) 521 m_pISOSelectorLabel->setEnabled(fEnabled); 522 if (m_pISOFilePathSelector) 523 m_pISOFilePathSelector->setEnabled(fEnabled); 524 if (m_pStartHeadlessCheckBox) 525 m_pStartHeadlessCheckBox->setEnabled(fEnabled); 526 // if (m_pStatusLabel) 527 // m_pStatusLabel->setEnabled(fEnabled); 528 emit completeChanged(); 529 } 530 531 387 532 void UIWizardNewVMPageBasicNameType::retranslateUi() 388 533 { … … 390 535 setTitle(UIWizardNewVM::tr("Name and operating system")); 391 536 392 /* Translate widgets: */ 393 m_pLabel->setText(UIWizardNewVM::tr("Please choose a descriptive name and destination folder for the new virtual machine " 394 "and select the type of operating system you intend to install on it. " 395 "The name you choose will be used throughout VirtualBox " 396 "to identify this machine.")); 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 } 549 if (m_pISOSelectorLabel) 550 m_pISOSelectorLabel->setText(UIWizardNewVM::tr("Installation medium:")); 551 if (m_pStartHeadlessCheckBox) 552 { 553 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")); 555 } 397 556 } 398 557 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicNameType.h
r84961 r85042 27 27 /* Forward declarations: */ 28 28 class UINameAndSystemEditor; 29 class QCheckBox; 30 class QLabel; 29 31 class QIRichTextLabel; 32 class UIFilePathSelector; 30 33 31 34 /* 1st page of the New Virtual Machine wizard (base part): */ … … 47 50 bool cleanupMachineFolder(bool fWizardCancel = false); 48 51 49 QString machineFilePath() const; 50 void setMachineFilePath(const QString &strMachineFilePath); 52 /** @name Property getters/setters 53 * @{ */ 54 QString machineFilePath() const; 55 void setMachineFilePath(const QString &strMachineFilePath); 51 56 52 QString machineFolder() const;53 void setMachineFolder(const QString &strMachineFolder);57 QString machineFolder() const; 58 void setMachineFolder(const QString &strMachineFolder); 54 59 55 QString machineBaseName() const;56 void setMachineBaseName(const QString &strMachineBaseName);60 QString machineBaseName() const; 61 void setMachineBaseName(const QString &strMachineBaseName); 57 62 58 QString guestOSFamiyId() const; 63 QString guestOSFamiyId() const; 64 QString ISOFilePath() const; 65 bool isUnattendedEnabled() const; 66 bool startHeadless() const; 67 const QString &detectedOSTypeId() const; 68 /** @} */ 59 69 70 71 bool determineOSType(const QString &strISOPath); 60 72 /** calls CVirtualBox::ComposeMachineFilename(...) and sets related member variables */ 61 73 void composeMachineFilePath(); 74 bool checkISOFile() const; 75 62 76 63 77 /** Provides a path selector and a line edit field for path and name entry. */ 64 78 UINameAndSystemEditor *m_pNameAndSystemEditor; 79 QCheckBox *m_pUnattendedCheckBox; 80 QCheckBox *m_pStartHeadlessCheckBox; 81 QLabel *m_pISOSelectorLabel; 82 UIFilePathSelector *m_pISOFilePathSelector; 83 QString m_strDetectedOSTypeId; 65 84 66 85 private: 86 67 87 68 88 /** Full path (including the file name) of the machine's configuration file. */ … … 80 100 bool m_fSupportsHWVirtEx; 81 101 bool m_fSupportsLongMode; 102 103 82 104 friend class UIWizardNewVM; 83 105 }; … … 91 113 Q_PROPERTY(QString machineBaseName READ machineBaseName WRITE setMachineBaseName); 92 114 Q_PROPERTY(QString guestOSFamiyId READ guestOSFamiyId); 115 Q_PROPERTY(QString ISOFilePath READ ISOFilePath); 116 Q_PROPERTY(bool isUnattendedEnabled READ isUnattendedEnabled); 117 Q_PROPERTY(bool startHeadless READ startHeadless); 118 Q_PROPERTY(QString detectedOSTypeId READ detectedOSTypeId); 93 119 94 120 … … 99 125 virtual int nextId() const /* override */; 100 126 void setTypeByISODetectedOSType(const QString &strDetectedOSType); 127 virtual bool isComplete() const; /* override */ 101 128 102 129 protected: … … 111 138 void sltPathChanged(const QString &strNewPath); 112 139 void sltOsTypeChanged(); 140 void sltISOPathChanged(const QString &strPath); 141 void sltUnattendedCheckBoxToggle(bool fEnabled); 113 142 114 143 private: 115 144 145 void prepare(); 116 146 /* Translation stuff: */ 117 147 void retranslateUi(); … … 126 156 /* Widgets: */ 127 157 QIRichTextLabel *m_pLabel; 158 128 159 }; 129 160 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicUnattended.cpp
r85039 r85042 126 126 if (m_pStatusLabel) 127 127 { 128 m_pStatusLabel->setText(QString(" <b>%1:</b> %2<br/><b>%3:</b> %4<br/><b>%5</b>: %6")128 m_pStatusLabel->setText(QString("%1: %2<br/>%3: %4<br/>%5: %6") 129 129 .arg(UIWizardNewVM::tr("Detected OS Type")).arg(m_strDetectedOSTypeId) 130 130 .arg(UIWizardNewVM::tr("Detected OS Version")).arg(m_strDetectedOSVersion) … … 143 143 connect(m_pUnattendedCheckBox, &QCheckBox::toggled, this, &UIWizardNewVMPageBasicUnattended::sltUnattendedCheckBoxToggle); 144 144 m_pISOSelectorLabel = new QLabel; 145 if (m_pISOSelectorLabel) 145 146 { 146 147 m_pISOSelectorLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); … … 148 149 } 149 150 m_pISOFilePathSelector = new UIFilePathSelector; 151 if (m_pISOFilePathSelector) 150 152 { 151 153 m_pISOFilePathSelector->setResetEnabled(false); … … 157 159 } 158 160 m_pStartHeadlessCheckBox = new QCheckBox; 159 m_pStartHeadlessCheckBox->setEnabled(false); 160 m_pStatusLabel = new QLabel; 161 m_pStatusLabel->setEnabled(false); 161 if (m_pStartHeadlessCheckBox) 162 { 163 m_pStartHeadlessCheckBox->setEnabled(false); 164 m_pStatusLabel = new QLabel; 165 m_pStatusLabel->setEnabled(false); 166 } 167 168 QGridLayout *pISOSelectorLayout = new QGridLayout; 169 if (pISOSelectorLayout) 170 { 171 pISOSelectorLayout->addWidget(m_pUnattendedCheckBox, 0, 0, 1, 5); 172 pISOSelectorLayout->addWidget(m_pISOSelectorLabel, 1, 1, 1, 1); 173 pISOSelectorLayout->addWidget(m_pISOFilePathSelector, 1, 2, 1, 4); 174 pISOSelectorLayout->addWidget(m_pStartHeadlessCheckBox, 2, 2, 1, 1); 175 pISOSelectorLayout->addWidget(m_pStatusLabel, 3, 2, 1, 1); 176 } 177 162 178 pMainLayout->addWidget(m_pLabel); 163 164 QGridLayout *pISOSelectorLayout = new QGridLayout;165 pISOSelectorLayout->addWidget(m_pUnattendedCheckBox, 0, 0, 1, 5);166 pISOSelectorLayout->addWidget(m_pISOSelectorLabel, 1, 1, 1, 1);167 pISOSelectorLayout->addWidget(m_pISOFilePathSelector, 1, 2, 1, 4);168 pISOSelectorLayout->addWidget(m_pStartHeadlessCheckBox, 2, 2, 1, 1);169 pISOSelectorLayout->addWidget(m_pStatusLabel, 3, 2, 1, 1);170 171 179 pMainLayout->addLayout(pISOSelectorLayout); 172 180 pMainLayout->addStretch(); … … 227 235 { 228 236 m_pStartHeadlessCheckBox->setText(UIWizardNewVM::tr("Start VM Headless")); 229 m_pStartHeadlessCheckBox->setToolTip(UIWizardNewVM::tr("When checked the unattended will start the virtual machine headless"));237 m_pStartHeadlessCheckBox->setToolTip(UIWizardNewVM::tr("When checked the unattended install will start the virtual machine headless")); 230 238 } 231 239 m_pISOFilePathSelector->setToolTip(UIWizardNewVM::tr("Please select an installation medium (ISO file) "
Note:
See TracChangeset
for help on using the changeset viewer.

