6#include <QtCore/QString>
7#include <QtGui/QStandardItemModel>
22 explicit ChoreStore(QString path, QObject *parent =
nullptr);
31 int add(
const QString &title);
35 int idAt(
int row)
const;
37 int rowOf(
int id)
const;
43 void append(
int id,
const QString &title,
bool done);
bool save() const
Writes the chores to the file. False if it can't be written.
Definition chorestore.cpp:43
bool remove(int id)
Removes the chore with this id. False if there is none.
Definition chorestore.cpp:73
bool load()
Reads the file, replacing the chores in the store.
Definition chorestore.cpp:22
int openCount() const
Chores not yet done.
Definition chorestore.cpp:97
int rowOf(int id) const
The row of the chore with this id, or -1.
Definition chorestore.cpp:88
QString m_path
The JSON file the chores are saved to.
Definition chorestore.h:45
int add(const QString &title)
Adds a chore at the end and returns its id.
Definition chorestore.cpp:65
int idAt(int row) const
The id of the chore in row, or -1.
Definition chorestore.cpp:82
ChoreStore(QString path, QObject *parent=nullptr)
An empty store that saves to path; an empty path saves nowhere.
Definition chorestore.cpp:17
void append(int id, const QString &title, bool done)
Appends an item for a chore.
Definition chorestore.cpp:107
int m_nextId
The id the next new chore gets.
Definition chorestore.h:46
Role
Item data roles of the model, beyond Qt's own.
Definition chorestore.h:17
@ IdRole
The chore's id, an int.
Definition chorestore.h:18