diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 77f2bda91..4c706900a 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -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) diff --git a/src/app/app.cpp b/src/app/app.cpp index d2099508a..9e6d9d7ee 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -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(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(createLogInDesktop, preferences()); m_legacy = std::make_unique(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 diff --git a/src/app/app.h b/src/app/app.h index 42f46ef52..eceee3d3f 100644 --- a/src/app/app.h +++ b/src/app/app.h @@ -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 diff --git a/src/app/drm.h b/src/app/drm.h index daf02f0d8..0e3189f26 100644 --- a/src/app/drm.h +++ b/src/app/drm.h @@ -12,6 +12,7 @@ #include "drm/drm.h" #else #define DRM_INVALID if (false) + #define DRM_CONFIGURE(path) #endif #endif diff --git a/src/app/file/file.cpp b/src/app/file/file.cpp index 339a55c40..74fd38f3d 100644 --- a/src/app/file/file.cpp +++ b/src/app/file/file.cpp @@ -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()) { diff --git a/src/app/ui/home_view.cpp b/src/app/ui/home_view.cpp index 337fdc093..151b67fe5 100644 --- a/src/app/ui/home_view.cpp +++ b/src/app/ui/home_view.cpp @@ -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)