feat: Enhance SettingsEditor with new features and UI improvements
- Added new tabs for Theme Management, Editor Behavior, Performance Settings, and AI Agent Configuration in the SettingsEditor. - Implemented UI elements for theme selection and management, including current theme display and available themes grid. - Introduced editor behavior settings such as auto-save options and recent files limit. - Added performance settings for graphics and memory management. - Updated keyboard shortcuts section with a placeholder for future customization features.
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
#include "app/gui/feature_flags_menu.h"
|
#include "app/gui/feature_flags_menu.h"
|
||||||
#include "app/gfx/performance_profiler.h"
|
#include "app/gfx/performance_profiler.h"
|
||||||
#include "app/gui/style.h"
|
#include "app/gui/style.h"
|
||||||
|
#include "app/gui/icons.h"
|
||||||
|
#include "app/gui/theme_manager.h"
|
||||||
#include "imgui/imgui.h"
|
#include "imgui/imgui.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
@@ -29,18 +31,34 @@ absl::Status SettingsEditor::Load() {
|
|||||||
|
|
||||||
absl::Status SettingsEditor::Update() {
|
absl::Status SettingsEditor::Update() {
|
||||||
if (BeginTabBar("Settings", ImGuiTabBarFlags_None)) {
|
if (BeginTabBar("Settings", ImGuiTabBarFlags_None)) {
|
||||||
if (BeginTabItem("General")) {
|
if (BeginTabItem(ICON_MD_SETTINGS " General")) {
|
||||||
DrawGeneralSettings();
|
DrawGeneralSettings();
|
||||||
EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
if (BeginTabItem("Font Manager")) {
|
if (BeginTabItem(ICON_MD_FONT_DOWNLOAD " Font Manager")) {
|
||||||
gui::DrawFontManager();
|
gui::DrawFontManager();
|
||||||
EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
if (BeginTabItem("Keyboard Shortcuts")) {
|
if (BeginTabItem(ICON_MD_KEYBOARD " Keyboard Shortcuts")) {
|
||||||
DrawKeyboardShortcuts();
|
DrawKeyboardShortcuts();
|
||||||
EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
|
if (BeginTabItem(ICON_MD_PALETTE " Themes")) {
|
||||||
|
DrawThemeSettings();
|
||||||
|
EndTabItem();
|
||||||
|
}
|
||||||
|
if (BeginTabItem(ICON_MD_TUNE " Editor Behavior")) {
|
||||||
|
DrawEditorBehavior();
|
||||||
|
EndTabItem();
|
||||||
|
}
|
||||||
|
if (BeginTabItem(ICON_MD_SPEED " Performance")) {
|
||||||
|
DrawPerformanceSettings();
|
||||||
|
EndTabItem();
|
||||||
|
}
|
||||||
|
if (BeginTabItem(ICON_MD_SMART_TOY " AI Agent")) {
|
||||||
|
DrawAIAgentSettings();
|
||||||
|
EndTabItem();
|
||||||
|
}
|
||||||
EndTabBar();
|
EndTabBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,13 +96,172 @@ void SettingsEditor::DrawGeneralSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SettingsEditor::DrawKeyboardShortcuts() {
|
void SettingsEditor::DrawKeyboardShortcuts() {
|
||||||
for (const auto& [name, shortcut] :
|
ImGui::Text("Keyboard shortcut customization coming soon...");
|
||||||
context_->shortcut_manager.GetShortcuts()) {
|
ImGui::Separator();
|
||||||
ImGui::PushID(name.c_str());
|
|
||||||
ImGui::Text("%s", name.c_str());
|
// TODO: Implement keyboard shortcut editor with:
|
||||||
ImGui::SameLine(ImGui::GetWindowWidth() - 100);
|
// - Visual shortcut conflict detection
|
||||||
ImGui::Text("%s", PrintShortcut(shortcut.keys).c_str());
|
// - Import/export shortcut profiles
|
||||||
ImGui::PopID();
|
// - Search and filter shortcuts
|
||||||
|
// - Live editing and rebinding
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsEditor::DrawThemeSettings() {
|
||||||
|
using namespace ImGui;
|
||||||
|
|
||||||
|
auto& theme_manager = gui::ThemeManager::Get();
|
||||||
|
|
||||||
|
Text("%s Theme Management", ICON_MD_PALETTE);
|
||||||
|
Separator();
|
||||||
|
|
||||||
|
// Current theme selection
|
||||||
|
Text("Current Theme:");
|
||||||
|
SameLine();
|
||||||
|
auto current = theme_manager.GetCurrentThemeName();
|
||||||
|
TextColored(ImVec4(0.4f, 0.8f, 1.0f, 1.0f), "%s", current.c_str());
|
||||||
|
|
||||||
|
Spacing();
|
||||||
|
|
||||||
|
// Available themes grid
|
||||||
|
Text("Available Themes:");
|
||||||
|
for (const auto& theme_name : theme_manager.GetAvailableThemes()) {
|
||||||
|
PushID(theme_name.c_str());
|
||||||
|
bool is_current = (theme_name == current);
|
||||||
|
|
||||||
|
if (is_current) {
|
||||||
|
PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.6f, 0.8f, 1.0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Button(theme_name.c_str(), ImVec2(180, 0))) {
|
||||||
|
theme_manager.LoadTheme(theme_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_current) {
|
||||||
|
PopStyleColor();
|
||||||
|
SameLine();
|
||||||
|
Text(ICON_MD_CHECK);
|
||||||
|
}
|
||||||
|
|
||||||
|
PopID();
|
||||||
|
}
|
||||||
|
|
||||||
|
Separator();
|
||||||
|
Spacing();
|
||||||
|
|
||||||
|
// Theme operations
|
||||||
|
if (CollapsingHeader(ICON_MD_EDIT " Theme Operations")) {
|
||||||
|
TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f),
|
||||||
|
"Theme import/export coming soon");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsEditor::DrawEditorBehavior() {
|
||||||
|
using namespace ImGui;
|
||||||
|
|
||||||
|
Text("%s Editor Behavior Settings", ICON_MD_TUNE);
|
||||||
|
Separator();
|
||||||
|
|
||||||
|
// Autosave settings
|
||||||
|
if (CollapsingHeader(ICON_MD_SAVE " Auto-Save", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||||
|
static bool autosave_enabled = true;
|
||||||
|
Checkbox("Enable Auto-Save", &autosave_enabled);
|
||||||
|
|
||||||
|
if (autosave_enabled) {
|
||||||
|
static int autosave_interval = 300;
|
||||||
|
SliderInt("Interval (seconds)", &autosave_interval, 60, 600);
|
||||||
|
|
||||||
|
static bool backup_before_save = true;
|
||||||
|
Checkbox("Create Backup Before Save", &backup_before_save);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recent files
|
||||||
|
if (CollapsingHeader(ICON_MD_HISTORY " Recent Files")) {
|
||||||
|
static int recent_files_limit = 10;
|
||||||
|
SliderInt("Recent Files Limit", &recent_files_limit, 5, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Editor defaults
|
||||||
|
if (CollapsingHeader(ICON_MD_EDIT " Default Editor")) {
|
||||||
|
Text("Editor to open on ROM load:");
|
||||||
|
static int default_editor = 0;
|
||||||
|
const char* editors[] = { "None", "Overworld", "Dungeon", "Graphics" };
|
||||||
|
Combo("##DefaultEditor", &default_editor, editors, IM_ARRAYSIZE(editors));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsEditor::DrawPerformanceSettings() {
|
||||||
|
using namespace ImGui;
|
||||||
|
|
||||||
|
Text("%s Performance Settings", ICON_MD_SPEED);
|
||||||
|
Separator();
|
||||||
|
|
||||||
|
// Graphics settings
|
||||||
|
if (CollapsingHeader(ICON_MD_IMAGE " Graphics", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||||
|
static bool vsync = true;
|
||||||
|
Checkbox("V-Sync", &vsync);
|
||||||
|
|
||||||
|
static int target_fps = 60;
|
||||||
|
SliderInt("Target FPS", &target_fps, 30, 144);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Memory settings
|
||||||
|
if (CollapsingHeader(ICON_MD_MEMORY " Memory")) {
|
||||||
|
static int cache_size = 512;
|
||||||
|
SliderInt("Cache Size (MB)", &cache_size, 128, 2048);
|
||||||
|
|
||||||
|
static int undo_size = 50;
|
||||||
|
SliderInt("Undo History", &undo_size, 10, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
Separator();
|
||||||
|
Text("Current FPS: %.1f", ImGui::GetIO().Framerate);
|
||||||
|
Text("Frame Time: %.3f ms", 1000.0f / ImGui::GetIO().Framerate);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsEditor::DrawAIAgentSettings() {
|
||||||
|
using namespace ImGui;
|
||||||
|
|
||||||
|
Text("%s AI Agent Configuration", ICON_MD_SMART_TOY);
|
||||||
|
Separator();
|
||||||
|
|
||||||
|
// Provider selection
|
||||||
|
if (CollapsingHeader(ICON_MD_CLOUD " AI Provider", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||||
|
static int provider = 0;
|
||||||
|
const char* providers[] = { "Ollama (Local)", "Gemini (Cloud)", "Mock (Testing)" };
|
||||||
|
Combo("Provider", &provider, providers, IM_ARRAYSIZE(providers));
|
||||||
|
|
||||||
|
Spacing();
|
||||||
|
|
||||||
|
if (provider == 0) { // Ollama
|
||||||
|
static char ollama_url[256] = "http://localhost:11434";
|
||||||
|
InputText("URL", ollama_url, IM_ARRAYSIZE(ollama_url));
|
||||||
|
} else if (provider == 1) { // Gemini
|
||||||
|
static char api_key[128] = "";
|
||||||
|
InputText("API Key", api_key, IM_ARRAYSIZE(api_key), ImGuiInputTextFlags_Password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Model parameters
|
||||||
|
if (CollapsingHeader(ICON_MD_TUNE " Model Parameters")) {
|
||||||
|
static float temperature = 0.7f;
|
||||||
|
SliderFloat("Temperature", &temperature, 0.0f, 2.0f);
|
||||||
|
TextDisabled("Higher = more creative");
|
||||||
|
|
||||||
|
static int max_tokens = 2048;
|
||||||
|
SliderInt("Max Tokens", &max_tokens, 256, 8192);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Agent behavior
|
||||||
|
if (CollapsingHeader(ICON_MD_PSYCHOLOGY " Behavior")) {
|
||||||
|
static bool proactive = true;
|
||||||
|
Checkbox("Proactive Suggestions", &proactive);
|
||||||
|
|
||||||
|
static bool auto_learn = true;
|
||||||
|
Checkbox("Auto-Learn Preferences", &auto_learn);
|
||||||
|
|
||||||
|
static bool multimodal = true;
|
||||||
|
Checkbox("Enable Vision/Multimodal", &multimodal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -234,6 +234,10 @@ class SettingsEditor : public Editor {
|
|||||||
Rom* rom_;
|
Rom* rom_;
|
||||||
void DrawGeneralSettings();
|
void DrawGeneralSettings();
|
||||||
void DrawKeyboardShortcuts();
|
void DrawKeyboardShortcuts();
|
||||||
|
void DrawThemeSettings();
|
||||||
|
void DrawEditorBehavior();
|
||||||
|
void DrawPerformanceSettings();
|
||||||
|
void DrawAIAgentSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace editor
|
} // namespace editor
|
||||||
|
|||||||
Reference in New Issue
Block a user