big time refactor + button styles

This commit is contained in:
2023-03-26 22:23:49 +02:00
parent a7fb909174
commit 6b29c5e0b8
6 changed files with 223 additions and 116 deletions

View File

@@ -56,16 +56,19 @@ void settingsReadLine(ImGuiContext* ctx, ImGuiSettingsHandler* handler, void* en
std::string task{};
task.resize(MAX_TASK_NAME_LENGTH);
time_t dayTimestamp;
if (sscanf_s(line, "task=%lld %s", &dayTimestamp, &task[0], MAX_TASK_NAME_LENGTH))
int year;
unsigned int month;
unsigned int day;
if (sscanf_s(line, "task=%d-%u-%u %s", &year, &month, &day, &task[0], MAX_TASK_NAME_LENGTH))
{
std::chrono::year_month_day date = std::chrono::year_month_day{ std::chrono::year{year}, std::chrono::month{month}, std::chrono::day{day} };
if (settings->tasks.contains(task))
{
settings->tasks[task].push_back(dayTimestamp);
settings->tasks[task].push_back(date);
}
else
{
settings->tasks.insert({ task, std::vector{ dayTimestamp } });
settings->tasks.insert({ task, std::vector{ date } });
}
}
@@ -117,7 +120,7 @@ void settingsWriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTex
{
for (auto& date : task.second)
{
outBuf->appendf("task=%lld %s\n", date, task.first.c_str());
outBuf->appendf("task=%d-%u-%u %s\n", int{ date.year() }, unsigned int{ date.month() }, unsigned int{ date.day() }, task.first.c_str());
}
}
@@ -176,11 +179,14 @@ void setAutostart(bool newValue)
void loadUiStyle()
{
ImGuiStyle& style = ImGui::GetStyle();
style.WindowPadding = { 6.f, 8.f };
style.WindowPadding = { 6.f, 12.f };
style.WindowBorderSize = 0.f;
style.FramePadding = { 8.f, 4.f };
style.ItemSpacing = { 4.f, 4.f };
style.WindowRounding = 4.f;
style.ItemSpacing = { 6.f, 4.f };
style.GrabRounding = 2.f;
style.PopupBorderSize = 4.f;
ImVec4* colors = style.Colors;
colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
@@ -188,7 +194,7 @@ void loadUiStyle()
colors[ImGuiCol_WindowBg] = ImVec4(0.10f, 0.07f, 0.09f, 0.99f);
colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.04f, 0.07f, 1.00f);
colors[ImGuiCol_Border] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f);
colors[ImGuiCol_Border] = ImVec4(0.14f, 0.10f, 0.13f, 0.99f);
colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
colors[ImGuiCol_FrameBg] = ImVec4(0.02f, 0.01f, 0.01f, 0.54f);
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.98f, 0.36f, 0.36f, 0.40f);
@@ -219,7 +225,7 @@ void loadUiStyle()
colors[ImGuiCol_Tab] = ImVec4(0.09f, 0.02f, 0.07f, 0.86f);
colors[ImGuiCol_TabHovered] = ImVec4(0.28f, 0.15f, 0.24f, 1.00f);
colors[ImGuiCol_TabActive] = ImVec4(0.37f, 0.14f, 0.29f, 1.00f);
colors[ImGuiCol_TabUnfocused] = ImVec4(0.15f, 0.09f, 0.07f, 0.97f);
colors[ImGuiCol_TabUnfocused] = ImVec4(0.33f, 0.21f, 0.28f, 1.00f);
colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.42f, 0.20f, 0.14f, 1.00f);
colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);