Changeset 92649 in vbox for trunk/src/VBox
- Timestamp:
- Nov 30, 2021 12:13:11 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestSessionPanel.cpp
r92648 r92649 57 57 private slots: 58 58 59 void slt CreateButtonClick();59 void sltButtonClick(); 60 60 void sltHandleTextChanged(const QString &strText); 61 61 62 62 private: 63 63 64 enum ButtonMode 65 { 66 ButtonMode_Create, 67 ButtonMode_Close 68 }; 69 64 70 void prepareWidgets(); 71 void updateButton(); 72 73 ButtonMode m_enmButtonMode; 65 74 QILineEdit *m_pUserNameEdit; 66 75 UIPasswordLineEdit *m_pPasswordEdit; 67 QPushButton *m_pCreateButton; 68 QPushButton *m_pCloseButton; 76 QPushButton *m_pButton; 69 77 QHBoxLayout *m_pMainLayout; 70 78 QColor m_defaultBaseColor; … … 80 88 UIGuestSessionCreateWidget::UIGuestSessionCreateWidget(QWidget *pParent /* = 0 */) 81 89 : QIWithRetranslateUI<QWidget>(pParent) 90 , m_enmButtonMode(ButtonMode_Create) 82 91 , m_pUserNameEdit(0) 83 92 , m_pPasswordEdit(0) 84 , m_pCreateButton(0) 85 , m_pCloseButton(0) 93 , m_pButton(0) 86 94 , m_pMainLayout(0) 87 95 , m_fMarkedForError(0) … … 119 127 } 120 128 121 m_pCreateButton = new QPushButton; 122 if (m_pCreateButton) 123 { 124 m_pMainLayout->addWidget(m_pCreateButton); 125 connect(m_pCreateButton, &QPushButton::clicked, this, &UIGuestSessionCreateWidget::sltCreateButtonClick); 126 } 127 128 m_pCloseButton = new QPushButton; 129 if (m_pCloseButton) 130 { 131 m_pMainLayout->addWidget(m_pCloseButton); 132 connect(m_pCloseButton, &QPushButton::clicked, this, &UIGuestSessionCreateWidget::sigCloseSession); 133 } 129 m_pButton = new QPushButton; 130 if (m_pButton) 131 { 132 m_pMainLayout->addWidget(m_pButton); 133 connect(m_pButton, &QPushButton::clicked, this, &UIGuestSessionCreateWidget::sltButtonClick); 134 } 135 136 134 137 m_pMainLayout->insertStretch(-1, 1); 135 138 switchSessionCreateMode(); … … 137 140 } 138 141 139 void UIGuestSessionCreateWidget::slt CreateButtonClick()140 { 141 if (m_ pUserNameEdit && m_pPasswordEdit)142 void UIGuestSessionCreateWidget::sltButtonClick() 143 { 144 if (m_enmButtonMode == ButtonMode_Create && m_pUserNameEdit && m_pPasswordEdit) 142 145 emit sigCreateSession(m_pUserNameEdit->text(), m_pPasswordEdit->text()); 146 else if (m_enmButtonMode == ButtonMode_Close) 147 emit sigCloseSession(); 143 148 } 144 149 … … 163 168 } 164 169 165 if (m_pCreateButton) 166 m_pCreateButton->setText(QApplication::translate("UIFileManager", "Create Session")); 167 if (m_pCloseButton) 168 m_pCloseButton->setText(QApplication::translate("UIFileManager", "Close Session")); 170 if (m_pButton) 171 { 172 if (m_enmButtonMode == ButtonMode_Create) 173 m_pButton->setText(QApplication::translate("UIFileManager", "Create Session")); 174 else 175 m_pButton->setText(QApplication::translate("UIFileManager", "Close Session")); 176 } 169 177 } 170 178 … … 194 202 if (m_pPasswordEdit) 195 203 m_pPasswordEdit->setEnabled(true); 196 if (m_pCreateButton) 197 m_pCreateButton->setEnabled(true); 198 if (m_pCloseButton) 199 m_pCloseButton->setEnabled(false); 204 m_enmButtonMode = ButtonMode_Create; 205 retranslateUi(); 200 206 } 201 207 … … 206 212 if (m_pPasswordEdit) 207 213 m_pPasswordEdit->setEnabled(false); 208 if (m_pCreateButton) 209 m_pCreateButton->setEnabled(false); 210 if (m_pCloseButton) 211 m_pCloseButton->setEnabled(true); 214 m_enmButtonMode = ButtonMode_Close; 215 retranslateUi(); 212 216 } 213 217
Note:
See TracChangeset
for help on using the changeset viewer.