GODT-1824: sign-in error label did not wrap.

This commit is contained in:
Xavier Michelon
2022-09-21 08:01:51 +02:00
parent 40fb9de15e
commit f76aec8b5a
5 changed files with 58 additions and 8 deletions

View File

@ -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())

View File

@ -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.

View File

@ -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.

View File

@ -6,14 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>1207</width>
<height>709</height>
<width>1225</width>
<height>717</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
<item>
<widget class="QTableView" name="tableUserList">
<property name="selectionMode">
@ -81,10 +81,46 @@
<item>
<widget class="QCheckBox" name="checkUsernamePasswordError">
<property name="text">
<string>Username/password error</string>
<string>Username/password error:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="editUsernamePasswordError">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Username/password error.</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkFreeUserError">
<property name="text">

View File

@ -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