/**************************************************************************
KitchenAlert
- Copyright (C) 2010 Heli Hyvättinen
+ Copyright (C) 2010-2011 Heli Hyvättinen
This file is part of KitchenAlert.
case timeRemainingColumnNumber_:
+ if (currentTimers_.at(index.row())->isRunning()) //timer running
+ {
+
allseconds = currentTimers_.at(index.row())->getRemainingTimeInSeconds();
- if (allseconds < 0)
- {
- timeAsText = tr("-", "negative sign");
- allseconds = -allseconds;
+ if (allseconds < 0)
+ {
+ timeAsText = tr("-", "negative sign");
+ allseconds = -allseconds;
+ }
+ }
+
+ else //timer stopped or never started
+
+ {
+ //use original time
+ allseconds = currentTimers_.at(index.row())->getOriginalTimeInSeconds();
}
hoursOnly.setNum( allseconds/(60*60));
case statusColumnNumber_:
if (currentTimers_.at(index.row())->isAlerting() == true)
- return QString("ALERT!");
+ return tr("ALERT!");
+
+ if (!currentTimers_.at(index.row())->isRunning())
+ return tr("stopped");
else return QString();
if (update == true)
{
refreshTimeAndStatusColumns(); //Refresh to catch up with past changes
- qDebug() << "Just refreshed time and status colums after returning to the app";
+// qDebug() << "Just refreshed time and status colums after returning to the app";
}
}
}
+bool CurrentAlertsTableModel::saveTimer(QModelIndex index, QString filename)
+{
+ return currentTimers_.at(index.row())->save(filename);
+}
+