AboutDialog.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2022, the SerenityOS developers.
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <LibCore/Version.h>
  9. #include <LibGUI/Dialog.h>
  10. namespace GUI {
  11. class AboutDialog final : public Dialog {
  12. C_OBJECT_ABSTRACT(AboutDialog)
  13. public:
  14. static ErrorOr<NonnullRefPtr<AboutDialog>> try_create(StringView name, StringView version, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr);
  15. virtual ~AboutDialog() override = default;
  16. static ErrorOr<void> show(StringView name, StringView version, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr, Gfx::Bitmap const* window_icon = nullptr)
  17. {
  18. auto dialog = TRY(AboutDialog::try_create(name, version, icon, parent_window));
  19. if (window_icon)
  20. dialog->set_icon(window_icon);
  21. dialog->exec();
  22. return {};
  23. }
  24. private:
  25. AboutDialog(StringView name, StringView version, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr);
  26. DeprecatedString m_name;
  27. RefPtr<Gfx::Bitmap> m_icon;
  28. DeprecatedString m_version_string;
  29. };
  30. }