Changeset 87348 in vbox
- Timestamp:
- Jan 21, 2021 12:09:05 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142324
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBox.cpp
r87318 r87348 67 67 int titleHeight() const; 68 68 int pageWidgetHeight() const; 69 void setTitleIcon(const QIcon &icon); 69 70 70 71 protected: … … 83 84 QWidget *m_pTitleContainerWidget; 84 85 QLabel *m_pTitleLabel; 86 QLabel *m_pIconLabel; 85 87 QCheckBox *m_pEnableCheckBox; 86 88 … … 98 100 , m_pTitleContainerWidget(0) 99 101 , m_pTitleLabel(0) 102 , m_pIconLabel(0) 100 103 , m_pEnableCheckBox(0) 101 104 , m_pWidget(0) … … 118 121 119 122 m_pTitleContainerWidget = new QWidget; 123 m_pTitleContainerWidget->installEventFilter(this); 120 124 QHBoxLayout *pTitleLayout = new QHBoxLayout(m_pTitleContainerWidget); 121 125 pTitleLayout->setContentsMargins(qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin), … … 133 137 m_pTitleLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 134 138 135 m_pTitleLabel->installEventFilter(this);136 139 pTitleLayout->addWidget(m_pTitleLabel); 140 m_pIconLabel = new QLabel; 141 pTitleLayout->addWidget(m_pIconLabel, Qt::AlignLeft); 142 pTitleLayout->addStretch(); 137 143 m_pTitleContainerWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 138 144 m_pLayout->addWidget(m_pTitleContainerWidget); … … 183 189 } 184 190 191 void UIToolBoxPage::setTitleIcon(const QIcon &icon) 192 { 193 if (!m_pIconLabel) 194 return; 195 if (icon.isNull()) 196 { 197 m_pIconLabel->setPixmap(QPixmap()); 198 return; 199 } 200 const int iMetricSmall = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); 201 m_pIconLabel->setPixmap(icon.pixmap(windowHandle(), QSize(iMetricSmall, iMetricSmall))); 202 } 203 185 204 int UIToolBoxPage::titleHeight() const 186 205 { … … 199 218 bool UIToolBoxPage::eventFilter(QObject *pWatched, QEvent *pEvent) 200 219 { 201 if (pWatched == m_pTitleLabel && pEvent->type() == QEvent::MouseButtonPress) 202 emit sigShowPageWidget(); 220 if (pWatched == m_pTitleContainerWidget) 221 { 222 if (pEvent->type() == QEvent::MouseButtonPress) 223 emit sigShowPageWidget(); 224 } 203 225 return QWidget::eventFilter(pWatched, pEvent); 204 226 … … 237 259 238 260 const QPalette pal = palette(); 239 QColor tabBackgroundColor = pal.color(QPalette::Active, QPalette::Highlight).lighter(1 10);261 QColor tabBackgroundColor = pal.color(QPalette::Active, QPalette::Highlight).lighter(130); 240 262 pNewPage->setTitleBackgroundColor(tabBackgroundColor); 241 263 … … 278 300 void UIToolBox::setItemIcon(int iIndex, const QIcon &icon) 279 301 { 280 Q_UNUSED(iIndex); 281 Q_UNUSED(icon); 302 QMap<int, UIToolBoxPage*>::iterator iterator = m_pages.find(iIndex); 303 if (iterator == m_pages.end()) 304 return; 305 iterator.value()->setTitleIcon(icon); 282 306 } 283 307 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIUserNamePasswordEditor.cpp
r87249 r87348 120 120 , m_pPasswordRepeatLabel(0) 121 121 , m_fForceUnmark(false) 122 , m_fShowPlaceholderText(true) 123 , m_fLabelsVisible(true) 122 124 { 123 125 prepare(); … … 188 190 } 189 191 192 void UIUserNamePasswordEditor::setPlaceholderTextEnabled(bool fEnabled) 193 { 194 if (m_fShowPlaceholderText == fEnabled) 195 return; 196 m_fShowPlaceholderText = fEnabled; 197 retranslateUi(); 198 } 199 200 void UIUserNamePasswordEditor::setLabelsVisible(bool fVisible) 201 { 202 if (m_fLabelsVisible == fVisible) 203 return; 204 m_fLabelsVisible = fVisible; 205 m_pUserNameLabel->setVisible(fVisible); 206 m_pPasswordLabel->setVisible(fVisible); 207 m_pPasswordRepeatLabel->setVisible(fVisible); 208 209 } 210 190 211 void UIUserNamePasswordEditor::retranslateUi() 191 212 { 213 QString strPassword = UIWizardNewVM::tr("Password:"); 214 QString strRepeatPassword = UIWizardNewVM::tr("Repeat Password:"); 215 QString strUsername = UIWizardNewVM::tr("Username:"); 192 216 if (m_pUserNameLabel) 193 217 { 194 m_pUserNameLabel->setText( UIWizardNewVM::tr("User Name:"));218 m_pUserNameLabel->setText(strUsername); 195 219 m_pUserNameLabel->setToolTip(UIWizardNewVM::tr("Type the user name which will be used in attended install:")); 196 220 … … 198 222 if (m_pPasswordLabel) 199 223 { 200 m_pPasswordLabel->setText( UIWizardNewVM::tr("Password:"));224 m_pPasswordLabel->setText(strPassword); 201 225 m_pPasswordLabel->setToolTip(UIWizardNewVM::tr("Type the password for the user name")); 202 226 … … 204 228 if (m_pPasswordRepeatLabel) 205 229 { 206 m_pPasswordRepeatLabel->setText( UIWizardNewVM::tr("Repeat Password:"));230 m_pPasswordRepeatLabel->setText(strRepeatPassword); 207 231 m_pPasswordRepeatLabel->setToolTip(UIWizardNewVM::tr("Retype the password:")); 232 } 233 234 if (m_fShowPlaceholderText) 235 { 236 if(m_pUserNameLineEdit) 237 m_pUserNameLineEdit->setPlaceholderText(strUsername); 238 if (m_pPasswordLineEdit) 239 m_pPasswordLineEdit->setPlaceholderText(strPassword); 240 if (m_pPasswordRepeatLineEdit) 241 m_pPasswordRepeatLineEdit->setPlaceholderText(strRepeatPassword); 242 } 243 else 244 { 245 if(m_pUserNameLineEdit) 246 m_pUserNameLineEdit->setPlaceholderText(QString()); 247 if (m_pPasswordLineEdit) 248 m_pPasswordLineEdit->setPlaceholderText(QString()); 249 if (m_pPasswordRepeatLineEdit) 250 m_pPasswordRepeatLineEdit->setPlaceholderText(QString()); 208 251 } 209 252 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIUserNamePasswordEditor.h
r85150 r87348 88 88 void setForceUnmark(bool fForceUnmark); 89 89 90 /** When fEnabled true place holder texts for the line edits are shown. */ 91 void setPlaceholderTextEnabled(bool fEnabled); 92 void setLabelsVisible(bool fVisible); 93 90 94 protected: 91 95 … … 118 122 /** When true line edits are not marked even if they have to be. */ 119 123 bool m_fForceUnmark; 124 bool m_fShowPlaceholderText; 125 bool m_fLabelsVisible; 120 126 }; 121 127 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
r87322 r87348 448 448 bool UIWizardNewVMPage1::isUnattendedEnabled() const 449 449 { 450 if (m_pISOFilePathSelector) 451 return m_pISOFilePathSelector->isValid(); 452 return false; 450 if (!m_pISOFilePathSelector) 451 return false; 452 const QString &strPath = m_pISOFilePathSelector->path(); 453 if (strPath.isNull() || strPath.isEmpty()) 454 return false; 455 return true; 453 456 } 454 457 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.cpp
r87322 r87348 115 115 QWidget *pContainer = new QWidget; 116 116 QGridLayout *pGridLayout = new QGridLayout(pContainer); 117 pGridLayout->setContentsMargins(0, 0, 0, 0); 117 118 118 119 m_pUserNamePasswordEditor = new UIUserNamePasswordEditor; … … 159 160 QWidget *pContainer = new QWidget; 160 161 QGridLayout *pGridLayout = new QGridLayout(pContainer); 161 162 pGridLayout->setContentsMargins(0, 0, 0, 0); 162 163 m_pProductKeyLabel = new QLabel; 163 164 m_pProductKeyLabel->setAlignment(Qt::AlignRight); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
r87322 r87348 20 20 #include <QCheckBox> 21 21 #include <QGridLayout> 22 #include <QGroupBox> 22 23 #include <QHBoxLayout> 23 24 #include <QLabel> … … 45 46 : UIWizardNewVMPage1(strGroup) 46 47 , m_pToolBox(0) 48 , m_pInstallationISOContainer(0) 49 , m_pUserNameContainer(0) 50 , m_pAdditionalOptionsContainer(0) 51 , m_pGAInstallationISOContainer(0) 47 52 { 48 53 /* Create widgets: */ … … 181 186 void UIWizardNewVMPageExpert::sltOSFamilyTypeChanged() 182 187 { 183 if (m_pToolBox) 184 m_pToolBox->setItemEnabled(ExpertToolboxItems_ProductKey, isProductKeyWidgetEnabled()); 188 disableEnableProductKeyWidgets(isProductKeyWidgetEnabled()); 185 189 } 186 190 … … 190 194 UIWizardNewVMPage2::retranslateWidgets(); 191 195 UIWizardNewVMPage3::retranslateWidgets(); 192 196 if (m_pInstallationISOContainer) 197 m_pInstallationISOContainer->setTitle(UIWizardNewVM::tr("Installation medium (ISO)")); 198 if (m_pUserNameContainer) 199 m_pUserNameContainer->setTitle(UIWizardNewVM::tr("User name and password")); 200 if (m_pAdditionalOptionsContainer) 201 m_pAdditionalOptionsContainer->setTitle(UIWizardNewVM::tr("Additional options")); 202 if (m_pGAInstallationISOContainer) 203 m_pGAInstallationISOContainer->setTitle(UIWizardNewVM::tr("Guest Additions Installation Medium (ISO)")); 193 204 if (m_pToolBox) 194 205 { 195 206 m_pToolBox->setItemText(ExpertToolboxItems_NameAndOSType, QString(UIWizardNewVM::tr("Name and operating system"))); 196 m_pToolBox->setItemText(ExpertToolboxItems_UsernameHostname, UIWizardNewVM::tr("Username and hostname"));197 207 m_pToolBox->setItemText(ExpertToolboxItems_Unattended, UIWizardNewVM::tr("Unattended Install")); 198 m_pToolBox->setItemText(ExpertToolboxItems_GAInstall, UIWizardNewVM::tr("Guest additions install"));199 m_pToolBox->setItemText(ExpertToolboxItems_ProductKey, UIWizardNewVM::tr("Product key"));200 208 m_pToolBox->setItemText(ExpertToolboxItems_Disk, UIWizardNewVM::tr("Hard disk")); 201 209 m_pToolBox->setItemText(ExpertToolboxItems_Hardware, UIWizardNewVM::tr("Hardware")); … … 311 319 int iRow = 0; 312 320 313 m_pISOSelectorLabel = new QLabel; 314 if (m_pISOSelectorLabel) 315 { 316 m_pISOSelectorLabel->setAlignment(Qt::AlignRight); 317 m_pISOSelectorLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); 318 pLayout->addWidget(m_pISOSelectorLabel, iRow, 0, 1, 1); 319 } 320 321 m_pISOFilePathSelector = new UIFilePathSelector; 322 if (m_pISOFilePathSelector) 323 { 324 m_pISOFilePathSelector->setResetEnabled(false); 325 m_pISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open); 326 m_pISOFilePathSelector->setFileDialogFilters("*.iso *.ISO"); 327 pLayout->addWidget(m_pISOFilePathSelector, iRow++, 1, 1, 4); 328 } 329 330 m_pStartHeadlessCheckBox = new QCheckBox; 331 if (m_pStartHeadlessCheckBox) 332 pLayout->addWidget(m_pStartHeadlessCheckBox, iRow++, 0, 1, 5); 333 334 pLayout->addWidget(createUserNameHostNameWidgets(), iRow, 0, 4, 5); 335 iRow += 4; 336 pLayout->addWidget(createGAInstallWidgets(), iRow, 0, 2, 5); 337 iRow += 2; 338 pLayout->addWidget(createProductKeyWidgets(), iRow, 0, 1, 5); 339 340 321 /* Installation medium selector etc: */ 322 { 323 m_pInstallationISOContainer = new QGroupBox; 324 QHBoxLayout *pInstallationISOContainerLayout = new QHBoxLayout(m_pInstallationISOContainer); 325 326 m_pISOFilePathSelector = new UIFilePathSelector; 327 if (m_pISOFilePathSelector) 328 { 329 m_pISOFilePathSelector->setResetEnabled(false); 330 m_pISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open); 331 m_pISOFilePathSelector->setFileDialogFilters("*.iso *.ISO"); 332 pInstallationISOContainerLayout->addWidget(m_pISOFilePathSelector); 333 } 334 pLayout->addWidget(m_pInstallationISOContainer, iRow++, 0, 1, 4); 335 } 336 337 /* Username selector: */ 338 { 339 m_pUserNameContainer = new QGroupBox; 340 QVBoxLayout *pUserNameContainerLayout = new QVBoxLayout(m_pUserNameContainer); 341 m_pUserNamePasswordEditor = new UIUserNamePasswordEditor; 342 if (m_pUserNamePasswordEditor) 343 { 344 m_pUserNamePasswordEditor->setLabelsVisible(true); 345 pUserNameContainerLayout->addWidget(m_pUserNamePasswordEditor); 346 } 347 pLayout->addWidget(m_pUserNameContainer, iRow, 0, 1, 2); 348 } 349 350 /* Additional options: */ 351 { 352 m_pAdditionalOptionsContainer = new QGroupBox; 353 QGridLayout *pAdditionalOptionsContainerLayout = new QGridLayout(m_pAdditionalOptionsContainer); 354 m_pStartHeadlessCheckBox = new QCheckBox; 355 if (m_pStartHeadlessCheckBox) 356 pAdditionalOptionsContainerLayout->addWidget(m_pStartHeadlessCheckBox, 0, 0, 1, 4); 357 358 m_pProductKeyLabel = new QLabel; 359 if (m_pProductKeyLabel) 360 { 361 m_pProductKeyLabel->setAlignment(Qt::AlignRight); 362 m_pProductKeyLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); 363 pAdditionalOptionsContainerLayout->addWidget(m_pProductKeyLabel, 1, 0, 1, 1); 364 } 365 m_pProductKeyLineEdit = new QLineEdit; 366 if (m_pProductKeyLineEdit) 367 { 368 m_pProductKeyLineEdit->setInputMask(">NNNNN-NNNNN-NNNNN-NNNNN-NNNNN;#"); 369 pAdditionalOptionsContainerLayout->addWidget(m_pProductKeyLineEdit, 1, 1, 1, 3); 370 } 371 372 m_pHostnameLabel = new QLabel; 373 if (m_pHostnameLabel) 374 { 375 m_pHostnameLabel->setAlignment(Qt::AlignRight); 376 m_pHostnameLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); 377 pAdditionalOptionsContainerLayout->addWidget(m_pHostnameLabel, 2, 0, 1, 1); 378 } 379 380 m_pHostnameLineEdit = new QLineEdit; 381 if (m_pHostnameLineEdit) 382 pAdditionalOptionsContainerLayout->addWidget(m_pHostnameLineEdit, 2, 1, 1, 3); 383 384 // pAdditionalOptionsContainerLayout->addWidget(createHostNameWidgets()); 385 386 // pAdditionalOptionsContainerLayout->addStretch(); 387 pLayout->addWidget(m_pAdditionalOptionsContainer, iRow, 2, 1, 2); 388 } 389 ++iRow; 390 /* Guest additions installation: */ 391 { 392 m_pGAInstallationISOContainer = new QGroupBox; 393 QHBoxLayout *pGAInstallationISOContainer = new QHBoxLayout(m_pGAInstallationISOContainer); 394 m_pGAISOFilePathSelector = new UIFilePathSelector; 395 { 396 m_pGAISOFilePathSelector->setResetEnabled(false); 397 m_pGAISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open); 398 m_pGAISOFilePathSelector->setFileDialogFilters("*.iso *.ISO"); 399 m_pGAISOFilePathSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); 400 pGAInstallationISOContainer->addWidget(m_pGAISOFilePathSelector); 401 } 402 pLayout->addWidget(m_pGAInstallationISOContainer, iRow, 0, 1, 4); 403 } 341 404 return pContainerWidget; 342 405 } … … 347 410 bool fIsComplete = true; 348 411 m_pToolBox->setItemIcon(ExpertToolboxItems_NameAndOSType, QIcon()); 412 m_pToolBox->setItemIcon(ExpertToolboxItems_Unattended, QIcon()); 349 413 m_pToolBox->setItemIcon(ExpertToolboxItems_Disk, QIcon()); 350 414 m_pToolBox->setItemIcon(ExpertToolboxItems_Hardware, QIcon()); 351 m_pToolBox->setItemIcon(ExpertToolboxItems_UsernameHostname, QIcon());352 m_pToolBox->setItemIcon(ExpertToolboxItems_GAInstall, QIcon());353 m_pToolBox->setItemIcon(ExpertToolboxItems_ProductKey, QIcon());354 415 355 416 if (!UIWizardPage::isComplete()) … … 370 431 { 371 432 /* Check the installation medium: */ 372 //if (!isISOFileSelectorComplete())373 //{374 // m_pToolBox->setItemIcon(ExpertToolboxItems_NameAndOSType,375 //UIIconPool::iconSet(":/status_error_16px.png"));376 //fIsComplete = false;377 //}433 if (!isISOFileSelectorComplete()) 434 { 435 m_pToolBox->setItemIcon(ExpertToolboxItems_Unattended, 436 UIIconPool::iconSet(":/status_error_16px.png")); 437 fIsComplete = false; 438 } 378 439 /* Check the GA installation medium: */ 379 440 if (!checkGAISOFile()) 380 441 { 381 m_pToolBox->setItemIcon(ExpertToolboxItems_GAInstall,382 UIIconPool::iconSet(":/status_error_16px.png"));442 // m_pToolBox->setItemIcon(ExpertToolboxItems_Unattended, 443 // UIIconPool::iconSet(":/status_error_16px.png")); 383 444 fIsComplete = false; 384 445 } … … 387 448 if (!m_pUserNamePasswordEditor->isComplete()) 388 449 { 389 m_pToolBox->setItemIcon(ExpertToolboxItems_U sernameHostname,450 m_pToolBox->setItemIcon(ExpertToolboxItems_Unattended, 390 451 UIIconPool::iconSet(":/status_error_16px.png")); 391 452 fIsComplete = false; … … 444 505 void UIWizardNewVMPageExpert::disableEnableUnattendedRelatedWidgets(bool fEnabled) 445 506 { 446 if (m_pStartHeadlessCheckBox) 447 m_pStartHeadlessCheckBox->setEnabled(fEnabled); 448 } 507 if (m_pUserNameContainer) 508 m_pUserNameContainer->setEnabled(fEnabled); 509 if (m_pAdditionalOptionsContainer) 510 m_pAdditionalOptionsContainer->setEnabled(fEnabled); 511 if (m_pGAInstallationISOContainer) 512 m_pGAInstallationISOContainer->setEnabled(fEnabled); 513 disableEnableProductKeyWidgets(isProductKeyWidgetEnabled()); 514 } 515 516 void UIWizardNewVMPageExpert::disableEnableProductKeyWidgets(bool fEnabled) 517 { 518 if (m_pProductKeyLabel) 519 m_pProductKeyLabel->setEnabled(fEnabled); 520 if (m_pProductKeyLineEdit) 521 m_pProductKeyLineEdit->setEnabled(fEnabled); 522 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h
r87322 r87348 28 28 29 29 /* Forward declarations: */ 30 class QGroupBox; 30 31 class UIToolBox; 31 32 … … 91 92 ExpertToolboxItems_Disk, 92 93 ExpertToolboxItems_Hardware, 93 ExpertToolboxItems_UsernameHostname,94 ExpertToolboxItems_GAInstall,95 ExpertToolboxItems_ProductKey96 94 }; 97 95 /** Translation stuff. */ … … 109 107 bool isProductKeyWidgetEnabled() const; 110 108 void disableEnableUnattendedRelatedWidgets(bool fEnabled); 109 void disableEnableProductKeyWidgets(bool fEnabled); 111 110 void markWidgets() const; 112 111 QWidget *createUnattendedWidgets(); 113 112 114 115 113 UIToolBox *m_pToolBox; 114 QGroupBox *m_pInstallationISOContainer; 115 QGroupBox *m_pUserNameContainer; 116 QGroupBox *m_pAdditionalOptionsContainer; 117 QGroupBox *m_pGAInstallationISOContainer; 116 118 }; 117 119
Note:
See TracChangeset
for help on using the changeset viewer.