Changeset 85150 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 9, 2020 12:56:45 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139101
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.cpp
r82968 r85150 20 20 21 21 /* Qt includes: */ 22 #include <QPalette> 22 23 #include <QStyleOptionFrame> 23 24 25 QILineEdit::QILineEdit(QWidget *pParent /* = 0 */) 26 : QLineEdit(pParent) 27 { 28 m_originalBaseColor = palette().color(QPalette::Base); 29 } 24 30 25 31 void QILineEdit::setMinimumWidthByText(const QString &strText) … … 52 58 return sa; 53 59 } 60 61 void QILineEdit::mark(bool fError) 62 { 63 QPalette newPalette = palette(); 64 if (fError) 65 newPalette.setColor(QPalette::Base, QColor(255, 180, 180)); 66 else 67 newPalette.setColor(QPalette::Base, m_originalBaseColor); 68 setPalette(newPalette); 69 } -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.h
r82968 r85150 36 36 37 37 /** Constructs label-separator passing @a pParent to the base-class. */ 38 QILineEdit(QWidget *pParent = 0) 39 : QLineEdit(pParent) {} 38 QILineEdit(QWidget *pParent = 0); 39 40 40 /** Constructs label-separator passing @a pParent to the base-class. 41 41 * @param strContents Brings the line-edit text. */ … … 48 48 void setFixedWidthByText(const QString &strText); 49 49 50 /** Sets the color to some reddish color when @p fError is true. Usually used to indicate some error. */ 51 void mark(bool fError); 52 50 53 private: 51 54 52 55 /** Calculates suitable @a strText size. */ 53 56 QSize featTextWidth(const QString &strText) const; 57 /** The original background base color. Used when marking/unmarking the combo box. */ 58 QColor m_originalBaseColor; 54 59 }; 55 60 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
r85104 r85150 254 254 } 255 255 256 void UINameAndSystemEditor::markNameLineEdit(bool fError) 257 { 258 if (m_pNameLineEdit) 259 m_pNameLineEdit->mark(fError); 260 } 261 256 262 void UINameAndSystemEditor::retranslateUi() 257 263 { -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.h
r85104 r85150 113 113 void setNameFieldValidator(const QString &strValidator); 114 114 115 /** Passes the @p fError to QILineEdit::mark(bool) effectively changing the background color. */ 116 void markNameLineEdit(bool fError); 117 115 118 protected: 116 119 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIUserNamePasswordEditor.cpp
r85118 r85150 119 119 , m_pPasswordLabel(0) 120 120 , m_pPasswordRepeatLabel(0) 121 , m_fForceUnmark(false) 121 122 { 122 123 prepare(); … … 180 181 } 181 182 183 void UIUserNamePasswordEditor::setForceUnmark(bool fForceUnmark) 184 { 185 m_fForceUnmark = fForceUnmark; 186 isUserNameComplete(); 187 isPasswordComplete(); 188 } 189 182 190 void UIUserNamePasswordEditor::retranslateUi() 183 191 { … … 227 235 return; 228 236 QPalette palette = pLineEdit->palette(); 229 if (fError) 237 if (!fError || m_fForceUnmark) 238 palette.setColor(QPalette::Base, m_orginalLineEditBaseColor); 239 else 230 240 palette.setColor(QPalette::Base, QColor(255, 180, 180)); 231 else232 palette.setColor(QPalette::Base, m_orginalLineEditBaseColor);233 241 pLineEdit->setPalette(palette); 234 242 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIUserNamePasswordEditor.h
r85118 r85150 85 85 /** Returns false if username or password fields are empty, or password fields do not match. */ 86 86 bool isComplete(); 87 /** Sets m_fForceUnmark flag. see it for more info. */ 88 void setForceUnmark(bool fForceUnmark); 87 89 88 90 protected: … … 114 116 QLabel *m_pPasswordRepeatLabel; 115 117 QColor m_orginalLineEditBaseColor; 118 /** When true line edits are not marked even if they have to be. */ 119 bool m_fForceUnmark; 116 120 }; 117 121 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
r85064 r85150 427 427 } 428 428 429 void UIWizardNewVM::sltCustomButtonClicked(int iId) 430 { 431 UIWizard::sltCustomButtonClicked(iId); 432 setFieldsFromDefaultUnttendedInstallData(); 433 } 434 429 435 void UIWizardNewVM::retranslateUi() 430 436 { … … 505 511 void UIWizardNewVM::setDefaultUnattendedInstallData(const UIUnattendedInstallData &unattendedInstallData) 506 512 { 507 setField("userName", unattendedInstallData.m_strUserName); 508 setField("password", unattendedInstallData.m_strPassword); 509 setField("hostname", unattendedInstallData.m_strHostname); 510 setField("installGuestAdditions", unattendedInstallData.m_fInstallGuestAdditions); 511 setField("guestAdditionsISOPath", unattendedInstallData.m_strGuestAdditionsISOPath); 513 m_unattendedInstallData = unattendedInstallData; 514 setFieldsFromDefaultUnttendedInstallData(); 515 } 516 517 void UIWizardNewVM::setFieldsFromDefaultUnttendedInstallData() 518 { 519 setField("userName", m_unattendedInstallData.m_strUserName); 520 setField("password", m_unattendedInstallData.m_strPassword); 521 setField("hostname", m_unattendedInstallData.m_strHostname); 522 setField("installGuestAdditions", m_unattendedInstallData.m_fInstallGuestAdditions); 523 setField("guestAdditionsISOPath", m_unattendedInstallData.m_strGuestAdditionsISOPath); 512 524 } 513 525 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h
r85135 r85150 105 105 void sltHandleWizardCancel(); 106 106 void sltHandleDetectedOSTypeChange(); 107 virtual void sltCustomButtonClicked(int iId) /* override */; 107 108 108 109 private: … … 114 115 /* Helping stuff: */ 115 116 QString getNextControllerName(KStorageBus type); 117 void setFieldsFromDefaultUnttendedInstallData(); 116 118 117 119 /* Variables: */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
r85135 r85150 492 492 { 493 493 if (m_pISOFilePathSelector) 494 m_pISOFilePathSelector->mark(isISOFileSelectorComplete()); 494 m_pISOFilePathSelector->mark(!isISOFileSelectorComplete()); 495 if (m_pNameAndSystemEditor) 496 m_pNameAndSystemEditor->markNameLineEdit(m_pNameAndSystemEditor->name().isEmpty()); 495 497 } 496 498 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.cpp
r85104 r85150 185 185 } 186 186 187 void UIWizardNewVMPage2::markWidgets() const 188 { 189 if (m_pGAISOFilePathSelector) 190 m_pGAISOFilePathSelector->mark(!checkGAISOFile()); 191 } 192 187 193 UIWizardNewVMPageBasic2::UIWizardNewVMPageBasic2() 188 194 : m_pLabel(0) … … 268 274 bool UIWizardNewVMPageBasic2::isComplete() const 269 275 { 276 markWidgets(); 270 277 if (!checkGAISOFile()) 271 278 return false; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.h
r85104 r85150 72 72 73 73 bool checkGAISOFile() const; 74 void markWidgets() const; 74 75 75 76 /** @name Widgets -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
r85135 r85150 334 334 } 335 335 336 void UIWizardNewVMPageExpert::markWidgets() const 337 { 338 UIWizardNewVMPage1::markWidgets(); 339 340 if (m_pGAISOFilePathSelector) 341 m_pGAISOFilePathSelector->mark(isUnattendedEnabled() && !checkGAISOFile()); 342 } 343 336 344 bool UIWizardNewVMPageExpert::isComplete() const 337 345 { 338 UIWizardNewVMPage1::markWidgets(); 346 markWidgets(); 347 339 348 /* Make sure mandatory fields are complete, 340 349 * 'ram' field feats the bounds, … … 352 361 if (!checkGAISOFile()) 353 362 return false; 354 }355 if (m_pUserNamePasswordEditor)356 {357 if (!m_pUserNamePasswordEditor->isComplete())358 return false;363 if (m_pUserNamePasswordEditor) 364 { 365 if (!m_pUserNamePasswordEditor->isComplete()) 366 return false; 367 } 359 368 } 360 369 return true; … … 421 430 if (m_pUsernameHostnameContainer) 422 431 m_pUsernameHostnameContainer->setEnabled(fEnabled); 432 if (m_pUserNamePasswordEditor) 433 m_pUserNamePasswordEditor->setForceUnmark(!fEnabled); 423 434 if (m_pProductKeyLabel) 424 435 m_pProductKeyLabel->setEnabled(isProductKeyWidgetEnabled()); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h
r85104 r85150 110 110 bool isProductKeyWidgetEnabled() const; 111 111 void disableEnableUnattendedRelatedWidgets(bool fEnabled); 112 112 void markWidgets() const; 113 113 /** Widgets. */ 114 114 QWidget *m_pNameAndSystemContainer;
Note:
See TracChangeset
for help on using the changeset viewer.