aseprite/src/app/commands/cmd_about.cpp
David Capello a0882ba443 Move PACKAGE/VERSION, etc. to new ver-lib
* As we moved the VERSION macro to a .c file, we don't have to
  recompile the whole project when we change the version number.
* Removed the version number from gui.xml
* Removed the invalid first menu item that might appear in the root
  menu when the gui.xml version is outdated in debug mode.
2020-03-16 10:31:32 -03:00

57 lines
1.1 KiB
C++

// Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/app.h"
#include "app/commands/command.h"
#include "app/modules/gui.h"
#include "app/ui/main_window.h"
#include "base/bind.h"
#include "fmt/format.h"
#include "ver/info.h"
#include "about.xml.h"
namespace app {
using namespace ui;
class AboutCommand : public Command {
public:
AboutCommand();
protected:
void onExecute(Context* context) override;
};
AboutCommand::AboutCommand()
: Command(CommandId::About(), CmdUIOnlyFlag)
{
}
void AboutCommand::onExecute(Context* context)
{
gen::About window;
window.title()->setText(fmt::format("{} v{}", get_app_name(), get_app_version()));
window.licenses()->Click.connect(
[&window]{
window.closeWindow(nullptr);
App::instance()->mainWindow()->showBrowser("docs/LICENSES.md");
});
window.openWindowInForeground();
}
Command* CommandFactory::createAboutCommand()
{
return new AboutCommand;
}
} // namespace app