mirror of
https://github.com/aseprite/aseprite.git
synced 2024-09-02 04:59:24 +00:00
Refactor the code to change the "register" dialog for "enter_license" dialog
This commit is contained in:
parent
fcac48cccb
commit
740dd166de
@ -1025,7 +1025,7 @@
|
|||||||
<param name="path" value="http://twitter.com/aseprite" />
|
<param name="path" value="http://twitter.com/aseprite" />
|
||||||
</item>
|
</item>
|
||||||
<separator />
|
<separator />
|
||||||
<item command="Register" text="@.help_register" group="help_register" />
|
<item command="EnterLicense" text="@.help_enter_license" group="help_enter_license" />
|
||||||
<separator />
|
<separator />
|
||||||
<item command="About" text="@.help_about" group="help_about" />
|
<item command="About" text="@.help_about" group="help_about" />
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -422,7 +422,7 @@ PlayAnimation = Play Animation
|
|||||||
PlayPreviewAnimation = Play Preview Animation
|
PlayPreviewAnimation = Play Preview Animation
|
||||||
Redo = Redo
|
Redo = Redo
|
||||||
Refresh = Refresh
|
Refresh = Refresh
|
||||||
Register = Register Aseprite
|
EnterLicense = Enter License
|
||||||
RemoveFrame = Remove Frame
|
RemoveFrame = Remove Frame
|
||||||
RemoveFrameTag = Remove Tag
|
RemoveFrameTag = Remove Tag
|
||||||
RemoveLayer = Remove Layer
|
RemoveLayer = Remove Layer
|
||||||
@ -1044,7 +1044,7 @@ help_documentation = Documentation
|
|||||||
help_tutorial = Tutorial
|
help_tutorial = Tutorial
|
||||||
help_release_notes = Release Notes
|
help_release_notes = Release Notes
|
||||||
help_twitter = Twitter
|
help_twitter = Twitter
|
||||||
help_register = &Register Aseprite
|
help_enter_license = Enter &License
|
||||||
help_about = &About
|
help_about = &About
|
||||||
|
|
||||||
[modify_selection]
|
[modify_selection]
|
||||||
@ -1063,10 +1063,10 @@ name = Name:
|
|||||||
tileset = Tileset:
|
tileset = Tileset:
|
||||||
default_new_layer_name = New Layer
|
default_new_layer_name = New Layer
|
||||||
|
|
||||||
[register]
|
[enter_license]
|
||||||
title = Register Aseprite
|
title = Enter License
|
||||||
default_message = If you need an activation code, go to
|
default_message = If you need a license key, go to
|
||||||
activation_code = Activation Code
|
license_key = License Key
|
||||||
|
|
||||||
[tileset_selector]
|
[tileset_selector]
|
||||||
new_tileset = New Tileset
|
new_tileset = New Tileset
|
||||||
|
@ -1,22 +1,18 @@
|
|||||||
<!-- Aseprite -->
|
<!-- Aseprite -->
|
||||||
<!-- Copyright (c) 2021 Igara Studio S.A. -->
|
<!-- Copyright (c) 2021 Igara Studio S.A. -->
|
||||||
<gui>
|
<gui>
|
||||||
<window id="register" text="@.title" expansive="false">
|
<window id="enter_license" text="@.title" expansive="false">
|
||||||
<box vertical="true">
|
<box vertical="true">
|
||||||
<hbox>
|
<hbox>
|
||||||
<label text="@.default_message" />
|
<label text="@.default_message" />
|
||||||
<link text="https://www.aseprite.org/download/" url="https://www.aseprite.org/download/" />
|
<link text="https://www.aseprite.org/download/" url="https://www.aseprite.org/download/" />
|
||||||
</hbox>
|
</hbox>
|
||||||
<separator text="@.activation_code" left="true" horizontal="true" />
|
<separator text="@.license_key" left="true" horizontal="true" />
|
||||||
<grid columns="4">
|
<entry id="license_key" cell_align="horizontal" magnet="true" maxsize="17" />
|
||||||
<entry id="code1" cell_align="horizontal" magnet="true" maxsize="5" />
|
|
||||||
<entry id="code2" cell_align="horizontal" maxsize="5" />
|
|
||||||
<entry id="code3" cell_align="horizontal" maxsize="5" />
|
|
||||||
</grid>
|
|
||||||
<box horizontal="true">
|
<box horizontal="true">
|
||||||
<box horizontal="true" expansive="true" />
|
<box horizontal="true" expansive="true" />
|
||||||
<box horizontal="true" homogeneous="true">
|
<box horizontal="true" homogeneous="true">
|
||||||
<button text="@general.ok" closewindow="true" id="ok_button" magnet="true" width="60" />
|
<button text="@general.ok" id="ok_button" magnet="true" width="60" />
|
||||||
<button text="@general.cancel" closewindow="true" />
|
<button text="@general.cancel" closewindow="true" />
|
||||||
</box>
|
</box>
|
||||||
</box>
|
</box>
|
@ -278,7 +278,7 @@ if(ENABLE_UI)
|
|||||||
commands/cmd_pixel_perfect_mode.cpp
|
commands/cmd_pixel_perfect_mode.cpp
|
||||||
commands/cmd_play_animation.cpp
|
commands/cmd_play_animation.cpp
|
||||||
commands/cmd_refresh.cpp
|
commands/cmd_refresh.cpp
|
||||||
commands/cmd_register.cpp
|
commands/cmd_enter_license.cpp
|
||||||
commands/cmd_remove_frame.cpp
|
commands/cmd_remove_frame.cpp
|
||||||
commands/cmd_remove_frame_tag.cpp
|
commands/cmd_remove_frame_tag.cpp
|
||||||
commands/cmd_remove_slice.cpp
|
commands/cmd_remove_slice.cpp
|
||||||
|
46
src/app/commands/cmd_enter_license.cpp
Normal file
46
src/app/commands/cmd_enter_license.cpp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// 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/app.h"
|
||||||
|
#include "app/commands/command.h"
|
||||||
|
#include "app/context.h"
|
||||||
|
|
||||||
|
#include "enter_license.xml.h"
|
||||||
|
|
||||||
|
namespace app {
|
||||||
|
|
||||||
|
class EnterLicenseCommand : public Command {
|
||||||
|
public:
|
||||||
|
EnterLicenseCommand();
|
||||||
|
protected:
|
||||||
|
void onExecute(Context* context) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
EnterLicenseCommand::EnterLicenseCommand()
|
||||||
|
: Command(CommandId::EnterLicense(), CmdUIOnlyFlag)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnterLicenseCommand::onExecute(Context* context)
|
||||||
|
{
|
||||||
|
// Load the window widget
|
||||||
|
app::gen::EnterLicense window;
|
||||||
|
|
||||||
|
window.setSizeable(false);
|
||||||
|
window.licenseKey()->Change.connect([&window]() {
|
||||||
|
window.licenseKey()->setText(base::string_to_upper(window.licenseKey()->text()));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Open the window
|
||||||
|
window.openWindowInForeground();
|
||||||
|
}
|
||||||
|
|
||||||
|
Command* CommandFactory::createRegisterCommand()
|
||||||
|
{
|
||||||
|
return new EnterLicenseCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace app
|
@ -1,53 +0,0 @@
|
|||||||
// 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/app.h"
|
|
||||||
#include "app/commands/command.h"
|
|
||||||
#include "app/context.h"
|
|
||||||
|
|
||||||
#include "register.xml.h"
|
|
||||||
|
|
||||||
namespace app {
|
|
||||||
|
|
||||||
class RegisterCommand : public Command {
|
|
||||||
public:
|
|
||||||
RegisterCommand();
|
|
||||||
protected:
|
|
||||||
void onExecute(Context* context) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
RegisterCommand::RegisterCommand()
|
|
||||||
: Command(CommandId::Register(), CmdUIOnlyFlag)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void RegisterCommand::onExecute(Context* context)
|
|
||||||
{
|
|
||||||
// Load the window widget
|
|
||||||
app::gen::Register window;
|
|
||||||
|
|
||||||
window.setSizeable(false);
|
|
||||||
|
|
||||||
auto onChange = [] (ui::Entry *entry) {
|
|
||||||
return [entry]() {
|
|
||||||
entry->setText(base::string_to_upper(entry->text()));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
window.code1()->Change.connect(onChange(window.code1()));
|
|
||||||
window.code2()->Change.connect(onChange(window.code2()));
|
|
||||||
window.code3()->Change.connect(onChange(window.code3()));
|
|
||||||
|
|
||||||
// Open the window
|
|
||||||
window.openWindowInForeground();
|
|
||||||
}
|
|
||||||
|
|
||||||
Command* CommandFactory::createRegisterCommand()
|
|
||||||
{
|
|
||||||
return new RegisterCommand;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace app
|
|
Loading…
Reference in New Issue
Block a user