Changeset 87570 in vbox
- Timestamp:
- Feb 3, 2021 3:07:34 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142597
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r87430 r87570 654 654 src/wizards/newvm/UIWizardNewVM.h \ 655 655 src/wizards/newvm/UIWizardNewVMPageBasic1.h \ 656 src/wizards/newvm/UIWizardNewVMPageBasic2.h \657 656 src/wizards/newvm/UIWizardNewVMPageBasic3.h \ 658 657 src/wizards/newvm/UIWizardNewVMPageBasic4.h \ … … 1137 1136 src/wizards/newvm/UIWizardNewVM.cpp \ 1138 1137 src/wizards/newvm/UIWizardNewVMPageBasic1.cpp \ 1139 src/wizards/newvm/UIWizardNewVMPageBasic2.cpp \1140 1138 src/wizards/newvm/UIWizardNewVMPageBasic3.cpp \ 1141 1139 src/wizards/newvm/UIWizardNewVMPageBasic4.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
r87430 r87570 24 24 #include "UIWizardNewVM.h" 25 25 #include "UIWizardNewVMPageBasic1.h" 26 #include "UIWizardNewVMPageBasic2.h"27 26 #include "UIWizardNewVMPageBasic3.h" 28 27 #include "UIWizardNewVMPageBasic4.h" … … 82 81 { 83 82 setPage(Page1, new UIWizardNewVMPageBasic1(m_strGroup)); 84 setPage(Page2, new UIWizardNewVMPageBasic2);85 83 setPage(Page3, new UIWizardNewVMPageBasic3); 86 84 setPage(Page4, new UIWizardNewVMPageBasic4); … … 430 428 void UIWizardNewVM::sltHandleDetectedOSTypeChange() 431 429 { 432 UIWizardNewVMPageBasic 2 *pPage = qobject_cast<UIWizardNewVMPageBasic2*>(page(Page1));430 UIWizardNewVMPageBasic1 *pPage = qobject_cast<UIWizardNewVMPageBasic1*>(page(Page1)); 433 431 if (!pPage) 434 432 return; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h
r87430 r87570 61 61 { 62 62 Page1, 63 Page2,64 63 Page3, 65 64 Page4, -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
r87414 r87570 182 182 : m_pNameAndSystemEditor(0) 183 183 , m_pNameOSTypeLabel(0) 184 , m_pISOFilePathSelector(0) 185 , m_pUnattendedLabel(0) 186 , m_pISOPathSelectorLabel(0) 184 187 , m_strGroup(strGroup) 185 188 { … … 351 354 if (m_pNameAndSystemEditor) 352 355 m_pNameAndSystemEditor->markNameLineEdit(m_pNameAndSystemEditor->name().isEmpty()); 356 if (m_pISOFilePathSelector) 357 m_pISOFilePathSelector->mark(!checkISOFile()); 353 358 } 354 359 355 360 void UIWizardNewVMPage1::retranslateWidgets() 356 361 { 362 } 363 364 QString UIWizardNewVMPage1::ISOFilePath() const 365 { 366 if (!m_pISOFilePathSelector) 367 return QString(); 368 return m_pISOFilePathSelector->path(); 369 } 370 371 bool UIWizardNewVMPage1::isUnattendedEnabled() const 372 { 373 if (!m_pISOFilePathSelector) 374 return false; 375 const QString &strPath = m_pISOFilePathSelector->path(); 376 if (strPath.isNull() || strPath.isEmpty()) 377 return false; 378 return true; 379 } 380 381 const QString &UIWizardNewVMPage1::detectedOSTypeId() const 382 { 383 return m_strDetectedOSTypeId; 384 } 385 386 bool UIWizardNewVMPage1::determineOSType(const QString &strISOPath) 387 { 388 QFileInfo isoFileInfo(strISOPath); 389 if (!isoFileInfo.exists()) 390 { 391 m_strDetectedOSTypeId.clear(); 392 return false; 393 } 394 395 CUnattended comUnatteded = uiCommon().virtualBox().CreateUnattendedInstaller(); 396 comUnatteded.SetIsoPath(strISOPath); 397 comUnatteded.DetectIsoOS(); 398 399 m_strDetectedOSTypeId = comUnatteded.GetDetectedOSTypeId(); 400 return true; 401 } 402 403 bool UIWizardNewVMPage1::checkISOFile() const 404 { 405 if (!m_pISOFilePathSelector) 406 return true; 407 const QString &strPath = m_pISOFilePathSelector->path(); 408 if (strPath.isNull() || strPath.isEmpty()) 409 return true; 410 QFileInfo fileInfo(strPath); 411 if (!fileInfo.exists() || !fileInfo.isReadable()) 412 return false; 413 return true; 414 } 415 416 void UIWizardNewVMPage1::setTypeByISODetectedOSType(const QString &strDetectedOSType) 417 { 418 Q_UNUSED(strDetectedOSType); 419 // if (!strDetectedOSType.isEmpty()) 420 // onNameChanged(strDetectedOSType); 357 421 } 358 422 … … 367 431 QVBoxLayout *pPageLayout = new QVBoxLayout(this); 368 432 pPageLayout->addWidget(createNameOSTypeWidgets(/* fCreateLabels */ true)); 433 434 m_pUnattendedLabel = new QIRichTextLabel; 435 if (m_pUnattendedLabel) 436 pPageLayout->addWidget(m_pUnattendedLabel); 437 438 QHBoxLayout *pISOSelectorLayout = new QHBoxLayout; 439 440 m_pISOPathSelectorLabel = new QLabel; 441 pISOSelectorLayout->addWidget(m_pISOPathSelectorLabel); 442 m_pISOPathSelectorLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); 443 444 m_pISOFilePathSelector = new UIFilePathSelector; 445 if (m_pISOFilePathSelector) 446 { 447 m_pISOFilePathSelector->setResetEnabled(false); 448 m_pISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open); 449 m_pISOFilePathSelector->setFileDialogFilters("*.iso *.ISO"); 450 m_pISOFilePathSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 451 pISOSelectorLayout->addWidget(m_pISOFilePathSelector); 452 } 453 454 pPageLayout->addLayout(pISOSelectorLayout); 369 455 pPageLayout->addStretch(); 456 457 458 370 459 371 460 createConnections(); … … 378 467 registerField("guestOSFamiyId", this, "guestOSFamiyId"); 379 468 registerField("startHeadless", this, "startHeadless"); 469 registerField("ISOFilePath", this, "ISOFilePath"); 470 registerField("isUnattendedEnabled", this, "isUnattendedEnabled"); 471 registerField("detectedOSTypeId", this, "detectedOSTypeId"); 380 472 } 381 473 382 474 void UIWizardNewVMPageBasic1::createConnections() 383 475 { 384 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigNameChanged, this, &UIWizardNewVMPageBasic1::sltNameChanged); 385 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigPathChanged, this, &UIWizardNewVMPageBasic1::sltPathChanged); 386 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged, this, &UIWizardNewVMPageBasic1::sltOsTypeChanged); 476 if (m_pNameAndSystemEditor) 477 { 478 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigNameChanged, this, &UIWizardNewVMPageBasic1::sltNameChanged); 479 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigPathChanged, this, &UIWizardNewVMPageBasic1::sltPathChanged); 480 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged, this, &UIWizardNewVMPageBasic1::sltOsTypeChanged); 481 } 482 if (m_pISOFilePathSelector) 483 connect(m_pISOFilePathSelector, &UIFilePathSelector::pathChanged, this, &UIWizardNewVMPageBasic1::sltISOPathChanged); 484 387 485 } 388 486 … … 392 490 if (m_pNameAndSystemEditor->name().isEmpty()) 393 491 return false; 394 return true; 492 return checkISOFile(); 493 } 494 495 int UIWizardNewVMPageBasic1::nextId() const 496 { 497 if (isUnattendedEnabled()) 498 return UIWizardNewVM::Page3; 499 return UIWizardNewVM::Page4; 395 500 } 396 501 … … 418 523 /* Translate page: */ 419 524 setTitle(UIWizardNewVM::tr("Virtual machine name and operating system")); 525 526 if (m_pUnattendedLabel) 527 m_pUnattendedLabel->setText(UIWizardNewVM::tr("Please decide whether you want to start an unattended guest OS install " 528 "in which case you will have to select a valid installation medium. If not, " 529 "your virtual disk will have an empty virtual hard disk after vm creation.")); 420 530 421 531 if (m_pNameOSTypeLabel) … … 424 534 "The name you choose will be used throughout VirtualBox " 425 535 "to identify this machine.")); 426 427 // if ( m_pNameAndSystemEditor 428 // && m_pSystemTypeEditor 429 // && m_pISOSelectorLabel) 430 // { 431 // int iMinWidthHint = 0; 432 // iMinWidthHint = qMax(iMinWidthHint, m_pISOSelectorLabel->minimumSizeHint().width()); 433 // m_pNameAndSystemEditor->setMinimumLayoutIndent(iMinWidthHint); 434 // m_pSystemTypeEditor->setMinimumLayoutIndent(iMinWidthHint); 435 // } 536 if (m_pISOPathSelectorLabel) 537 m_pISOPathSelectorLabel->setText(UIWizardNewVM::tr("Installation ISO:")); 538 539 if (m_pNameAndSystemEditor && m_pISOPathSelectorLabel) 540 m_pNameAndSystemEditor->setMinimumLayoutIndent(m_pISOPathSelectorLabel->width()); 436 541 } 437 542 … … 457 562 return createMachineFolder(); 458 563 } 564 565 void UIWizardNewVMPageBasic1::sltISOPathChanged(const QString &strPath) 566 { 567 determineOSType(strPath); 568 setTypeByISODetectedOSType(m_strDetectedOSTypeId); 569 570 emit completeChanged(); 571 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h
r87414 r87570 87 87 88 88 89 90 QString ISOFilePath() const; 91 bool isUnattendedEnabled() const; 92 const QString &detectedOSTypeId() const; 93 bool determineOSType(const QString &strISOPath); 94 bool isISOFileSelectorComplete() const; 95 void setTypeByISODetectedOSType(const QString &strDetectedOSType); 96 /** Return false if ISO path is not empty but points to an missing or unreadable file. */ 97 bool checkISOFile() const; 98 99 /** @name Widgets 100 * @{ */ 101 mutable UIFilePathSelector *m_pISOFilePathSelector; 102 QIRichTextLabel *m_pUnattendedLabel; 103 /** @} */ 104 105 QString m_strDetectedOSTypeId; 106 QLabel *m_pISOPathSelectorLabel; 107 89 108 private: 90 109 … … 115 134 Q_PROPERTY(QString machineBaseName READ machineBaseName WRITE setMachineBaseName); 116 135 Q_PROPERTY(QString guestOSFamiyId READ guestOSFamiyId); 136 Q_PROPERTY(QString ISOFilePath READ ISOFilePath); 137 Q_PROPERTY(bool isUnattendedEnabled READ isUnattendedEnabled); 138 Q_PROPERTY(QString detectedOSTypeId READ detectedOSTypeId); 139 117 140 118 141 public: … … 121 144 UIWizardNewVMPageBasic1(const QString &strGroup); 122 145 virtual bool isComplete() const; /* override */ 146 virtual int nextId() const /* override */; 123 147 124 148 protected: … … 133 157 void sltPathChanged(const QString &strNewPath); 134 158 void sltOsTypeChanged(); 159 void sltISOPathChanged(const QString &strPath); 135 160 136 161 private: -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
r87433 r87570 183 183 { 184 184 UIWizardNewVMPage1::retranslateWidgets(); 185 UIWizardNewVMPage2::retranslateWidgets();186 185 UIWizardNewVMPage3::retranslateWidgets(); 187 186 UIWizardNewVMPage4::retranslateWidgets(); … … 306 305 { 307 306 UIWizardNewVMPage1::markWidgets(); 308 UIWizardNewVMPage2::markWidgets();309 307 UIWizardNewVMPage3::markWidgets(); 310 308 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h
r87430 r87570 24 24 /* Local includes: */ 25 25 #include "UIWizardNewVMPageBasic1.h" 26 #include "UIWizardNewVMPageBasic2.h"27 26 #include "UIWizardNewVMPageBasic3.h" 28 27 #include "UIWizardNewVMPageBasic4.h" … … 36 35 class UIWizardNewVMPageExpert : public UIWizardPage, 37 36 public UIWizardNewVMPage1, 38 public UIWizardNewVMPage2,39 37 public UIWizardNewVMPage3, 40 38 public UIWizardNewVMPage4,
Note:
See TracChangeset
for help on using the changeset viewer.