فهرست منبع

frontend: Add frontend applet for ProfileSelect

Responsible for selecting a profile and firing callback upon completion.
Zach Hilman 7 سال پیش
والد
کامیت
d17f38494b
3فایلهای تغییر یافته به همراه48 افزوده شده و 0 حذف شده
  1. 2 0
      src/core/CMakeLists.txt
  2. 19 0
      src/core/frontend/applets/profile_select.cpp
  3. 27 0
      src/core/frontend/applets/profile_select.h

+ 2 - 0
src/core/CMakeLists.txt

@@ -79,6 +79,8 @@ add_library(core STATIC
     file_sys/vfs_vector.h
     file_sys/xts_archive.cpp
     file_sys/xts_archive.h
+    frontend/applets/profile_select.cpp
+    frontend/applets/profile_select.h
     frontend/applets/software_keyboard.cpp
     frontend/applets/software_keyboard.h
     frontend/emu_window.cpp

+ 19 - 0
src/core/frontend/applets/profile_select.cpp

@@ -0,0 +1,19 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "core/frontend/applets/profile_select.h"
+#include "core/settings.h"
+
+namespace Core::Frontend {
+
+ProfileSelectApplet::~ProfileSelectApplet() = default;
+
+void DefaultProfileSelectApplet::SelectProfile(
+    std::function<void(std::optional<Service::Account::UUID>)> callback) const {
+    Service::Account::ProfileManager manager;
+    callback(manager.GetUser(Settings::values.current_user).value_or(Service::Account::UUID{}));
+    LOG_INFO(Service_ACC, "called, selecting current user instead of prompting...");
+}
+
+} // namespace Core::Frontend

+ 27 - 0
src/core/frontend/applets/profile_select.h

@@ -0,0 +1,27 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <functional>
+#include <optional>
+#include "core/hle/service/acc/profile_manager.h"
+
+namespace Core::Frontend {
+
+class ProfileSelectApplet {
+public:
+    virtual ~ProfileSelectApplet();
+
+    virtual void SelectProfile(
+        std::function<void(std::optional<Service::Account::UUID>)> callback) const = 0;
+};
+
+class DefaultProfileSelectApplet final : public ProfileSelectApplet {
+public:
+    void SelectProfile(
+        std::function<void(std::optional<Service::Account::UUID>)> callback) const override;
+};
+
+} // namespace Core::Frontend