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
50
launcher/ui/dialogs/ChooseOfflineNameDialog.h
Normal file
50
launcher/ui/dialogs/ChooseOfflineNameDialog.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (C) 2025 Octol1ttle <l1ttleofficial@outlook.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <QRegularExpressionValidator>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
class ChooseOfflineNameDialog;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class ChooseOfflineNameDialog final : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ChooseOfflineNameDialog(const QString& message, QWidget* parent = nullptr);
|
||||
~ChooseOfflineNameDialog() override;
|
||||
|
||||
QString getUsername() const;
|
||||
void setUsername(const QString& username) const;
|
||||
|
||||
private:
|
||||
void updateAcceptAllowed(const QString& username) const;
|
||||
|
||||
protected slots:
|
||||
void on_usernameTextBox_textEdited(const QString& newText) const;
|
||||
void on_allowInvalidUsernames_checkStateChanged(Qt::CheckState checkState) const;
|
||||
|
||||
private:
|
||||
Ui::ChooseOfflineNameDialog* ui;
|
||||
QRegularExpressionValidator* m_usernameValidator;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue