Changeset 83963 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 24, 2020 11:05:10 AM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 8 deleted
- 5 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r83950 r83963 288 288 VBOX_GUI_INC_DIRS = \ 289 289 ./src \ 290 ./src/cloud/machinesettings \ 290 291 ./src/cloud/profilemanager \ 291 292 ./src/converter \ … … 614 615 # 615 616 VirtualBox_QT_MOCHDRS = \ 617 src/cloud/machinesettings/UICloudMachineSettingsDialog.h \ 618 src/cloud/machinesettings/UICloudMachineSettingsDialogPage.h \ 616 619 src/cloud/profilemanager/UICloudProfileDetailsWidget.h \ 617 620 src/cloud/profilemanager/UICloudProfileManager.h \ … … 1065 1068 VirtualBox_SOURCES = \ 1066 1069 src/main.cpp \ 1070 src/cloud/machinesettings/UICloudMachineSettingsDialog.cpp \ 1071 src/cloud/machinesettings/UICloudMachineSettingsDialogPage.cpp \ 1067 1072 src/cloud/profilemanager/UICloudProfileDetailsWidget.cpp \ 1068 1073 src/cloud/profilemanager/UICloudProfileManager.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/cloud/machinesettings/UICloudMachineSettingsDialog.cpp
r83946 r83963 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI WizardNewCloudVMclass implementation.3 * VBox Qt GUI - UICloudMachineSettingsDialog class implementation. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 20 09-2020 Oracle Corporation7 * Copyright (C) 2020 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 17 17 18 18 /* Qt includes: */ 19 #include <QAbstractButton> 19 #include <QPushButton> 20 #include <QVBoxLayout> 20 21 21 22 /* GUI includes: */ 23 #include "QIDialogButtonBox.h" 22 24 #include "UIMessageCenter.h" 23 #include "UIWizardNewCloudVM.h" 24 #include "UIWizardNewCloudVMPageBasic1.h" 25 #include "UIWizardNewCloudVMPageBasic2.h" 26 #include "UIWizardNewCloudVMPageExpert.h" 25 #include "UICloudMachineSettingsDialog.h" 26 #include "UICloudMachineSettingsDialogPage.h" 27 27 28 28 /* COM includes: */ … … 30 30 31 31 32 UIWizardNewCloudVM::UIWizardNewCloudVM(QWidget *pParent, 33 const CCloudClient &comClient /* = CCloudClient() */, 34 const CVirtualSystemDescription &comDescription /* = CVirtualSystemDescription() */, 35 WizardMode enmMode /* = WizardMode_Auto */) 36 : UIWizard(pParent, WizardType_NewCloudVM, enmMode) 37 , m_comClient(comClient) 38 , m_comVSD(comDescription) 39 , m_fFullWizard(m_comClient.isNull() || m_comVSD.isNull()) 40 , m_fFinalStepPrevented(false) 32 UICloudMachineSettingsDialog::UICloudMachineSettingsDialog(QWidget *pParent, const CCloudMachine &comCloudMachine) 33 : QIWithRetranslateUI<QDialog>(pParent) 34 , m_comCloudMachine(comCloudMachine) 35 , m_pPage(0) 36 , m_pButtonBox(0) 41 37 { 42 #ifndef VBOX_WS_MAC 43 /* Assign watermark: */ 44 assignWatermark(":/wizard_new_cloud_vm.png"); 45 #else 46 /* Assign background image: */ 47 assignBackground(":/wizard_new_cloud_vm_bg.png"); 48 #endif 38 prepare(); 49 39 } 50 40 51 void UIWizardNewCloudVM::prepare()41 int UICloudMachineSettingsDialog::exec() 52 42 { 53 /* Create corresponding pages: */ 54 switch (mode()) 43 /* Request dialog initialization: */ 44 QMetaObject::invokeMethod(this, "sltRefresh", Qt::QueuedConnection); 45 46 /* Call to base-class: */ 47 return QIWithRetranslateUI<QDialog>::exec(); 48 } 49 50 void UICloudMachineSettingsDialog::accept() 51 { 52 /** Makes sure page data committed: */ 53 if (m_pPage) 54 m_pPage->makeSureDataCommitted(); 55 56 /* Apply form: */ 57 AssertReturnVoid(m_comForm.isNotNull()); 58 CProgress comProgress = m_comForm.Apply(); 59 if (!m_comForm.isOk()) 55 60 { 56 case WizardMode_Basic: 61 msgCenter().cannotApplyCloudMachineFormSettings(m_comForm, m_strName, this); 62 return; 63 } 64 msgCenter().showModalProgressDialog(comProgress, 65 m_strName, 66 ":/progress_settings_90px.png", this, 0); 67 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 68 { 69 msgCenter().cannotApplyCloudMachineFormSettings(comProgress, m_strName, this); 70 return; 71 } 72 73 /* Call to base-class: */ 74 QIWithRetranslateUI<QDialog>::accept(); 75 } 76 77 void UICloudMachineSettingsDialog::retranslateUi() 78 { 79 /* Translate title: */ 80 const QString strCaption = tr("Settings"); 81 if (m_strName.isNull()) 82 setWindowTitle(strCaption); 83 else 84 setWindowTitle(tr("%1 - %2").arg(m_strName, strCaption)); 85 } 86 87 void UICloudMachineSettingsDialog::sltRefresh() 88 { 89 /* Update name: */ 90 m_strName = m_comCloudMachine.GetName(); 91 if (!m_comCloudMachine.isOk()) 92 { 93 msgCenter().cannotAcquireCloudMachineParameter(m_comCloudMachine, this); 94 reject(); 95 } 96 97 /* Retranslate title: */ 98 retranslateUi(); 99 100 /* Update form: */ 101 CForm comForm; 102 CProgress comProgress = m_comCloudMachine.GetSettingsForm(comForm); 103 if (!m_comCloudMachine.isOk()) 104 { 105 msgCenter().cannotAcquireCloudMachineParameter(m_comCloudMachine, this); 106 reject(); 107 } 108 msgCenter().showModalProgressDialog(comProgress, 109 m_strName, 110 ":/progress_settings_90px.png", this, 0); 111 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 112 { 113 msgCenter().cannotAcquireCloudClientParameter(comProgress, this); 114 reject(); 115 } 116 m_comForm = comForm; 117 118 /* Assign page with form: */ 119 m_pPage->setForm(m_comForm); 120 } 121 122 void UICloudMachineSettingsDialog::prepare() 123 { 124 /* Prepare layout: */ 125 QVBoxLayout *pLayout = new QVBoxLayout(this); 126 if (pLayout) 127 { 128 /* Prepare page: */ 129 m_pPage = new UICloudMachineSettingsDialogPage(this); 130 if (m_pPage) 57 131 { 58 if (m_fFullWizard) 59 setPage(Page1, new UIWizardNewCloudVMPageBasic1); 60 setPage(Page2, new UIWizardNewCloudVMPageBasic2(m_fFullWizard)); 61 break; 132 /* Add into layout: */ 133 pLayout->addWidget(m_pPage); 62 134 } 63 case WizardMode_Expert: 135 136 /* Prepare button-box: */ 137 m_pButtonBox = new QIDialogButtonBox; 138 if (m_pButtonBox) 64 139 { 65 setPage(PageExpert, new UIWizardNewCloudVMPageExpert(m_fFullWizard)); 66 break; 67 } 68 default: 69 { 70 AssertMsgFailed(("Invalid mode: %d", mode())); 71 break; 140 m_pButtonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); 141 m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(Qt::Key_Escape); 142 connect(m_pButtonBox, &QIDialogButtonBox::accepted, this, &UICloudMachineSettingsDialog::accept); 143 connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &UICloudMachineSettingsDialog::reject); 144 /* Add into layout: */ 145 pLayout->addWidget(m_pButtonBox); 72 146 } 73 147 } 74 /* Call to base-class: */ 75 UIWizard::prepare(); 148 149 /* Apply language settings: */ 150 retranslateUi(); 76 151 } 77 78 bool UIWizardNewCloudVM::createVSDForm()79 {80 /* Prepare result: */81 bool fResult = false;82 83 /* Main API request sequence, can be interrupted after any step: */84 do85 {86 /* Acquire prepared client and description: */87 CCloudClient comClient = client();88 CVirtualSystemDescription comDescription = vsd();89 AssertReturn(comClient.isNotNull() && comDescription.isNotNull(), false);90 91 /* Read Cloud Client description form: */92 CVirtualSystemDescriptionForm comForm;93 CProgress comProgress = comClient.GetLaunchDescriptionForm(comDescription, comForm);94 if (!comClient.isOk())95 {96 msgCenter().cannotAcquireCloudClientParameter(comClient);97 break;98 }99 100 /* Show "Acquire launch form" progress: */101 msgCenter().showModalProgressDialog(comProgress, tr("Acquire launch form ..."),102 ":/progress_refresh_90px.png", this, 0);103 if (!comProgress.isOk() || comProgress.GetResultCode() != 0)104 {105 msgCenter().cannotAcquireCloudClientParameter(comProgress);106 break;107 }108 109 /* Remember Virtual System Description Form: */110 setVSDForm(comForm);111 112 /* Finally, success: */113 fResult = true;114 }115 while (0);116 117 /* Return result: */118 return fResult;119 }120 121 bool UIWizardNewCloudVM::createCloudVM()122 {123 /* Prepare result: */124 bool fResult = false;125 126 /* Main API request sequence, can be interrupted after any step: */127 do128 {129 /* Do nothing if prevented: */130 if (m_fFinalStepPrevented)131 {132 fResult = true;133 break;134 }135 136 /* Acquire prepared client and description: */137 CCloudClient comClient = client();138 CVirtualSystemDescription comDescription = vsd();139 AssertReturn(comClient.isNotNull() && comDescription.isNotNull(), false);140 141 /* Initiate cloud VM creation procedure: */142 CProgress comProgress = comClient.LaunchVM(comDescription);143 if (!comClient.isOk())144 {145 msgCenter().cannotCreateCloudMachine(comClient, this);146 break;147 }148 149 /* Show "Create Cloud Machine" progress: */150 msgCenter().showModalProgressDialog(comProgress, tr("Create Cloud Machine ..."),151 ":/progress_new_cloud_vm_90px.png", this, 0);152 if (comProgress.GetCanceled())153 break;154 if (!comProgress.isOk() || comProgress.GetResultCode() != 0)155 {156 msgCenter().cannotCreateCloudMachine(comProgress, this);157 break;158 }159 160 /* Finally, success: */161 fResult = true;162 }163 while (0);164 165 /* Return result: */166 return fResult;167 }168 169 void UIWizardNewCloudVM::scheduleAutoFinish()170 {171 QMetaObject::invokeMethod(this, "sltTriggerFinishButton", Qt::QueuedConnection);172 }173 174 void UIWizardNewCloudVM::retranslateUi()175 {176 /* Call to base-class: */177 UIWizard::retranslateUi();178 179 /* Translate wizard: */180 setWindowTitle(tr("Create Cloud Virtual Machine"));181 setButtonText(QWizard::FinishButton, tr("Create"));182 }183 184 void UIWizardNewCloudVM::sltTriggerFinishButton()185 {186 button(QWizard::FinishButton)->click();187 } -
trunk/src/VBox/Frontends/VirtualBox/src/cloud/machinesettings/UICloudMachineSettingsDialog.h
r83946 r83963 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI WizardNewCloudVMclass declaration.3 * VBox Qt GUI - UICloudMachineSettingsDialog class declaration. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 20 09-2020 Oracle Corporation7 * Copyright (C) 2020 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef FEQT_INCLUDED_SRC_ wizards_newcloudvm_UIWizardNewCloudVM_h19 #define FEQT_INCLUDED_SRC_ wizards_newcloudvm_UIWizardNewCloudVM_h18 #ifndef FEQT_INCLUDED_SRC_cloud_machinesettings_UICloudMachineSettingsDialog_h 19 #define FEQT_INCLUDED_SRC_cloud_machinesettings_UICloudMachineSettingsDialog_h 20 20 #ifndef RT_WITHOUT_PRAGMA_ONCE 21 21 # pragma once 22 22 #endif 23 23 24 /* Qt includes: */ 25 #include <QDialog> 26 #include <QPointer> 27 24 28 /* GUI includes: */ 25 #include "UIWizard.h" 29 #include "QIWithRetranslateUI.h" 30 #include "UICloudMachineSettingsDialogPage.h" 26 31 27 32 /* COM includes: */ 28 33 #include "COMEnums.h" 29 #include "CCloudClient.h" 30 #include "CVirtualSystemDescription.h" 31 #include "CVirtualSystemDescriptionForm.h" 34 #include "CCloudMachine.h" 35 #include "CForm.h" 32 36 33 /** New Cloud VM wizard. */ 34 class UIWizardNewCloudVM : public UIWizard 37 /* Forward declarations: */ 38 class QIDialogButtonBox; 39 40 /** Cloud machine settings dialog. */ 41 class UICloudMachineSettingsDialog : public QIWithRetranslateUI<QDialog> 35 42 { 36 43 Q_OBJECT; … … 38 45 public: 39 46 40 /** Basic page IDs. */ 41 enum 42 { 43 Page1, 44 Page2 45 }; 47 /** Constructs @a comCloudMachine settings dialog passing @a pParent to the base-class. */ 48 UICloudMachineSettingsDialog(QWidget *pParent, const CCloudMachine &comCloudMachine); 46 49 47 /** Expert page IDs. */ 48 enum 49 { 50 PageExpert 51 }; 50 public slots: 52 51 53 /** Constructs New Cloud VM wizard passing @a pParent to the base-class. 54 * @param comClient Brings the Cloud Client object to work with. 55 * @param comDescription Brings the Virtual System Description object to use. */ 56 UIWizardNewCloudVM(QWidget *pParent, 57 const CCloudClient &comClient = CCloudClient(), 58 const CVirtualSystemDescription &comDescription = CVirtualSystemDescription(), 59 WizardMode enmMode = WizardMode_Auto); 52 /** Shows the dialog as a modal dialog, blocking until the user closes it. */ 53 virtual int exec() /* override */; 60 54 61 /** Prepares all. */ 62 virtual void prepare() /* override */; 63 64 /** Sets whether the final step is @a fPrevented. */ 65 void setFinalStepPrevented(bool fPrevented) { m_fFinalStepPrevented = fPrevented; } 66 67 /** Defines Cloud @a comClient object. */ 68 void setClient(const CCloudClient &comClient) { m_comClient = comClient; } 69 /** Returns Cloud Client object. */ 70 CCloudClient client() const { return m_comClient; } 71 72 /** Defines Virtual System @a comDescription object. */ 73 void setVSD(const CVirtualSystemDescription &comDescription) { m_comVSD = comDescription; } 74 /** Returns Virtual System Description object. */ 75 CVirtualSystemDescription vsd() const { return m_comVSD; } 76 77 /** Defines Virtual System Description @a comForm object. */ 78 void setVSDForm(const CVirtualSystemDescriptionForm &comForm) { m_comVSDForm = comForm; } 79 /** Returns Virtual System Description Form object. */ 80 CVirtualSystemDescriptionForm vsdForm() const { return m_comVSDForm; } 81 82 /** Creates VSD Form. */ 83 bool createVSDForm(); 84 85 /** Creates New Cloud VM. */ 86 bool createCloudVM(); 87 88 /** Schedules Finish button trigger for 89 * the next event-loop cicle. */ 90 void scheduleAutoFinish(); 55 /** Hides the modal dialog and sets the result code to Accepted. */ 56 virtual void accept() /* override */; 91 57 92 58 protected: … … 97 63 private slots: 98 64 99 /** Triggers Finish button. */100 void slt TriggerFinishButton();65 /** Performs dialog refresh. */ 66 void sltRefresh(); 101 67 102 68 private: 103 69 104 /** Holds the Cloud Client object reference. */ 105 CCloudClient m_comClient; 106 /** Holds the Virtual System Description object reference. */ 107 CVirtualSystemDescription m_comVSD; 108 /** Holds the Virtual System Description Form object reference. */ 109 CVirtualSystemDescriptionForm m_comVSDForm; 70 /** Prepares all. */ 71 void prepare(); 110 72 111 /** Holds whether we want full wizard form or short one. */ 112 bool m_fFullWizard; 113 /** Holds whether the final step is prevented. */ 114 bool m_fFinalStepPrevented; 73 /** Holds the cloud machine object reference. */ 74 CCloudMachine m_comCloudMachine; 75 /** Holds the cloud machine settings form object reference. */ 76 CForm m_comForm; 77 /** Holds the cloud machine name. */ 78 QString m_strName; 79 80 /** Holds the cloud machine settings dialog page instance. */ 81 UISafePointerCloudMachineSettingsDialogPage m_pPage; 82 /** Holds the dialog button-box instance. */ 83 QIDialogButtonBox *m_pButtonBox; 115 84 }; 116 85 117 /** Safe pointer to new cloud vm wizard. */118 typedef QPointer<UI WizardNewCloudVM> UISafePointerWizardNewCloudVM;86 /** Safe pointer to cloud machine settings dialog. */ 87 typedef QPointer<UICloudMachineSettingsDialog> UISafePointerCloudMachineSettingsDialog; 119 88 120 #endif /* !FEQT_INCLUDED_SRC_ wizards_newcloudvm_UIWizardNewCloudVM_h */89 #endif /* !FEQT_INCLUDED_SRC_cloud_machinesettings_UICloudMachineSettingsDialog_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/cloud/machinesettings/UICloudMachineSettingsDialogPage.cpp
r83946 r83963 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI WizardNewCloudVMPageBasic2class implementation.3 * VBox Qt GUI - UICloudMachineSettingsDialogPage class implementation. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 20 09-2020 Oracle Corporation7 * Copyright (C) 2020 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 18 18 /* Qt includes: */ 19 19 #include <QHeaderView> 20 #include <QLabel>21 20 #include <QVBoxLayout> 22 21 23 22 /* GUI includes: */ 24 #include "QIRichTextLabel.h" 25 #include "UIMessageCenter.h" 26 #include "UIWizardNewCloudVM.h" 27 #include "UIWizardNewCloudVMPageBasic2.h" 23 #include "UICloudMachineSettingsDialogPage.h" 28 24 29 25 30 /********************************************************************************************************************************* 31 * Class UIWizardNewCloudVMPage2 implementation. * 32 *********************************************************************************************************************************/ 33 34 UIWizardNewCloudVMPage2::UIWizardNewCloudVMPage2(bool fFullWizard) 35 : m_fFullWizard(fFullWizard) 36 , m_fPolished(false) 26 UICloudMachineSettingsDialogPage::UICloudMachineSettingsDialogPage(QWidget *pParent) 27 : QWidget(pParent) 37 28 { 29 prepare(); 38 30 } 39 31 40 void UI WizardNewCloudVMPage2::refreshFormPropertiesTable()32 void UICloudMachineSettingsDialogPage::setForm(const CForm &comForm) 41 33 { 42 /* Acquire VSD form: */ 43 CVirtualSystemDescriptionForm comForm = vsdForm(); 44 /* Make sure the properties table get the new description form: */ 45 if (comForm.isNotNull()) 46 m_pFormEditor->setVirtualSystemDescriptionForm(comForm); 34 if (m_pFormEditor) 35 m_pFormEditor->setForm(comForm); 47 36 } 48 37 49 CCloudClient UIWizardNewCloudVMPage2::client() const 38 void UICloudMachineSettingsDialogPage::makeSureDataCommitted() 50 39 { 51 return qobject_cast<UIWizardNewCloudVM*>(wizardImp())->client(); 40 if (m_pFormEditor) 41 m_pFormEditor->makeSureEditorDataCommitted(); 52 42 } 53 43 54 CVirtualSystemDescription UIWizardNewCloudVMPage2::vsd() const 44 void UICloudMachineSettingsDialogPage::prepare() 55 45 { 56 return qobject_cast<UIWizardNewCloudVM*>(wizardImp())->vsd(); 57 } 46 /* Prepare layout: */ 47 QVBoxLayout *pLayout = new QVBoxLayout(this); 48 if (pLayout) 49 { 50 pLayout->setContentsMargins(0, 0, 0, 0); 58 51 59 void UIWizardNewCloudVMPage2::setVSDForm(const CVirtualSystemDescriptionForm &comForm) 60 { 61 qobject_cast<UIWizardNewCloudVM*>(wizardImp())->setVSDForm(comForm); 62 } 63 64 CVirtualSystemDescriptionForm UIWizardNewCloudVMPage2::vsdForm() const 65 { 66 return qobject_cast<UIWizardNewCloudVM*>(wizardImp())->vsdForm(); 67 } 68 69 70 /********************************************************************************************************************************* 71 * Class UIWizardNewCloudVMPageBasic2 implementation. * 72 *********************************************************************************************************************************/ 73 74 UIWizardNewCloudVMPageBasic2::UIWizardNewCloudVMPageBasic2(bool fFullWizard) 75 : UIWizardNewCloudVMPage2(fFullWizard) 76 { 77 /* Create main layout: */ 78 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 79 if (pMainLayout) 80 { 81 /* Create label: */ 82 m_pLabel = new QIRichTextLabel(this); 83 if (m_pLabel) 84 { 85 /* Add into layout: */ 86 pMainLayout->addWidget(m_pLabel); 87 } 88 89 /* Create form editor widget: */ 52 /* Prepare form editor widget: */ 90 53 m_pFormEditor = new UIFormEditorWidget(this); 91 54 if (m_pFormEditor) 92 55 { 93 /* Make form-editor fit 8sections in height by default: */56 /* Make form-editor fit 12 sections in height by default: */ 94 57 const int iDefaultSectionHeight = m_pFormEditor->verticalHeader() 95 58 ? m_pFormEditor->verticalHeader()->defaultSectionSize() 96 59 : 0; 97 60 if (iDefaultSectionHeight > 0) 98 m_pFormEditor->setMinimumHeight(8 * iDefaultSectionHeight); 61 { 62 const int iProposedHeight = iDefaultSectionHeight * 12; 63 const int iProposedWidth = iProposedHeight * 1.66; 64 m_pFormEditor->setMinimumSize(iProposedWidth, iProposedHeight); 65 } 99 66 100 67 /* Add into layout: */ 101 p MainLayout->addWidget(m_pFormEditor);68 pLayout->addWidget(m_pFormEditor); 102 69 } 103 70 } 104 71 } 105 106 void UIWizardNewCloudVMPageBasic2::retranslateUi()107 {108 /* Translate page: */109 setTitle(UIWizardNewCloudVM::tr("Cloud Virtual Machine settings"));110 111 /* Translate description label: */112 m_pLabel->setText(UIWizardNewCloudVM::tr("These are the the suggested settings of the cloud VM creation procedure, they are "113 "influencing the resulting cloud VM instance. You can change many of the "114 "properties shown by double-clicking on the items and disable others using the "115 "check boxes below."));116 }117 118 void UIWizardNewCloudVMPageBasic2::initializePage()119 {120 /* If wasn't polished yet: */121 if (!m_fPolished)122 {123 if (!m_fFullWizard)124 {125 /* Generate VSD form, asynchronously: */126 QMetaObject::invokeMethod(this, "sltInitShortWizardForm", Qt::QueuedConnection);127 }128 m_fPolished = true;129 }130 131 /* Refresh form properties: */132 refreshFormPropertiesTable();133 134 /* Translate page: */135 retranslateUi();136 }137 138 bool UIWizardNewCloudVMPageBasic2::isComplete() const139 {140 /* Initial result: */141 bool fResult = true;142 143 /* Check cloud settings: */144 fResult = client().isNotNull()145 && vsd().isNotNull();146 147 /* Return result: */148 return fResult;149 }150 151 bool UIWizardNewCloudVMPageBasic2::validatePage()152 {153 /* Initial result: */154 bool fResult = true;155 156 /* Lock finish button: */157 startProcessing();158 159 /* Make sure table has own data committed: */160 m_pFormEditor->makeSureEditorDataCommitted();161 162 /* Check whether we have proper VSD form: */163 CVirtualSystemDescriptionForm comForm = vsdForm();164 /* Give changed VSD back: */165 if (comForm.isNotNull())166 {167 comForm.GetVirtualSystemDescription();168 fResult = comForm.isOk();169 if (!fResult)170 msgCenter().cannotAcquireVirtualSystemDescriptionFormProperty(comForm);171 }172 173 /* Try to create cloud VM: */174 if (fResult)175 {176 fResult = qobject_cast<UIWizardNewCloudVM*>(wizard())->createCloudVM();177 178 /* If the final step failed we could try179 * sugest user more valid form this time: */180 if (!fResult)181 sltInitShortWizardForm();182 }183 184 /* Unlock finish button: */185 endProcessing();186 187 /* Return result: */188 return fResult;189 }190 191 void UIWizardNewCloudVMPageBasic2::sltInitShortWizardForm()192 {193 /* Create Virtual System Description Form: */194 qobject_cast<UIWizardNewCloudVM*>(wizardImp())->createVSDForm();195 196 /* Refresh form properties table: */197 refreshFormPropertiesTable();198 emit completeChanged();199 } -
trunk/src/VBox/Frontends/VirtualBox/src/cloud/machinesettings/UICloudMachineSettingsDialogPage.h
r83946 r83963 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI WizardNewCloudVMPageBasic2class declaration.3 * VBox Qt GUI - UICloudMachineSettingsDialogPage class declaration. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 20 09-2020 Oracle Corporation7 * Copyright (C) 2020 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef FEQT_INCLUDED_SRC_ wizards_newcloudvm_UIWizardNewCloudVMPageBasic2_h19 #define FEQT_INCLUDED_SRC_ wizards_newcloudvm_UIWizardNewCloudVMPageBasic2_h18 #ifndef FEQT_INCLUDED_SRC_cloud_machinesettings_UICloudMachineSettingsDialogPage_h 19 #define FEQT_INCLUDED_SRC_cloud_machinesettings_UICloudMachineSettingsDialogPage_h 20 20 #ifndef RT_WITHOUT_PRAGMA_ONCE 21 21 # pragma once 22 22 #endif 23 23 24 /* Qt includes: */ 25 #include <QPointer> 26 #include <QWidget> 27 24 28 /* GUI includes: */ 25 29 #include "UIFormEditorWidget.h" 26 #include "UIWizardPage.h"27 28 /* COM includes: */29 #include "COMEnums.h"30 #include "CCloudClient.h"31 #include "CVirtualSystemDescription.h"32 #include "CVirtualSystemDescriptionForm.h"33 30 34 31 /* Forward declarations: */ 35 class QIRichTextLabel;32 class CForm; 36 33 37 /** UIWizardPageBase extension for 2nd page of the New Cloud VM wizard. */ 38 class UIWizardNewCloudVMPage2 : public UIWizardPageBase 39 { 40 protected: 41 42 /** Constructs 2nd page base. */ 43 UIWizardNewCloudVMPage2(bool fFullWizard); 44 45 /** Refreshes form properties table. */ 46 void refreshFormPropertiesTable(); 47 48 /** Returns Cloud Client object. */ 49 CCloudClient client() const; 50 /** Returns Virtual System Description object. */ 51 CVirtualSystemDescription vsd() const; 52 53 /** Defines Virtual System Description @a comForm object. */ 54 void setVSDForm(const CVirtualSystemDescriptionForm &comForm); 55 /** Returns Virtual System Description Form object. */ 56 CVirtualSystemDescriptionForm vsdForm() const; 57 58 /** Holds whether wizard should be in full form. */ 59 bool m_fFullWizard; 60 /** Holds whether starting page was polished. */ 61 bool m_fPolished; 62 63 /** Holds the Form Editor widget instance. */ 64 UIFormEditorWidgetPointer m_pFormEditor; 65 }; 66 67 /** UIWizardPage extension for 2nd page of the New Cloud VM wizard, extends UIWizardNewCloudVMPage2 as well. */ 68 class UIWizardNewCloudVMPageBasic2 : public UIWizardPage, public UIWizardNewCloudVMPage2 34 /** Cloud machine settings dialog page. */ 35 class UICloudMachineSettingsDialogPage : public QWidget 69 36 { 70 37 Q_OBJECT; … … 72 39 public: 73 40 74 /** Constructs 2nd basic page. */75 UI WizardNewCloudVMPageBasic2(bool fFullWizard);41 /** Constructs cloud machine settings dialog page passing @a pParent to the base-class. */ 42 UICloudMachineSettingsDialogPage(QWidget *pParent); 76 43 77 protected: 44 /** Defines page @a comForm. */ 45 void setForm(const CForm &comForm); 78 46 79 /** Allows access wizard from base part. */ 80 virtual UIWizard *wizardImp() const /* override */ { return UIWizardPage::wizard(); } 81 82 /** Handles translation event. */ 83 virtual void retranslateUi() /* override */; 84 85 /** Performs page initialization. */ 86 virtual void initializePage() /* override */; 87 88 /** Returns whether page is complete. */ 89 virtual bool isComplete() const /* override */; 90 91 /** Performs page validation. */ 92 virtual bool validatePage() /* override */; 93 94 private slots: 95 96 /** Initializes short wizard form. */ 97 void sltInitShortWizardForm(); 47 /** Makes sure page data committed. */ 48 void makeSureDataCommitted(); 98 49 99 50 private: 100 51 101 /** Holds the label instance. */ 102 QIRichTextLabel *m_pLabel; 52 /** Prepares all. */ 53 void prepare(); 54 55 /** Holds the form editor widget instance. */ 56 UIFormEditorWidgetPointer m_pFormEditor; 103 57 }; 104 58 105 #endif /* !FEQT_INCLUDED_SRC_wizards_newcloudvm_UIWizardNewCloudVMPageBasic2_h */ 59 /** Safe pointer to Form Editor widget. */ 60 typedef QPointer<UICloudMachineSettingsDialogPage> UISafePointerCloudMachineSettingsDialogPage; 61 62 #endif /* !FEQT_INCLUDED_SRC_cloud_machinesettings_UICloudMachineSettingsDialogPage_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r83962 r83963 62 62 #include "CCloudProviderManager.h" 63 63 #include "CDHCPServer.h" 64 #include "CForm.h" 64 65 #include "CGraphicsAdapter.h" 65 66 #include "CNATEngine.h" … … 1344 1345 .arg(CMachine(machine).GetName(), CMachine(machine).GetSettingsFilePath()), 1345 1346 UIErrorString::formatErrorInfo(machine)); 1347 } 1348 1349 void UIMessageCenter::cannotApplyCloudMachineFormSettings(const CForm &comForm, const QString &strName, QWidget *pParent /* = 0 */) const 1350 { 1351 error(pParent, MessageType_Error, 1352 tr("Failed to save the settings of the cloud virtual machine <b>%1</b>.").arg(strName), 1353 UIErrorString::formatErrorInfo(comForm)); 1354 } 1355 1356 void UIMessageCenter::cannotApplyCloudMachineFormSettings(const CProgress &comProgress, const QString &strName, QWidget *pParent /* = 0 */) const 1357 { 1358 error(pParent, MessageType_Error, 1359 tr("Failed to save the settings of the cloud virtual machine <b>%1</b>.").arg(strName), 1360 UIErrorString::formatErrorInfo(comProgress)); 1346 1361 } 1347 1362 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r83962 r83963 344 344 void cannotChangeMachineAttribute(const CMachine &comMachine, QWidget *pParent = 0) const; 345 345 void cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent = 0) const; 346 void cannotApplyCloudMachineFormSettings(const CForm &comForm, const QString &strName, QWidget *pParent = 0) const; 347 void cannotApplyCloudMachineFormSettings(const CProgress &comProgress, const QString &strName, QWidget *pParent = 0) const; 346 348 void cannotChangeGraphicsAdapterAttribute(const CGraphicsAdapter &comAdapter, QWidget *pParent = 0) const; 347 349 void cannotChangeAudioAdapterAttribute(const CAudioAdapter &comAdapter, QWidget *pParent = 0) const; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r83962 r83963 25 25 #include "QIFileDialog.h" 26 26 #include "UIActionPoolManager.h" 27 #include "UICloudMachineSettingsDialog.h" 27 28 #include "UICloudProfileManager.h" 28 29 #include "UIDesktopServices.h" … … 612 613 AssertMsgReturnVoid(pItem, ("Current item should be selected!\n")); 613 614 614 /* Process href from VM details / description: */ 615 if (!strCategory.isEmpty() && strCategory[0] != '#') 616 { 617 uiCommon().openURL(strCategory); 618 } 615 /* For local machine: */ 616 if (pItem->itemType() == UIVirtualMachineItemType_Local) 617 { 618 /* Process href from VM details / description: */ 619 if (!strCategory.isEmpty() && strCategory[0] != '#') 620 { 621 uiCommon().openURL(strCategory); 622 } 623 else 624 { 625 /* Check if control is coded into the URL by %%: */ 626 if (strControl.isEmpty()) 627 { 628 QStringList parts = strCategory.split("%%"); 629 if (parts.size() == 2) 630 { 631 strCategory = parts.at(0); 632 strControl = parts.at(1); 633 } 634 } 635 636 /* Don't show the inaccessible warning 637 * if the user tries to open VM settings: */ 638 m_fFirstMediumEnumerationHandled = true; 639 640 /* Use the "safe way" to open stack of Mac OS X Sheets: */ 641 QWidget *pDialogParent = windowManager().realParentWindow(this); 642 UISafePointerSettingsDialogMachine pDialog = new UISettingsDialogMachine(pDialogParent, 643 uID.isNull() ? pItem->id() : uID, 644 strCategory, strControl); 645 windowManager().registerNewParent(pDialog, pDialogParent); 646 647 /* Execute dialog: */ 648 pDialog->execute(); 649 delete pDialog; 650 } 651 } 652 /* For cloud machine: */ 619 653 else 620 654 { 621 /* Check if control is coded into the URL by %%: */622 if (strControl.isEmpty())623 {624 QStringList parts = strCategory.split("%%");625 if (parts.size() == 2)626 {627 strCategory = parts.at(0);628 strControl = parts.at(1);629 }630 }631 632 /* Don't show the inaccessible warning633 * if the user tries to open VM settings: */634 m_fFirstMediumEnumerationHandled = true;635 636 655 /* Use the "safe way" to open stack of Mac OS X Sheets: */ 637 656 QWidget *pDialogParent = windowManager().realParentWindow(this); 638 UISafePointerSettingsDialogMachine pDialog = new UISettingsDialogMachine(pDialogParent, 639 uID.isNull() ? pItem->id() : uID, 640 strCategory, strControl); 657 UISafePointerCloudMachineSettingsDialog pDialog = new UICloudMachineSettingsDialog(pDialogParent, 658 pItem->toCloud()->machine()); 641 659 windowManager().registerNewParent(pDialog, pDialogParent); 642 660 643 661 /* Execute dialog: */ 644 pDialog->exec ute();662 pDialog->exec(); 645 663 delete pDialog; 646 664 } … … 1988 2006 return !isGroupSavingInProgress() && 1989 2007 items.size() == 1 && 1990 pItem->toLocal() &&1991 2008 pItem->configurationAccessLevel() != ConfigurationAccessLevel_Null && 1992 2009 (m_pWidget->currentMachineTool() != UIToolType_Snapshots || -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.cpp
r83921 r83963 110 110 111 111 /* Determine configuration access level: */ 112 m_enmConfigurationAccessLevel = ConfigurationAccessLevel_Null; 112 if (itemType() == UIVirtualMachineItemType_CloudReal) 113 m_enmConfigurationAccessLevel = ConfigurationAccessLevel_Full; 114 else 115 m_enmConfigurationAccessLevel = ConfigurationAccessLevel_Null; 113 116 114 117 /* Determine whether we should show this VM details: */
Note:
See TracChangeset
for help on using the changeset viewer.