From f76aec8b5ae19ef70e10fa8a6542a8f12ac32f37 Mon Sep 17 00:00:00 2001 From: Xavier Michelon Date: Wed, 21 Sep 2022 08:01:51 +0200 Subject: [PATCH] GODT-1824: sign-in error label did not wrap. --- .../bridge-gui-tester/GRPCService.cpp | 2 +- .../bridge-gui-tester/Tabs/UsersTab.cpp | 11 +++++ .../bridge-gui-tester/Tabs/UsersTab.h | 3 +- .../bridge-gui-tester/Tabs/UsersTab.ui | 44 +++++++++++++++++-- .../bridge-gui/bridge-gui/qml/SignIn.qml | 6 ++- 5 files changed, 58 insertions(+), 8 deletions(-) diff --git a/internal/frontend/bridge-gui/bridge-gui-tester/GRPCService.cpp b/internal/frontend/bridge-gui/bridge-gui-tester/GRPCService.cpp index b43c9489..90c7704f 100644 --- a/internal/frontend/bridge-gui/bridge-gui-tester/GRPCService.cpp +++ b/internal/frontend/bridge-gui/bridge-gui-tester/GRPCService.cpp @@ -392,7 +392,7 @@ Status GRPCService::Login(ServerContext *, LoginRequest const *request, Empty *) loginUsername_ = QString::fromStdString(request->username()); if (usersTab.nextUserUsernamePasswordError()) { - qtProxy_.sendDelayedEvent(newLoginError(LoginErrorType::USERNAME_PASSWORD_ERROR, "Username/password error.")); + qtProxy_.sendDelayedEvent(newLoginError(LoginErrorType::USERNAME_PASSWORD_ERROR, usersTab.usernamePasswordErrorMessage())); return Status::OK; } if (usersTab.nextUserFreeUserError()) diff --git a/internal/frontend/bridge-gui/bridge-gui-tester/Tabs/UsersTab.cpp b/internal/frontend/bridge-gui/bridge-gui-tester/Tabs/UsersTab.cpp index 76ff5650..b7e2bbfd 100644 --- a/internal/frontend/bridge-gui/bridge-gui-tester/Tabs/UsersTab.cpp +++ b/internal/frontend/bridge-gui/bridge-gui-tester/Tabs/UsersTab.cpp @@ -51,6 +51,7 @@ UsersTab::UsersTab(QWidget *parent) connect(ui_.buttonEditUser, &QPushButton::clicked, this, &UsersTab::onEditUserButton); connect(ui_.tableUserList, &QTableView::doubleClicked, this, &UsersTab::onEditUserButton); connect(ui_.buttonRemoveUser, &QPushButton::clicked, this, &UsersTab::onRemoveUserButton); + connect(ui_.checkUsernamePasswordError, &QCheckBox::toggled, this, &UsersTab::updateGUIState); users_.append(randomUser()); @@ -129,6 +130,7 @@ void UsersTab::updateGUIState() bool const hasSelectedUser = ui_.tableUserList->selectionModel()->hasSelection(); ui_.buttonEditUser->setEnabled(hasSelectedUser); ui_.buttonRemoveUser->setEnabled(hasSelectedUser); + ui_.editUsernamePasswordError->setEnabled(ui_.checkUsernamePasswordError->isChecked()); } @@ -252,6 +254,15 @@ bool UsersTab::nextUserAlreadyLoggedIn() const } +//**************************************************************************************************************************************************** +/// \return the message for the username/password error. +//**************************************************************************************************************************************************** +QString UsersTab::usernamePasswordErrorMessage() const +{ + return ui_.editUsernamePasswordError->text(); +} + + //**************************************************************************************************************************************************** /// \param[in] userID The userID. /// \param[in] makeItActive Should split mode be activated. diff --git a/internal/frontend/bridge-gui/bridge-gui-tester/Tabs/UsersTab.h b/internal/frontend/bridge-gui/bridge-gui-tester/Tabs/UsersTab.h index 55a44c49..11e9f385 100644 --- a/internal/frontend/bridge-gui/bridge-gui-tester/Tabs/UsersTab.h +++ b/internal/frontend/bridge-gui/bridge-gui-tester/Tabs/UsersTab.h @@ -48,6 +48,7 @@ public: // member functions. bool nextUserTwoPasswordsError() const; ///< Check if next user login should trigger 2nd password error. bool nextUserTwoPasswordsAbort() const; ///< Check if next user login should trigger 2nd password abort. bool nextUserAlreadyLoggedIn() const; ///< Check if next user login should report user as already logged in. + QString usernamePasswordErrorMessage() const; ///< Return the username password error message. public slots: void setUserSplitMode(QString const &userID, bool makeItActive); ///< Slot for the split mode. @@ -60,9 +61,9 @@ private slots: void onEditUserButton(); ///< Edit the currently selected user. void onRemoveUserButton(); ///< Remove the currently selected user. void onSelectionChanged(QItemSelection, QItemSelection); ///< Slot for the change of the selection. + void updateGUIState(); ///< Update the GUI state. private: // member functions. - void updateGUIState(); ///< Update the GUI state. qint32 selectedIndex() const; ///< Get the index of the selected row. bridgepp::SPUser selectedUser(); ///< Get the selected user. diff --git a/internal/frontend/bridge-gui/bridge-gui-tester/Tabs/UsersTab.ui b/internal/frontend/bridge-gui/bridge-gui-tester/Tabs/UsersTab.ui index ce297a51..ad4db4ee 100644 --- a/internal/frontend/bridge-gui/bridge-gui-tester/Tabs/UsersTab.ui +++ b/internal/frontend/bridge-gui/bridge-gui-tester/Tabs/UsersTab.ui @@ -6,14 +6,14 @@ 0 0 - 1207 - 709 + 1225 + 717 Form - + @@ -81,10 +81,46 @@ - Username/password error + Username/password error: + + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + + 200 + 0 + + + + Username/password error. + + + + + diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/SignIn.qml b/internal/frontend/bridge-gui/bridge-gui/qml/SignIn.qml index b263a4b2..4be8e088 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/SignIn.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/SignIn.qml @@ -185,13 +185,15 @@ FocusScope { ColorImage { color: root.colorScheme.signal_danger source: "/qml/icons/ic-exclamation-circle-filled.svg" - height: errorLabel.height - sourceSize.height: errorLabel.height + height: errorLabel.lineHeight + sourceSize.height: errorLabel.lineHeight } Label { colorScheme: root.colorScheme id: errorLabel + wrapMode: Text.WordWrap + Layout.fillWidth: true; Layout.leftMargin: 4 color: root.colorScheme.signal_danger