From babd4d57f0f4de7eb83c2464fac3c4e2d7093150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Stoj=C5=A1in?= Date: Fri, 26 Apr 2024 01:05:11 +0200 Subject: [PATCH] Set errors if packing/unpacking failed --- source/src/gui/dt_comp_pack.cpp | 14 ++++++++++++-- source/src/gui/dt_comp_unpack.cpp | 13 +++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/source/src/gui/dt_comp_pack.cpp b/source/src/gui/dt_comp_pack.cpp index 8d61e85..195b92f 100644 --- a/source/src/gui/dt_comp_pack.cpp +++ b/source/src/gui/dt_comp_pack.cpp @@ -25,14 +25,24 @@ dt_comp_pack::dt_comp_pack(dt_app& app) m_progress = 100.0f; m_app.get_systems().core.is_working = false; + m_app.get_systems().core.has_errors = false; + m_app.get_systems().core.errors = ""; m_app.set_taskbar_status(dvsku::dv_taskbar_status::no_progress); m_app.set_taskbar_progress(0U); - if (result.status == libevp::evp_result_status::ok) + if (result.status == libevp::evp_result_status::ok) { m_app.play_sound(dvsku::dv_sound_type::success); - else if (result.status == libevp::evp_result_status::error) + } + else if (result.status == libevp::evp_result_status::error) { m_app.play_sound(dvsku::dv_sound_type::warning); + + if (!result.message.empty()) { + m_app.get_systems().core.has_errors = true; + m_app.get_systems().core.errors = result.message; + } + } + }; m_context.update_callback = [this](float progress) { std::lock_guard guard(m_app.get_systems().core.mutex); diff --git a/source/src/gui/dt_comp_unpack.cpp b/source/src/gui/dt_comp_unpack.cpp index f2464a2..a73906f 100644 --- a/source/src/gui/dt_comp_unpack.cpp +++ b/source/src/gui/dt_comp_unpack.cpp @@ -25,14 +25,23 @@ dt_comp_unpack::dt_comp_unpack(dt_app& app) m_progress = 100.0f; m_app.get_systems().core.is_working = false; + m_app.get_systems().core.has_errors = false; + m_app.get_systems().core.errors = ""; m_app.set_taskbar_status(dvsku::dv_taskbar_status::no_progress); m_app.set_taskbar_progress(0U); - if (result.status == libevp::evp_result_status::ok) + if (result.status == libevp::evp_result_status::ok) { m_app.play_sound(dvsku::dv_sound_type::success); - else if (result.status == libevp::evp_result_status::error) + } + else if (result.status == libevp::evp_result_status::error) { m_app.play_sound(dvsku::dv_sound_type::warning); + + if (!result.message.empty()) { + m_app.get_systems().core.has_errors = true; + m_app.get_systems().core.errors = result.message; + } + } }; m_context.update_callback = [this](float progress) { std::lock_guard guard(m_app.get_systems().core.mutex);