mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +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" />
|
||||
</item>
|
||||
<separator />
|
||||
<item command="Register" text="@.help_register" group="help_register" />
|
||||
<item command="EnterLicense" text="@.help_enter_license" group="help_enter_license" />
|
||||
<separator />
|
||||
<item command="About" text="@.help_about" group="help_about" />
|
||||
</menu>
|
||||
|
@ -422,7 +422,7 @@ PlayAnimation = Play Animation
|
||||
PlayPreviewAnimation = Play Preview Animation
|
||||
Redo = Redo
|
||||
Refresh = Refresh
|
||||
Register = Register Aseprite
|
||||
EnterLicense = Enter License
|
||||
RemoveFrame = Remove Frame
|
||||
RemoveFrameTag = Remove Tag
|
||||
RemoveLayer = Remove Layer
|
||||
@ -1044,7 +1044,7 @@ help_documentation = Documentation
|
||||
help_tutorial = Tutorial
|
||||
help_release_notes = Release Notes
|
||||
help_twitter = Twitter
|
||||
help_register = &Register Aseprite
|
||||
help_enter_license = Enter &License
|
||||
help_about = &About
|
||||
|
||||
[modify_selection]
|
||||
@ -1063,10 +1063,10 @@ name = Name:
|
||||
tileset = Tileset:
|
||||
default_new_layer_name = New Layer
|
||||
|
||||
[register]
|
||||
title = Register Aseprite
|
||||
default_message = If you need an activation code, go to
|
||||
activation_code = Activation Code
|
||||
[enter_license]
|
||||
title = Enter License
|
||||
default_message = If you need a license key, go to
|
||||
license_key = License Key
|
||||
|
||||
[tileset_selector]
|
||||
new_tileset = New Tileset
|
||||
|
@ -1,22 +1,18 @@
|
||||
<!-- Aseprite -->
|
||||
<!-- Copyright (c) 2021 Igara Studio S.A. -->
|
||||
<gui>
|
||||
<window id="register" text="@.title" expansive="false">
|
||||
<window id="enter_license" text="@.title" expansive="false">
|
||||
<box vertical="true">
|
||||
<hbox>
|
||||
<label text="@.default_message" />
|
||||
<link text="https://www.aseprite.org/download/" url="https://www.aseprite.org/download/" />
|
||||
</hbox>
|
||||
<separator text="@.activation_code" left="true" horizontal="true" />
|
||||
<grid columns="4">
|
||||
<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>
|
||||
<separator text="@.license_key" left="true" horizontal="true" />
|
||||
<entry id="license_key" cell_align="horizontal" magnet="true" maxsize="17" />
|
||||
<box horizontal="true">
|
||||
<box horizontal="true" expansive="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" />
|
||||
</box>
|
||||
</box>
|
@ -278,7 +278,7 @@ if(ENABLE_UI)
|
||||
commands/cmd_pixel_perfect_mode.cpp
|
||||
commands/cmd_play_animation.cpp
|
||||
commands/cmd_refresh.cpp
|
||||
commands/cmd_register.cpp
|
||||
commands/cmd_enter_license.cpp
|
||||
commands/cmd_remove_frame.cpp
|
||||
commands/cmd_remove_frame_tag.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…
x
Reference in New Issue
Block a user