1 | // Aseprite |
---|---|
2 | // Copyright (C) 2021 Igara Studio S.A. |
3 | // |
4 | // This program is distributed under the terms of |
5 | // the End-User License Agreement for Aseprite. |
6 | |
7 | #include "app/commands/command.h" |
8 | #include "app/context.h" |
9 | |
10 | #ifdef ENABLE_DRM |
11 | #include "app/ui/enter_license.h" |
12 | #else |
13 | #include "app/i18n/strings.h" |
14 | #include "ui/alert.h" |
15 | #endif |
16 | |
17 | namespace app { |
18 | |
19 | class EnterLicenseCommand : public Command { |
20 | public: |
21 | EnterLicenseCommand(); |
22 | protected: |
23 | void onExecute(Context* context) override; |
24 | }; |
25 | |
26 | EnterLicenseCommand::EnterLicenseCommand() |
27 | : Command(CommandId::EnterLicense(), CmdUIOnlyFlag) |
28 | { |
29 | } |
30 | |
31 | void EnterLicenseCommand::onExecute(Context* context) |
32 | { |
33 | #ifdef ENABLE_DRM |
34 | // Load the window widget |
35 | app::EnterLicense window; |
36 | // Open the window |
37 | window.openWindowInForeground(); |
38 | #else |
39 | ui::Alert::show(Strings::alerts_enter_license_disabled()); |
40 | #endif |
41 | } |
42 | |
43 | Command* CommandFactory::createRegisterCommand() |
44 | { |
45 | return new EnterLicenseCommand; |
46 | } |
47 | |
48 | } // namespace app |
49 |