AEPreferences.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  2. // Please see LICENSE.md in repository root for license information
  3. // https://github.com/AtomicGameEngine/AtomicGameEngine
  4. #pragma once
  5. #include <Atomic/Core/Object.h>
  6. #include <Atomic/IO/FileSystem.h>
  7. using namespace Atomic;
  8. namespace AtomicEditor
  9. {
  10. class AEPreferences : public Object
  11. {
  12. OBJECT(AEPreferences);
  13. public:
  14. struct StartupPreferences
  15. {
  16. IntVector2 windowPos;
  17. int windowWidth;
  18. int windowHeight;
  19. };
  20. /// Construct.
  21. AEPreferences(Context* context);
  22. /// Destruct.
  23. ~AEPreferences();
  24. void RegisterRecentProject(const String& fullpath);
  25. const Vector<String>& GetRecentProjects() { return recentProjects_; }
  26. void DeleteRecentProjects();
  27. void SetAndroidSDKPath(const String& path) { androidSDKPath_ = path; Write(); }
  28. void SetAntPath(const String& path) { antPath_ = path; Write(); }
  29. void SetJDKRootPath(const String& path) { jdkRootPath_ = path; Write(); }
  30. String GetAndroidSDKPath() { return AddTrailingSlash(androidSDKPath_); }
  31. String GetJDKRootPath() { return AddTrailingSlash(jdkRootPath_); }
  32. String GetAntPath() { return AddTrailingSlash(antPath_); }
  33. void Read();
  34. void Write();
  35. static bool ReadStartupPrefs(Context* context, StartupPreferences& prefs);
  36. void UpdateRecentFiles(bool write = true);
  37. private:
  38. void HandleEditorShutdown(StringHash eventType, VariantMap& eventData);
  39. void Clear();
  40. String GetPreferencesFullPath();
  41. String androidSDKPath_;
  42. String jdkRootPath_;
  43. String antPath_;
  44. String lastProjectFullPath_;
  45. Vector<String> recentProjects_;
  46. };
  47. }