Changeset 90696 in vbox
- Timestamp:
- Aug 16, 2021 1:30:36 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/clonevm/UIWizardCloneVM.cpp
r90674 r90696 59 59 bool UIWizardCloneVM::isCloneModePageVisible() const 60 60 { 61 /* If we did not create the clone mode page return false: */ 61 62 if (m_iCloneModePageIndex == -1) 62 63 return false; … … 252 253 { 253 254 case WizardMode_Basic: 254 case WizardMode_Expert:255 255 { 256 256 addPage(new UIWizardCloneVMPageBasic1(m_strCloneName, strDefaultMachineFolder, m_strGroup)); … … 260 260 break; 261 261 } 262 263 { 264 // setPage(PageExpert,new UIWizardCloneVMPageExpert(m_machine.GetName(),265 //strDefaultMachineFolder,266 //m_snapshot.isNull(),267 //m_snapshot.isNull() ? false : m_snapshot.GetChildrenCount() > 0,268 //m_strGroup));262 case WizardMode_Expert: 263 { 264 addPage(new UIWizardCloneVMPageExpert(m_machine.GetName(), 265 strDefaultMachineFolder, 266 m_snapshot.isNull(), 267 m_snapshot.isNull() ? false : m_snapshot.GetChildrenCount() > 0, 268 m_strGroup)); 269 269 break; 270 270 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp
r90669 r90696 107 107 { 108 108 m_pNamePathEditor->setFlat(true); 109 m_pNamePathEditor->setLayoutContentsMargins(0, 0, 0, 0); 109 110 pMainLayout->addWidget(m_pNamePathEditor); 110 111 connect(m_pNamePathEditor, &UICloneVMNamePathEditor::sigCloneNameChanged, -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp
r90607 r90696 35 35 36 36 37 UIWizardCloneVMPageExpert::UIWizardCloneVMPageExpert(const QString & /*strOriginalName*/, const QString &/*strDefaultPath*/,37 UIWizardCloneVMPageExpert::UIWizardCloneVMPageExpert(const QString &strOriginalName, const QString &strDefaultPath, 38 38 bool /*fAdditionalInfo*/, bool fShowChildsOption, const QString &/*strGroup*/) 39 : m_fShowChildsOption(fShowChildsOption) 39 : m_pMainLayout(0) 40 , m_pNamePathGroupBox(0) 41 , m_pCloneTypeGroupBox(0) 42 , m_pCloneModeGroupBox(0) 43 , m_pAdditionalOptionsroupBox(0) 40 44 { 41 /* Create widgets: */ 42 // QGridLayout *pMainLayout = new QGridLayout(this); 43 // { 44 // m_pNameCnt = new QGroupBox(this); 45 // { 46 // QGridLayout *pNameCntLayout = new QGridLayout(m_pNameCnt); 47 // { 48 // //pNameCntLayout->setContentsMargins(0, 0, 0, 0); 49 // m_pNameLabel = new QLabel; 50 // if (m_pNameLabel) 51 // { 52 // m_pNameLabel->setAlignment(Qt::AlignRight); 53 // m_pNameLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 54 // pNameCntLayout->addWidget(m_pNameLabel, 0, 0, 1, 1); 55 56 // } 57 // m_pNameLineEdit = new QILineEdit(m_pNameCnt); 58 // if (m_pNameLineEdit) 59 // { 60 // m_pNameLineEdit->setText(UIWizardCloneVM::tr("%1 Clone").arg(m_strOriginalName)); 61 // pNameCntLayout->addWidget(m_pNameLineEdit, 0, 1, 1, 1); 62 // } 63 64 // m_pPathLabel = new QLabel(this); 65 // if (m_pPathLabel) 66 // { 67 // m_pPathLabel->setAlignment(Qt::AlignRight); 68 // m_pPathLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 69 // pNameCntLayout->addWidget(m_pPathLabel, 1, 0, 1, 1); 70 // } 71 72 // m_pPathSelector = new UIFilePathSelector(this); 73 // if (m_pPathSelector) 74 // { 75 // pNameCntLayout->addWidget(m_pPathSelector, 1, 1, 1, 1); 76 // m_pPathSelector->setPath(m_strDefaultPath); 77 // } 78 // } 79 // } 80 // /* Prepare clone-type options container: */ 81 // m_pCloneTypeCnt = new QGroupBox(this); 82 // if (m_pCloneTypeCnt) 83 // { 84 // /* Prepare clone-type options button-group: */ 85 // m_pButtonGroup = new QButtonGroup(m_pCloneTypeCnt); 86 // if (m_pButtonGroup) 87 // { 88 // /* Prepare clone-type options layout: */ 89 // QVBoxLayout *pCloneTypeCntLayout = new QVBoxLayout(m_pCloneTypeCnt); 90 // { 91 // /* Prepare full clone option radio-button: */ 92 // m_pFullCloneRadio = new QRadioButton(m_pCloneTypeCnt); 93 // if (m_pFullCloneRadio) 94 // { 95 // m_pFullCloneRadio->setChecked(true); 96 // m_pButtonGroup->addButton(m_pFullCloneRadio); 97 // pCloneTypeCntLayout->addWidget(m_pFullCloneRadio); 98 // } 99 100 // /* Load currently supported clone options: */ 101 // CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties(); 102 // const QVector<KCloneOptions> supportedOptions = comProperties.GetSupportedCloneOptions(); 103 // /* Check whether we support linked clone option at all: */ 104 // const bool fSupportedLinkedClone = supportedOptions.contains(KCloneOptions_Link); 105 106 // /* Prepare linked clone option radio-button: */ 107 // if (fSupportedLinkedClone) 108 // { 109 // m_pLinkedCloneRadio = new QRadioButton(m_pCloneTypeCnt); 110 // if (m_pLinkedCloneRadio) 111 // { 112 // m_pButtonGroup->addButton(m_pLinkedCloneRadio); 113 // pCloneTypeCntLayout->addWidget(m_pLinkedCloneRadio); 114 // } 115 // } 116 // } 117 // } 118 // } 119 // m_pCloneModeCnt = new QGroupBox(this); 120 // { 121 // QVBoxLayout *pCloneModeCntLayout = new QVBoxLayout(m_pCloneModeCnt); 122 // { 123 // m_pMachineRadio = new QRadioButton(m_pCloneModeCnt); 124 // { 125 // m_pMachineRadio->setChecked(true); 126 // } 127 // m_pMachineAndChildsRadio = new QRadioButton(m_pCloneModeCnt); 128 // { 129 // if (!m_fShowChildsOption) 130 // m_pMachineAndChildsRadio->hide(); 131 // } 132 // m_pAllRadio = new QRadioButton(m_pCloneModeCnt); 133 // pCloneModeCntLayout->addWidget(m_pMachineRadio); 134 // pCloneModeCntLayout->addWidget(m_pMachineAndChildsRadio); 135 // pCloneModeCntLayout->addWidget(m_pAllRadio); 136 // } 137 // } 138 // m_pCloneOptionsCnt = new QGroupBox(this); 139 // if (m_pCloneOptionsCnt) 140 // { 141 // m_pCloneOptionsLayout = new QGridLayout(m_pCloneOptionsCnt); 142 // /* Create MAC policy combo-box: */ 143 // m_pMACComboBox = new QComboBox; 144 // if (m_pMACComboBox) 145 // { 146 // /* Add into layout: */ 147 // m_pCloneOptionsLayout->addWidget(m_pMACComboBox, 0, 1, 1, 1); 148 // } 149 150 // /* Create format combo-box label: */ 151 // m_pMACComboBoxLabel = new QLabel; 152 // if (m_pMACComboBoxLabel) 153 // { 154 // m_pMACComboBoxLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); 155 // m_pMACComboBoxLabel->setBuddy(m_pMACComboBox); 156 // /* Add into layout: */ 157 // m_pCloneOptionsLayout->addWidget(m_pMACComboBoxLabel, 0, 0, 1, 1); 158 // } 159 160 // /* Load currently supported clone options: */ 161 // CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties(); 162 // const QVector<KCloneOptions> supportedOptions = comProperties.GetSupportedCloneOptions(); 163 // /* Check whether we support additional clone options at all: */ 164 // int iVerticalPosition = 3; 165 // const bool fSupportedKeepDiskNames = supportedOptions.contains(KCloneOptions_KeepDiskNames); 166 // const bool fSupportedKeepHWUUIDs = supportedOptions.contains(KCloneOptions_KeepHwUUIDs); 167 // if (fSupportedKeepDiskNames) 168 // { 169 // m_pKeepDiskNamesCheckBox = new QCheckBox; 170 // if (m_pKeepDiskNamesCheckBox) 171 // m_pCloneOptionsLayout->addWidget(m_pKeepDiskNamesCheckBox, iVerticalPosition++, 1, 1, 1); 172 // } 173 // if (fSupportedKeepHWUUIDs) 174 // { 175 // m_pKeepHWUUIDsCheckBox = new QCheckBox; 176 // if (m_pKeepHWUUIDsCheckBox) 177 // m_pCloneOptionsLayout->addWidget(m_pKeepHWUUIDsCheckBox, iVerticalPosition++, 1, 1, 1); 178 // } 179 // } 180 181 // pMainLayout->addWidget(m_pNameCnt, 0, 0, 1, 2); 182 // pMainLayout->addWidget(m_pCloneTypeCnt, 1, 0, Qt::AlignTop); 183 // pMainLayout->addWidget(m_pCloneModeCnt, 1, 1, Qt::AlignTop); 184 // pMainLayout->addWidget(m_pCloneOptionsCnt, 2, 0, 1, 2, Qt::AlignTop); 185 // pMainLayout->setRowStretch(3, 1); 186 // } 187 188 // /* Setup connections: */ 189 // connect(m_pNameLineEdit, &QILineEdit::textChanged, 190 // this, &UIWizardCloneVMPageExpert::completeChanged); 191 // connect(m_pPathSelector, &UIFilePathSelector::pathChanged, 192 // this, &UIWizardCloneVMPageExpert::completeChanged); 193 // connect(m_pNameLineEdit, &QILineEdit::textChanged, 194 // this, &UIWizardCloneVMPageExpert::sltNameChanged); 195 // connect(m_pPathSelector, &UIFilePathSelector::pathChanged, 196 // this, &UIWizardCloneVMPageExpert::sltPathChanged); 197 // connect(m_pButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*, bool)>(&QButtonGroup::buttonToggled), 198 // this, &UIWizardCloneVMPageExpert::sltButtonToggled); 199 200 // /* Register classes: */ 201 // qRegisterMetaType<KCloneMode>(); 202 203 // /* Populate MAC address policies: */ 204 // populateMACAddressClonePolicies(); 205 206 /* Register fields: */ 207 // registerField("cloneName", this, "cloneName"); 208 // registerField("cloneFilePath", this, "cloneFilePath"); 209 // registerField("linkedClone", this, "linkedClone"); 210 // registerField("cloneMode", this, "cloneMode"); 211 // registerField("macAddressClonePolicy", this, "macAddressClonePolicy"); 212 // registerField("keepDiskNames", this, "keepDiskNames"); 213 // registerField("keepHWUUIDs", this, "keepHWUUIDs"); 214 215 //composeCloneFilePath(); 45 prepare(strOriginalName, strDefaultPath, fShowChildsOption); 216 46 } 217 47 218 //void UIWizardCloneVMPageExpert::sltButtonToggled(QAbstractButton */*pButton*/, bool /*fChecked*/) 219 //{ 220 // if (m_pLinkedCloneRadio && pButton == m_pLinkedCloneRadio && fChecked) 221 // { 222 // m_pCloneModeCnt->setEnabled(false); 223 // m_pMachineRadio->setChecked(true); 224 // } 225 // else 226 // { 227 // m_pCloneModeCnt->setEnabled(true); 228 // } 229 //} 48 void UIWizardCloneVMPageExpert::prepare(const QString &strOriginalName, const QString &strDefaultPath, bool fShowChildsOption) 49 { 50 m_pMainLayout = new QGridLayout(this); 51 AssertReturnVoid(m_pMainLayout); 52 m_pNamePathGroupBox = new UICloneVMNamePathEditor(strOriginalName, strDefaultPath); 53 if (m_pNamePathGroupBox) 54 m_pMainLayout->addWidget(m_pNamePathGroupBox, 0, 0, 3, 2); 55 56 m_pCloneTypeGroupBox = new UICloneVMCloneTypeGroupBox; 57 if (m_pCloneTypeGroupBox) 58 m_pMainLayout->addWidget(m_pCloneTypeGroupBox, 3, 0, 2, 1); 59 60 m_pCloneModeGroupBox = new UICloneVMCloneModeGroupBox(fShowChildsOption); 61 if (m_pCloneModeGroupBox) 62 m_pMainLayout->addWidget(m_pCloneModeGroupBox, 3, 1, 2, 1); 63 64 m_pAdditionalOptionsroupBox = new UICloneVMAdditionalOptionsEditor; 65 if (m_pAdditionalOptionsroupBox) 66 m_pMainLayout->addWidget(m_pAdditionalOptionsroupBox, 5, 0, 2, 2); 67 retranslateUi(); 68 } 230 69 231 70 void UIWizardCloneVMPageExpert::retranslateUi() 232 71 { 233 // /* Translate widgets: */ 234 // m_pNameCnt->setTitle(UIWizardCloneVM::tr("New machine &name and path")); 235 // m_pCloneTypeCnt->setTitle(UIWizardCloneVM::tr("Clone type")); 236 // m_pFullCloneRadio->setText(UIWizardCloneVM::tr("&Full Clone")); 237 // if (m_pLinkedCloneRadio) 238 // m_pLinkedCloneRadio->setText(UIWizardCloneVM::tr("&Linked Clone")); 239 // m_pCloneModeCnt->setTitle(UIWizardCloneVM::tr("Snapshots")); 240 // m_pMachineRadio->setText(UIWizardCloneVM::tr("Current &machine state")); 241 // m_pMachineAndChildsRadio->setText(UIWizardCloneVM::tr("Current &snapshot tree branch")); 242 // m_pAllRadio->setText(UIWizardCloneVM::tr("&Everything")); 243 // m_pNameLabel->setText(UIWizardCloneVM::tr("Name:")); 244 // m_pPathLabel->setText(UIWizardCloneVM::tr("Path:")); 245 // m_pCloneOptionsCnt->setTitle(UIWizardCloneVM::tr("Additional options")); 246 247 // /* Translate MAC address policy combo-box: */ 248 // m_pMACComboBoxLabel->setText(UIWizardCloneVM::tr("MAC Address &Policy:")); 249 // for (int i = 0; i < m_pMACComboBox->count(); ++i) 250 // { 251 // const MACAddressClonePolicy enmPolicy = m_pMACComboBox->itemData(i).value<MACAddressClonePolicy>(); 252 // switch (enmPolicy) 253 // { 254 // case MACAddressClonePolicy_KeepAllMACs: 255 // { 256 // m_pMACComboBox->setItemText(i, UIWizardCloneVM::tr("Include all network adapter MAC addresses")); 257 // m_pMACComboBox->setItemData(i, UIWizardCloneVM::tr("Include all network adapter MAC addresses during cloning."), Qt::ToolTipRole); 258 // break; 259 // } 260 // case MACAddressClonePolicy_KeepNATMACs: 261 // { 262 // m_pMACComboBox->setItemText(i, UIWizardCloneVM::tr("Include only NAT network adapter MAC addresses")); 263 // m_pMACComboBox->setItemData(i, UIWizardCloneVM::tr("Include only NAT network adapter MAC addresses during cloning."), Qt::ToolTipRole); 264 // break; 265 // } 266 // case MACAddressClonePolicy_StripAllMACs: 267 // { 268 // m_pMACComboBox->setItemText(i, UIWizardCloneVM::tr("Generate new MAC addresses for all network adapters")); 269 // m_pMACComboBox->setItemData(i, UIWizardCloneVM::tr("Generate new MAC addresses for all network adapters during cloning."), Qt::ToolTipRole); 270 // break; 271 // } 272 // default: 273 // break; 274 // } 275 // } 276 277 // if (m_pKeepDiskNamesCheckBox) 278 // { 279 // m_pKeepDiskNamesCheckBox->setToolTip(UIWizardCloneVM::tr("Don't change the disk names during cloning.")); 280 // m_pKeepDiskNamesCheckBox->setText(UIWizardCloneVM::tr("Keep &Disk Names")); 281 // } 282 // if (m_pKeepHWUUIDsCheckBox) 283 // { 284 // m_pKeepHWUUIDsCheckBox->setToolTip(UIWizardCloneVM::tr("Don't change hardware UUIDs during cloning.")); 285 // m_pKeepHWUUIDsCheckBox->setText(UIWizardCloneVM::tr("Keep &Hardware UUIDs")); 286 // } 72 /* Translate widgets: */ 73 if (m_pNamePathGroupBox) 74 m_pNamePathGroupBox->setTitle(UIWizardCloneVM::tr("New machine &name and path")); 75 if (m_pCloneTypeGroupBox) 76 m_pCloneTypeGroupBox->setTitle(UIWizardCloneVM::tr("Clone type")); 77 if (m_pCloneModeGroupBox) 78 m_pCloneModeGroupBox->setTitle(UIWizardCloneVM::tr("Snapshots")); 79 if (m_pAdditionalOptionsroupBox) 80 m_pAdditionalOptionsroupBox->setTitle(UIWizardCloneVM::tr("Additional options")); 287 81 } 288 82 289 83 void UIWizardCloneVMPageExpert::initializePage() 290 84 { 291 /* Translate page: */292 85 retranslateUi(); 293 86 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.h
r90607 r90696 28 28 class QGroupBox; 29 29 class QGridLayout; 30 class UICloneVMAdditionalOptionsEditor; 31 class UICloneVMCloneModeGroupBox; 32 class UICloneVMCloneTypeGroupBox; 33 class UICloneVMNamePathEditor; 34 30 35 31 36 /* Expert page of the Clone Virtual Machine wizard: */ … … 61 66 /* Prepare stuff: */ 62 67 void initializePage(); 68 void prepare(const QString &strOriginalName, const QString &strDefaultPath, bool fShowChildsOption); 63 69 64 70 /* Validation stuff: */ … … 66 72 bool validatePage(); 67 73 68 /* Widgets: */ 69 QGroupBox *m_pNameCnt; 70 QGroupBox *m_pCloneTypeCnt; 71 QGroupBox *m_pCloneModeCnt; 72 QGroupBox *m_pCloneOptionsCnt; 73 QGridLayout *m_pCloneOptionsLayout; 74 75 bool m_fShowChildsOption; 74 QGridLayout *m_pMainLayout; 75 UICloneVMNamePathEditor *m_pNamePathGroupBox; 76 UICloneVMCloneTypeGroupBox *m_pCloneTypeGroupBox; 77 UICloneVMCloneModeGroupBox *m_pCloneModeGroupBox; 78 UICloneVMAdditionalOptionsEditor *m_pAdditionalOptionsroupBox; 76 79 }; 77 80 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardCloneVMEditors.cpp
r90669 r90696 108 108 } 109 109 110 void UICloneVMNamePathEditor::setLayoutContentsMargins(int iLeft, int iTop, int iRight, int iBottom) 111 { 112 if (m_pContainerLayout) 113 m_pContainerLayout->setContentsMargins(iLeft, iTop, iRight, iBottom); 114 } 115 110 116 void UICloneVMNamePathEditor::prepare() 111 117 { 112 118 m_pContainerLayout = new QGridLayout(this); 113 m_pContainerLayout->setContentsMargins(0, 0, 0, 0); 119 114 120 115 121 m_pNameLabel = new QLabel; … … 177 183 } 178 184 185 void UICloneVMAdditionalOptionsEditor::setLayoutContentsMargins(int iLeft, int iTop, int iRight, int iBottom) 186 { 187 if (m_pContainerLayout) 188 m_pContainerLayout->setContentsMargins(iLeft, iTop, iRight, iBottom); 189 } 190 179 191 void UICloneVMAdditionalOptionsEditor::setFirstColumnWidth(int iWidth) 180 192 { … … 222 234 { 223 235 m_pContainerLayout = new QGridLayout(this); 224 m_pContainerLayout->setContentsMargins(0, 0, 0, 0);225 236 226 237 m_pMACComboBoxLabel = new QLabel; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardCloneVMEditors.h
r90669 r90696 23 23 24 24 /* Qt includes: */ 25 // #include <QIcon>26 25 #include <QGroupBox> 27 26 … … 34 33 35 34 /* Forward declarations: */ 36 // class CMediumFormat;37 35 class QAbstractButton; 38 36 class QButtonGroup; … … 42 40 class QLabel; 43 41 class QRadioButton; 44 // class QVBoxLayout;45 // class QIRichTextLabel;46 42 class QILineEdit; 47 // class QIToolButton;48 43 class UIFilePathSelector; 49 // class UIHostnameDomainNameEditor;50 // class UIPasswordLineEdit;51 // class UIUserNamePasswordEditor;52 // class UIMediumSizeEditor;53 54 /* Other VBox includes: */55 // #include "COMEnums.h"56 // #include "CMediumFormat.h"57 44 58 45 /** MAC address policies. */ … … 82 69 int firstColumnWidth() const; 83 70 71 void setLayoutContentsMargins(int iLeft, int iTop, int iRight, int iBottom); 72 84 73 QString cloneName() const; 85 74 void setCloneName(const QString &strName); … … 89 78 90 79 bool isComplete(); 91 92 80 93 81 private: … … 122 110 123 111 bool isComplete(); 112 113 void setLayoutContentsMargins(int iLeft, int iTop, int iRight, int iBottom); 124 114 125 115 MACAddressClonePolicy macAddressClonePolicy() const;
Note:
See TracChangeset
for help on using the changeset viewer.