1
0
mirror of synced 2024-12-01 02:37:18 +01:00

impr: Make info banner open a web page

This commit is contained in:
WerWolv 2023-12-08 14:46:32 +01:00
parent e9bca123c2
commit 48bc0985d9

View File

@ -348,6 +348,12 @@ namespace hex::plugin::builtin {
ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.info"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX); ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.info"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
{ {
ImGui::Image(s_infoBannerTexture, ImVec2(width, width / s_infoBannerTexture.getAspectRatio())); ImGui::Image(s_infoBannerTexture, ImVec2(width, width / s_infoBannerTexture.getAspectRatio()));
if (ImGui::IsItemClicked()) {
hex::openWebpage(ImHexApiURL + hex::format("/info/{}/link",
ImHexApi::System::getOSName() | std::views::transform([](char c) { return std::tolower(c); })
));
}
} }
ImGuiExt::EndSubWindow(); ImGuiExt::EndSubWindow();
ImGui::PopStyleVar(); ImGui::PopStyleVar();
@ -638,7 +644,7 @@ namespace hex::plugin::builtin {
if (!s_infoBannerTexture.isValid()) { if (!s_infoBannerTexture.isValid()) {
TaskManager::createBackgroundTask("Load banner", [](auto&) { TaskManager::createBackgroundTask("Load banner", [](auto&) {
HttpRequest request("GET", HttpRequest request("GET",
ImHexApiURL + hex::format("/{}/info_banner", ImHexApiURL + hex::format("/info/{}/image",
ImHexApi::System::getOSName() | std::views::transform([](char c) { return std::tolower(c); }) ImHexApi::System::getOSName() | std::views::transform([](char c) { return std::tolower(c); })
) )
); );