From 65a2411c46a8ddc239f256e2d0f1dac76f553003 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Sun, 28 Oct 2018 12:06:37 -0400 Subject: [PATCH] Better interface for idle timer values --- mainwindow.cpp | 17 +++++++++++++++-- mainwindow.h | 3 +++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index a1539b3..58e0fa0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1539,8 +1539,7 @@ void MainWindow::on_the_minute () if (m_config.watchdog ()) { - ++m_idleMinutes; - qDebug() << "idle" << m_idleMinutes << "minutes"; + incrementIdleTimer(); update_watchdog_label (); } else @@ -2655,6 +2654,8 @@ bool MainWindow::eventFilter (QObject * object, QEvent * event) // fall through case QEvent::MouseButtonPress: // reset the Tx watchdog + qDebug() << event; + resetIdleTimer(); tx_watchdog (false); break; @@ -10162,6 +10163,18 @@ void MainWindow::remove_child_from_event_filter (QObject * target) } } +void MainWindow::resetIdleTimer(){ + if(m_idleMinutes){ + m_idleMinutes = 0; + qDebug() << "idle" << m_idleMinutes << "minutes"; + } +} + +void MainWindow::incrementIdleTimer(){ + m_idleMinutes++; + qDebug() << "increment idle to" << m_idleMinutes << "minutes"; +} + void MainWindow::tx_watchdog (bool triggered) { auto prior = m_tx_watchdog; diff --git a/mainwindow.h b/mainwindow.h index 325e398..a597496 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -935,6 +935,9 @@ private: void add_child_to_event_filter (QObject *); void remove_child_from_event_filter (QObject *); void setup_status_bar (bool vhf); + + void resetIdleTimer(); + void incrementIdleTimer(); void tx_watchdog (bool triggered); qint64 nWidgets(QString t); void displayWidgets(qint64 n);