From 90132698a6e1cc3897b1b421f9494eeaa07334d3 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 22 May 2017 14:37:29 -0300 Subject: [PATCH] Move RenderTaskJob impl to render_task_job.cpp --- src/app/CMakeLists.txt | 1 + src/app/render_task_job.cpp | 35 +++++++++++++++++++++++++++++++++++ src/app/render_task_job.h | 13 +++---------- 3 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 src/app/render_task_job.cpp diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 26237fa58..5f476db55 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -390,6 +390,7 @@ add_library(app-lib pref/preferences.cpp project.cpp recent_files.cpp + render_task_job.cpp res/http_loader.cpp res/palettes_loader_delegate.cpp res/resources_loader.cpp diff --git a/src/app/render_task_job.cpp b/src/app/render_task_job.cpp new file mode 100644 index 000000000..7eaecef74 --- /dev/null +++ b/src/app/render_task_job.cpp @@ -0,0 +1,35 @@ +// Aseprite +// Copyright (C) 2017 David Capello +// +// This program is distributed under the terms of +// the End-User License Agreement for Aseprite. + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "app/render_task_job.h" + +namespace app { + +void RenderTaskJob::onJob() +{ + try { + m_func(); + } + catch (std::exception& ex) { + // TODO show the exception + } +} + +bool RenderTaskJob::continueTask() +{ + return !isCanceled(); +} + +void RenderTaskJob::notifyTaskProgress(double progress) +{ + jobProgress(progress); +} + +} // namespace app diff --git a/src/app/render_task_job.h b/src/app/render_task_job.h index a3977a66b..9a373ad3a 100644 --- a/src/app/render_task_job.h +++ b/src/app/render_task_job.h @@ -25,18 +25,11 @@ public: } private: - - void onJob() override { - m_func(); - } + void onJob() override; // render::TaskDelegate impl - bool continueTask() override { - return !isCanceled(); - } - void notifyTaskProgress(double progress) override { - jobProgress(progress); - } + bool continueTask() override; + void notifyTaskProgress(double progress) override; std::function m_func; };