Changeset 78092 in vbox
- Timestamp:
- Apr 10, 2019 2:27:06 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDialogPanel.h
r78001 r78092 61 61 62 62 /** Handles the Qt show @a pEvent. */ 63 void showEvent(QShowEvent *pEvent) ;63 void showEvent(QShowEvent *pEvent) /* override */; 64 64 /** Handles the Qt hide @a pEvent. */ 65 void hideEvent(QHideEvent *pEvent) ;65 void hideEvent(QHideEvent *pEvent) /* override */; 66 66 void addVerticalSeparator(); 67 67 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.cpp
r78010 r78092 413 413 appendLog("Could not find Guest Additions", FileManagerLogType_Error); 414 414 postSessionClosed(); 415 if (m_pSessionPanel) 416 m_pSessionPanel->markForError(true); 415 417 return; 416 418 } … … 418 420 { 419 421 appendLog("No user name is given", FileManagerLogType_Error); 420 return; 421 } 422 createSession(strUserName, strPassword); 422 if (m_pSessionPanel) 423 m_pSessionPanel->markForError(true); 424 return; 425 } 426 if (m_pSessionPanel) 427 m_pSessionPanel->markForError(!createSession(strUserName, strPassword)); 423 428 } 424 429 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerOperationsPanel.cpp
r77528 r78092 338 338 return; 339 339 340 QPalette mPalette = palette(); 341 mPalette.setColor(QPalette::Window, qApp->palette().color(QPalette::Light)); 342 setPalette(mPalette); 340 343 341 344 m_pScrollArea = new QScrollArea; -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerSessionPanel.cpp
r77528 r78092 46 46 /** Makes sure certain widgets are enabled so that a guest session can be created. */ 47 47 void switchSessionCloseMode(); 48 void markForError(bool fMarkForError); 48 49 49 50 protected: … … 57 58 void sltCreateButtonClick(); 58 59 void sltShowHidePassword(bool flag); 60 void sltHandleTextChanged(const QString &strText); 59 61 60 62 private: … … 67 69 QHBoxLayout *m_pMainLayout; 68 70 QCheckBox *m_pShowPasswordCheckBox; 71 QColor m_defaultBaseColor; 72 QColor m_errorBaseColor; 73 bool m_fMarkedForError; 69 74 }; 70 75 … … 82 87 , m_pMainLayout(0) 83 88 , m_pShowPasswordCheckBox(0) 89 , m_fMarkedForError(0) 84 90 { 85 91 prepareWidgets(); … … 97 103 m_pMainLayout->addWidget(m_pUserNameEdit, 2); 98 104 m_pUserNameEdit->setPlaceholderText(QApplication::translate("UIFileManager", "User Name")); 105 m_defaultBaseColor = m_pUserNameEdit->palette().color(QPalette::Base); 106 m_errorBaseColor = QColor(m_defaultBaseColor.red(), 107 0.5 * m_defaultBaseColor.green(), 108 0.5 * m_defaultBaseColor.blue()); 109 connect(m_pUserNameEdit, &QILineEdit::textChanged, 110 this, &UIGuestSessionCreateWidget::sltHandleTextChanged); 99 111 } 100 112 … … 105 117 m_pPasswordEdit->setPlaceholderText(QApplication::translate("UIFileManager", "Password")); 106 118 m_pPasswordEdit->setEchoMode(QLineEdit::Password); 119 connect(m_pPasswordEdit, &QILineEdit::textChanged, 120 this, &UIGuestSessionCreateWidget::sltHandleTextChanged); 107 121 } 108 122 … … 148 162 else 149 163 m_pPasswordEdit->setEchoMode(QLineEdit::Password); 164 } 165 166 void UIGuestSessionCreateWidget::sltHandleTextChanged(const QString &strText) 167 { 168 Q_UNUSED(strText); 169 markForError(false); 150 170 } 151 171 … … 213 233 } 214 234 235 void UIGuestSessionCreateWidget::markForError(bool fMarkForError) 236 { 237 if (m_fMarkedForError == fMarkForError) 238 return; 239 m_fMarkedForError = fMarkForError; 240 241 if (m_pUserNameEdit) 242 { 243 QPalette mPalette = m_pUserNameEdit->palette(); 244 if (m_fMarkedForError) 245 mPalette.setColor(QPalette::Base, m_errorBaseColor); 246 else 247 mPalette.setColor(QPalette::Base, m_defaultBaseColor); 248 m_pUserNameEdit->setPalette(mPalette); 249 } 250 if (m_pPasswordEdit) 251 { 252 QPalette mPalette = m_pPasswordEdit->palette(); 253 if (m_fMarkedForError) 254 mPalette.setColor(QPalette::Base, m_errorBaseColor); 255 else 256 mPalette.setColor(QPalette::Base, m_defaultBaseColor); 257 m_pPasswordEdit->setPalette(mPalette); 258 } 259 } 260 215 261 216 262 /********************************************************************************************************************************* … … 240 286 { 241 287 return "SessionPanel"; 288 } 289 290 void UIFileManagerSessionPanel::markForError(bool fMarkForError) 291 { 292 if (m_pSessionCreateWidget) 293 m_pSessionCreateWidget->markForError(fMarkForError); 242 294 } 243 295 … … 268 320 } 269 321 322 void UIFileManagerSessionPanel::showEvent(QShowEvent *pEvent) 323 { 324 markForError(false); 325 UIDialogPanel::showEvent(pEvent); 326 } 327 270 328 #include "UIFileManagerSessionPanel.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerSessionPanel.h
r77528 r78092 47 47 /** @} */ 48 48 virtual QString panelName() const /* override */; 49 void markForError(bool fMarkForError); 49 50 50 51 protected: … … 53 54 virtual void prepareConnections() /* override */; 54 55 void retranslateUi(); 56 void showEvent(QShowEvent *pEvent) /* override */; 55 57 56 58 private:
Note:
See TracChangeset
for help on using the changeset viewer.