fix: minor ui fixes

This commit is contained in:
2025-12-19 20:04:30 +03:00
parent 8112096647
commit d17776b8e4
6 changed files with 63 additions and 59 deletions

View File

@@ -6,7 +6,7 @@
namespace clrsync::core
{
const std::string GIT_SEMVER = "0.1.7+git.g4ada2c4";
const std::string GIT_SEMVER = "0.1.7+git.g8112096";
const std::string version_string();
} // namespace clrsync::core

View File

@@ -198,7 +198,7 @@ Result<void> config::save_config_value(const std::string &section, const std::st
if (!m_temp_file)
{
m_temp_file = std::make_unique<clrsync::core::io::toml_file>(m_temp_config_path);
m_temp_file->parse();
(void)m_temp_file->parse();
}
m_temp_file->set_value(section, key, value);
@@ -347,7 +347,7 @@ Result<void> config::remove_template(const std::string &key)
if (!m_temp_file)
{
m_temp_file = std::make_unique<clrsync::core::io::toml_file>(m_temp_config_path);
m_temp_file->parse();
(void)m_temp_file->parse();
}
m_temp_file->remove_section("templates." + key);
return m_temp_file->save_file();

View File

@@ -27,6 +27,7 @@ void main_layout::render_menu_bar()
ImGui::Begin("##TopBar", nullptr, flags);
ImGuiStyle &style = ImGui::GetStyle();
style.FrameBorderSize = 1.0f;
const char *settings_label = "Settings";
const char *about_label = "About";

View File

@@ -35,8 +35,6 @@ void about_window::render(const clrsync::core::palette &pal)
ImGui::Separator();
ImGui::Spacing();
ImGui::Text("Links:");
constexpr float button_width = 200.0f;
float spacing = ImGui::GetStyle().ItemSpacing.x;
float total_width = 2.0f * button_width + spacing;

View File

@@ -114,11 +114,15 @@ void color_table_renderer::render(const clrsync::core::palette &current,
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(8, 6));
ImGui::AlignTextToFramePadding();
ImGui::Text("Filter:");
ImGui::SameLine();
ImGui::SetNextItemWidth(200);
bool filter_changed = ImGui::InputTextWithHint("##color_filter", "Search colors...",
m_filter_text, sizeof(m_filter_text));
bool filter_changed =
ImGui::InputTextWithHint("##color_filter",
"Search colors...",
m_filter_text,
sizeof(m_filter_text));
if (m_filter_text[0] != '\0')
{

View File

@@ -1,12 +1,11 @@
#include "gui/views/settings_window.hpp"
#include "core/common/error.hpp"
#include "core/config/config.hpp"
#include "gui/widgets/section_header.hpp"
#include "gui/ui_manager.hpp"
#include "gui/widgets/section_header.hpp"
#include "imgui.h"
settings_window::settings_window(clrsync::gui::ui_manager* ui_mgr)
: m_ui_manager(ui_mgr)
settings_window::settings_window(clrsync::gui::ui_manager *ui_mgr) : m_ui_manager(ui_mgr)
{
if (m_ui_manager)
m_available_fonts = m_ui_manager->get_system_fonts();
@@ -57,7 +56,8 @@ void settings_window::render()
ImGui::Separator();
clrsync::gui::widgets::settings_buttons_callbacks callbacks{
.on_ok = [this]() {
.on_ok =
[this]() {
apply_settings();
if (!m_error.has_error())
{
@@ -65,17 +65,18 @@ void settings_window::render()
m_settings_changed = false;
}
},
.on_apply = [this]() {
.on_apply =
[this]() {
apply_settings();
if (!m_error.has_error())
m_settings_changed = false;
},
.on_reset = [this]() { reset_to_defaults(); },
.on_cancel = [this]() {
.on_cancel =
[this]() {
load_settings();
m_visible = false;
}
};
}};
m_buttons.render(callbacks, m_settings_changed);
}
ImGui::End();
@@ -176,22 +177,22 @@ void settings_window::render_general_tab()
section_header("Theme Settings", m_current_palette);
form_field_config theme_cfg{
.label = "Default Theme",
.tooltip = "The default color scheme to load on startup",
.field_width = -100.0f
};
form_field_config theme_cfg;
theme_cfg.label = "Default Theme";
theme_cfg.label_width = 150.0f;
theme_cfg.tooltip = "The default color scheme to load on startup";
theme_cfg.field_width = -100.0f;
if (m_form.render_text(theme_cfg, m_default_theme))
m_settings_changed = true;
section_header("Path Settings", m_current_palette);
form_field_config path_cfg{
.label = "Palettes Directory",
.tooltip = "Directory where color palettes are stored\nSupports ~ for home directory",
.field_width = -1.0f,
.type = field_type::path
};
form_field_config path_cfg;
path_cfg.label = "Palettes Directory";
path_cfg.label_width = 150.0f;
path_cfg.tooltip = "Directory where color palettes are stored\nSupports ~ for home directory";
path_cfg.field_width = -1.0f;
path_cfg.type = field_type::path;
if (m_form.render_path(path_cfg, m_palettes_path))
m_settings_changed = true;
}
@@ -202,28 +203,28 @@ void settings_window::render_appearance_tab()
section_header("Font Settings", m_current_palette);
form_field_config font_cfg{
.label = "Font Family",
.tooltip = "Select font family for the application interface",
.field_width = -1.0f,
.type = field_type::combo
};
form_field_config font_cfg;
font_cfg.label = "Font Family";
font_cfg.label_width = 150.0f;
font_cfg.tooltip = "Select font family for the application interface";
font_cfg.field_width = -1.0f;
font_cfg.type = field_type::combo;
if (m_form.render_combo(font_cfg, m_available_fonts, m_selected_font_idx, m_font))
m_settings_changed = true;
ImGui::Spacing();
form_field_config size_cfg{
.label = "Font Size",
.tooltip = "Font size for the application interface (8-48)",
.field_width = 120.0f,
.type = field_type::slider,
.min_value = 8.0f,
.max_value = 48.0f,
.format = "%d px",
.show_reset = true,
.default_value = 14
};
form_field_config size_cfg;
size_cfg.label = "Font Size",
size_cfg.label_width = 150.0f;
size_cfg.tooltip = "Font size for the application interface (8-48)";
size_cfg.field_width = 120.0f;
size_cfg.type = field_type::slider;
size_cfg.min_value = 8.0f;
size_cfg.max_value = 48.0f;
size_cfg.format = "%d px";
size_cfg.show_reset = true;
size_cfg.default_value = 14;
if (m_form.render_slider(size_cfg, m_font_size))
m_settings_changed = true;
}