mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-22 10:20:53 +00:00
Add conditional compilation of code for DRM-enabled trial version
This commit is contained in:
parent
48ffaaa378
commit
854e4eb370
@ -367,7 +367,6 @@ if(ENABLE_UI)
|
||||
ui/editor/state_with_wheel_behavior.cpp
|
||||
ui/editor/transform_handles.cpp
|
||||
ui/editor/zooming_state.cpp
|
||||
ui/enter_license.cpp
|
||||
ui/export_file_window.cpp
|
||||
ui/expr_entry.cpp
|
||||
ui/file_list.cpp
|
||||
@ -428,6 +427,11 @@ if(ENABLE_UI)
|
||||
ui/news_listbox.cpp
|
||||
${ui_app_files})
|
||||
endif()
|
||||
if(ENABLE_DRM)
|
||||
set(ui_app_files
|
||||
ui/enter_license.cpp
|
||||
${ui_app_files})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(send_crash_files)
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include "base/scoped_lock.h"
|
||||
#include "base/split_string.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "drm.h"
|
||||
#include "fmt/format.h"
|
||||
#include "os/error.h"
|
||||
#include "os/surface.h"
|
||||
@ -188,6 +189,13 @@ public:
|
||||
|
||||
void createDataRecovery(Context* ctx) {
|
||||
#ifdef ENABLE_DATA_RECOVERY
|
||||
|
||||
#ifdef ENABLE_TRIAL_VERSION
|
||||
DRM_INVALID{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_recovery = std::make_unique<app::crash::DataRecovery>(ctx);
|
||||
m_recovery->SessionsListIsReady.connect(
|
||||
[] {
|
||||
@ -203,6 +211,13 @@ public:
|
||||
|
||||
void searchDataRecoverySessions() {
|
||||
#ifdef ENABLE_DATA_RECOVERY
|
||||
|
||||
#ifdef ENABLE_TRIAL_VERSION
|
||||
DRM_INVALID{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
ASSERT(m_recovery);
|
||||
if (m_recovery)
|
||||
m_recovery->launchSearch();
|
||||
@ -211,6 +226,13 @@ public:
|
||||
|
||||
void deleteDataRecovery() {
|
||||
#ifdef ENABLE_DATA_RECOVERY
|
||||
|
||||
#ifdef ENABLE_TRIAL_VERSION
|
||||
DRM_INVALID{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_recovery.reset();
|
||||
#endif
|
||||
}
|
||||
@ -299,6 +321,11 @@ int App::initialize(const AppOptions& options)
|
||||
|
||||
initialize_color_spaces(preferences());
|
||||
|
||||
#ifdef ENABLE_DRM
|
||||
LOG("APP: Initializing DRM...\n");
|
||||
app_configure_drm();
|
||||
#endif
|
||||
|
||||
// Load modules
|
||||
m_modules = std::make_unique<Modules>(createLogInDesktop, preferences());
|
||||
m_legacy = std::make_unique<LegacyModules>(isGui() ? REQUIRE_INTERFACE: 0);
|
||||
@ -816,4 +843,12 @@ int app_get_color_to_clear_layer(Layer* layer)
|
||||
return color_utils::color_for_layer(color, layer);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DRM
|
||||
void app_configure_drm() {
|
||||
ResourceFinder rf;
|
||||
rf.includeUserDir("");
|
||||
DRM_CONFIGURE(rf.getFirstOrCreateDefault());
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace app
|
||||
|
@ -160,6 +160,7 @@ namespace app {
|
||||
void app_rebuild_documents_tabs();
|
||||
PixelFormat app_get_current_pixel_format();
|
||||
int app_get_color_to_clear_layer(doc::Layer* layer);
|
||||
void app_configure_drm();
|
||||
|
||||
} // namespace app
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "drm/drm.h"
|
||||
#else
|
||||
#define DRM_INVALID if (false)
|
||||
#define DRM_CONFIGURE(path)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -888,13 +888,14 @@ void FileOp::operate(IFileOpProgress* progress)
|
||||
m_format->support(FILE_SUPPORT_SAVE)) {
|
||||
#ifdef ENABLE_SAVE
|
||||
|
||||
DRM_INVALID {
|
||||
#if defined(ENABLE_TRIAL_MODE)
|
||||
DRM_INVALID{
|
||||
setError(
|
||||
fmt::format("Save operation is not supported, activate this Aseprite first.\n"
|
||||
"Go to {} and get a license key.",
|
||||
fmt::format("Save operation is not supported in trial version, activate this Aseprite first.\n"
|
||||
"Go to {} and get a license key to upgrade.",
|
||||
get_app_download_url()).c_str());
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Save a sequence
|
||||
if (isSequence()) {
|
||||
|
@ -110,6 +110,13 @@ HomeView::~HomeView()
|
||||
void HomeView::dataRecoverySessionsAreReady()
|
||||
{
|
||||
#ifdef ENABLE_DATA_RECOVERY
|
||||
|
||||
#ifdef ENABLE_TRIAL_VERSION
|
||||
DRM_INVALID{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (App::instance()->dataRecovery()->hasRecoverySessions()) {
|
||||
// We highlight the "Recover Files" options because we came from a crash
|
||||
auto theme = SkinTheme::get(this);
|
||||
@ -244,6 +251,13 @@ void HomeView::onNewUpdate(const std::string& url, const std::string& version)
|
||||
void HomeView::onRecoverSprites()
|
||||
{
|
||||
#ifdef ENABLE_DATA_RECOVERY
|
||||
|
||||
#ifdef ENABLE_TRIAL_VERSION
|
||||
DRM_INVALID{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
ASSERT(m_dataRecovery); // "Recover Files" button is hidden when
|
||||
// data recovery is disabled (m_dataRecovery == nullptr)
|
||||
if (!m_dataRecovery)
|
||||
|
Loading…
x
Reference in New Issue
Block a user