Olive
projectmodel.h
1 #ifndef PROJECTMODEL_H
2 #define PROJECTMODEL_H
3 
4 #include <QAbstractItemModel>
5 
6 class Media;
7 
8 class ProjectModel : public QAbstractItemModel
9 {
10  Q_OBJECT
11 public:
12  ProjectModel(QObject* parent = nullptr);
13  ~ProjectModel() override;
14 
15  void make_root();
16  void destroy_root();
17  void clear();
18  Media* get_root();
19  QVariant data(const QModelIndex &index, int role) const override;
20  Qt::ItemFlags flags(const QModelIndex &index) const override;
21  QVariant headerData(int section, Qt::Orientation orientation,
22  int role = Qt::DisplayRole) const override;
23  QModelIndex index(int row, int column,
24  const QModelIndex &parent = QModelIndex()) const override;
25  QModelIndex create_index(int arow, int acolumn, void *aid);
26  QModelIndex parent(const QModelIndex &index) const override;
27  bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
28  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
29  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
30  Media *getItem(const QModelIndex &index) const;
31 
32  void appendChild(Media* parent, Media* child);
33  void moveChild(Media *child, Media *to);
34  void removeChild(Media *parent, Media* m);
35  Media *child(int i, Media* parent = nullptr);
36  int childCount(Media* parent = nullptr);
37  void set_icon(Media* m, const QIcon &ico);
38 
39 private:
40  Media* root_item;
41 };
42 
43 #endif // PROJECTMODEL_H
Definition: projectmodel.h:8
Definition: media.h:20