~aleteoryx/muditaos

1045daf623d9e79f3ef282efde476f52520c41b4 — Tigran Soghbatyan 4 years ago 8439e6a
[BH-1122] Fix window timeout

Fix resetTimer behaviour in windows with timeout
M module-apps/apps-common/popups/WindowWithTimer.cpp => module-apps/apps-common/popups/WindowWithTimer.cpp +5 -3
@@ 27,11 27,13 @@ namespace gui

    void WindowWithTimer::resetTimer(const std::chrono::seconds newTimeout)
    {
        timeout = newTimeout;
        if (newTimeout != noTimeoutChange) {
            timeout = newTimeout;
        }
        if (!popupTimer.isValid()) {
            popupTimer = app::GuiTimerFactory::createSingleShotTimer(application, this, popup::timerName, newTimeout);
            popupTimer = app::GuiTimerFactory::createSingleShotTimer(application, this, popup::timerName, timeout);
        }
        popupTimer.restart(newTimeout);
        popupTimer.restart(timeout);
    }

    void WindowWithTimer::detachTimerIfExists()

M module-apps/apps-common/popups/WindowWithTimer.hpp => module-apps/apps-common/popups/WindowWithTimer.hpp +3 -2
@@ 8,7 8,8 @@

namespace gui
{
    inline constexpr auto defautTimeout = std::chrono::seconds{3};
    inline constexpr auto defautTimeout   = std::chrono::seconds{3};
    inline constexpr auto noTimeoutChange = std::chrono::seconds::zero();
    class WindowWithTimer : public gui::AppWindow
    {
      private:


@@ 27,6 28,6 @@ namespace gui

      protected:
        void detachTimerIfExists();
        void resetTimer(const std::chrono::seconds newTimeout = defautTimeout);
        void resetTimer(const std::chrono::seconds newTimeout = noTimeoutChange);
    };
} // namespace gui