3#include "absl/status/status.h"
11#include "imgui/imgui.h"
20using ImGui::BeginTabBar;
21using ImGui::BeginTabItem;
22using ImGui::BeginTable;
23using ImGui::EndTabBar;
24using ImGui::EndTabItem;
26using ImGui::TableHeadersRow;
27using ImGui::TableNextColumn;
28using ImGui::TableSetupColumn;
37 .display_name =
"General Settings",
43 card_registry->RegisterCard({
45 .display_name =
"Appearance",
51 card_registry->RegisterCard({
52 .card_id =
MakeCardId(
"settings.editor_behavior"),
53 .display_name =
"Editor Behavior",
59 card_registry->RegisterCard({
61 .display_name =
"Performance",
67 card_registry->RegisterCard({
69 .display_name =
"AI Agent",
75 card_registry->RegisterCard({
77 .display_name =
"Keyboard Shortcuts",
84 card_registry->ShowCard(
MakeCardId(
"settings.general"));
89 return absl::OkStatus();
98 if (general_visible && *general_visible) {
101 if (general_card.
Begin(general_visible)) {
108 bool* appearance_visible = card_registry->GetVisibilityFlag(
MakeCardId(
"settings.appearance"));
109 if (appearance_visible && *appearance_visible) {
112 if (appearance_card.
Begin(appearance_visible)) {
117 appearance_card.
End();
121 bool* behavior_visible = card_registry->GetVisibilityFlag(
MakeCardId(
"settings.editor_behavior"));
122 if (behavior_visible && *behavior_visible) {
125 if (behavior_card.
Begin(behavior_visible)) {
132 bool* perf_visible = card_registry->GetVisibilityFlag(
MakeCardId(
"settings.performance"));
133 if (perf_visible && *perf_visible) {
136 if (perf_card.
Begin(perf_visible)) {
143 bool* ai_visible = card_registry->GetVisibilityFlag(
MakeCardId(
"settings.ai_agent"));
144 if (ai_visible && *ai_visible) {
147 if (ai_card.
Begin(ai_visible)) {
154 bool* shortcuts_visible = card_registry->GetVisibilityFlag(
MakeCardId(
"settings.shortcuts"));
155 if (shortcuts_visible && *shortcuts_visible) {
158 if (shortcuts_card.
Begin(shortcuts_visible)) {
161 shortcuts_card.
End();
164 return absl::OkStatus();
170 if (BeginTable(
"##SettingsTable", 4,
171 ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable |
172 ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable)) {
173 TableSetupColumn(
"System Flags", ImGuiTableColumnFlags_WidthStretch);
174 TableSetupColumn(
"Overworld Flags", ImGuiTableColumnFlags_WidthStretch);
175 TableSetupColumn(
"Dungeon Flags", ImGuiTableColumnFlags_WidthStretch);
176 TableSetupColumn(
"Resource Flags", ImGuiTableColumnFlags_WidthStretch,
198 ImGui::Text(
"Keyboard shortcut customization coming soon...");
209 using namespace ImGui;
217 Text(
"Current Theme:");
219 auto current = theme_manager.GetCurrentThemeName();
220 TextColored(ImVec4(0.4f, 0.8f, 1.0f, 1.0f),
"%s", current.c_str());
225 Text(
"Available Themes:");
226 for (
const auto& theme_name : theme_manager.GetAvailableThemes()) {
227 PushID(theme_name.c_str());
228 bool is_current = (theme_name == current);
231 PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.6f, 0.8f, 1.0f));
234 if (Button(theme_name.c_str(), ImVec2(180, 0))) {
235 theme_manager.LoadTheme(theme_name);
251 if (CollapsingHeader(
ICON_MD_EDIT " Theme Operations")) {
252 TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f),
253 "Theme import/export coming soon");
258 using namespace ImGui;
261 Text(
"No user settings available");
269 if (CollapsingHeader(
ICON_MD_SAVE " Auto-Save", ImGuiTreeNodeFlags_DefaultOpen)) {
276 if (SliderInt(
"Interval (seconds)", &interval, 60, 600)) {
296 Text(
"Editor to open on ROM load:");
297 const char* editors[] = {
"None",
"Overworld",
"Dungeon",
"Graphics" };
305 using namespace ImGui;
308 Text(
"No user settings available");
316 if (CollapsingHeader(
ICON_MD_IMAGE " Graphics", ImGuiTreeNodeFlags_DefaultOpen)) {
338 Text(
"Current FPS: %.1f", ImGui::GetIO().Framerate);
339 Text(
"Frame Time: %.3f ms", 1000.0f / ImGui::GetIO().Framerate);
343 using namespace ImGui;
346 Text(
"No user settings available");
354 if (CollapsingHeader(
ICON_MD_CLOUD " AI Provider", ImGuiTreeNodeFlags_DefaultOpen)) {
355 const char* providers[] = {
"Ollama (Local)",
"Gemini (Cloud)",
"Mock (Testing)" };
363 char url_buffer[256];
365 url_buffer[
sizeof(url_buffer) - 1] =
'\0';
366 if (InputText(
"URL", url_buffer, IM_ARRAYSIZE(url_buffer))) {
371 char key_buffer[128];
373 key_buffer[
sizeof(key_buffer) - 1] =
'\0';
374 if (InputText(
"API Key", key_buffer, IM_ARRAYSIZE(key_buffer), ImGuiInputTextFlags_Password)) {
382 if (CollapsingHeader(
ICON_MD_TUNE " Model Parameters")) {
386 TextDisabled(
"Higher = more creative");
409 if (CollapsingHeader(
ICON_MD_TERMINAL " CLI Logging", ImGuiTreeNodeFlags_DefaultOpen)) {
410 Text(
"Configure z3ed command-line logging behavior");
414 const char* log_levels[] = {
"Debug (Verbose)",
"Info (Normal)",
"Warning (Quiet)",
"Error (Critical)",
"Fatal Only" };
428 std::set<std::string> categories;
437 Text(
"✓ Log level applied");
439 TextDisabled(
"Controls verbosity of YAZE and z3ed output");
448 const char* home = std::getenv(
"HOME");
455 std::set<std::string> categories;
460 std::set<std::string> categories;
469 char path_buffer[512];
471 path_buffer[
sizeof(path_buffer) - 1] =
'\0';
472 if (InputText(
"Log File", path_buffer, IM_ARRAYSIZE(path_buffer))) {
475 std::set<std::string> categories;
481 TextDisabled(
"Log file path (supports ~ for home directory)");
490 TextDisabled(
"Enable/disable specific log categories");
493 bool categories_changed =
false;
500 if (categories_changed) {
502 std::set<std::string> categories;
522 if (std::filesystem::exists(path)) {
523 std::filesystem::remove(path);
532 std::filesystem::path dir = path.parent_path();
536 std::string cmd =
"explorer " + dir.string();
538 std::string cmd =
"open " + dir.string();
540 std::string cmd =
"xdg-open " + dir.string();
551 if (Button(
"Test Debug")) {
552 LOG_DEBUG(
"Settings",
"This is a debug message");
555 if (Button(
"Test Info")) {
556 LOG_INFO(
"Settings",
"This is an info message");
559 if (Button(
"Test Warning")) {
560 LOG_WARN(
"Settings",
"This is a warning message");
563 if (Button(
"Test Error")) {
564 LOG_ERROR(
"Settings",
"This is an error message");
bool * GetVisibilityFlag(size_t session_id, const std::string &base_card_id)
Get visibility flag pointer for a card.
void RegisterCard(size_t session_id, const CardInfo &base_info)
Register a card for a specific session.
EditorDependencies dependencies_
std::string MakeCardId(const std::string &base_id) const
void DrawGeneralSettings()
absl::Status Update() override
void DrawPerformanceSettings()
UserSettings * user_settings_
absl::Status Load() override
void Initialize() override
void DrawKeyboardShortcuts()
void DrawEditorBehavior()
void DrawAIAgentSettings()
RAII timer for automatic timing management.
Draggable, dockable card for editor sub-windows.
bool Begin(bool *p_open=nullptr)
void SetDefaultSize(float width, float height)
static ThemeManager & Get()
static LogManager & instance()
void configure(LogLevel level, const std::string &file_path, const std::set< std::string > &categories)
Configures the logging system.
#define ICON_MD_FOLDER_OPEN
#define ICON_MD_BUG_REPORT
#define ICON_MD_PSYCHOLOGY
#define ICON_MD_FILTER_ALT
#define ICON_MD_SMART_TOY
#define LOG_DEBUG(category, format,...)
#define LOG_ERROR(category, format,...)
#define LOG_WARN(category, format,...)
#define LOG_INFO(category, format,...)
LogLevel
Defines the severity levels for log messages. This allows for filtering messages based on their impor...
Main namespace for the application.
EditorCardRegistry * card_registry
std::string gemini_api_key
std::string log_file_path