AEPreferences.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 SetAndroidSDKPath(const String& path) { androidSDKPath_ = path; Write(); }
  27. void SetAntPath(const String& path) { antPath_ = path; Write(); }
  28. void SetJDKRootPath(const String& path) { jdkRootPath_ = path; Write(); }
  29. String GetAndroidSDKPath() { return AddTrailingSlash(androidSDKPath_); }
  30. String GetJDKRootPath() { return AddTrailingSlash(jdkRootPath_); }
  31. String GetAntPath() { return AddTrailingSlash(antPath_); }
  32. void Read();
  33. void Write();
  34. static bool ReadStartupPrefs(Context* context, StartupPreferences& prefs);
  35. void UpdateRecentFiles(bool write = true);
  36. private:
  37. void HandleEditorShutdown(StringHash eventType, VariantMap& eventData);
  38. void Clear();
  39. String GetPreferencesFullPath();
  40. String androidSDKPath_;
  41. String jdkRootPath_;
  42. String antPath_;
  43. String lastProjectFullPath_;
  44. Vector<String> recentProjects_;
  45. };
  46. }