aboutsummaryrefslogtreecommitdiff
path: root/notebookmodel.h
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-06-07 21:22:45 +0200
committerJavier <dev.git@javispedro.com>2015-06-07 21:22:45 +0200
commita69e97943539a8abc4d2762638c169dc19c88516 (patch)
treef3516ea29745db65971247cee4c260b49f1067b2 /notebookmodel.h
downloadscribiu-a69e97943539a8abc4d2762638c169dc19c88516.tar.gz
scribiu-a69e97943539a8abc4d2762638c169dc19c88516.zip
initial import
Diffstat (limited to 'notebookmodel.h')
-rw-r--r--notebookmodel.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/notebookmodel.h b/notebookmodel.h
new file mode 100644
index 0000000..83bb004
--- /dev/null
+++ b/notebookmodel.h
@@ -0,0 +1,49 @@
+#ifndef NOTEBOOKMODEL_H
+#define NOTEBOOKMODEL_H
+
+#include <QtCore/QAbstractItemModel>
+#include <QtCore/QDir>
+#include <QtCore/QFileSystemWatcher>
+
+class NotebookModel : public QAbstractItemModel
+{
+ Q_OBJECT
+public:
+ explicit NotebookModel(QObject *parent = 0);
+
+ QString penDirectory(const QString &name) const;
+ QString notebookDirectory(const QString &penName, const QString &nbName) const;
+ QString notebookDirectory(const QModelIndex &index) const;
+
+ QVariant data(const QModelIndex &index, int role) const;
+ Qt::ItemFlags flags(const QModelIndex &index) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent) const;
+ QModelIndex parent(const QModelIndex &child) const;
+ int rowCount(const QModelIndex &parent) const;
+ int columnCount(const QModelIndex &parent) const;
+
+signals:
+
+public slots:
+ void refresh();
+ void refreshPen(const QString &name);
+
+private:
+
+private:
+ int indexOfPen(const QString &name);
+ QDir notebookDir(const QString &pen, const QString &notebook) const;
+ QIcon getNotebookIcon(const QString &pen, const QString &notebook) const;
+ bool isNotebookLocked(const QString &pen, const QString &notebook) const;
+
+private slots:
+ void handleChangedDirectory(const QString &path);
+
+private:
+ QDir _dataDir;
+ QFileSystemWatcher _watcher;
+ QStringList _pens;
+ QHash<QString, QStringList> _notebooks;
+};
+
+#endif // NOTEBOOKMODEL_H