diff --git a/qt/main_window.cpp b/qt/main_window.cpp index d7c3b4a..3883b6b 100644 --- a/qt/main_window.cpp +++ b/qt/main_window.cpp @@ -328,8 +328,8 @@ void MainWindow::prefsUpdated() // Refresh the timer values QSettings qs; - int timerTotal = qs.value(PrefsDialog::kINTF_TIMER_TOTAL_DURATION).toInt(); - int timerAlert = qs.value(PrefsDialog::kINTF_TIMER_ALERT_DURATION).toInt(); + int timerTotal = qs.value(PrefsDialog::kINTF_TIMER_TOTAL_DURATION, 180).toInt(); + int timerAlert = qs.value(PrefsDialog::kINTF_TIMER_ALERT_DURATION, 30).toInt(); m_timerModel->setTotalDuration(timerTotal); m_timerModel->setAlertDuration(timerAlert); diff --git a/qt/timer_widget.cpp b/qt/timer_widget.cpp index b064e01..10f93ed 100644 --- a/qt/timer_widget.cpp +++ b/qt/timer_widget.cpp @@ -22,6 +22,7 @@ #include #include "timer_widget.h" +#include "debug.h" INIT_LOGGER(qt, TimerModel); @@ -101,11 +102,10 @@ bool TimerModel::isActiveTimer() const void TimerModel::setTotalDuration(int iSeconds) { + ASSERT(iSeconds > 0, "Invalid total duration"); if (iSeconds == m_totalDuration) return; m_totalDuration = iSeconds; - if (m_totalDuration < 0) - m_totalDuration = 0; emit newTotalDuration(m_totalDuration); resetTimer(); } @@ -113,6 +113,7 @@ void TimerModel::setTotalDuration(int iSeconds) void TimerModel::setAlertDuration(int iSeconds) { + // The duration can be negative (to deactivate the alert) if (iSeconds == m_alertDuration) return; m_alertDuration = iSeconds; diff --git a/qt/ui/prefs_dialog.ui b/qt/ui/prefs_dialog.ui index 603ae2e..6d41734 100644 --- a/qt/ui/prefs_dialog.ui +++ b/qt/ui/prefs_dialog.ui @@ -48,6 +48,9 @@ + + 1 + 999