Olive
projectmodel.h
1 /***
2 
3  Olive - Non-Linear Video Editor
4  Copyright (C) 2019 Olive Team
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 ***/
20 
21 #ifndef PROJECTMODEL_H
22 #define PROJECTMODEL_H
23 
24 #include <QAbstractItemModel>
25 
26 class Media;
27 
28 class ProjectModel : public QAbstractItemModel
29 {
30  Q_OBJECT
31 public:
32  ProjectModel(QObject* parent = nullptr);
33  ~ProjectModel() override;
34 
35  void make_root();
36  void destroy_root();
37  void clear();
38  Media* get_root();
39  QVariant data(const QModelIndex &index, int role) const override;
40  Qt::ItemFlags flags(const QModelIndex &index) const override;
41  QVariant headerData(int section, Qt::Orientation orientation,
42  int role = Qt::DisplayRole) const override;
43  QModelIndex index(int row, int column,
44  const QModelIndex &parent = QModelIndex()) const override;
45  QModelIndex create_index(int arow, int acolumn, void *aid);
46  QModelIndex parent(const QModelIndex &index) const override;
47  bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
48  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
49  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
50  Media *getItem(const QModelIndex &index) const;
51 
52  void appendChild(Media* parent, Media* child);
53  void moveChild(Media *child, Media *to);
54  void removeChild(Media *parent, Media* m);
55  Media *child(int i, Media* parent = nullptr);
56  int childCount(Media* parent = nullptr);
57  void set_icon(Media* m, const QIcon &ico);
58 
59 private:
60  Media* root_item;
61 };
62 
63 #endif // PROJECTMODEL_H
Definition: projectmodel.h:28
Definition: media.h:40