diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2b6a13d..5e04557 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -82,6 +82,8 @@ target_sources(tomato PUBLIC ./sys_tray.cpp ./string_formatter_utils.hpp + ./chat_gui/about.hpp + ./chat_gui/about.cpp ./chat_gui/theme.hpp ./chat_gui/theme.cpp ./chat_gui/icons/direct.hpp diff --git a/src/chat_gui/about.cpp b/src/chat_gui/about.cpp new file mode 100644 index 0000000..038d5be --- /dev/null +++ b/src/chat_gui/about.cpp @@ -0,0 +1,54 @@ +#include "./about.hpp" + +#include "./version.hpp" + +#include + +#include + +void ImGuiTomatoAbout(void) { + if (ImGui::BeginTabBar("about")) { + if (ImGui::BeginTabItem("tomato")) { + std::string tomato_version_string {"tomato " TOMATO_VERSION_STR}; + if (TOMATO_GIT_DEPTH != 0) { + tomato_version_string += "-" + std::to_string(TOMATO_GIT_DEPTH); + } + if (std::string_view{TOMATO_GIT_COMMIT} != "UNK") { + tomato_version_string += "+git."; + tomato_version_string += TOMATO_GIT_COMMIT; + } + + ImGui::TextUnformatted(tomato_version_string.c_str()); + + ImGui::SameLine(); + if (ImGui::SmallButton("click to copy")) { + ImGui::SetClipboardText(tomato_version_string.c_str()); + } + + ImGui::Separator(); + + ImGui::TextUnformatted("TODO: tomato license"); + + ImGui::EndTabItem(); + } + + if (ImGui::BeginTabItem("imgui")) { + ImGui::ShowAboutWindow(); + ImGui::EndTabItem(); + } + + if (ImGui::BeginTabItem("others")) { + ImGui::TextUnformatted("TODO: list all the other libs and their licenses"); + ImGui::EndTabItem(); + } + + if (ImGui::BeginTabItem("funding")) { + ImGui::TextWrapped("Your Help is needed, to keep the project alive, expand it's features and to inspire new features!"); + ImGui::TextLinkOpenURL("https://github.com/sponsors/Green-Sky"); + ImGui::TextUnformatted("Contact Me for more ways to help the project. :)"); + ImGui::EndTabItem(); + } + + ImGui::EndTabBar(); + } +} diff --git a/src/chat_gui/about.hpp b/src/chat_gui/about.hpp new file mode 100644 index 0000000..0cef657 --- /dev/null +++ b/src/chat_gui/about.hpp @@ -0,0 +1,5 @@ +#pragma once + +// not a window, just the content +void ImGuiTomatoAbout(void); + diff --git a/src/main_screen.cpp b/src/main_screen.cpp index cd2352c..eb75507 100644 --- a/src/main_screen.cpp +++ b/src/main_screen.cpp @@ -5,6 +5,8 @@ #include +#include "./chat_gui/about.hpp" + #include "./frame_streams/sdl/sdl_audio2_frame_stream2.hpp" #include "./frame_streams/sdl/sdl_video_frame_stream2.hpp" @@ -433,6 +435,9 @@ Screen* MainScreen::render(float time_delta, bool&) { ImGui::EndMenu(); } + if (ImGui::MenuItem("About", nullptr, _show_about)) { + _show_about = !_show_about; + } ImGui::EndMenuBar(); } @@ -467,6 +472,13 @@ Screen* MainScreen::render(float time_delta, bool&) { ImGui::ShowDemoWindow(&_show_tool_demo); } + if (_show_about) { + if (ImGui::Begin("About", &_show_about, ImGuiWindowFlags_AlwaysAutoResize)) { + ImGuiTomatoAbout(); + } + ImGui::End(); + } + _compute_lower_limit_hit_rendered = true; float tc_unfinished_queue_interval; diff --git a/src/main_screen.hpp b/src/main_screen.hpp index ea6ff42..af157ce 100644 --- a/src/main_screen.hpp +++ b/src/main_screen.hpp @@ -117,6 +117,7 @@ struct MainScreen final : public Screen { bool _show_tool_debug_log {false}; bool _show_tool_id_stack {false}; bool _show_tool_demo {false}; + bool _show_about {false}; bool _window_focused {true}; bool _window_hidden {false}; diff --git a/src/start_screen.cpp b/src/start_screen.cpp index 0d53633..9541e7c 100644 --- a/src/start_screen.cpp +++ b/src/start_screen.cpp @@ -4,6 +4,8 @@ #include "./json_to_config.hpp" +#include "./chat_gui/about.hpp" + #include #include @@ -393,6 +395,12 @@ Screen* StartScreen::render(float, bool&) { ImGui::EndTabItem(); } + + if (ImGui::BeginTabItem("about")) { + ImGuiTomatoAbout(); + ImGui::EndTabItem(); + } + ImGui::EndTabBar(); } }