X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fcurrentalertstablemodel.h;h=b20ead123dd68f1927f93807bcf989136abaef07;hb=a06334fdc173e26d116b5625aa50b1236d119dfe;hp=9751671556a07238678ba9d5abba80d9fbc10808;hpb=55e83dd6677893a7d2ed9de67c675fd9b45a68bc;p=kitchenalert diff --git a/src/currentalertstablemodel.h b/src/currentalertstablemodel.h old mode 100644 new mode 100755 index 9751671..b20ead1 --- a/src/currentalertstablemodel.h +++ b/src/currentalertstablemodel.h @@ -35,8 +35,8 @@ /*! Class that contains the model that holds the timers' @author Heli Hyvättinen - @date 2010-06-26 - @version 0.09 + @date 2011-04-05 + @version 0.2.1 Class that contains the model that holds the timers @@ -49,44 +49,111 @@ class CurrentAlertsTableModel : public QAbstractTableModel public: explicit CurrentAlertsTableModel(QObject *parent = 0); + /*! + Returns the number of rows in the model. + Used by the view. + */ int rowCount(const QModelIndex &parent) const; + /*! + Returns the (fixed) number of columns in the model. + Used by the view. + */ int columnCount(const QModelIndex &parent) const; + /*! + Returns the queried contents of the cell + Used by the view. + */ QVariant data(const QModelIndex &index, int role) const; + /*! + Returns the queried header data. + As no headers are wanted, it always returns an empty QVariant. + Used by the view. + */ QVariant headerData(int section, Qt::Orientation orientation, int role) const; + /*! + Returns the index in the model of the given timer + */ QModelIndex giveIndexForTimer(Timer * ptimer); + /*! + Returns whether the timer in the given position is currently alerting. + @param index Any cell from the row of the alert is good here. + */ bool isThisTimerAlerting(QModelIndex index); -signals: -public slots: + /*! Saves a timer to a file + @param index The index of the timer to be saved. Any cell from the row of the timer is good here. + @param filename The name of the file to which the timer is to be saved + */ + bool saveTimer(QModelIndex index,QString filename); - void addTimers(QList timers); - void refreshTimeColumn (); +signals: +public slots: + + /*! + Adds the timers to the model + @param timers List of timers to be added + @param startImmediately If true, the timers will be started after adding to the model. + */ + void addTimers(QList timers, bool startImmediately = true); + + /*! + Tells the view to refresh all information in the time and status columns. + (The time and status change without user inervention unlike the alert text and thus + need to be refreshed.) + */ + void refreshTimeAndStatusColumns (); + + /*! + Passes the start command to the timer in the given index. + @param index Any cell from the row of the alert is good here. + */ void startTimer(QModelIndex index); + + /*! + Passes the snooze command to the timer in the given index. + @param index Any cell from the row of the alert is good here. + */ void snoozeTimer(QModelIndex index); - void stopTimer(QModelIndex index); + /*! + Passes the stop command to the timer in the given index. + @param index Any cell from the row of the alert is good here. + */ + void stopTimer(QModelIndex index); + +/*! +Sets whether the view should be kept up to date. +*/ void setUpdateViewOnChanges(bool update); +/*! + Removes a timer from the model + */ + + void removeTimer(QModelIndex index); + + + private: - QList currentTimers_; + QList currentTimers_; /*! Holds the timers */ - static const int numberOfColumns_ = 3; - static const int alertTextColumnNumber_ = 0; - static const int timeRemainingColumnNumber_ = 1; - static const int statusColumnNumber_ = 2; + static const int numberOfColumns_ = 3; /*! The fixed number of columns in the model */ + static const int alertTextColumnNumber_ = 0; /*! Tells which column contains the alert text */ + static const int timeRemainingColumnNumber_ = 1; /*! Tells which column contains the time remaining until alert */ + static const int statusColumnNumber_ = 2; /*! Tells which column contains status information, such as that the timer is alerting */ - bool updateViewOnChanges_; + bool updateViewOnChanges_; /*! Keeps track on whether the view should be kept up to date. */ };