diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2022-03-19 16:02:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-19 16:02:28 +0100 |
commit | 8225f1ac92c687917e52febbdc2c0f8e6f4f065e (patch) | |
tree | ef444efd8709f0adbec881979fd447edb0aa120c /launcher/ui | |
parent | 06d16c6b13cc2253b7ccae19f351a263c9551384 (diff) | |
parent | 90780818cab043003cb4d18d3865323ce07fb92d (diff) | |
download | PrismLauncher-8225f1ac92c687917e52febbdc2c0f8e6f4f065e.tar.gz PrismLauncher-8225f1ac92c687917e52febbdc2c0f8e6f4f065e.tar.bz2 PrismLauncher-8225f1ac92c687917e52febbdc2c0f8e6f4f065e.zip |
Merge pull request #292 from lack/offline_username_limits
Limit offline username to 16 characters with override
Diffstat (limited to 'launcher/ui')
-rw-r--r-- | launcher/ui/dialogs/OfflineLoginDialog.cpp | 9 | ||||
-rw-r--r-- | launcher/ui/dialogs/OfflineLoginDialog.h | 1 | ||||
-rw-r--r-- | launcher/ui/dialogs/OfflineLoginDialog.ui | 13 |
3 files changed, 23 insertions, 0 deletions
diff --git a/launcher/ui/dialogs/OfflineLoginDialog.cpp b/launcher/ui/dialogs/OfflineLoginDialog.cpp index 345ed40a..4f3d8be4 100644 --- a/launcher/ui/dialogs/OfflineLoginDialog.cpp +++ b/launcher/ui/dialogs/OfflineLoginDialog.cpp @@ -42,6 +42,15 @@ void OfflineLoginDialog::setUserInputsEnabled(bool enable) ui->buttonBox->setEnabled(enable); } +void OfflineLoginDialog::on_allowLongUsernames_stateChanged(int value) +{ + if (value == Qt::Checked) { + ui->userTextBox->setMaxLength(INT_MAX); + } else { + ui->userTextBox->setMaxLength(16); + } +} + // Enable the OK button only when the textbox contains something. void OfflineLoginDialog::on_userTextBox_textEdited(const QString &newText) { diff --git a/launcher/ui/dialogs/OfflineLoginDialog.h b/launcher/ui/dialogs/OfflineLoginDialog.h index 5e608379..fdb3d91f 100644 --- a/launcher/ui/dialogs/OfflineLoginDialog.h +++ b/launcher/ui/dialogs/OfflineLoginDialog.h @@ -35,6 +35,7 @@ slots: void onTaskProgress(qint64 current, qint64 total); void on_userTextBox_textEdited(const QString &newText); + void on_allowLongUsernames_stateChanged(int value); private: Ui::OfflineLoginDialog *ui; diff --git a/launcher/ui/dialogs/OfflineLoginDialog.ui b/launcher/ui/dialogs/OfflineLoginDialog.ui index d8964a2e..4633cbe3 100644 --- a/launcher/ui/dialogs/OfflineLoginDialog.ui +++ b/launcher/ui/dialogs/OfflineLoginDialog.ui @@ -35,12 +35,25 @@ </item> <item> <widget class="QLineEdit" name="userTextBox"> + <property name="maxLength"> + <number>16</number> + </property> <property name="placeholderText"> <string>Username</string> </property> </widget> </item> <item> + <widget class="QCheckBox" name="allowLongUsernames"> + <property name="toolTip"> + <string>Usernames longer than 16 characters cannot be used for LAN games or offline-mode servers.</string> + </property> + <property name="text"> + <string>Allow long usernames</string> + </property> + </widget> + </item> + <item> <widget class="QProgressBar" name="progressBar"> <property name="value"> <number>69</number> |