Merge pull request #10006 from german77/profile_select

service: am: Improve profile select applet
This commit is contained in:
liamwhite 2023-04-01 09:49:22 -04:00 committed by GitHub
commit 1ab052952d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 270 additions and 34 deletions

View file

@ -11,7 +11,8 @@ ProfileSelectApplet::~ProfileSelectApplet() = default;
void DefaultProfileSelectApplet::Close() const {}
void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback) const {
void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback,
const ProfileSelectParameters& parameters) const {
Service::Account::ProfileManager manager;
callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{}));
LOG_INFO(Service_ACC, "called, selecting current user instead of prompting...");

View file

@ -5,25 +5,35 @@
#include <functional>
#include <optional>
#include "common/uuid.h"
#include "common/uuid.h"
#include "core/frontend/applets/applet.h"
#include "core/hle/service/am/applets/applet_profile_select.h"
namespace Core::Frontend {
struct ProfileSelectParameters {
Service::AM::Applets::UiMode mode;
std::array<Common::UUID, 8> invalid_uid_list;
Service::AM::Applets::UiSettingsDisplayOptions display_options;
Service::AM::Applets::UserSelectionPurpose purpose;
};
class ProfileSelectApplet : public Applet {
public:
using SelectProfileCallback = std::function<void(std::optional<Common::UUID>)>;
virtual ~ProfileSelectApplet();
virtual void SelectProfile(SelectProfileCallback callback) const = 0;
virtual void SelectProfile(SelectProfileCallback callback,
const ProfileSelectParameters& parameters) const = 0;
};
class DefaultProfileSelectApplet final : public ProfileSelectApplet {
public:
void Close() const override;
void SelectProfile(SelectProfileCallback callback) const override;
void SelectProfile(SelectProfileCallback callback,
const ProfileSelectParameters& parameters) const override;
};
} // namespace Core::Frontend