general_frontend.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. // Copyright 2019 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <functional>
  6. #include <optional>
  7. #include "common/common_types.h"
  8. namespace Core::Frontend {
  9. class ParentalControlsApplet {
  10. public:
  11. virtual ~ParentalControlsApplet();
  12. // Prompts the user to enter a PIN and calls the callback with whether or not it matches the
  13. // correct PIN. If the bool is passed, and the PIN was recently entered correctly, the frontend
  14. // should not prompt and simply return true.
  15. virtual void VerifyPIN(std::function<void(bool)> finished,
  16. bool suspend_future_verification_temporarily) = 0;
  17. // Prompts the user to enter a PIN and calls the callback for correctness. Frontends can
  18. // optionally alert the user that this is to change parental controls settings.
  19. virtual void VerifyPINForSettings(std::function<void(bool)> finished) = 0;
  20. // Prompts the user to create a new PIN for pctl and stores it with the service.
  21. virtual void RegisterPIN(std::function<void()> finished) = 0;
  22. // Prompts the user to verify the current PIN and then store a new one into pctl.
  23. virtual void ChangePIN(std::function<void()> finished) = 0;
  24. };
  25. class DefaultParentalControlsApplet final : public ParentalControlsApplet {
  26. public:
  27. ~DefaultParentalControlsApplet() override;
  28. void VerifyPIN(std::function<void(bool)> finished,
  29. bool suspend_future_verification_temporarily) override;
  30. void VerifyPINForSettings(std::function<void(bool)> finished) override;
  31. void RegisterPIN(std::function<void()> finished) override;
  32. void ChangePIN(std::function<void()> finished) override;
  33. };
  34. class PhotoViewerApplet {
  35. public:
  36. virtual ~PhotoViewerApplet();
  37. virtual void ShowPhotosForApplication(u64 title_id, std::function<void()> finished) const = 0;
  38. virtual void ShowAllPhotos(std::function<void()> finished) const = 0;
  39. };
  40. class DefaultPhotoViewerApplet final : public PhotoViewerApplet {
  41. public:
  42. ~DefaultPhotoViewerApplet() override;
  43. void ShowPhotosForApplication(u64 title_id, std::function<void()> finished) const override;
  44. void ShowAllPhotos(std::function<void()> finished) const override;
  45. };
  46. class ECommerceApplet {
  47. public:
  48. virtual ~ECommerceApplet();
  49. // Shows a page with application icons, description, name, and price.
  50. virtual void ShowApplicationInformation(std::function<void()> finished, u64 title_id,
  51. std::optional<u128> user_id = {},
  52. std::optional<bool> full_display = {},
  53. std::optional<std::string> extra_parameter = {}) = 0;
  54. // Shows a page with all of the add on content available for a game, with name, description, and
  55. // price.
  56. virtual void ShowAddOnContentList(std::function<void()> finished, u64 title_id,
  57. std::optional<u128> user_id = {},
  58. std::optional<bool> full_display = {}) = 0;
  59. // Shows a page with all of the subscriptions (recurring payments) for a game, with name,
  60. // description, price, and renewal period.
  61. virtual void ShowSubscriptionList(std::function<void()> finished, u64 title_id,
  62. std::optional<u128> user_id = {}) = 0;
  63. // Shows a page with a list of any additional game related purchasable items (DLC,
  64. // subscriptions, etc) for a particular game, with name, description, type, and price.
  65. virtual void ShowConsumableItemList(std::function<void()> finished, u64 title_id,
  66. std::optional<u128> user_id = {}) = 0;
  67. // Shows the home page of the shop.
  68. virtual void ShowShopHome(std::function<void()> finished, u128 user_id, bool full_display) = 0;
  69. // Shows the user settings page of the shop.
  70. virtual void ShowSettings(std::function<void()> finished, u128 user_id, bool full_display) = 0;
  71. };
  72. class DefaultECommerceApplet : public ECommerceApplet {
  73. public:
  74. ~DefaultECommerceApplet() override;
  75. void ShowApplicationInformation(std::function<void()> finished, u64 title_id,
  76. std::optional<u128> user_id, std::optional<bool> full_display,
  77. std::optional<std::string> extra_parameter) override;
  78. void ShowAddOnContentList(std::function<void()> finished, u64 title_id,
  79. std::optional<u128> user_id,
  80. std::optional<bool> full_display) override;
  81. void ShowSubscriptionList(std::function<void()> finished, u64 title_id,
  82. std::optional<u128> user_id) override;
  83. void ShowConsumableItemList(std::function<void()> finished, u64 title_id,
  84. std::optional<u128> user_id) override;
  85. void ShowShopHome(std::function<void()> finished, u128 user_id, bool full_display) override;
  86. void ShowSettings(std::function<void()> finished, u128 user_id, bool full_display) override;
  87. };
  88. } // namespace Core::Frontend