mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2024-12-25 21:59:30 +01:00
Fix a timer bug
This commit is contained in:
parent
7f31fe8b0e
commit
f131fa9050
3 changed files with 8 additions and 4 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <QtGui/QMouseEvent>
|
||||
|
||||
#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;
|
||||
|
|
|
@ -48,6 +48,9 @@
|
|||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxTimerTotal">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999</number>
|
||||
</property>
|
||||
|
|
Loading…
Reference in a new issue