2015-02-12 23:16:25 +08:00
|
|
|
// Aseprite
|
2025-05-11 23:14:01 +08:00
|
|
|
// Copyright (C) 2020-2025 Igara Studio S.A.
|
2018-06-15 03:16:50 +08:00
|
|
|
// Copyright (C) 2001-2018 David Capello
|
2015-02-12 23:16:25 +08:00
|
|
|
//
|
2016-08-27 04:02:58 +08:00
|
|
|
// This program is distributed under the terms of
|
|
|
|
// the End-User License Agreement for Aseprite.
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2012-01-06 06:45:03 +08:00
|
|
|
#include "config.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
#endif
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2016-12-07 03:03:51 +08:00
|
|
|
#include "app/app.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
#include "app/commands/command.h"
|
2016-12-07 03:03:51 +08:00
|
|
|
#include "app/ui/main_window.h"
|
2020-03-16 21:29:58 +08:00
|
|
|
#include "fmt/format.h"
|
|
|
|
#include "ver/info.h"
|
2018-06-15 03:16:50 +08:00
|
|
|
|
|
|
|
#include "about.xml.h"
|
2025-08-06 02:59:31 +08:00
|
|
|
#include "app/context.h"
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
namespace app {
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2012-06-18 09:02:54 +08:00
|
|
|
using namespace ui;
|
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
class AboutCommand : public Command {
|
2012-01-06 06:45:03 +08:00
|
|
|
public:
|
|
|
|
AboutCommand();
|
|
|
|
|
|
|
|
protected:
|
2025-08-06 02:59:31 +08:00
|
|
|
bool onEnabled(Context* context) override;
|
2015-10-01 03:34:43 +08:00
|
|
|
void onExecute(Context* context) override;
|
2012-01-06 06:45:03 +08:00
|
|
|
};
|
|
|
|
|
2025-08-06 02:59:31 +08:00
|
|
|
AboutCommand::AboutCommand() : Command(CommandId::About())
|
2012-01-06 06:45:03 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2025-08-06 02:59:31 +08:00
|
|
|
bool AboutCommand::onEnabled(Context* context)
|
|
|
|
{
|
|
|
|
return context->isUIAvailable();
|
|
|
|
}
|
|
|
|
|
2012-01-06 06:45:03 +08:00
|
|
|
void AboutCommand::onExecute(Context* context)
|
|
|
|
{
|
2018-06-15 03:16:50 +08:00
|
|
|
gen::About window;
|
2020-03-16 21:29:58 +08:00
|
|
|
window.title()->setText(fmt::format("{} v{}", get_app_name(), get_app_version()));
|
2018-06-15 03:16:50 +08:00
|
|
|
window.licenses()->Click.connect([&window] {
|
|
|
|
window.closeWindow(nullptr);
|
2016-12-07 12:12:54 +08:00
|
|
|
App::instance()->mainWindow()->showBrowser("docs/LICENSES.md");
|
2016-12-07 03:03:51 +08:00
|
|
|
});
|
2021-04-14 06:08:33 +08:00
|
|
|
window.credits()->Click.connect([&window] {
|
|
|
|
window.closeWindow(nullptr);
|
2025-05-11 23:14:01 +08:00
|
|
|
App::instance()->mainWindow()->showBrowser("AUTHORS.md", "Authors");
|
2021-04-14 06:08:33 +08:00
|
|
|
});
|
2024-02-12 22:59:26 +08:00
|
|
|
window.i18nCredits()->Click.connect([&window] {
|
|
|
|
window.closeWindow(nullptr);
|
|
|
|
App::instance()->mainWindow()->showBrowser("strings/README.md", "Translators");
|
|
|
|
});
|
2018-06-15 03:16:50 +08:00
|
|
|
window.openWindowInForeground();
|
2012-01-06 06:45:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Command* CommandFactory::createAboutCommand()
|
|
|
|
{
|
|
|
|
return new AboutCommand;
|
|
|
|
}
|
2013-08-06 08:20:19 +08:00
|
|
|
|
|
|
|
} // namespace app
|