-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.hpp
47 lines (34 loc) · 1.13 KB
/
model.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef MODEL_HPP
#define MODEL_HPP
#include <ostream>
#include <QtCore/QAbstractItemModel>
#include <QtCore/QString>
#include <QtCore/QList>
#include <odb/transaction.hxx>
#include <odb/schema-catalog.hxx>
#include <odb/sqlite/database.hxx>
#include "library.hpp"
#include "library-odb.hxx"
#include "treeitem.hpp"
#include "treeitem-odb.hxx"
class Model:public QAbstractItemModel
{
public:
TreeItem* Root;
QString DatabaseFilename;
Model(const QString& filename="yarl.db");
~Model();
QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
QModelIndex parent ( const QModelIndex & index ) const;
int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
void Erase(const QModelIndex& index);
void AddArtist(Artist* artist);
friend std::ostream& operator<<(std::ostream& out, const Model& model);
void NewDatabase(const QString& filename="");
void LoadDatabase(const QString& filename="");
protected:
private:
};
#endif