- Timestamp:
- Aug 17, 2021 3:40:19 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards
- Files:
-
- 5 edited
-
clonevm/UIWizardCloneVMPageBasic1.cpp (modified) (8 diffs)
-
clonevm/UIWizardCloneVMPageExpert.cpp (modified) (6 diffs)
-
clonevm/UIWizardCloneVMPageExpert.h (modified) (3 diffs)
-
editors/UIWizardCloneVMEditors.cpp (modified) (3 diffs)
-
editors/UIWizardCloneVMEditors.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp
r90696 r90702 29 29 #include "CVirtualBox.h" 30 30 31 32 33 31 QString UIWizardCloneVMNamePage::composeCloneFilePath(const QString &strCloneName, const QString &strGroup, const QString &strFolderPath) 34 32 { 35 33 CVirtualBox vbox = uiCommon().virtualBox(); 36 34 QString strCloneFilePath = vbox.ComposeMachineFilename(strCloneName, strGroup, QString(), strFolderPath); 37 return QDir::toNativeSeparators( QFileInfo(strCloneFilePath).absolutePath());35 return QDir::toNativeSeparators(strCloneFilePath); 38 36 } 39 40 37 41 38 UIWizardCloneVMPageBasic1::UIWizardCloneVMPageBasic1(const QString &strOriginalName, const QString &strDefaultPath, const QString &strGroup) … … 73 70 retranslateUi(); 74 71 if (m_pNamePathEditor) 72 { 75 73 m_pNamePathEditor->setFocus(); 76 if (m_pNamePathEditor)77 {78 74 if (!m_userModifiedParameters.contains("CloneName")) 79 75 cloneVMWizardPropertySet(CloneName, m_pNamePathEditor->cloneName()); … … 135 131 bool UIWizardCloneVMPageBasic1::isComplete() const 136 132 { 137 // if (!m_pPathSelector) 138 // return false; 139 140 // QString path = m_pPathSelector->path(); 141 // if (path.isEmpty()) 142 // return false; 143 // /* Make sure VM name feat the rules: */ 144 // QString strName = m_pNameLineEdit->text().trimmed(); 145 // return !strName.isEmpty() && strName != m_strOriginalName; 146 return true; 133 return m_pNamePathEditor && m_pNamePathEditor->isComplete(m_strGroup); 147 134 } 148 135 … … 155 142 cloneVMWizardPropertySet(CloneFilePath, 156 143 UIWizardCloneVMNamePage::composeCloneFilePath(strCloneName, m_strGroup, m_pNamePathEditor->clonePath())); 144 emit completeChanged(); 157 145 } 158 146 … … 163 151 cloneVMWizardPropertySet(CloneFilePath, 164 152 UIWizardCloneVMNamePage::composeCloneFilePath(m_pNamePathEditor->cloneName(), m_strGroup, strClonePath)); 153 emit completeChanged(); 165 154 } 166 155 … … 169 158 m_userModifiedParameters << "MacAddressPolicy"; 170 159 cloneVMWizardPropertySet(MacAddressPolicy, enmMACAddressClonePolicy); 160 emit completeChanged(); 171 161 } 172 162 … … 175 165 m_userModifiedParameters << "KeepDiskNames"; 176 166 cloneVMWizardPropertySet(KeepDiskNames, fKeepDiskNames); 167 emit completeChanged(); 177 168 } 178 169 … … 181 172 m_userModifiedParameters << "KeepHardwareUUIDs"; 182 173 cloneVMWizardPropertySet(KeepHardwareUUIDs, fKeepHardwareUUIDs); 174 emit completeChanged(); 183 175 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp
r90696 r90702 30 30 #include "UIWizardCloneVMPageExpert.h" 31 31 #include "UIWizardCloneVM.h" 32 #include "UIWizardCloneVMPageBasic1.h" 32 33 33 34 /* COM includes: */ … … 36 37 37 38 UIWizardCloneVMPageExpert::UIWizardCloneVMPageExpert(const QString &strOriginalName, const QString &strDefaultPath, 38 bool /*fAdditionalInfo*/, bool fShowChildsOption, const QString & /*strGroup*/)39 bool /*fAdditionalInfo*/, bool fShowChildsOption, const QString &strGroup) 39 40 : m_pMainLayout(0) 40 41 , m_pNamePathGroupBox(0) 41 42 , m_pCloneTypeGroupBox(0) 42 43 , m_pCloneModeGroupBox(0) 43 , m_pAdditionalOptionsroupBox(0) 44 , m_pAdditionalOptionsGroupBox(0) 45 , m_strGroup(strGroup) 44 46 { 45 47 prepare(strOriginalName, strDefaultPath, fShowChildsOption); … … 52 54 m_pNamePathGroupBox = new UICloneVMNamePathEditor(strOriginalName, strDefaultPath); 53 55 if (m_pNamePathGroupBox) 56 { 54 57 m_pMainLayout->addWidget(m_pNamePathGroupBox, 0, 0, 3, 2); 58 connect(m_pNamePathGroupBox, &UICloneVMNamePathEditor::sigCloneNameChanged, 59 this, &UIWizardCloneVMPageExpert::sltCloneNameChanged); 60 connect(m_pNamePathGroupBox, &UICloneVMNamePathEditor::sigClonePathChanged, 61 this, &UIWizardCloneVMPageExpert::sltClonePathChanged); 62 } 55 63 56 64 m_pCloneTypeGroupBox = new UICloneVMCloneTypeGroupBox; … … 62 70 m_pMainLayout->addWidget(m_pCloneModeGroupBox, 3, 1, 2, 1); 63 71 64 m_pAdditionalOptionsroupBox = new UICloneVMAdditionalOptionsEditor; 65 if (m_pAdditionalOptionsroupBox) 66 m_pMainLayout->addWidget(m_pAdditionalOptionsroupBox, 5, 0, 2, 2); 72 m_pAdditionalOptionsGroupBox = new UICloneVMAdditionalOptionsEditor; 73 if (m_pAdditionalOptionsGroupBox) 74 { 75 m_pMainLayout->addWidget(m_pAdditionalOptionsGroupBox, 5, 0, 2, 2); 76 connect(m_pAdditionalOptionsGroupBox, &UICloneVMAdditionalOptionsEditor::sigMACAddressClonePolicyChanged, 77 this, &UIWizardCloneVMPageExpert::sltMACAddressClonePolicyChanged); 78 connect(m_pAdditionalOptionsGroupBox, &UICloneVMAdditionalOptionsEditor::sigKeepDiskNamesToggled, 79 this, &UIWizardCloneVMPageExpert::sltKeepDiskNamesToggled); 80 connect(m_pAdditionalOptionsGroupBox, &UICloneVMAdditionalOptionsEditor::sigKeepHardwareUUIDsToggled, 81 this, &UIWizardCloneVMPageExpert::sltKeepHardwareUUIDsToggled); 82 } 83 67 84 retranslateUi(); 68 85 } … … 77 94 if (m_pCloneModeGroupBox) 78 95 m_pCloneModeGroupBox->setTitle(UIWizardCloneVM::tr("Snapshots")); 79 if (m_pAdditionalOptions roupBox)80 m_pAdditionalOptions roupBox->setTitle(UIWizardCloneVM::tr("Additional options"));96 if (m_pAdditionalOptionsGroupBox) 97 m_pAdditionalOptionsGroupBox->setTitle(UIWizardCloneVM::tr("Additional options")); 81 98 } 82 99 83 100 void UIWizardCloneVMPageExpert::initializePage() 84 101 { 102 if (m_pNamePathGroupBox) 103 { 104 m_pNamePathGroupBox->setFocus(); 105 cloneVMWizardPropertySet(CloneName, m_pNamePathGroupBox->cloneName()); 106 cloneVMWizardPropertySet(CloneFilePath, 107 UIWizardCloneVMNamePage::composeCloneFilePath(m_pNamePathGroupBox->cloneName(), m_strGroup, m_pNamePathGroupBox->clonePath())); 108 } 109 if (m_pAdditionalOptionsGroupBox) 110 { 111 cloneVMWizardPropertySet(MacAddressPolicy, m_pAdditionalOptionsGroupBox->macAddressClonePolicy()); 112 cloneVMWizardPropertySet(KeepDiskNames, m_pAdditionalOptionsGroupBox->keepDiskNames()); 113 cloneVMWizardPropertySet(KeepHardwareUUIDs, m_pAdditionalOptionsGroupBox->keepHardwareUUIDs()); 114 } 115 if (m_pCloneTypeGroupBox) 116 cloneVMWizardPropertySet(LinkedClone, !m_pCloneTypeGroupBox->isFullClone()); 117 if (m_pCloneModeGroupBox) 118 cloneVMWizardPropertySet(CloneMode, m_pCloneModeGroupBox->cloneMode()); 119 85 120 retranslateUi(); 86 121 } … … 88 123 bool UIWizardCloneVMPageExpert::isComplete() const 89 124 { 90 // if (!m_pPathSelector) 91 // return false; 92 93 // QString path = m_pPathSelector->path(); 94 // if (path.isEmpty()) 95 // return false; 96 // /* Make sure VM name feat the rules: */ 97 // QString strName = m_pNameLineEdit->text().trimmed(); 98 // return !strName.isEmpty() && strName != m_strOriginalName; 99 return true; 125 return m_pNamePathGroupBox && m_pNamePathGroupBox->isComplete(m_strGroup); 100 126 } 101 127 102 128 bool UIWizardCloneVMPageExpert::validatePage() 103 129 { 104 /* Initial result: */ 105 bool fResult = true; 106 107 // /* Lock finish button: */ 108 // startProcessing(); 109 110 // /* Trying to clone VM: */ 111 // if (fResult) 112 // fResult = qobject_cast<UIWizardCloneVM*>(wizard())->cloneVM(); 113 114 // /* Unlock finish button: */ 115 // endProcessing(); 116 117 /* Return result: */ 118 return fResult; 130 return qobject_cast<UIWizardCloneVM*>(wizard())->cloneVM();; 119 131 } 120 132 121 //void UIWizardCloneVMPageExpert::sltNameChanged() 122 //{ 123 //composeCloneFilePath(); 124 //} 133 void UIWizardCloneVMPageExpert::sltCloneNameChanged(const QString &strCloneName) 134 { 135 AssertReturnVoid(m_pNamePathGroupBox); 136 cloneVMWizardPropertySet(CloneName, strCloneName); 137 cloneVMWizardPropertySet(CloneFilePath, 138 UIWizardCloneVMNamePage::composeCloneFilePath(strCloneName, m_strGroup, m_pNamePathGroupBox->clonePath())); 139 } 125 140 126 //void UIWizardCloneVMPageExpert::sltPathChanged() 127 //{ 128 //composeCloneFilePath(); 129 //} 141 void UIWizardCloneVMPageExpert::sltClonePathChanged(const QString &strClonePath) 142 { 143 AssertReturnVoid(m_pNamePathGroupBox); 144 cloneVMWizardPropertySet(CloneFilePath, 145 UIWizardCloneVMNamePage::composeCloneFilePath(m_pNamePathGroupBox->cloneName(), m_strGroup, strClonePath)); 146 } 147 148 void UIWizardCloneVMPageExpert::sltMACAddressClonePolicyChanged(MACAddressClonePolicy enmMACAddressClonePolicy) 149 { 150 cloneVMWizardPropertySet(MacAddressPolicy, enmMACAddressClonePolicy); 151 } 152 153 void UIWizardCloneVMPageExpert::sltKeepDiskNamesToggled(bool fKeepDiskNames) 154 { 155 cloneVMWizardPropertySet(KeepDiskNames, fKeepDiskNames); 156 } 157 158 void UIWizardCloneVMPageExpert::sltKeepHardwareUUIDsToggled(bool fKeepHardwareUUIDs) 159 { 160 cloneVMWizardPropertySet(KeepHardwareUUIDs, fKeepHardwareUUIDs); 161 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.h
r90696 r90702 24 24 /* Local includes: */ 25 25 #include "UINativeWizardPage.h" 26 #include "UIWizardCloneVMEditors.h" 26 27 27 28 /* Forward declarations: */ … … 54 55 private slots: 55 56 56 /* Button toggle handler: */ 57 // void sltButtonToggled(QAbstractButton *pButton, bool fChecked); 58 // void sltNameChanged(); 59 // void sltPathChanged(); 57 void sltCloneNameChanged(const QString &strCloneName); 58 void sltClonePathChanged(const QString &strClonePath); 59 void sltMACAddressClonePolicyChanged(MACAddressClonePolicy enmMACAddressClonePolicy); 60 void sltKeepDiskNamesToggled(bool fKeepDiskNames); 61 void sltKeepHardwareUUIDsToggled(bool fKeepHardwareUUIDs); 60 62 61 63 private: … … 76 78 UICloneVMCloneTypeGroupBox *m_pCloneTypeGroupBox; 77 79 UICloneVMCloneModeGroupBox *m_pCloneModeGroupBox; 78 UICloneVMAdditionalOptionsEditor *m_pAdditionalOptionsroupBox; 80 UICloneVMAdditionalOptionsEditor *m_pAdditionalOptionsGroupBox; 81 QString m_strGroup; 79 82 }; 80 83 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardCloneVMEditors.cpp
r90696 r90702 20 20 #include <QCheckBox> 21 21 #include <QComboBox> 22 // #include <QDir> 23 // #include <QFileInfo> 22 #include <QDir> 24 23 #include <QLabel> 25 24 #include <QRadioButton> … … 28 27 /* GUI includes: */ 29 28 #include "QILineEdit.h" 30 // #include "QIToolButton.h"31 // #include "QIRichTextLabel.h"32 29 #include "UICommon.h" 33 // #include "UIConverter.h"34 30 #include "UIFilePathSelector.h" 35 // #include "UIHostnameDomainNameEditor.h"36 // #include "UIIconPool.h"37 // #include "UIMediumSizeEditor.h"38 // #include "UIUserNamePasswordEditor.h"39 // #include "UIWizardDiskEditors.h"40 // #include "UIWizardNewVM.h"41 // #include "UIWizardNewVMDiskPageBasic.h"42 31 #include "UIWizardCloneVMEditors.h" 43 32 44 33 /* Other VBox includes: */ 45 34 #include "iprt/assert.h" 46 // #include "iprt/fs.h"47 35 #include "COMEnums.h" 48 36 #include "CSystemProperties.h" … … 64 52 { 65 53 prepare(); 54 } 55 56 bool UICloneVMNamePathEditor::isComplete(const QString &strMachineGroup) 57 { 58 AssertReturn(m_pNameLineEdit && m_pPathSelector, false); 59 60 bool fInvalidName = m_pNameLineEdit->text().isEmpty(); 61 m_pNameLineEdit->mark(fInvalidName, tr("Clone name cannot be empty")); 62 63 const QString &strPath = m_pPathSelector->path(); 64 QDir dir(strPath); 65 bool fInvalidPath = strPath.isEmpty() || !dir.exists() || !dir.isReadable(); 66 m_pPathSelector->mark(fInvalidPath, tr("Path is invalid")); 67 68 /* Check if there is already a machine folder for this name and path: */ 69 bool fExists = false; 70 if (!fInvalidName) 71 { 72 CVirtualBox vbox = uiCommon().virtualBox(); 73 QString strCloneFilePath = 74 vbox.ComposeMachineFilename(m_pNameLineEdit->text(), strMachineGroup, QString(), m_pPathSelector->path()); 75 fExists = QDir(QDir::toNativeSeparators(QFileInfo(strCloneFilePath).absolutePath())).exists(); 76 m_pNameLineEdit->mark(fExists, tr("The clone name is not unique")); 77 } 78 79 return !fInvalidName && !fInvalidPath && !fExists; 66 80 } 67 81 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardCloneVMEditors.h
r90696 r90702 77 77 void setClonePath(const QString &strPath); 78 78 79 bool isComplete( );79 bool isComplete(const QString &strMachineGroup); 80 80 81 81 private:
Note:
See TracChangeset
for help on using the changeset viewer.

