From 50c050465f883f65d0b4ecc295a022fbf401410d Mon Sep 17 00:00:00 2001 From: cryham Date: Thu, 25 Apr 2024 18:33:02 +0200 Subject: [PATCH] gui ed url --- data/gui/Game_Help.layout | 11 +++++++++++ src/game/CGui.h | 5 ++++- src/game/Gui_Init.cpp | 12 +++++++----- src/game/Gui_Util.cpp | 22 ++++++++++++++-------- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/data/gui/Game_Help.layout b/data/gui/Game_Help.layout index 6208e5a9..37f71e4c 100644 --- a/data/gui/Game_Help.layout +++ b/data/gui/Game_Help.layout @@ -96,6 +96,17 @@ + + + + + + + + + + + diff --git a/src/game/CGui.h b/src/game/CGui.h index 202418d5..4d1fb562 100644 --- a/src/game/CGui.h +++ b/src/game/CGui.h @@ -574,7 +574,10 @@ class CGui : public BGui // fonts SV svFntWnd, svFntGui, svFntHud, svFntTimes; - // 🔗 open urls + // 🔗 open urls ---- + Ed edOpenUrl =0; + void Url(const std::string& url); + void btnTrackEditor(WP); // start ed exe void btnWelcome(WP), btnWebsite(WP), btnWiki(WP), btnWikiInput(WP); void btnForum(WP), btnSources(WP), btnEdTut(WP), btnTransl(WP), btnDonations(WP); diff --git a/src/game/Gui_Init.cpp b/src/game/Gui_Init.cpp index ad3a3eb0..ae0580e5 100644 --- a/src/game/Gui_Init.cpp +++ b/src/game/Gui_Init.cpp @@ -491,11 +491,6 @@ void CGui::InitGui() Edt(edNetLocalPort, "edNetLocalPort", evEdNetLocalPort); edNetLocalPort->setCaption( toStr(pSet->local_port)); - // user dir - Ed edUserDir = fEd("EdUserDir"); - edUserDir->setCaption(PATHS::UserConfigDir()); - - /// 🕹ī¸ Input tab ------- InitInputGui(); @@ -557,6 +552,13 @@ void CGui::InitGui() sv= &svFntTimes; sv->Init("FntTimes", &pSet->font_times, 0.6f, 1.5f); sv->DefaultF(1.f); + // user dir + Ed edUserDir = fEd("EdUserDir"); + edUserDir->setCaption(PATHS::UserConfigDir()); + + edOpenUrl = fEd("OpenUrl"); + edOpenUrl->setCaption("https://stuntrally.tuxfamily.org/"); + // 🔗 open url btns ------------- Btn("BtnTrackEditor", btnTrackEditor); Btn("OpenWelcome", btnWelcome); Btn("OpenWebsite", btnWebsite); Btn("OpenSources", btnSources); diff --git a/src/game/Gui_Util.cpp b/src/game/Gui_Util.cpp index e999d029..85878849 100644 --- a/src/game/Gui_Util.cpp +++ b/src/game/Gui_Util.cpp @@ -369,38 +369,44 @@ void CGui::btnWelcome(WP) { app->mWndWelcome->setVisible(true); } + +void CGui::Url(const string& url) +{ + edOpenUrl->setCaption(url); + PATHS::OpenUrl(url); +} void CGui::btnWebsite(WP) { - PATHS::OpenUrl("https://stuntrally.tuxfamily.org/"); + Url("https://stuntrally.tuxfamily.org/"); } void CGui::btnWiki(WP) { - PATHS::OpenUrl("https://github.com/stuntrally/stuntrally3/blob/main/docs/_menu.md"); + Url("https://github.com/stuntrally/stuntrally3/blob/main/docs/_menu.md"); } void CGui::btnWikiInput(WP) { - PATHS::OpenUrl("https://github.com/stuntrally/stuntrally3/blob/main/docs/Running.md#controllers"); + Url("https://github.com/stuntrally/stuntrally3/blob/main/docs/Running.md#controllers"); } void CGui::btnForum(WP) { - PATHS::OpenUrl("https://groups.f-hub.org/stunt-rally/"); + Url("https://groups.f-hub.org/stunt-rally/"); } void CGui::btnSources(WP) { - PATHS::OpenUrl("https://github.com/stuntrally/stuntrally3"); + Url("https://github.com/stuntrally/stuntrally3"); } void CGui::btnEdTut(WP) { - PATHS::OpenUrl("https://github.com/stuntrally/stuntrally3/blob/main/docs/Editor.md"); + Url("https://github.com/stuntrally/stuntrally3/blob/main/docs/Editor.md"); } void CGui::btnTransl(WP) { - PATHS::OpenUrl("https://github.com/stuntrally/stuntrally3/blob/main/docs/Localization.md"); + Url("https://github.com/stuntrally/stuntrally3/blob/main/docs/Localization.md"); } void CGui::btnDonations(WP) { - PATHS::OpenUrl("https://cryham.tuxfamily.org/donate/"); + Url("https://cryham.tuxfamily.org/donate/"); }