From cb0b82ec464f28fae134403fc268961c02f27e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Tue, 30 Aug 2022 12:49:08 +0200 Subject: [PATCH] Userland+LibCore: Remove legacy SERENITY_VERSION from Core::Version This was being used as a default version argument in a couple of APIs, so those need to change signature and the caller always needs to provide a version. --- Userland/Applications/About/main.cpp | 2 +- Userland/Applications/Browser/BrowserWindow.cpp | 3 ++- Userland/Libraries/LibCore/ArgsParser.cpp | 2 +- Userland/Libraries/LibCore/Version.h | 2 -- Userland/Libraries/LibGUI/AboutDialog.cpp | 2 +- Userland/Libraries/LibGUI/AboutDialog.h | 6 +++--- Userland/Libraries/LibGUI/CommonActions.cpp | 3 ++- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Userland/Applications/About/main.cpp b/Userland/Applications/About/main.cpp index 0cc6a5949c7..b0d13322fda 100644 --- a/Userland/Applications/About/main.cpp +++ b/Userland/Applications/About/main.cpp @@ -21,6 +21,6 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil(nullptr, nullptr)); auto app_icon = TRY(GUI::Icon::try_create_default_icon("ladyball"sv)); - GUI::AboutDialog::show("SerenityOS"sv, app_icon.bitmap_for_size(32), nullptr, app_icon.bitmap_for_size(16), Core::Version::read_long_version_string()); + GUI::AboutDialog::show("SerenityOS"sv, Core::Version::read_long_version_string(), app_icon.bitmap_for_size(32), nullptr, app_icon.bitmap_for_size(16)); return app->exec(); } diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index 292cced932b..a1cfe695b2f 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -128,7 +129,7 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url) m_window_actions.on_about = [this] { auto app_icon = GUI::Icon::default_icon("app-browser"sv); - GUI::AboutDialog::show("Browser"sv, app_icon.bitmap_for_size(32), this); + GUI::AboutDialog::show("Browser"sv, Core::Version::read_long_version_string(), app_icon.bitmap_for_size(32), this); }; m_window_actions.on_show_bookmarks_bar = [](auto& action) { diff --git a/Userland/Libraries/LibCore/ArgsParser.cpp b/Userland/Libraries/LibCore/ArgsParser.cpp index 90a4fd33627..15866d95737 100644 --- a/Userland/Libraries/LibCore/ArgsParser.cpp +++ b/Userland/Libraries/LibCore/ArgsParser.cpp @@ -367,7 +367,7 @@ void ArgsParser::print_usage_markdown(FILE* file, char const* argv0) void ArgsParser::print_version(FILE* file) { - outln(file, Core::Version::SERENITY_VERSION); + outln(file, Core::Version::read_long_version_string()); } void ArgsParser::add_option(Option&& option) diff --git a/Userland/Libraries/LibCore/Version.h b/Userland/Libraries/LibCore/Version.h index 1ca7a18d1d3..1cd915eb659 100644 --- a/Userland/Libraries/LibCore/Version.h +++ b/Userland/Libraries/LibCore/Version.h @@ -10,8 +10,6 @@ namespace Core::Version { -constexpr StringView SERENITY_VERSION = "Version 1.0"sv; - String read_long_version_string(); } diff --git a/Userland/Libraries/LibGUI/AboutDialog.cpp b/Userland/Libraries/LibGUI/AboutDialog.cpp index 9bbbdfa83cb..b5279777217 100644 --- a/Userland/Libraries/LibGUI/AboutDialog.cpp +++ b/Userland/Libraries/LibGUI/AboutDialog.cpp @@ -17,7 +17,7 @@ namespace GUI { -AboutDialog::AboutDialog(StringView name, Gfx::Bitmap const* icon, Window* parent_window, StringView version) +AboutDialog::AboutDialog(StringView name, StringView version, Gfx::Bitmap const* icon, Window* parent_window) : Dialog(parent_window) , m_name(name) , m_icon(icon) diff --git a/Userland/Libraries/LibGUI/AboutDialog.h b/Userland/Libraries/LibGUI/AboutDialog.h index a6b5a724e05..bdbb028cc3a 100644 --- a/Userland/Libraries/LibGUI/AboutDialog.h +++ b/Userland/Libraries/LibGUI/AboutDialog.h @@ -17,16 +17,16 @@ class AboutDialog final : public Dialog { public: virtual ~AboutDialog() override = default; - static void show(StringView name, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr, Gfx::Bitmap const* window_icon = nullptr, StringView version = Core::Version::SERENITY_VERSION) + static void show(StringView name, StringView version, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr, Gfx::Bitmap const* window_icon = nullptr) { - auto dialog = AboutDialog::construct(name, icon, parent_window, version); + auto dialog = AboutDialog::construct(name, version, icon, parent_window); if (window_icon) dialog->set_icon(window_icon); dialog->exec(); } private: - AboutDialog(StringView name, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr, StringView version = Core::Version::SERENITY_VERSION); + AboutDialog(StringView name, StringView version, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr); String m_name; RefPtr m_icon; diff --git a/Userland/Libraries/LibGUI/CommonActions.cpp b/Userland/Libraries/LibGUI/CommonActions.cpp index ccb32eeb611..4d5caf31b5a 100644 --- a/Userland/Libraries/LibGUI/CommonActions.cpp +++ b/Userland/Libraries/LibGUI/CommonActions.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -19,7 +20,7 @@ NonnullRefPtr make_about_action(String const& app_name, Icon const& app_ { auto weak_parent = AK::make_weak_ptr_if_nonnull(parent); auto action = Action::create(String::formatted("&About {}", app_name), app_icon.bitmap_for_size(16), [=](auto&) { - AboutDialog::show(app_name, app_icon.bitmap_for_size(32), weak_parent.ptr()); + AboutDialog::show(app_name, Core::Version::read_long_version_string(), app_icon.bitmap_for_size(32), weak_parent.ptr()); }); action->set_status_tip("Show application about box"); return action;