File: projectmodel.h

package info (click to toggle)
olive-editor 20181223-2
  • links: PTS
  • area: main
  • in suites: buster
  • size: 2,844 kB
  • sloc: cpp: 20,147; xml: 315; ansic: 16; makefile: 11
file content (41 lines) | stat: -rw-r--r-- 1,409 bytes parent folder | download
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
#ifndef PROJECTMODEL_H
#define PROJECTMODEL_H

#include <QAbstractItemModel>

class Media;

class ProjectModel : public QAbstractItemModel
{
    Q_OBJECT
public:
    ProjectModel(QObject* parent = 0);
    ~ProjectModel() override;

    void destroy_root();
    void clear();
    Media* get_root();
    QVariant data(const QModelIndex &index, int role) const override;
    Qt::ItemFlags flags(const QModelIndex &index) const override;
    QVariant headerData(int section, Qt::Orientation orientation,
                        int role = Qt::DisplayRole) const override;
    QModelIndex index(int row, int column,
                      const QModelIndex &parent = QModelIndex()) const override;
    QModelIndex parent(const QModelIndex &index) const override;
    bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    int columnCount(const QModelIndex &parent = QModelIndex()) const override;
    Media *getItem(const QModelIndex &index) const;

    void appendChild(Media* parent, Media* child);
    void moveChild(Media *child, Media *to);
    void removeChild(Media *parent, Media* m);
    Media *child(int i, Media* parent = NULL);
    int childCount(Media* parent = NULL);
    void set_icon(Media* m, const QIcon &ico);

private:
    Media* root_item;
};

#endif // PROJECTMODEL_H