mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +00:00
Add option to enter Aseprite license key (#2664)
This is an initial version to add an automatic update feature in the future.
This commit is contained in:
parent
faecd682fc
commit
fcac48cccb
@ -65,6 +65,7 @@ option(ENABLE_WEBSOCKET "Compile with websocket support" on)
|
||||
option(ENABLE_TESTS "Compile unit tests" off)
|
||||
option(ENABLE_BENCHMARKS "Compile benchmarks" off)
|
||||
option(ENABLE_TRIAL_MODE "Compile the trial version" off)
|
||||
option(ENABLE_DRM "Compile the DRM-enabled version (e.g. for automatic updates)" off)
|
||||
option(ENABLE_STEAM "Compile with Steam library" off)
|
||||
option(ENABLE_DEVMODE "Compile vesion for developers" off)
|
||||
option(ENABLE_UI "Compile UI (turn off to compile CLI-only version)" on)
|
||||
@ -107,6 +108,10 @@ if(LAF_OS_WITH_GTK)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_DRM AND NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/drm/CMakeLists.txt)
|
||||
message(FATAL_ERROR "Your Aseprite repository is incomplete, clone the drm repository")
|
||||
endif()
|
||||
|
||||
######################################################################
|
||||
# Profile build type
|
||||
|
||||
@ -331,6 +336,9 @@ endif()
|
||||
set(LAF_WITH_TESTS ${ENABLE_TESTS} CACHE BOOL "Enable LAF tests")
|
||||
set(UNDO_TESTS ${ENABLE_TESTS} CACHE BOOL "Enable undo tests")
|
||||
|
||||
if(ENABLE_DRM)
|
||||
add_subdirectory(drm)
|
||||
endif()
|
||||
add_subdirectory(laf)
|
||||
|
||||
# LAF libraries + Aseprite are compiled with config.h
|
||||
|
@ -1025,6 +1025,8 @@
|
||||
<param name="path" value="http://twitter.com/aseprite" />
|
||||
</item>
|
||||
<separator />
|
||||
<item command="Register" text="@.help_register" group="help_register" />
|
||||
<separator />
|
||||
<item command="About" text="@.help_about" group="help_about" />
|
||||
</menu>
|
||||
</menu>
|
||||
|
@ -422,6 +422,7 @@ PlayAnimation = Play Animation
|
||||
PlayPreviewAnimation = Play Preview Animation
|
||||
Redo = Redo
|
||||
Refresh = Refresh
|
||||
Register = Register Aseprite
|
||||
RemoveFrame = Remove Frame
|
||||
RemoveFrameTag = Remove Tag
|
||||
RemoveLayer = Remove Layer
|
||||
@ -1043,6 +1044,7 @@ help_documentation = Documentation
|
||||
help_tutorial = Tutorial
|
||||
help_release_notes = Release Notes
|
||||
help_twitter = Twitter
|
||||
help_register = &Register Aseprite
|
||||
help_about = &About
|
||||
|
||||
[modify_selection]
|
||||
@ -1061,6 +1063,11 @@ 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
|
||||
|
||||
[tileset_selector]
|
||||
new_tileset = New Tileset
|
||||
grid_width = Grid Width:
|
||||
|
25
data/widgets/register.xml
Normal file
25
data/widgets/register.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<!-- Aseprite -->
|
||||
<!-- Copyright (c) 2021 Igara Studio S.A. -->
|
||||
<gui>
|
||||
<window id="register" 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>
|
||||
<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.cancel" closewindow="true" />
|
||||
</box>
|
||||
</box>
|
||||
</box>
|
||||
</window>
|
||||
</gui>
|
@ -54,6 +54,10 @@ else()
|
||||
add_definitions(-DENABLE_TRIAL_MODE)
|
||||
endif()
|
||||
|
||||
if(ENABLE_DRM)
|
||||
add_definitions(-DENABLE_DRM)
|
||||
endif()
|
||||
|
||||
if(ENABLE_DEVMODE)
|
||||
add_definitions(-DENABLE_DEVMODE)
|
||||
endif()
|
||||
|
@ -278,6 +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_remove_frame.cpp
|
||||
commands/cmd_remove_frame_tag.cpp
|
||||
commands/cmd_remove_slice.cpp
|
||||
|
53
src/app/commands/cmd_register.cpp
Normal file
53
src/app/commands/cmd_register.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
// 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
|
@ -122,6 +122,7 @@ FOR_EACH_COMMAND(PixelPerfectMode)
|
||||
FOR_EACH_COMMAND(PlayAnimation)
|
||||
FOR_EACH_COMMAND(PlayPreviewAnimation)
|
||||
FOR_EACH_COMMAND(Refresh)
|
||||
FOR_EACH_COMMAND(Register)
|
||||
FOR_EACH_COMMAND(RemoveFrame)
|
||||
FOR_EACH_COMMAND(RemoveFrameTag)
|
||||
FOR_EACH_COMMAND(RemoveSlice)
|
||||
|
17
src/app/drm.h
Normal file
17
src/app/drm.h
Normal file
@ -0,0 +1,17 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2021 Igara Studio S.A.
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
||||
#ifndef APP_DRM_H_INCLUDED
|
||||
#define APP_DRM_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#ifdef ENABLE_DRM
|
||||
#include "drm/drm.h"
|
||||
#else
|
||||
#define DRM_INVALID if (false)
|
||||
#endif
|
||||
|
||||
#endif
|
@ -16,6 +16,7 @@
|
||||
#include "app/console.h"
|
||||
#include "app/context.h"
|
||||
#include "app/doc.h"
|
||||
#include "app/drm.h"
|
||||
#include "app/file/file_data.h"
|
||||
#include "app/file/file_format.h"
|
||||
#include "app/file/file_formats_manager.h"
|
||||
@ -886,6 +887,15 @@ void FileOp::operate(IFileOpProgress* progress)
|
||||
m_format != NULL &&
|
||||
m_format->support(FILE_SUPPORT_SAVE)) {
|
||||
#ifdef ENABLE_SAVE
|
||||
|
||||
DRM_INVALID {
|
||||
setError(
|
||||
fmt::format("Save operation is not supported, activate this Aseprite first.\n"
|
||||
"Go to {} and get an activation code or get the DRM-FREE full-version.",
|
||||
get_app_download_url()).c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
// Save a sequence
|
||||
if (isSequence()) {
|
||||
ASSERT(m_format->support(FILE_SUPPORT_SEQUENCES));
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/drm.h"
|
||||
#include "app/file/file_format.h"
|
||||
#include "app/file/format_options.h"
|
||||
|
||||
@ -48,6 +49,8 @@ bool FileFormat::load(FileOp* fop)
|
||||
#ifdef ENABLE_SAVE
|
||||
bool FileFormat::save(FileOp* fop)
|
||||
{
|
||||
DRM_INVALID return false;
|
||||
|
||||
ASSERT(support(FILE_SUPPORT_SAVE));
|
||||
return onSave(fop);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user