2021-08-25 03:58:49 +08:00
|
|
|
// Aseprite
|
|
|
|
// Copyright (C) 2021 Igara Studio S.A.
|
|
|
|
//
|
|
|
|
// This program is distributed under the terms of
|
|
|
|
// the End-User License Agreement for Aseprite.
|
|
|
|
|
|
|
|
#include "app/commands/command.h"
|
|
|
|
#include "app/context.h"
|
2021-08-28 04:48:51 +08:00
|
|
|
|
|
|
|
#ifdef ENABLE_DRM
|
2021-09-08 03:33:27 +08:00
|
|
|
#include "app/ui/enter_license.h"
|
2021-08-28 04:48:51 +08:00
|
|
|
#else
|
|
|
|
#include "app/i18n/strings.h"
|
|
|
|
#include "ui/alert.h"
|
|
|
|
#endif
|
2021-08-25 03:58:49 +08:00
|
|
|
|
|
|
|
namespace app {
|
|
|
|
|
|
|
|
class EnterLicenseCommand : public Command {
|
|
|
|
public:
|
|
|
|
EnterLicenseCommand();
|
2024-12-17 01:52:19 +08:00
|
|
|
|
2021-08-25 03:58:49 +08:00
|
|
|
protected:
|
|
|
|
void onExecute(Context* context) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
EnterLicenseCommand::EnterLicenseCommand() : Command(CommandId::EnterLicense(), CmdUIOnlyFlag)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void EnterLicenseCommand::onExecute(Context* context)
|
|
|
|
{
|
2021-08-28 04:48:51 +08:00
|
|
|
#ifdef ENABLE_DRM
|
2021-08-25 03:58:49 +08:00
|
|
|
// Load the window widget
|
2021-09-08 03:33:27 +08:00
|
|
|
app::EnterLicense window;
|
2021-08-25 03:58:49 +08:00
|
|
|
// Open the window
|
|
|
|
window.openWindowInForeground();
|
2021-08-28 04:48:51 +08:00
|
|
|
#else
|
|
|
|
ui::Alert::show(Strings::alerts_enter_license_disabled());
|
|
|
|
#endif
|
2021-08-25 03:58:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Command* CommandFactory::createRegisterCommand()
|
|
|
|
{
|
|
|
|
return new EnterLicenseCommand;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace app
|