| 1 | // Aseprite |
|---|---|
| 2 | // Copyright (C) 2020-2021 Igara Studio S.A. |
| 3 | // Copyright (C) 2001-2018 David Capello |
| 4 | // |
| 5 | // This program is distributed under the terms of |
| 6 | // the End-User License Agreement for Aseprite. |
| 7 | |
| 8 | #ifdef HAVE_CONFIG_H |
| 9 | #include "config.h" |
| 10 | #endif |
| 11 | |
| 12 | #include "app/app.h" |
| 13 | #include "app/commands/command.h" |
| 14 | #include "app/modules/gui.h" |
| 15 | #include "app/ui/main_window.h" |
| 16 | #include "fmt/format.h" |
| 17 | #include "ver/info.h" |
| 18 | |
| 19 | #include "about.xml.h" |
| 20 | |
| 21 | namespace app { |
| 22 | |
| 23 | using namespace ui; |
| 24 | |
| 25 | class AboutCommand : public Command { |
| 26 | public: |
| 27 | AboutCommand(); |
| 28 | |
| 29 | protected: |
| 30 | void onExecute(Context* context) override; |
| 31 | }; |
| 32 | |
| 33 | AboutCommand::AboutCommand() |
| 34 | : Command(CommandId::About(), CmdUIOnlyFlag) |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | void AboutCommand::onExecute(Context* context) |
| 39 | { |
| 40 | gen::About window; |
| 41 | window.title()->setText(fmt::format("{} v{}", get_app_name(), get_app_version())); |
| 42 | window.licenses()->Click.connect( |
| 43 | [&window]{ |
| 44 | window.closeWindow(nullptr); |
| 45 | App::instance()->mainWindow()->showBrowser("docs/LICENSES.md"); |
| 46 | }); |
| 47 | window.credits()->Click.connect( |
| 48 | [&window]{ |
| 49 | window.closeWindow(nullptr); |
| 50 | App::instance()->mainWindow()->showBrowser("README.md", "Authors"); |
| 51 | }); |
| 52 | window.openWindowInForeground(); |
| 53 | } |
| 54 | |
| 55 | Command* CommandFactory::createAboutCommand() |
| 56 | { |
| 57 | return new AboutCommand; |
| 58 | } |
| 59 | |
| 60 | } // namespace app |
| 61 |