projects
/
kitchenalert
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'sticky2'
[kitchenalert]
/
src
/
currentalertstablemodel.cpp
diff --git
a/src/currentalertstablemodel.cpp
b/src/currentalertstablemodel.cpp
index
7631630
..
d0e70c3
100644
(file)
--- a/
src/currentalertstablemodel.cpp
+++ b/
src/currentalertstablemodel.cpp
@@
-1,7
+1,7
@@
/**************************************************************************
KitchenAlert
/**************************************************************************
KitchenAlert
- Copyright (C) 2010 Heli Hyvättinen
+ Copyright (C) 2010-2011 Heli Hyvättinen
This file is part of KitchenAlert.
This file is part of KitchenAlert.
@@
-113,15
+113,26
@@
QVariant CurrentAlertsTableModel::data(const QModelIndex &index, int role) const
case timeRemainingColumnNumber_:
case timeRemainingColumnNumber_:
+ if (currentTimers_.at(index.row())->isRunning()) //timer running
+ {
+
allseconds = currentTimers_.at(index.row())->getRemainingTimeInSeconds();
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));
}
hoursOnly.setNum( allseconds/(60*60));
@@
-146,7
+157,10
@@
QVariant CurrentAlertsTableModel::data(const QModelIndex &index, int role) const
case statusColumnNumber_:
if (currentTimers_.at(index.row())->isAlerting() == true)
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();
else return QString();
@@
-295,7
+309,7
@@
void CurrentAlertsTableModel::setUpdateViewOnChanges(bool update)
if (update == true)
{
refreshTimeAndStatusColumns(); //Refresh to catch up with past changes
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";
}
}
}
}
@@
-325,3
+339,8
@@
void CurrentAlertsTableModel::removeTimer(QModelIndex index)
}
}
+bool CurrentAlertsTableModel::saveTimer(QModelIndex index, QString filename)
+{
+ return currentTimers_.at(index.row())->save(filename);
+}
+