6#include "absl/strings/str_format.h"
8#include "imgui/imgui.h"
18 if (config_dir_status.ok()) {
21 LOG_WARN(
"UserSettings",
"Could not determine config directory. Using local.");
30 return absl::OkStatus();
33 std::istringstream ss(data);
35 while (std::getline(ss, line)) {
36 size_t eq_pos = line.find(
'=');
37 if (eq_pos == std::string::npos)
continue;
39 std::string key = line.substr(0, eq_pos);
40 std::string val = line.substr(eq_pos + 1);
43 if (key ==
"font_global_scale") {
45 }
else if (key ==
"backup_rom") {
47 }
else if (key ==
"save_new_auto") {
49 }
else if (key ==
"autosave_enabled") {
51 }
else if (key ==
"autosave_interval") {
53 }
else if (key ==
"recent_files_limit") {
55 }
else if (key ==
"last_rom_path") {
57 }
else if (key ==
"last_project_path") {
59 }
else if (key ==
"show_welcome_on_startup") {
61 }
else if (key ==
"restore_last_session") {
65 else if (key ==
"backup_before_save") {
67 }
else if (key ==
"default_editor") {
71 else if (key ==
"vsync") {
73 }
else if (key ==
"target_fps") {
75 }
else if (key ==
"cache_size_mb") {
77 }
else if (key ==
"undo_history_size") {
81 else if (key ==
"ai_provider") {
83 }
else if (key ==
"ollama_url") {
85 }
else if (key ==
"gemini_api_key") {
87 }
else if (key ==
"ai_temperature") {
89 }
else if (key ==
"ai_max_tokens") {
91 }
else if (key ==
"ai_proactive") {
93 }
else if (key ==
"ai_auto_learn") {
95 }
else if (key ==
"ai_multimodal") {
99 else if (key ==
"log_level") {
101 }
else if (key ==
"log_to_file") {
103 }
else if (key ==
"log_file_path") {
105 }
else if (key ==
"log_ai_requests") {
107 }
else if (key ==
"log_rom_operations") {
109 }
else if (key ==
"log_gui_automation") {
111 }
else if (key ==
"log_proposals") {
116 }
catch (
const std::exception& e) {
117 return absl::InternalError(
118 absl::StrFormat(
"Failed to load user settings: %s", e.what()));
120 return absl::OkStatus();
125 std::ostringstream ss;
168 }
catch (
const std::exception& e) {
169 return absl::InternalError(
170 absl::StrFormat(
"Failed to save user settings: %s", e.what()));
172 return absl::OkStatus();
std::string settings_file_path_
#define LOG_WARN(category, format,...)
void SaveFile(const std::string &filename, const std::string &contents)
std::string LoadFile(const std::string &filename)
Loads the entire contents of a file into a string.
Main namespace for the application.
std::string gemini_api_key
bool show_welcome_on_startup
std::string last_project_path
std::string log_file_path
std::string last_rom_path
bool restore_last_session