1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:57:45 +00:00

LibCore+LibGUI+About: Use String in Core::Version and GUI::AboutDialog

The Core::Version API now returns ErrorOr<String>, and the
GUI::AboutDialog API was adjusted to accommodate this.
This commit is contained in:
Andreas Kling 2023-02-28 16:39:41 +01:00
parent ad4b4046f4
commit d0977ac566
7 changed files with 40 additions and 33 deletions

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/String.h>
#include <LibCore/Version.h>
#include <LibGUI/Dialog.h>
@ -15,23 +16,16 @@ namespace GUI {
class AboutDialog final : public Dialog {
C_OBJECT_ABSTRACT(AboutDialog)
public:
static ErrorOr<NonnullRefPtr<AboutDialog>> try_create(StringView name, StringView version, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr);
static ErrorOr<NonnullRefPtr<AboutDialog>> try_create(String name, String version, RefPtr<Gfx::Bitmap const> icon = nullptr, Window* parent_window = nullptr);
virtual ~AboutDialog() override = default;
static ErrorOr<void> show(StringView name, StringView version, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr, Gfx::Bitmap const* window_icon = nullptr)
{
auto dialog = TRY(AboutDialog::try_create(name, version, icon, parent_window));
if (window_icon)
dialog->set_icon(window_icon);
dialog->exec();
return {};
}
static ErrorOr<void> show(String name, String version, RefPtr<Gfx::Bitmap const> icon = nullptr, Window* parent_window = nullptr, RefPtr<Gfx::Bitmap const> window_icon = nullptr);
private:
AboutDialog(StringView name, StringView version, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr);
AboutDialog(String name, String version, RefPtr<Gfx::Bitmap const> icon = nullptr, Window* parent_window = nullptr);
DeprecatedString m_name;
String m_name;
String m_version_string;
RefPtr<Gfx::Bitmap const> m_icon;
DeprecatedString m_version_string;
};
}