SettingsInterface.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <ProjectInfo.h>
  10. #include <AzCore/EBus/EBus.h>
  11. #include <AzCore/Interface/Interface.h>
  12. namespace O3DE::ProjectManager
  13. {
  14. //! Interface used to interact with the settings functions
  15. class ISettings
  16. {
  17. public:
  18. AZ_RTTI(O3DE::ProjectManager::ISettings, "{95D87D95-0E04-462F-8B0B-ED15C0A9F090}");
  19. AZ_DISABLE_COPY_MOVE(ISettings);
  20. static constexpr char ProjectManagerKeyPrefix[] = "/O3DE/ProjectManager";
  21. static constexpr char ExternalLinkWarningKey[] = "/O3DE/ProjectManager/SkipExternalLinkWarning";
  22. static constexpr char ProjectsBuiltSuccessfullyKey[] = "/O3DE/ProjectManager/SuccessfulBuildPaths";
  23. ISettings() = default;
  24. virtual ~ISettings() = default;
  25. /**
  26. * Get the value for a string settings key
  27. * @param result Store string result in this variable
  28. * @param settingsKey The key to get the value in
  29. * @return true if all calls to settings registry were successful
  30. */
  31. virtual bool Get(QString& result, const QString& settingsKey) = 0;
  32. /**
  33. * Get the value for a bool settings key
  34. * @param result Store bool result in this variable
  35. * @param settingsKey The key to get the value in
  36. * @return true if all calls to settings registry were successful
  37. */
  38. virtual bool Get(bool& result, const QString& settingsKey) = 0;
  39. /**
  40. * Set the value for a string settings key
  41. * @param settingsKey The key to set the value in
  42. * @param settingsValue String value to set key to
  43. * @return true if all calls to settings registry were successful
  44. */
  45. virtual bool Set(const QString& settingsKey, const QString& settingsValue) = 0;
  46. /**
  47. * Set the value for a bool settings key
  48. * @param settingsKey The key to set the value in
  49. * @param settingsValue Bool value to set key to
  50. * @return true if all calls to settings registry were successful
  51. */
  52. virtual bool Set(const QString& settingsKey, bool settingsValue) = 0;
  53. /**
  54. * Remove settings key
  55. * @param settingsKey The key to remove
  56. * @return true if all calls to settings registry were successful
  57. */
  58. virtual bool Remove(const QString& settingsKey) = 0;
  59. /**
  60. * Copy the string settings value from one key to another
  61. * @param settingsKeyOrig The original key to copy from
  62. * @param settingsKeyDest The destination key to copy to
  63. * @param removeOrig(Optional) Delete the original key if true
  64. * @return true if all calls to settings registry were successful
  65. */
  66. virtual bool Copy(const QString& settingsKeyOrig, const QString& settingsKeyDest, bool removeOrig = false) = 0;
  67. /**
  68. * Generate prefix for project settings key
  69. * @param projectInfo Project for settings key
  70. * @return QString Prefix for project specific settings key
  71. */
  72. virtual QString GetProjectKey(const ProjectInfo& projectInfo) = 0;
  73. /**
  74. * Get the build status for a project
  75. * @param result Store bool build status in this variable
  76. * @param projectInfo Project to check built status for
  77. * @return true if all calls to settings registry were successful
  78. */
  79. virtual bool GetProjectBuiltSuccessfully(bool& result, const ProjectInfo& projectInfo) = 0;
  80. /**
  81. * Set the build status for a project
  82. * @param projectInfo Project to set built status for
  83. * @param successfullyBuilt Bool value to set build status to
  84. * @return true if all calls to settings registry were successful
  85. */
  86. virtual bool SetProjectBuiltSuccessfully(const ProjectInfo& projectInfo, bool successfullyBuilt) = 0;
  87. };
  88. using SettingsInterface = AZ::Interface<ISettings>;
  89. } // namespace O3DE::ProjectManager