Changeset 90169 in vbox
- Timestamp:
- Jul 13, 2021 4:16:35 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.cpp
r90165 r90169 17 17 18 18 /* Qt includes: */ 19 #include <QLabel> 19 20 #include <QVBoxLayout> 20 21 21 22 /* GUI includes: */ 23 #include "UICommon.h" 24 #include "UIFilePathSelector.h" 22 25 #include "UIUserNamePasswordEditor.h" 26 #include "UIWizardNewVM.h" 23 27 #include "UIWizardNewVMEditors.h" 24 28 … … 26 30 #include "iprt/assert.h" 27 31 32 /********************************************************************************************************************************* 33 * UIUserNamePasswordGroupBox implementation. * 34 *********************************************************************************************************************************/ 35 28 36 UIUserNamePasswordGroupBox::UIUserNamePasswordGroupBox(QWidget *pParent /* = 0 */) 29 37 :QGroupBox(pParent) 38 , m_pUserNamePasswordEditor(0) 30 39 { 31 40 prepare(); … … 85 94 m_pUserNamePasswordEditor->setLabelsVisible(fVisible); 86 95 } 96 97 /********************************************************************************************************************************* 98 * UIUserNamePasswordGroupBox implementation. * 99 *********************************************************************************************************************************/ 100 101 UIGAInstallationGroupBox::UIGAInstallationGroupBox(QWidget *pParent /* = 0 */) 102 : QIWithRetranslateUI<QGroupBox>(pParent) 103 , m_pGAISOPathLabel(0) 104 , m_pGAISOFilePathSelector(0) 105 106 { 107 prepare(); 108 } 109 110 void UIGAInstallationGroupBox::prepare() 111 { 112 setCheckable(true); 113 114 QHBoxLayout *pGAInstallationISOLayout = new QHBoxLayout(this); 115 AssertReturnVoid(pGAInstallationISOLayout); 116 m_pGAISOPathLabel = new QLabel; 117 AssertReturnVoid(m_pGAISOPathLabel); 118 m_pGAISOPathLabel->setAlignment(Qt::AlignRight); 119 m_pGAISOPathLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 120 121 pGAInstallationISOLayout->addWidget(m_pGAISOPathLabel); 122 123 m_pGAISOFilePathSelector = new UIFilePathSelector; 124 AssertReturnVoid(m_pGAISOFilePathSelector); 125 126 m_pGAISOFilePathSelector->setResetEnabled(false); 127 m_pGAISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open); 128 m_pGAISOFilePathSelector->setFileDialogFilters("ISO Images(*.iso *.ISO)"); 129 m_pGAISOFilePathSelector->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 130 m_pGAISOFilePathSelector->setInitialPath(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD)); 131 if (m_pGAISOPathLabel) 132 m_pGAISOPathLabel->setBuddy(m_pGAISOFilePathSelector); 133 134 pGAInstallationISOLayout->addWidget(m_pGAISOFilePathSelector); 135 136 connect(m_pGAISOFilePathSelector, &UIFilePathSelector::pathChanged, 137 this, &UIGAInstallationGroupBox::sigPathChanged); 138 connect(this, &UIGAInstallationGroupBox::toggled, 139 this, &UIGAInstallationGroupBox::sltToggleWidgetsEnabled); 140 retranslateUi(); 141 } 142 143 void UIGAInstallationGroupBox::retranslateUi() 144 { 145 if (m_pGAISOFilePathSelector) 146 m_pGAISOFilePathSelector->setToolTip(UIWizardNewVM::tr("Please select an installation medium (ISO file)")); 147 if (m_pGAISOPathLabel) 148 m_pGAISOPathLabel->setText(UIWizardNewVM::tr("GA I&nstallation ISO:")); 149 setTitle(UIWizardNewVM::tr("Gu&est Additions")); 150 setToolTip(UIWizardNewVM::tr("<p>When checked the guest additions will be installed " 151 "after the OS install.</p>")); 152 } 153 154 QString UIGAInstallationGroupBox::path() const 155 { 156 if (m_pGAISOFilePathSelector) 157 return m_pGAISOFilePathSelector->path(); 158 return QString(); 159 } 160 161 void UIGAInstallationGroupBox::setPath(const QString &strPath, bool fRefreshText /* = true */) 162 { 163 if (m_pGAISOFilePathSelector) 164 m_pGAISOFilePathSelector->setPath(strPath, fRefreshText); 165 } 166 167 void UIGAInstallationGroupBox::mark(bool fError, const QString &strErrorMessage /* = QString() */) 168 { 169 if (m_pGAISOFilePathSelector) 170 m_pGAISOFilePathSelector->mark(fError, strErrorMessage); 171 } 172 173 174 void UIGAInstallationGroupBox::sltToggleWidgetsEnabled(bool fEnabled) 175 { 176 if (m_pGAISOPathLabel) 177 m_pGAISOPathLabel->setEnabled(fEnabled); 178 179 if (m_pGAISOFilePathSelector) 180 m_pGAISOFilePathSelector->setEnabled(m_pGAISOFilePathSelector); 181 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.h
r90165 r90169 33 33 class QLabel; 34 34 class QILineEdit; 35 class UIFilePathSelector; 35 36 class UIPasswordLineEdit; 36 37 class UIUserNamePasswordEditor; … … 67 68 }; 68 69 70 71 class UIGAInstallationGroupBox : public QIWithRetranslateUI<QGroupBox> 72 { 73 Q_OBJECT; 74 75 signals: 76 77 void sigPathChanged(const QString &strPath); 78 79 public: 80 81 UIGAInstallationGroupBox(QWidget *pParent = 0); 82 83 /** @name Wrappers for UIFilePathSelector 84 * @{ */ 85 QString path() const; 86 void setPath(const QString &strPath, bool fRefreshText = true); 87 void mark(bool fError, const QString &strErrorMessage = QString()); 88 /** @} */ 89 90 public slots: 91 92 void sltToggleWidgetsEnabled(bool fEnabled); 93 94 private: 95 96 virtual void retranslateUi() /* override final */; 97 void prepare(); 98 99 QLabel *m_pGAISOPathLabel; 100 UIFilePathSelector *m_pGAISOFilePathSelector; 101 102 }; 103 69 104 #endif /* !FEQT_INCLUDED_SRC_wizards_editors_UIWizardNewVMEditors_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
r90165 r90169 70 70 , m_pStartHeadlessCheckBox(0) 71 71 , m_pGAInstallationISOContainer(0) 72 , m_pGAISOPathLabel(0)73 , m_pGAISOFilePathSelector(0)74 72 , m_pUserNameContainer(0) 75 73 { … … 195 193 m_pProductKeyLabel->setText(UIWizardNewVM::tr("&Product Key:")); 196 194 197 if (m_pGAISOPathLabel)198 m_pGAISOPathLabel->setText(UIWizardNewVM::tr("GA I&nstallation ISO:"));199 if (m_pGAISOFilePathSelector)200 m_pGAISOFilePathSelector->setToolTip(UIWizardNewVM::tr("Please select an installation medium (ISO file)"));201 if (m_pGAInstallationISOContainer)202 {203 m_pGAInstallationISOContainer->setTitle(UIWizardNewVM::tr("Gu&est Additions"));204 m_pGAInstallationISOContainer->setToolTip(UIWizardNewVM::tr("<p>When checked the guest additions will be installed "205 "after the OS install.</p>"));206 }207 208 195 if (m_pUserNameContainer) 209 196 m_pUserNameContainer->setTitle(UIWizardNewVM::tr("Username and Password")); … … 412 399 ++iRow; 413 400 /* Guest additions installation: */ 414 pLayout->addWidget(createGAInstallWidgets(), iRow, 0, 1, 4); 401 m_pGAInstallationISOContainer = new UIGAInstallationGroupBox; 402 403 pLayout->addWidget(m_pGAInstallationISOContainer, iRow, 0, 1, 4); 415 404 416 405 return pContainerWidget; … … 897 886 return m_pAdditionalOptionsContainer; 898 887 } 899 900 QWidget *UIWizardNewVMPageExpert::createGAInstallWidgets()901 {902 if (m_pGAInstallationISOContainer)903 return m_pGAInstallationISOContainer;904 905 m_pGAInstallationISOContainer = new QGroupBox;906 if (m_pGAInstallationISOContainer)907 {908 m_pGAInstallationISOContainer->setCheckable(true);909 910 QHBoxLayout *pGAInstallationISOLayout = new QHBoxLayout(m_pGAInstallationISOContainer);911 if (pGAInstallationISOLayout)912 {913 m_pGAISOPathLabel = new QLabel;914 if (m_pGAISOPathLabel)915 {916 m_pGAISOPathLabel->setAlignment(Qt::AlignRight);917 m_pGAISOPathLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);918 919 pGAInstallationISOLayout->addWidget(m_pGAISOPathLabel);920 }921 m_pGAISOFilePathSelector = new UIFilePathSelector;922 {923 m_pGAISOFilePathSelector->setResetEnabled(false);924 m_pGAISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open);925 m_pGAISOFilePathSelector->setFileDialogFilters("ISO Images(*.iso *.ISO)");926 m_pGAISOFilePathSelector->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);927 m_pGAISOFilePathSelector->setInitialPath(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD));928 if (m_pGAISOPathLabel)929 m_pGAISOPathLabel->setBuddy(m_pGAISOFilePathSelector);930 931 pGAInstallationISOLayout->addWidget(m_pGAISOFilePathSelector);932 }933 }934 }935 936 return m_pGAInstallationISOContainer;937 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h
r90165 r90169 39 39 class QVBoxLayout; 40 40 class UIFilePathSelector; 41 class UIGAInstallationGroupBox; 41 42 class UIHostnameDomainNameEditor; 42 43 class UIMediumSizeEditor; … … 115 116 QWidget *createNameOSTypeWidgets(); 116 117 QWidget *createAdditionalOptionsWidgets(); 117 QWidget *createGAInstallWidgets();118 118 119 119 void updateVirtualDiskPathFromMachinePathName(); … … 147 147 148 148 QCheckBox *m_pStartHeadlessCheckBox; 149 QGroupBox *m_pGAInstallationISOContainer; 150 QLabel *m_pGAISOPathLabel; 151 UIFilePathSelector *m_pGAISOFilePathSelector; 149 UIGAInstallationGroupBox *m_pGAInstallationISOContainer; 152 150 QGroupBox *m_pUserNameContainer; 153 151 UIUserNamePasswordGroupBox *m_pUserNamePasswordGroupBox; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMUnattendedPageBasic.cpp
r90165 r90169 41 41 #include "CUnattended.h" 42 42 43 bool UIWizardNewVMUnattendedPage::checkGAISOFile(UIFilePathSelector *pGAISOFilePathSelector) 44 { 45 if (!pGAISOFilePathSelector) 46 return false; 47 /* GA ISO selector should not be empty since GA install check box is checked at this point: */ 48 const QString &strPath = pGAISOFilePathSelector->path(); 43 bool UIWizardNewVMUnattendedPage::checkGAISOFile(const QString &strPath) 44 { 49 45 if (strPath.isNull() || strPath.isEmpty()) 50 46 return false; … … 62 58 , m_pUserNamePasswordGroupBox(0) 63 59 , m_pHostnameDomainNameEditor(0) 64 , m_pGAISOPathLabel(0)65 , m_pGAISOFilePathSelector(0)66 60 , m_pProductKeyLineEdit(0) 67 61 , m_pProductKeyLabel(0) … … 81 75 pMainLayout->addWidget(m_pUserNamePasswordGroupBox, 1, 0, 1, 1); 82 76 pMainLayout->addWidget(createAdditionalOptionsWidgets(), 1, 1, 1, 1); 83 pMainLayout->addWidget(createGAInstallWidgets(), 2, 0, 1, 2); 77 m_pGAInstallationISOContainer = new UIGAInstallationGroupBox; 78 pMainLayout->addWidget(m_pGAInstallationISOContainer, 2, 0, 1, 2); 84 79 pMainLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding), 3, 0, 1, 2); 85 80 … … 96 91 this, &UIWizardNewVMUnattendedPageBasic::sltUserNameChanged); 97 92 } 98 if (m_pGAISOFilePathSelector) 99 connect(m_pGAISOFilePathSelector, &UIFilePathSelector::pathChanged, 93 if (m_pGAInstallationISOContainer) 94 { 95 connect(m_pGAInstallationISOContainer, &UIGAInstallationGroupBox::toggled, 96 this, &UIWizardNewVMUnattendedPageBasic::sltInstallGACheckBoxToggle); 97 connect(m_pGAInstallationISOContainer, &UIGAInstallationGroupBox::sigPathChanged, 100 98 this, &UIWizardNewVMUnattendedPageBasic::sltGAISOPathChanged); 101 if (m_pGAISOFilePathSelector) 102 connect(m_pGAInstallationISOContainer, &QGroupBox::toggled, 103 this, &UIWizardNewVMUnattendedPageBasic::sltInstallGACheckBoxToggle); 99 } 104 100 if (m_pHostnameDomainNameEditor) 105 101 connect(m_pHostnameDomainNameEditor, &UIHostnameDomainNameEditor::sigHostnameDomainNameChanged, … … 121 117 "hostname. Additionally you can enable guest additions install. " 122 118 "For Microsoft Windows guests it is possible to provide a product key.</p>")); 123 if (m_pGAISOPathLabel)124 m_pGAISOPathLabel->setText(UIWizardNewVM::tr("GA I&nstallation ISO:"));125 if (m_pGAISOFilePathSelector)126 m_pGAISOFilePathSelector->setToolTip(UIWizardNewVM::tr("Please select an installation medium (ISO file)"));127 if (m_pGAInstallationISOContainer)128 {129 m_pGAInstallationISOContainer->setTitle(UIWizardNewVM::tr("Gu&est Additions"));130 m_pGAInstallationISOContainer->setToolTip(UIWizardNewVM::tr("<p>When checked the guest additions will be installed "131 "after the OS install.</p>"));132 }133 119 if (m_pProductKeyLabel) 134 120 m_pProductKeyLabel->setText(UIWizardNewVM::tr("&Product Key:")); … … 149 135 { 150 136 disableEnableProductKeyWidgets(isProductKeyWidgetEnabled()); 151 disableEnableGAWidgets(m_pGAInstallationISOContainer ? m_pGAInstallationISOContainer->isChecked() : false); 137 if (m_pGAInstallationISOContainer) 138 m_pGAInstallationISOContainer->sltToggleWidgetsEnabled(m_pGAInstallationISOContainer->isChecked()); 152 139 retranslateUi(); 153 140 … … 185 172 } 186 173 187 if (m_pGAI SOFilePathSelector && !m_userModifiedParameters.contains("GuestAdditionsISOPath"))188 { 189 m_pGAI SOFilePathSelector->blockSignals(true);190 m_pGAI SOFilePathSelector->setPath(pWizard->guestAdditionsISOPath());191 m_pGAI SOFilePathSelector->blockSignals(false);174 if (m_pGAInstallationISOContainer && !m_userModifiedParameters.contains("GuestAdditionsISOPath")) 175 { 176 m_pGAInstallationISOContainer->blockSignals(true); 177 m_pGAInstallationISOContainer->setPath(pWizard->guestAdditionsISOPath()); 178 m_pGAInstallationISOContainer->blockSignals(false); 192 179 } 193 180 } … … 198 185 UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard()); 199 186 if (pWizard && pWizard->installGuestAdditions() && 200 !UIWizardNewVMUnattendedPage::checkGAISOFile(m_pGAISOFilePathSelector)) 187 m_pGAInstallationISOContainer && 188 !UIWizardNewVMUnattendedPage::checkGAISOFile(m_pGAInstallationISOContainer->path())) 201 189 return false; 202 190 if (m_pUserNamePasswordGroupBox && !m_pUserNamePasswordGroupBox->isComplete()) … … 218 206 void UIWizardNewVMUnattendedPageBasic::sltInstallGACheckBoxToggle(bool fEnabled) 219 207 { 220 disableEnableGAWidgets(fEnabled); 208 if (m_pGAInstallationISOContainer) 209 m_pGAInstallationISOContainer->sltToggleWidgetsEnabled(fEnabled); 221 210 newVMWizardPropertySet(InstallGuestAdditions, fEnabled); 222 211 m_userModifiedParameters << "InstallGuestAdditions"; … … 307 296 } 308 297 309 QWidget *UIWizardNewVMUnattendedPageBasic::createGAInstallWidgets()310 {311 if (m_pGAInstallationISOContainer)312 return m_pGAInstallationISOContainer;313 314 /* Prepare GA Installation ISO container: */315 m_pGAInstallationISOContainer = new QGroupBox;316 if (m_pGAInstallationISOContainer)317 {318 m_pGAInstallationISOContainer->setCheckable(true);319 320 /* Prepare GA Installation ISO layout: */321 QHBoxLayout *pGAInstallationISOLayout = new QHBoxLayout(m_pGAInstallationISOContainer);322 if (pGAInstallationISOLayout)323 {324 /* Prepare GA ISO path label: */325 m_pGAISOPathLabel = new QLabel;326 if (m_pGAISOPathLabel)327 {328 m_pGAISOPathLabel->setAlignment(Qt::AlignRight);329 m_pGAISOPathLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);330 331 pGAInstallationISOLayout->addWidget(m_pGAISOPathLabel);332 }333 /* Prepare GA ISO path editor: */334 m_pGAISOFilePathSelector = new UIFilePathSelector;335 {336 m_pGAISOFilePathSelector->setResetEnabled(false);337 m_pGAISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open);338 m_pGAISOFilePathSelector->setFileDialogFilters("ISO Images(*.iso *.ISO)");339 m_pGAISOFilePathSelector->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);340 m_pGAISOFilePathSelector->setInitialPath(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD));341 if (m_pGAISOPathLabel)342 m_pGAISOPathLabel->setBuddy(m_pGAISOFilePathSelector);343 344 pGAInstallationISOLayout->addWidget(m_pGAISOFilePathSelector);345 }346 }347 }348 349 return m_pGAInstallationISOContainer;350 }351 352 void UIWizardNewVMUnattendedPageBasic::disableEnableGAWidgets(bool fEnabled)353 {354 if (m_pGAISOPathLabel)355 m_pGAISOPathLabel->setEnabled(fEnabled);356 if (m_pGAISOFilePathSelector)357 m_pGAISOFilePathSelector->setEnabled(fEnabled);358 }359 360 298 void UIWizardNewVMUnattendedPageBasic::disableEnableProductKeyWidgets(bool fEnabled) 361 299 { … … 369 307 { 370 308 UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard()); 371 if (pWizard && pWizard->installGuestAdditions() )372 m_pGAI SOFilePathSelector->mark(!UIWizardNewVMUnattendedPage::checkGAISOFile(m_pGAISOFilePathSelector));373 } 309 if (pWizard && pWizard->installGuestAdditions() && m_pGAInstallationISOContainer) 310 m_pGAInstallationISOContainer->mark(!UIWizardNewVMUnattendedPage::checkGAISOFile(m_pGAInstallationISOContainer->path())); 311 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMUnattendedPageBasic.h
r90165 r90169 33 33 class QLineEdit; 34 34 class QIRichTextLabel; 35 class UIGAInstallationGroupBox; 35 36 class UIFilePathSelector; 36 37 class UIUserNamePasswordGroupBox; … … 42 43 { 43 44 /** Returns false if ISO path selector is non empty but has invalid file path. */ 44 bool checkGAISOFile( UIFilePathSelector *pGAISOFilePathSelector);45 bool checkGAISOFile(const QString &strPatho); 45 46 } 46 47 … … 74 75 void createConnections(); 75 76 QWidget *createAdditionalOptionsWidgets(); 76 QWidget *createGAInstallWidgets();77 77 78 78 void retranslateUi(); … … 82 82 bool isProductKeyWidgetEnabled() const; 83 83 void disableEnableProductKeyWidgets(bool fEnabled); 84 void disableEnableGAWidgets(bool fEnabled);85 84 void markWidgets() const; 86 85 … … 89 88 QIRichTextLabel *m_pLabel; 90 89 QGroupBox *m_pAdditionalOptionsContainer; 91 QGroupBox *m_pGAInstallationISOContainer;90 UIGAInstallationGroupBox *m_pGAInstallationISOContainer; 92 91 QCheckBox *m_pStartHeadlessCheckBox; 93 92 UIUserNamePasswordGroupBox *m_pUserNamePasswordGroupBox; 94 93 UIHostnameDomainNameEditor *m_pHostnameDomainNameEditor; 95 QLabel *m_pGAISOPathLabel;96 UIFilePathSelector *m_pGAISOFilePathSelector;97 94 /** Product key stuff. */ 98 95 QLineEdit *m_pProductKeyLineEdit;
Note:
See TracChangeset
for help on using the changeset viewer.