summaryrefslogtreecommitdiff
path: root/src/yuzu
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu')
-rw-r--r--src/yuzu/applets/qt_controller.cpp8
-rw-r--r--src/yuzu/applets/qt_controller.h2
-rw-r--r--src/yuzu/applets/qt_controller.ui8
-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.cpp37
-rw-r--r--src/yuzu/main.h7
7 files changed, 132 insertions, 26 deletions
diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp
index 79018a7f6..00aafb8f8 100644
--- a/src/yuzu/applets/qt_controller.cpp
+++ b/src/yuzu/applets/qt_controller.cpp
@@ -300,7 +300,7 @@ bool QtControllerSelectorDialog::CheckIfParametersMet() {
if (num_connected_players < min_supported_players ||
num_connected_players > max_supported_players) {
parameters_met = false;
- ui->buttonBox->setEnabled(parameters_met);
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(parameters_met);
return parameters_met;
}
@@ -327,7 +327,7 @@ bool QtControllerSelectorDialog::CheckIfParametersMet() {
}();
parameters_met = all_controllers_compatible;
- ui->buttonBox->setEnabled(parameters_met);
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(parameters_met);
return parameters_met;
}
@@ -697,8 +697,8 @@ void QtControllerSelector::ReconfigureControllers(
emit MainWindowReconfigureControllers(parameters);
}
-void QtControllerSelector::MainWindowReconfigureFinished() {
+void QtControllerSelector::MainWindowReconfigureFinished(bool is_success) {
if (callback) {
- callback();
+ callback(is_success);
}
}
diff --git a/src/yuzu/applets/qt_controller.h b/src/yuzu/applets/qt_controller.h
index 2ef7e488f..2fdc35857 100644
--- a/src/yuzu/applets/qt_controller.h
+++ b/src/yuzu/applets/qt_controller.h
@@ -167,7 +167,7 @@ signals:
void MainWindowRequestExit() const;
private:
- void MainWindowReconfigureFinished();
+ void MainWindowReconfigureFinished(bool is_success);
mutable ReconfigureCallback callback;
};
diff --git a/src/yuzu/applets/qt_controller.ui b/src/yuzu/applets/qt_controller.ui
index f5eccba70..729e921ee 100644
--- a/src/yuzu/applets/qt_controller.ui
+++ b/src/yuzu/applets/qt_controller.ui
@@ -2629,7 +2629,7 @@
<bool>true</bool>
</property>
<property name="standardButtons">
- <set>QDialogButtonBox::Ok</set>
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
@@ -2649,5 +2649,11 @@
<receiver>QtControllerSelectorDialog</receiver>
<slot>accept()</slot>
</connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>QtControllerSelectorDialog</receiver>
+ <slot>reject()</slot>
+ </connection>
</connections>
</ui>
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..b79409a68 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");
@@ -634,15 +638,16 @@ void GMainWindow::ControllerSelectorReconfigureControllers(
Qt::WindowStaysOnTopHint | Qt::WindowTitleHint |
Qt::WindowSystemMenuHint);
controller_applet->setWindowModality(Qt::WindowModal);
- controller_applet->exec();
-
- emit ControllerSelectorReconfigureFinished();
+ bool is_success = controller_applet->exec() != QDialog::Rejected;
// Don't forget to apply settings.
+ system->HIDCore().DisableAllControllerConfiguration();
system->ApplySettings();
config->Save();
UpdateStatusButtons();
+
+ emit ControllerSelectorReconfigureFinished(is_success);
}
void GMainWindow::ControllerSelectorRequestExit() {
@@ -651,8 +656,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 +1725,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 +1773,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 +2071,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..8b5c1d747 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 {
@@ -165,7 +166,7 @@ signals:
void AmiiboSettingsFinished(bool is_success, const std::string& name);
- void ControllerSelectorReconfigureFinished();
+ void ControllerSelectorReconfigureFinished(bool is_success);
void ErrorDisplayFinished();
@@ -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.