From e0421a3ba6ca566dab584da32ecd32329ae45b1e Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Fri, 20 Apr 2018 14:53:11 +0200 Subject: [PATCH] PresetUpdater: Don't display new Slic3r version notifications multiple times for the same version --- xs/src/slic3r/Utils/PresetUpdater.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/xs/src/slic3r/Utils/PresetUpdater.cpp b/xs/src/slic3r/Utils/PresetUpdater.cpp index 9b271492c8..473fcf84f7 100644 --- a/xs/src/slic3r/Utils/PresetUpdater.cpp +++ b/xs/src/slic3r/Utils/PresetUpdater.cpp @@ -411,18 +411,24 @@ void PresetUpdater::slic3r_update_notify() auto* app_config = GUI::get_app_config(); const auto ver_slic3r = Semver::parse(SLIC3R_VERSION); - const auto ver_online = Semver::parse(app_config->get("version_online")); + const auto ver_online_str = app_config->get("version_online"); + const auto ver_online = Semver::parse(ver_online_str); + const auto ver_online_seen = Semver::parse(app_config->get("version_online_seen")); if (! ver_slic3r) { throw std::runtime_error("Could not parse Slic3r version string: " SLIC3R_VERSION); } - if (ver_online && *ver_online > *ver_slic3r) { - UpdateNotification notification(*ver_slic3r, *ver_online); - notification.ShowModal(); - if (notification.disable_version_check()) { - app_config->set("version_check", "0"); - p->enabled_version_check = false; + if (ver_online) { + // Only display the notification if the version available online is newer AND if we haven't seen it before + if (*ver_online > *ver_slic3r && (! ver_online_seen || *ver_online_seen < *ver_online)) { + UpdateNotification notification(*ver_slic3r, *ver_online); + notification.ShowModal(); + if (notification.disable_version_check()) { + app_config->set("version_check", "0"); + p->enabled_version_check = false; + } } + app_config->set("version_online_seen", ver_online_str); } }