mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
Create a unified dialog to ask user for offline name
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
8b5e91920d
commit
ea004846a9
9 changed files with 201 additions and 235 deletions
|
|
@ -61,6 +61,7 @@
|
|||
#include "JavaCommon.h"
|
||||
#include "launch/steps/TextPrint.h"
|
||||
#include "tasks/Task.h"
|
||||
#include "ui/dialogs/ChooseOfflineNameDialog.h"
|
||||
|
||||
LaunchController::LaunchController() : Task() {}
|
||||
|
||||
|
|
@ -157,10 +158,15 @@ QString LaunchController::askOfflineName(QString playerName, bool demo, bool& ok
|
|||
|
||||
QString lastOfflinePlayerName = APPLICATION->settings()->get("LastOfflinePlayerName").toString();
|
||||
QString usedname = lastOfflinePlayerName.isEmpty() ? playerName : lastOfflinePlayerName;
|
||||
QString name = QInputDialog::getText(m_parentWidget, tr("Player name"), message, QLineEdit::Normal, usedname, &ok);
|
||||
if (!ok)
|
||||
|
||||
ChooseOfflineNameDialog dialog(message, m_parentWidget);
|
||||
dialog.setWindowTitle(tr("Player name"));
|
||||
dialog.setUsername(usedname);
|
||||
if (dialog.exec() != QDialog::Accepted) {
|
||||
return {};
|
||||
if (name.length()) {
|
||||
}
|
||||
|
||||
if (const QString name = dialog.getUsername(); !name.isEmpty()) {
|
||||
usedname = name;
|
||||
APPLICATION->settings()->set("LastOfflinePlayerName", usedname);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue