Settings.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 <SettingsInterface.h>
  10. #include <AzCore/std/string/string.h>
  11. #include <AzCore/std/containers/set.h>
  12. namespace AZ
  13. {
  14. class SettingsRegistryInterface;
  15. }
  16. namespace O3DE::ProjectManager
  17. {
  18. class Settings
  19. : public SettingsInterface::Registrar
  20. {
  21. public:
  22. Settings(bool saveToDisk = true);
  23. bool Get(QString& result, const QString& settingsKey) override;
  24. bool Get(bool& result, const QString& settingsKey) override;
  25. bool Set(const QString& settingsKey, const QString& settingsValue) override;
  26. bool Set(const QString& settingsKey, bool settingsValue) override;
  27. bool Remove(const QString& settingsKey) override;
  28. bool Copy(const QString& settingsKeyOrig, const QString& settingsKeyDest, bool removeOrig = false) override;
  29. QString GetProjectKey(const ProjectInfo& projectInfo) override;
  30. bool GetProjectBuiltSuccessfully(bool& result, const ProjectInfo& projectInfo) override;
  31. bool SetProjectBuiltSuccessfully(const ProjectInfo& projectInfo, bool successfullyBuilt) override;
  32. private:
  33. void Save();
  34. void OnSettingsChanged();
  35. bool GetBuiltSuccessfullyPaths(AZStd::set<AZStd::string>& result);
  36. bool m_saveToDisk;
  37. AZ::SettingsRegistryInterface* m_settingsRegistry = nullptr;
  38. };
  39. } // namespace O3DE::ProjectManager