Changeset 106079 in vbox for trunk/src/VBox
- Timestamp:
- Sep 18, 2024 12:17:40 PM (3 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIHostnameDomainNameEditor.cpp
r106061 r106079 41 41 #include "UIHostnameDomainNameEditor.h" 42 42 #include "UITranslationEventListener.h" 43 #include "UIWizardNewVM.h" 43 44 44 45 /* Other VBox includes: */ … … 50 51 , m_pHostnameLineEdit(0) 51 52 , m_pDomainNameLineEdit(0) 53 , m_pProductKeyLineEdit(0) 52 54 , m_pHostnameLabel(0) 53 55 , m_pDomainNameLabel(0) 56 , m_pProductKeyLabel(0) 54 57 , m_pMainLayout(0) 55 58 { … … 110 113 } 111 114 112 int UIHostnameDomainNameEditor::firstColumnWidth() const113 {114 int iWidth = 0;115 if (m_pHostnameLabel)116 iWidth = qMax(iWidth, m_pHostnameLabel->minimumSizeHint().width());117 if (m_pDomainNameLabel)118 iWidth = qMax(iWidth, m_pDomainNameLabel->minimumSizeHint().width());119 return iWidth;120 }121 122 void UIHostnameDomainNameEditor::setFirstColumnWidth(int iWidth)123 {124 if (m_pMainLayout)125 m_pMainLayout->setColumnMinimumWidth(0, iWidth);126 }127 128 115 void UIHostnameDomainNameEditor::sltRetranslateUI() 129 116 { … … 136 123 if (m_pDomainNameLineEdit) 137 124 m_pDomainNameLineEdit->setToolTip(tr("Holds the domain name.")); 125 if (m_pProductKeyLabel) 126 m_pProductKeyLabel->setText(UIWizardNewVM::tr("&Product Key:")); 127 if (m_pProductKeyLineEdit) 128 m_pProductKeyLineEdit->setToolTip(UIWizardNewVM::tr("Holds the product key.")); 138 129 } 139 130 … … 167 158 setLayout(m_pMainLayout); 168 159 int iRow = 0; 160 161 162 163 addLineEdit(iRow, m_pProductKeyLabel, m_pProductKeyLineEdit, m_pMainLayout); 169 164 addLineEdit(iRow, m_pHostnameLabel, m_pHostnameLineEdit, m_pMainLayout); 170 165 addLineEdit(iRow, m_pDomainNameLabel, m_pDomainNameLineEdit, m_pMainLayout); 166 167 if (m_pProductKeyLineEdit) 168 { 169 m_pProductKeyLineEdit->setInputMask(">NNNNN-NNNNN-NNNNN-NNNNN-NNNNN;#"); 170 m_pProductKeyLineEdit->setMinimumWidth(fontMetrics().horizontalAdvance("NNNNN-NNNNN-NNNNN-NNNNN-NNNNN")); 171 } 171 172 172 173 /* Host name and domain should be strings of minimum length of 2 and composed of alpha numerics, '-', and '.' … … 179 180 connect(m_pDomainNameLineEdit, &QILineEdit::textChanged, 180 181 this, &UIHostnameDomainNameEditor::sltDomainChanged); 182 connect(m_pProductKeyLineEdit, &QILineEdit::textChanged, 183 this, &UIHostnameDomainNameEditor::sigProductKeyChanged); 181 184 182 185 sltRetranslateUI(); … … 202 205 emit sigHostnameDomainNameChanged(hostnameDomainName(), isComplete()); 203 206 } 207 208 void UIHostnameDomainNameEditor::disableEnableProductKeyWidgets(bool fEnabled) 209 { 210 if (m_pProductKeyLabel) 211 m_pProductKeyLabel->setEnabled(fEnabled); 212 if (m_pProductKeyLineEdit) 213 m_pProductKeyLineEdit->setEnabled(fEnabled); 214 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIHostnameDomainNameEditor.h
r106061 r106079 50 50 51 51 void sigHostnameDomainNameChanged(const QString &strHostNameDomain, bool fIsComplete); 52 void sigProductKeyChanged(const QString &strProductKey); 52 53 53 54 public: … … 66 67 void mark(); 67 68 68 int firstColumnWidth() const; 69 void setFirstColumnWidth(int iWidth); 69 void disableEnableProductKeyWidgets(bool fEnabled); 70 70 71 71 private slots: … … 82 82 QILineEdit *m_pHostnameLineEdit; 83 83 QILineEdit *m_pDomainNameLineEdit; 84 QILineEdit *m_pProductKeyLineEdit; 84 85 85 86 QLabel *m_pHostnameLabel; 86 87 QLabel *m_pDomainNameLabel; 88 QLabel *m_pProductKeyLabel; 87 89 QGridLayout *m_pMainLayout; 88 90 }; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.cpp
r106061 r106079 225 225 UIAdditionalUnattendedOptions::UIAdditionalUnattendedOptions(QWidget *pParent /* = 0 */) 226 226 : QGroupBox(pParent) 227 , m_pProductKeyLabel(0)228 , m_pProductKeyLineEdit(0)229 227 , m_pHostnameDomainNameEditor(0) 230 228 , m_pStartHeadlessCheckBox(0) … … 238 236 m_pMainLayout->setColumnStretch(0, 0); 239 237 m_pMainLayout->setColumnStretch(1, 1); 240 m_pProductKeyLabel = new QLabel;241 if (m_pProductKeyLabel)242 {243 m_pProductKeyLabel->setAlignment(Qt::AlignRight);244 m_pProductKeyLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);245 m_pMainLayout->addWidget(m_pProductKeyLabel, 0, 0);246 }247 m_pProductKeyLineEdit = new QILineEdit;248 if (m_pProductKeyLineEdit)249 {250 m_pProductKeyLineEdit->setInputMask(">NNNNN-NNNNN-NNNNN-NNNNN-NNNNN;#");251 if (m_pProductKeyLabel)252 m_pProductKeyLabel->setBuddy(m_pProductKeyLineEdit);253 m_pMainLayout->addWidget(m_pProductKeyLineEdit, 0, 1, 1, 2);254 }255 238 256 239 m_pHostnameDomainNameEditor = new UIHostnameDomainNameEditor; … … 263 246 264 247 if (m_pHostnameDomainNameEditor) 248 { 265 249 connect(m_pHostnameDomainNameEditor, &UIHostnameDomainNameEditor::sigHostnameDomainNameChanged, 266 250 this, &UIAdditionalUnattendedOptions::sigHostnameDomainNameChanged); 267 if (m_pProductKeyLineEdit) 268 connect(m_pProductKeyLineEdit, &QILineEdit::textChanged, 251 connect(m_pHostnameDomainNameEditor, &UIHostnameDomainNameEditor::sigProductKeyChanged, 269 252 this, &UIAdditionalUnattendedOptions::sigProductKeyChanged); 253 } 270 254 if (m_pStartHeadlessCheckBox) 271 255 connect(m_pStartHeadlessCheckBox, &QCheckBox::toggled, … … 280 264 { 281 265 setTitle(UIWizardNewVM::tr("Additional Options")); 282 283 if (m_pProductKeyLabel)284 m_pProductKeyLabel->setText(UIWizardNewVM::tr("&Product Key:"));285 266 286 267 if (m_pStartHeadlessCheckBox) … … 290 271 "unattended guest OS installation of newly created virtual machine.")); 291 272 } 292 293 int iMaxWidth = 0;294 if (m_pProductKeyLabel)295 iMaxWidth = qMax(m_pProductKeyLabel->minimumSizeHint().width(), iMaxWidth);296 if (m_pHostnameDomainNameEditor)297 iMaxWidth = qMax(m_pHostnameDomainNameEditor->firstColumnWidth(), iMaxWidth);298 if (iMaxWidth > 0)299 {300 m_pMainLayout->setColumnMinimumWidth(0, iMaxWidth);301 m_pHostnameDomainNameEditor->setFirstColumnWidth(iMaxWidth);302 }303 if (m_pProductKeyLineEdit)304 m_pProductKeyLineEdit->setToolTip(UIWizardNewVM::tr("Holds the product key."));305 273 } 306 274 … … 359 327 void UIAdditionalUnattendedOptions::disableEnableProductKeyWidgets(bool fEnabled) 360 328 { 361 if (m_pProductKeyLabel) 362 m_pProductKeyLabel->setEnabled(fEnabled); 363 if (m_pProductKeyLineEdit) 364 m_pProductKeyLineEdit->setEnabled(fEnabled); 329 if (m_pHostnameDomainNameEditor) 330 m_pHostnameDomainNameEditor->disableEnableProductKeyWidgets(fEnabled); 365 331 } 366 332 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.h
r105742 r106079 124 124 125 125 void sigHostnameDomainNameChanged(const QString &strHostnameDomainName, bool fIsComplete); 126 void sigProductKeyChanged(const QString &str HostnameDomainName);126 void sigProductKeyChanged(const QString &strProductKey); 127 127 void sigStartHeadlessChanged(bool fChecked); 128 128 … … 152 152 void prepare(); 153 153 154 QLabel *m_pProductKeyLabel; 155 QILineEdit *m_pProductKeyLineEdit; 154 155 156 156 UIHostnameDomainNameEditor *m_pHostnameDomainNameEditor; 157 157 QCheckBox *m_pStartHeadlessCheckBox;
Note:
See TracChangeset
for help on using the changeset viewer.