summaryrefslogtreecommitdiffstats
path: root/src/yuzu
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu')
-rw-r--r--src/yuzu/applets/qt_profile_select.cpp85
-rw-r--r--src/yuzu/applets/qt_profile_select.h11
-rw-r--r--src/yuzu/main.cpp30
-rw-r--r--src/yuzu/main.h5
4 files changed, 115 insertions, 16 deletions
diff --git a/src/yuzu/applets/qt_profile_select.cpp b/src/yuzu/applets/qt_profile_select.cpp
index c0a1d5ab7..2448e46b6 100644
--- a/src/yuzu/applets/qt_profile_select.cpp
+++ b/src/yuzu/applets/qt_profile_select.cpp
@@ -46,11 +46,13 @@ QPixmap GetIcon(Common::UUID uuid) {
}
} // Anonymous namespace
-QtProfileSelectionDialog::QtProfileSelectionDialog(Core::HID::HIDCore& hid_core, QWidget* parent)
+QtProfileSelectionDialog::QtProfileSelectionDialog(
+ Core::HID::HIDCore& hid_core, QWidget* parent,
+ const Core::Frontend::ProfileSelectParameters& parameters)
: QDialog(parent), profile_manager(std::make_unique<Service::Account::ProfileManager>()) {
outer_layout = new QVBoxLayout;
- instruction_label = new QLabel(tr("Select a user:"));
+ instruction_label = new QLabel();
scroll_area = new QScrollArea;
@@ -120,7 +122,8 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(Core::HID::HIDCore& hid_core,
item_model->appendRow(item);
setLayout(outer_layout);
- setWindowTitle(tr("Profile Selector"));
+ SetWindowTitle(parameters);
+ SetDialogPurpose(parameters);
resize(550, 400);
}
@@ -154,6 +157,76 @@ void QtProfileSelectionDialog::SelectUser(const QModelIndex& index) {
user_index = index.row();
}
+void QtProfileSelectionDialog::SetWindowTitle(
+ const Core::Frontend::ProfileSelectParameters& parameters) {
+ using Service::AM::Applets::UiMode;
+ switch (parameters.mode) {
+ case UiMode::UserCreator:
+ case UiMode::UserCreatorForStarter:
+ setWindowTitle(tr("Profile Creator"));
+ return;
+ case UiMode::EnsureNetworkServiceAccountAvailable:
+ setWindowTitle(tr("Profile Selector"));
+ return;
+ case UiMode::UserIconEditor:
+ setWindowTitle(tr("Profile Icon Editor"));
+ return;
+ case UiMode::UserNicknameEditor:
+ setWindowTitle(tr("Profile Nickname Editor"));
+ return;
+ case UiMode::NintendoAccountAuthorizationRequestContext:
+ case UiMode::IntroduceExternalNetworkServiceAccount:
+ case UiMode::IntroduceExternalNetworkServiceAccountForRegistration:
+ case UiMode::NintendoAccountNnidLinker:
+ case UiMode::LicenseRequirementsForNetworkService:
+ case UiMode::LicenseRequirementsForNetworkServiceWithUserContextImpl:
+ case UiMode::UserCreatorForImmediateNaLoginTest:
+ case UiMode::UserQualificationPromoter:
+ case UiMode::UserSelector:
+ default:
+ setWindowTitle(tr("Profile Selector"));
+ }
+}
+
+void QtProfileSelectionDialog::SetDialogPurpose(
+ const Core::Frontend::ProfileSelectParameters& parameters) {
+ using Service::AM::Applets::UserSelectionPurpose;
+
+ switch (parameters.purpose) {
+ case UserSelectionPurpose::GameCardRegistration:
+ instruction_label->setText(tr("Who will receive the points?"));
+ return;
+ case UserSelectionPurpose::EShopLaunch:
+ instruction_label->setText(tr("Who is using Nintendo eShop?"));
+ return;
+ case UserSelectionPurpose::EShopItemShow:
+ instruction_label->setText(tr("Who is making this purchase?"));
+ return;
+ case UserSelectionPurpose::PicturePost:
+ instruction_label->setText(tr("Who is posting?"));
+ return;
+ case UserSelectionPurpose::NintendoAccountLinkage:
+ instruction_label->setText(tr("Select a user to link to a Nintendo Account."));
+ return;
+ case UserSelectionPurpose::SettingsUpdate:
+ instruction_label->setText(tr("Change settings for which user?"));
+ return;
+ case UserSelectionPurpose::SaveDataDeletion:
+ instruction_label->setText(tr("Format data for which user?"));
+ return;
+ case UserSelectionPurpose::UserMigration:
+ instruction_label->setText(tr("Which user will be transferred to another console?"));
+ return;
+ case UserSelectionPurpose::SaveDataTransfer:
+ instruction_label->setText(tr("Send save data for which user?"));
+ return;
+ case UserSelectionPurpose::General:
+ default:
+ instruction_label->setText(tr("Select a user:"));
+ return;
+ }
+}
+
QtProfileSelector::QtProfileSelector(GMainWindow& parent) {
connect(this, &QtProfileSelector::MainWindowSelectProfile, &parent,
&GMainWindow::ProfileSelectorSelectProfile, Qt::QueuedConnection);
@@ -170,9 +243,11 @@ void QtProfileSelector::Close() const {
emit MainWindowRequestExit();
}
-void QtProfileSelector::SelectProfile(SelectProfileCallback callback_) const {
+void QtProfileSelector::SelectProfile(
+ SelectProfileCallback callback_,
+ const Core::Frontend::ProfileSelectParameters& parameters) const {
callback = std::move(callback_);
- emit MainWindowSelectProfile();
+ emit MainWindowSelectProfile(parameters);
}
void QtProfileSelector::MainWindowFinishedSelection(std::optional<Common::UUID> uuid) {
diff --git a/src/yuzu/applets/qt_profile_select.h b/src/yuzu/applets/qt_profile_select.h
index 9f214d071..99056e274 100644
--- a/src/yuzu/applets/qt_profile_select.h
+++ b/src/yuzu/applets/qt_profile_select.h
@@ -28,7 +28,8 @@ class QtProfileSelectionDialog final : public QDialog {
Q_OBJECT
public:
- explicit QtProfileSelectionDialog(Core::HID::HIDCore& hid_core, QWidget* parent);
+ explicit QtProfileSelectionDialog(Core::HID::HIDCore& hid_core, QWidget* parent,
+ const Core::Frontend::ProfileSelectParameters& parameters);
~QtProfileSelectionDialog() override;
int exec() override;
@@ -40,6 +41,9 @@ public:
private:
void SelectUser(const QModelIndex& index);
+ void SetWindowTitle(const Core::Frontend::ProfileSelectParameters& parameters);
+ void SetDialogPurpose(const Core::Frontend::ProfileSelectParameters& parameters);
+
int user_index = 0;
QVBoxLayout* layout;
@@ -66,10 +70,11 @@ public:
~QtProfileSelector() override;
void Close() const override;
- void SelectProfile(SelectProfileCallback callback_) const override;
+ void SelectProfile(SelectProfileCallback callback_,
+ const Core::Frontend::ProfileSelectParameters& parameters) const override;
signals:
- void MainWindowSelectProfile() const;
+ void MainWindowSelectProfile(const Core::Frontend::ProfileSelectParameters& parameters) const;
void MainWindowRequestExit() const;
private:
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 0c60a90cb..136935259 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -576,6 +576,10 @@ void GMainWindow::RegisterMetaTypes() {
// Controller Applet
qRegisterMetaType<Core::Frontend::ControllerParameters>("Core::Frontend::ControllerParameters");
+ // Profile Select Applet
+ qRegisterMetaType<Core::Frontend::ProfileSelectParameters>(
+ "Core::Frontend::ProfileSelectParameters");
+
// Software Keyboard Applet
qRegisterMetaType<Core::Frontend::KeyboardInitializeParameters>(
"Core::Frontend::KeyboardInitializeParameters");
@@ -651,8 +655,9 @@ void GMainWindow::ControllerSelectorRequestExit() {
}
}
-void GMainWindow::ProfileSelectorSelectProfile() {
- profile_select_applet = new QtProfileSelectionDialog(system->HIDCore(), this);
+void GMainWindow::ProfileSelectorSelectProfile(
+ const Core::Frontend::ProfileSelectParameters& parameters) {
+ profile_select_applet = new QtProfileSelectionDialog(system->HIDCore(), this, parameters);
SCOPE_EXIT({
profile_select_applet->deleteLater();
profile_select_applet = nullptr;
@@ -1719,8 +1724,9 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
return true;
}
-bool GMainWindow::SelectAndSetCurrentUser() {
- QtProfileSelectionDialog dialog(system->HIDCore(), this);
+bool GMainWindow::SelectAndSetCurrentUser(
+ const Core::Frontend::ProfileSelectParameters& parameters) {
+ QtProfileSelectionDialog dialog(system->HIDCore(), this, parameters);
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
dialog.setWindowModality(Qt::WindowModal);
@@ -1766,7 +1772,13 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
Settings::LogSettings();
if (UISettings::values.select_user_on_boot) {
- if (SelectAndSetCurrentUser() == false) {
+ const Core::Frontend::ProfileSelectParameters parameters{
+ .mode = Service::AM::Applets::UiMode::UserSelector,
+ .invalid_uid_list = {},
+ .display_options = {},
+ .purpose = Service::AM::Applets::UserSelectionPurpose::General,
+ };
+ if (SelectAndSetCurrentUser(parameters) == false) {
return;
}
}
@@ -2058,7 +2070,13 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
if (has_user_save) {
// User save data
const auto select_profile = [this] {
- QtProfileSelectionDialog dialog(system->HIDCore(), this);
+ const Core::Frontend::ProfileSelectParameters parameters{
+ .mode = Service::AM::Applets::UiMode::UserSelector,
+ .invalid_uid_list = {},
+ .display_options = {},
+ .purpose = Service::AM::Applets::UserSelectionPurpose::General,
+ };
+ QtProfileSelectionDialog dialog(system->HIDCore(), this, parameters);
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
dialog.setWindowModality(Qt::WindowModal);
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index a99938eaa..2f16e0b1c 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -69,6 +69,7 @@ struct ControllerParameters;
struct InlineAppearParameters;
struct InlineTextParameters;
struct KeyboardInitializeParameters;
+struct ProfileSelectParameters;
} // namespace Core::Frontend
namespace DiscordRPC {
@@ -203,7 +204,7 @@ public slots:
void SoftwareKeyboardExit();
void ErrorDisplayDisplayError(QString error_code, QString error_text);
void ErrorDisplayRequestExit();
- void ProfileSelectorSelectProfile();
+ void ProfileSelectorSelectProfile(const Core::Frontend::ProfileSelectParameters& parameters);
void ProfileSelectorRequestExit();
void WebBrowserOpenWebPage(const std::string& main_url, const std::string& additional_args,
bool is_local);
@@ -242,7 +243,7 @@ private:
void SetDiscordEnabled(bool state);
void LoadAmiibo(const QString& filename);
- bool SelectAndSetCurrentUser();
+ bool SelectAndSetCurrentUser(const Core::Frontend::ProfileSelectParameters& parameters);
/**
* Stores the filename in the recently loaded files list.