Changeset 90599 in vbox for trunk/src/VBox
- Timestamp:
- Aug 10, 2021 1:18:31 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp
r90589 r90599 199 199 void UIWizardCloneVMPageBasic1::retranslateUi() 200 200 { 201 // /* Translate page: */202 201 setTitle(UIWizardCloneVM::tr("New machine name and path")); 203 202 … … 206 205 "The new machine will be a clone of the machine <b>%1</b>.</p>") 207 206 .arg(m_strOriginalName)); 207 208 int iMaxWidth = 0; 209 if (m_pNamePathEditor) 210 iMaxWidth = qMax(iMaxWidth, m_pNamePathEditor->firstColumnWidth()); 211 if (m_pAdditionalOptionsEditor) 212 iMaxWidth = qMax(iMaxWidth, m_pAdditionalOptionsEditor->firstColumnWidth()); 213 214 if (m_pNamePathEditor) 215 m_pNamePathEditor->setFirstColumnWidth(iMaxWidth); 216 if (m_pAdditionalOptionsEditor) 217 m_pAdditionalOptionsEditor->setFirstColumnWidth(iMaxWidth); 208 218 } 209 219 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.h
r90589 r90599 79 79 // QLabel *m_pMACComboBoxLabel; 80 80 // QComboBox *m_pMACComboBox; 81 // QCheckBox *m_pKeepDiskNamesCheckBox;82 // QCheckBox *m_pKeepHWUUIDsCheckBox;83 81 // }; 84 82 … … 115 113 QIRichTextLabel *m_pMainLabel; 116 114 // QGridLayout *m_pContainerLayout; 117 // QLabel *m_pAdditionalOptionsLabel;118 115 119 116 UICloneVMNamePathEditor *m_pNamePathEditor; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardCloneVMEditors.cpp
r90589 r90599 18 18 /* Qt includes: */ 19 19 // #include <QButtonGroup> 20 //#include <QCheckBox>20 #include <QCheckBox> 21 21 #include <QComboBox> 22 22 // #include <QDir> … … 55 55 UICloneVMNamePathEditor::UICloneVMNamePathEditor(const QString &strOriginalName, const QString &strDefaultPath, QWidget *pParent /* = 0 */) 56 56 :QIWithRetranslateUI<QGroupBox>(pParent) 57 , m_pContainerLayout(0) 57 58 , m_pNameLineEdit(0) 58 59 , m_pPathSelector(0) … … 65 66 } 66 67 68 void UICloneVMNamePathEditor::setFirstColumnWidth(int iWidth) 69 { 70 if (m_pContainerLayout) 71 m_pContainerLayout->setColumnMinimumWidth(0, iWidth); 72 } 73 74 int UICloneVMNamePathEditor::firstColumnWidth() const 75 { 76 int iMaxWidth = 0; 77 if (m_pNameLabel) 78 iMaxWidth = qMax(iMaxWidth, m_pNameLabel->minimumSizeHint().width()); 79 if (m_pPathLabel) 80 iMaxWidth = qMax(iMaxWidth, m_pPathLabel->minimumSizeHint().width()); 81 return iMaxWidth; 82 } 83 67 84 void UICloneVMNamePathEditor::prepare() 68 85 { 69 QGridLayout *pContainerLayout = new QGridLayout(this);70 pContainerLayout->setContentsMargins(0, 0, 0, 0);86 m_pContainerLayout = new QGridLayout(this); 87 m_pContainerLayout->setContentsMargins(0, 0, 0, 0); 71 88 72 89 m_pNameLabel = new QLabel; … … 75 92 m_pNameLabel->setAlignment(Qt::AlignRight); 76 93 m_pNameLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 77 pContainerLayout->addWidget(m_pNameLabel, 0, 0, 1, 1);94 m_pContainerLayout->addWidget(m_pNameLabel, 0, 0, 1, 1); 78 95 } 79 96 … … 81 98 if (m_pNameLineEdit) 82 99 { 83 pContainerLayout->addWidget(m_pNameLineEdit, 0, 1, 1, 1);100 m_pContainerLayout->addWidget(m_pNameLineEdit, 0, 1, 1, 1); 84 101 m_pNameLineEdit->setText(tr("%1 Clone").arg(m_strOriginalName)); 85 102 } … … 90 107 m_pPathLabel->setAlignment(Qt::AlignRight); 91 108 m_pPathLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 92 pContainerLayout->addWidget(m_pPathLabel, 1, 0, 1, 1);109 m_pContainerLayout->addWidget(m_pPathLabel, 1, 0, 1, 1); 93 110 } 94 111 … … 96 113 if (m_pPathSelector) 97 114 { 98 pContainerLayout->addWidget(m_pPathSelector, 1, 1, 1, 1);115 m_pContainerLayout->addWidget(m_pPathSelector, 1, 1, 1, 1); 99 116 m_pPathSelector->setPath(m_strDefaultPath); 100 117 } 118 101 119 retranslateUi(); 102 120 } … … 110 128 m_pPathLabel->setText(tr("Path:")); 111 129 } 130 112 131 113 132 … … 119 138 UICloneVMAdditionalOptionsEditor::UICloneVMAdditionalOptionsEditor(QWidget *pParent /* = 0 */) 120 139 :QIWithRetranslateUI<QGroupBox>(pParent) 140 , m_pContainerLayout(0) 121 141 , m_pMACComboBoxLabel(0) 122 142 , m_pMACComboBox(0) 143 , m_pAdditionalOptionsLabel(0) 144 , m_pKeepDiskNamesCheckBox(0) 145 , m_pKeepHWUUIDsCheckBox(0) 123 146 { 124 147 prepare(); 148 } 149 150 void UICloneVMAdditionalOptionsEditor::setFirstColumnWidth(int iWidth) 151 { 152 if (m_pContainerLayout) 153 m_pContainerLayout->setColumnMinimumWidth(0, iWidth); 154 } 155 156 int UICloneVMAdditionalOptionsEditor::firstColumnWidth() const 157 { 158 int iMaxWidth = 0; 159 if (m_pMACComboBoxLabel) 160 iMaxWidth = qMax(iMaxWidth, m_pMACComboBoxLabel->minimumSizeHint().width()); 161 if (m_pAdditionalOptionsLabel) 162 iMaxWidth = qMax(iMaxWidth, m_pAdditionalOptionsLabel->minimumSizeHint().width()); 163 return iMaxWidth; 125 164 } 126 165 … … 139 178 void UICloneVMAdditionalOptionsEditor::prepare() 140 179 { 141 QGridLayout *pContainerLayout = new QGridLayout(this);142 pContainerLayout->setContentsMargins(0, 0, 0, 0);180 m_pContainerLayout = new QGridLayout(this); 181 m_pContainerLayout->setContentsMargins(0, 0, 0, 0); 143 182 144 183 m_pMACComboBoxLabel = new QLabel; … … 147 186 m_pMACComboBoxLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); 148 187 m_pMACComboBoxLabel->setBuddy(m_pMACComboBox); 149 pContainerLayout->addWidget(m_pMACComboBoxLabel, 2, 0, 1, 1);188 m_pContainerLayout->addWidget(m_pMACComboBoxLabel, 2, 0, 1, 1); 150 189 } 151 190 152 191 m_pMACComboBox = new QComboBox; 153 192 if (m_pMACComboBox) 154 pContainerLayout->addWidget(m_pMACComboBox, 2, 1, 1, 1);193 m_pContainerLayout->addWidget(m_pMACComboBox, 2, 1, 1, 1); 155 194 populateMACAddressClonePolicies(); 195 196 197 /* Load currently supported clone options: */ 198 CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties(); 199 const QVector<KCloneOptions> supportedOptions = comProperties.GetSupportedCloneOptions(); 200 /* Check whether we support additional clone options at all: */ 201 int iVerticalPosition = 3; 202 const bool fSupportedKeepDiskNames = supportedOptions.contains(KCloneOptions_KeepDiskNames); 203 const bool fSupportedKeepHWUUIDs = supportedOptions.contains(KCloneOptions_KeepHwUUIDs); 204 if (fSupportedKeepDiskNames || fSupportedKeepHWUUIDs) 205 { 206 m_pAdditionalOptionsLabel = new QLabel; 207 if (m_pAdditionalOptionsLabel) 208 { 209 m_pAdditionalOptionsLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); 210 m_pContainerLayout->addWidget(m_pAdditionalOptionsLabel, iVerticalPosition, 0, 1, 1); 211 } 212 } 213 if (fSupportedKeepDiskNames) 214 { 215 m_pKeepDiskNamesCheckBox = new QCheckBox; 216 if (m_pKeepDiskNamesCheckBox) 217 m_pContainerLayout->addWidget(m_pKeepDiskNamesCheckBox, iVerticalPosition++, 1, 1, 1); 218 } 219 if (fSupportedKeepHWUUIDs) 220 { 221 m_pKeepHWUUIDsCheckBox = new QCheckBox; 222 if (m_pKeepHWUUIDsCheckBox) 223 m_pContainerLayout->addWidget(m_pKeepHWUUIDsCheckBox, iVerticalPosition++, 1, 1, 1); 224 } 225 226 156 227 retranslateUi(); 157 228 } … … 187 258 } 188 259 } 260 261 if (m_pAdditionalOptionsLabel) 262 m_pAdditionalOptionsLabel->setText(tr("Additional Options:")); 263 if (m_pKeepDiskNamesCheckBox) 264 { 265 m_pKeepDiskNamesCheckBox->setToolTip(tr("Don't change the disk names during cloning.")); 266 m_pKeepDiskNamesCheckBox->setText(tr("Keep &Disk Names")); 267 } 268 if (m_pKeepHWUUIDsCheckBox) 269 { 270 m_pKeepHWUUIDsCheckBox->setToolTip(tr("Don't change hardware UUIDs during cloning.")); 271 m_pKeepHWUUIDsCheckBox->setText(tr("Keep &Hardware UUIDs")); 272 } 273 189 274 } 190 275 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardCloneVMEditors.h
r90589 r90599 33 33 // class CMediumFormat; 34 34 // class QButtonGroup; 35 //class QCheckBox;36 //class QGridLayout;35 class QCheckBox; 36 class QGridLayout; 37 37 class QComboBox; 38 38 class QLabel; … … 74 74 UICloneVMNamePathEditor(const QString &strOriginalName, const QString &strDefaultPath, QWidget *pParent = 0); 75 75 76 void setFirstColumnWidth(int iWidth); 77 int firstColumnWidth() const; 78 76 79 QString name() const; 77 80 void setName(const QString &strName); … … 81 84 bool isComplete(); 82 85 86 83 87 private: 84 88 … … 86 90 virtual void retranslateUi() /* override final */; 87 91 92 QGridLayout *m_pContainerLayout; 88 93 QILineEdit *m_pNameLineEdit; 89 94 UIFilePathSelector *m_pPathSelector; … … 111 116 MACAddressClonePolicy macAddressClonePolicy() const; 112 117 void setMACAddressClonePolicy(MACAddressClonePolicy enmMACAddressClonePolicy); 118 void setFirstColumnWidth(int iWidth); 119 int firstColumnWidth() const; 113 120 114 121 private: … … 118 125 void populateMACAddressClonePolicies(); 119 126 127 QGridLayout *m_pContainerLayout; 120 128 QLabel *m_pMACComboBoxLabel; 121 129 QComboBox *m_pMACComboBox; 122 130 QLabel *m_pAdditionalOptionsLabel; 131 QCheckBox *m_pKeepDiskNamesCheckBox; 132 QCheckBox *m_pKeepHWUUIDsCheckBox; 123 133 }; 124 134
Note:
See TracChangeset
for help on using the changeset viewer.