From 053c897056d5002bbb03a1d73de1e5abd8463341 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 23 Jan 2022 20:46:19 +0100 Subject: [PATCH] ui: Added ImHex logo to about page --- lib/external/libromfs | 2 +- .../include/content/views/view_help.hpp | 2 + .../source/content/views/view_help.cpp | 41 +++++++++++++------ 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/lib/external/libromfs b/lib/external/libromfs index 0842d22de..5d3273443 160000 --- a/lib/external/libromfs +++ b/lib/external/libromfs @@ -1 +1 @@ -Subproject commit 0842d22deb13e036eb1fb15df368b6cad552abfe +Subproject commit 5d3273443a47f4a2f295cc476b5266a84e836206 diff --git a/plugins/builtin/include/content/views/view_help.hpp b/plugins/builtin/include/content/views/view_help.hpp index feecdd04c..6742b5ae9 100644 --- a/plugins/builtin/include/content/views/view_help.hpp +++ b/plugins/builtin/include/content/views/view_help.hpp @@ -37,6 +37,8 @@ namespace hex::plugin::builtin { void drawLibraryCreditsPage(); void drawPathsPage(); void drawLicensePage(); + + ImGui::Texture m_logoTexture; }; } \ No newline at end of file diff --git a/plugins/builtin/source/content/views/view_help.cpp b/plugins/builtin/source/content/views/view_help.cpp index ec54a9789..3b08d0ac0 100644 --- a/plugins/builtin/source/content/views/view_help.cpp +++ b/plugins/builtin/source/content/views/view_help.cpp @@ -3,6 +3,7 @@ #include #include +#include #include @@ -25,28 +26,44 @@ namespace hex::plugin::builtin { } ViewHelp::~ViewHelp() { - + ImGui::UnloadImage(this->m_logoTexture); } static void link(const std::string &label, const std::string &url) { if (ImGui::BulletHyperlink(label.data())) - hex::openWebpage(url.data()); + hex::openWebpage(url); } void ViewHelp::drawAboutMainPage() { - ImGui::TextFormatted("ImHex Hex Editor v{} by WerWolv - " ICON_FA_CODE_BRANCH, IMHEX_VERSION); + if (ImGui::BeginTable("about_table", 2, ImGuiTableFlags_SizingFixedFit)) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); - #if defined(GIT_BRANCH) && defined(GIT_COMMIT_HASH) - ImGui::SameLine(); - if (ImGui::Hyperlink(hex::format("{0}@{1}", GIT_BRANCH, GIT_COMMIT_HASH).c_str())) - hex::openWebpage("https://github.com/WerWolv/ImHex/commit/" GIT_COMMIT_HASH); - #endif + if (!this->m_logoTexture.valid()) { + auto logo = romfs::get("logo.png"); + this->m_logoTexture = ImGui::LoadImageFromMemory(reinterpret_cast(logo.data()), logo.size()); + } - ImGui::TextUnformatted("hex.builtin.view.help.about.translator"_lang); + ImGui::Image(this->m_logoTexture.textureId, scaled(this->m_logoTexture.size())); + ImGui::TableNextColumn(); + + ImGui::TextFormatted("ImHex Hex Editor v{} by WerWolv - " ICON_FA_CODE_BRANCH, IMHEX_VERSION); + + #if defined(GIT_BRANCH) && defined(GIT_COMMIT_HASH) + ImGui::SameLine(); + if (ImGui::Hyperlink(hex::format("{0}@{1}", GIT_BRANCH, GIT_COMMIT_HASH).c_str())) + hex::openWebpage("https://github.com/WerWolv/ImHex/commit/" GIT_COMMIT_HASH); + #endif + + ImGui::TextUnformatted("hex.builtin.view.help.about.translator"_lang); + + ImGui::TextUnformatted("hex.builtin.view.help.about.source"_lang); ImGui::SameLine(); + if (ImGui::Hyperlink("WerWolv/ImHex")) + hex::openWebpage("https://github.com/WerWolv/ImHex"); + + ImGui::EndTable(); + } - ImGui::TextUnformatted("hex.builtin.view.help.about.source"_lang); ImGui::SameLine(); - if (ImGui::Hyperlink("WerWolv/ImHex")) - hex::openWebpage("https://github.com/WerWolv/ImHex"); ImGui::NewLine(); ImGui::TextUnformatted("hex.builtin.view.help.about.donations"_lang);