feat: Add UserSettings and WorkspaceManager for enhanced user preferences and layout management
- Introduced `UserSettings` class to manage user preferences and settings persistence, including loading and saving functionality. - Added `WorkspaceManager` class to handle workspace layouts, sessions, and presets, improving user experience with layout management. - Updated `editor_library.cmake` to include new source files for `UserSettings` and `WorkspaceManager`.
This commit is contained in:
24
src/app/editor/system/user_settings.cc
Normal file
24
src/app/editor/system/user_settings.cc
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "app/editor/system/user_settings.h"
|
||||
#include <fstream>
|
||||
#include "util/file_util.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace editor {
|
||||
|
||||
UserSettings::UserSettings() {
|
||||
// TODO: Get platform-specific settings path
|
||||
settings_file_path_ = "yaze_settings.json";
|
||||
}
|
||||
|
||||
absl::Status UserSettings::Load() {
|
||||
// TODO: Load from JSON file
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
absl::Status UserSettings::Save() {
|
||||
// TODO: Save to JSON file
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace yaze
|
||||
44
src/app/editor/system/user_settings.h
Normal file
44
src/app/editor/system/user_settings.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef YAZE_APP_EDITOR_SYSTEM_USER_SETTINGS_H_
|
||||
#define YAZE_APP_EDITOR_SYSTEM_USER_SETTINGS_H_
|
||||
|
||||
#include <string>
|
||||
#include "absl/status/status.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace editor {
|
||||
|
||||
/**
|
||||
* @brief Manages user preferences and settings persistence
|
||||
*/
|
||||
class UserSettings {
|
||||
public:
|
||||
struct Preferences {
|
||||
float font_global_scale = 1.0f;
|
||||
bool backup_rom = false;
|
||||
bool save_new_auto = true;
|
||||
bool autosave_enabled = true;
|
||||
float autosave_interval = 300.0f;
|
||||
int recent_files_limit = 10;
|
||||
std::string last_rom_path;
|
||||
std::string last_project_path;
|
||||
bool show_welcome_on_startup = true;
|
||||
bool restore_last_session = true;
|
||||
};
|
||||
|
||||
UserSettings();
|
||||
|
||||
absl::Status Load();
|
||||
absl::Status Save();
|
||||
|
||||
Preferences& prefs() { return prefs_; }
|
||||
const Preferences& prefs() const { return prefs_; }
|
||||
|
||||
private:
|
||||
Preferences prefs_;
|
||||
std::string settings_file_path_;
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_SYSTEM_USER_SETTINGS_H_
|
||||
Reference in New Issue
Block a user