general_frontend.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. } // namespace Core::Frontend