Changeset 94593 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 13, 2022 5:33:39 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 150954
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r94168 r94593 654 654 const QString strFile = list.at(i).toLocalFile(); 655 655 #endif 656 const QStringList isoExtensionList = QStringList() << "iso"; 656 657 /* If there is such file exists: */ 657 658 if (!strFile.isEmpty() && QFile::exists(strFile)) … … 689 690 #endif 690 691 } 692 else if (UICommon::hasAllowedExtension(strFile, isoExtensionList)) 693 { 694 openNewMachineWizard(strFile); 695 } 691 696 } 692 697 } … … 957 962 void UIVirtualBoxManager::sltOpenNewMachineWizard() 958 963 { 959 /* Lock the actions preventing cascade calls: */ 960 UIQObjectPropertySetter guardBlock(QList<QObject*>() << actionPool()->action(UIActionIndexMN_M_Welcome_S_New) 961 << actionPool()->action(UIActionIndexMN_M_Machine_S_New) 962 << actionPool()->action(UIActionIndexMN_M_Group_S_New), 963 "opened", true); 964 connect(&guardBlock, &UIQObjectPropertySetter::sigAboutToBeDestroyed, 965 this, &UIVirtualBoxManager::sltHandleUpdateActionAppearanceRequest); 966 updateActionsAppearance(); 967 968 /* Get first selected item: */ 969 UIVirtualMachineItem *pItem = currentItem(); 970 971 /* For global item or local machine: */ 972 if ( !pItem 973 || pItem->itemType() == UIVirtualMachineItemType_Local) 974 { 975 CUnattended comUnattendedInstaller = uiCommon().virtualBox().CreateUnattendedInstaller(); 976 AssertMsg(!comUnattendedInstaller.isNull(), ("Could not create unattended installer!\n")); 977 978 /* Use the "safe way" to open stack of Mac OS X Sheets: */ 979 QWidget *pWizardParent = windowManager().realParentWindow(this); 980 UISafePointerWizardNewVM pWizard = new UIWizardNewVM(pWizardParent, actionPool(), 981 m_pWidget->fullGroupName(), "gui-createvm", comUnattendedInstaller); 982 windowManager().registerNewParent(pWizard, pWizardParent); 983 984 /* Execute wizard: */ 985 pWizard->exec(); 986 987 bool fStartHeadless = pWizard->startHeadless(); 988 bool fUnattendedEnabled = pWizard->isUnattendedEnabled(); 989 QString strMachineId = pWizard->createdMachineId().toString(); 990 delete pWizard; 991 /* Handle unattended install stuff: */ 992 if (fUnattendedEnabled) 993 startUnattendedInstall(comUnattendedInstaller, fStartHeadless, strMachineId); 994 } 995 /* For cloud machine: */ 996 else 997 { 998 /* Use the "safe way" to open stack of Mac OS X Sheets: */ 999 QWidget *pWizardParent = windowManager().realParentWindow(this); 1000 UISafePointerWizardNewCloudVM pWizard = new UIWizardNewCloudVM(pWizardParent, m_pWidget->fullGroupName()); 1001 windowManager().registerNewParent(pWizard, pWizardParent); 1002 1003 /* Execute wizard: */ 1004 pWizard->exec(); 1005 delete pWizard; 1006 } 964 openNewMachineWizard(); 1007 965 } 1008 966 … … 2529 2487 } 2530 2488 2489 void UIVirtualBoxManager::openNewMachineWizard(const QString &strISOFilePath /* = QString() */) 2490 { 2491 /* Lock the actions preventing cascade calls: */ 2492 UIQObjectPropertySetter guardBlock(QList<QObject*>() << actionPool()->action(UIActionIndexMN_M_Welcome_S_New) 2493 << actionPool()->action(UIActionIndexMN_M_Machine_S_New) 2494 << actionPool()->action(UIActionIndexMN_M_Group_S_New), 2495 "opened", true); 2496 connect(&guardBlock, &UIQObjectPropertySetter::sigAboutToBeDestroyed, 2497 this, &UIVirtualBoxManager::sltHandleUpdateActionAppearanceRequest); 2498 updateActionsAppearance(); 2499 2500 /* Get first selected item: */ 2501 UIVirtualMachineItem *pItem = currentItem(); 2502 2503 /* For global item or local machine: */ 2504 if ( !pItem 2505 || pItem->itemType() == UIVirtualMachineItemType_Local) 2506 { 2507 CUnattended comUnattendedInstaller = uiCommon().virtualBox().CreateUnattendedInstaller(); 2508 AssertMsg(!comUnattendedInstaller.isNull(), ("Could not create unattended installer!\n")); 2509 2510 /* Use the "safe way" to open stack of Mac OS X Sheets: */ 2511 QWidget *pWizardParent = windowManager().realParentWindow(this); 2512 UISafePointerWizardNewVM pWizard = new UIWizardNewVM(pWizardParent, actionPool(), 2513 m_pWidget->fullGroupName(), "gui-createvm", 2514 comUnattendedInstaller, strISOFilePath); 2515 windowManager().registerNewParent(pWizard, pWizardParent); 2516 2517 /* Execute wizard: */ 2518 pWizard->exec(); 2519 2520 bool fStartHeadless = pWizard->startHeadless(); 2521 bool fUnattendedEnabled = pWizard->isUnattendedEnabled(); 2522 QString strMachineId = pWizard->createdMachineId().toString(); 2523 delete pWizard; 2524 /* Handle unattended install stuff: */ 2525 if (fUnattendedEnabled) 2526 startUnattendedInstall(comUnattendedInstaller, fStartHeadless, strMachineId); 2527 } 2528 /* For cloud machine: */ 2529 else 2530 { 2531 /* Use the "safe way" to open stack of Mac OS X Sheets: */ 2532 QWidget *pWizardParent = windowManager().realParentWindow(this); 2533 UISafePointerWizardNewCloudVM pWizard = new UIWizardNewCloudVM(pWizardParent, m_pWidget->fullGroupName()); 2534 windowManager().registerNewParent(pWizard, pWizardParent); 2535 2536 /* Execute wizard: */ 2537 pWizard->exec(); 2538 delete pWizard; 2539 } 2540 } 2541 2531 2542 /* static */ 2532 2543 void UIVirtualBoxManager::launchMachine(CMachine &comMachine, -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h
r94089 r94593 368 368 /** Opens add machine dialog specifying initial name with @a strFileName. */ 369 369 void openAddMachineDialog(const QString &strFileName = QString()); 370 370 /** Opens new machine dialog specifying initial name with @a strFileName. */ 371 void openNewMachineWizard(const QString &strISOFilePath = QString()); 371 372 /** Launches certain @a comMachine in specified @a enmLaunchMode. */ 372 373 static void launchMachine(CMachine &comMachine, UICommon::LaunchMode enmLaunchMode = UICommon::LaunchMode_Default); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp
r94445 r94593 136 136 } 137 137 138 void UINameAndSystemEditor::setISOImagePath(const QString &strPath) 139 { 140 if (m_pSelectorImage) 141 m_pSelectorImage->setPath(strPath); 142 emit sigImageChanged(strPath); 143 } 138 144 QString UINameAndSystemEditor::ISOImagePath() const 139 145 { … … 543 549 m_pLabelEdition->setAlignment(Qt::AlignRight); 544 550 m_pLabelEdition->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 545 546 551 m_pLayout->addWidget(m_pLabelEdition, iRow, 0); 547 552 } … … 550 555 if (m_pComboEdition) 551 556 { 552 m_pLabelEdition->setBuddy(m_pComboEdition ->focusProxy());557 m_pLabelEdition->setBuddy(m_pComboEdition); 553 558 m_pLayout->addWidget(m_pComboEdition, iRow, 1, 1, 2); 554 559 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h
r94445 r94593 111 111 /** Returns image string selected by the user. */ 112 112 QString ISOImagePath() const; 113 /** Sets image path. */ 114 void setISOImagePath(const QString &strPath); 113 115 114 116 /** Defines the VM OS @a strTypeId and @a strFamilyId if passed. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
r94078 r94593 49 49 UIWizardNewVM::UIWizardNewVM(QWidget *pParent, UIActionPool *pActionPool, 50 50 const QString &strMachineGroup, const QString &strHelpHashtag, 51 CUnattended &comUnattended )51 CUnattended &comUnattended, const QString &strISOFilePath /* = QString() */) 52 52 : UINativeWizard(pParent, WizardType_NewVM, WizardMode_Auto, strHelpHashtag) 53 53 , m_strMachineGroup(strMachineGroup) … … 71 71 , m_comUnattended(comUnattended) 72 72 , m_fStartHeadless(false) 73 , m_strInitialISOFilePath(strISOFilePath) 73 74 { 74 75 #ifndef VBOX_WS_MAC … … 91 92 case WizardMode_Basic: 92 93 { 93 addPage(new UIWizardNewVMNameOSTypePage); 94 UIWizardNewVMNameOSTypePage *pNamePage = new UIWizardNewVMNameOSTypePage; 95 addPage(pNamePage); 96 if (!m_strInitialISOFilePath.isEmpty()) 97 pNamePage->setISOFilePath(m_strInitialISOFilePath); 94 98 m_iUnattendedInstallPageIndex = addPage(new UIWizardNewVMUnattendedPage); 95 99 setUnattendedPageVisible(false); … … 101 105 case WizardMode_Expert: 102 106 { 103 addPage(new UIWizardNewVMExpertPage(m_pActionPool)); 107 UIWizardNewVMExpertPage *pExpertPage = new UIWizardNewVMExpertPage(m_pActionPool); 108 addPage(pExpertPage); 109 if (!m_strInitialISOFilePath.isEmpty()) 110 pExpertPage->setISOFilePath(m_strInitialISOFilePath); 104 111 break; 105 112 } … … 708 715 void UIWizardNewVM::setISOFilePath(const QString &strISOFilePath) 709 716 { 710 /* am I being a paranoid?: */711 717 QFileInfo isoFileInfo(strISOFilePath); 712 718 if (!isoFileInfo.exists()) -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h
r94078 r94593 51 51 52 52 UIWizardNewVM(QWidget *pParent, UIActionPool *pActionPool, 53 const QString &strMachineGroup, const QString &strHelpHashtag, CUnattended &comUnattended); 53 const QString &strMachineGroup, const QString &strHelpHashtag, 54 CUnattended &comUnattended, const QString &strISOFilePath = QString()); 55 54 56 bool isUnattendedEnabled() const; 55 57 bool isUnattendedInstallSupported() const; … … 225 227 CUnattended &m_comUnattended; 226 228 bool m_fStartHeadless; 229 QString m_strInitialISOFilePath; 227 230 /** @} */ 228 231 }; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMExpertPage.cpp
r94078 r94593 84 84 } 85 85 86 void UIWizardNewVMExpertPage::setISOFilePath(const QString &strISOFilePath) 87 { 88 QFileInfo isoFileInfo(strISOFilePath); 89 if (isoFileInfo.exists() && m_pNameAndSystemEditor) 90 m_pNameAndSystemEditor->setISOImagePath(strISOFilePath); 91 } 92 86 93 void UIWizardNewVMExpertPage::sltNameChanged(const QString &strNewName) 87 94 { -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMExpertPage.h
r94078 r94593 55 55 56 56 UIWizardNewVMExpertPage(UIActionPool *pActionPool); 57 void setISOFilePath(const QString &strISOFilePath); 57 58 58 59 private slots: -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePage.cpp
r94478 r94593 407 407 } 408 408 409 void UIWizardNewVMNameOSTypePage::setISOFilePath(const QString &strISOFilePath) 410 { 411 QFileInfo isoFileInfo(strISOFilePath); 412 if (isoFileInfo.exists() && m_pNameAndSystemEditor) 413 m_pNameAndSystemEditor->setISOImagePath(strISOFilePath); 414 } 415 409 416 void UIWizardNewVMNameOSTypePage::prepare() 410 417 { … … 511 518 { 512 519 m_pNameAndSystemEditor->setFocus(); 513 m_pNameAndSystemEditor->setEditionSelectorEnabled(false);520 setEditionSelectorEnabled(); 514 521 } 515 522 setSkipCheckBoxEnable(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePage.h
r94078 r94593 56 56 /** Constructor. */ 57 57 UIWizardNewVMNameOSTypePage(); 58 58 void setISOFilePath(const QString &strISOFilePath); 59 59 60 60 protected:
Note:
See TracChangeset
for help on using the changeset viewer.