CuteLogger
Fast and simple logging solution for Qt based applications
resourcemodel.h
1/*
2 * Copyright (c) 2023-2024 Meltytech, LLC
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef RESOURCEMODEL_H
19#define RESOURCEMODEL_H
20
21#include <MltProducer.h>
22#include <QAbstractItemModel>
23
24class ResourceModel : public QAbstractItemModel
25{
26 Q_OBJECT
27
28public:
29 enum Columns {
30 COLUMN_INFO = 0,
31 COLUMN_NAME,
32 COLUMN_SIZE,
33 COLUMN_VID_DESCRIPTION,
34 COLUMN_AUD_DESCRIPTION,
35 COLUMN_COUNT,
36 };
37
38 explicit ResourceModel(QObject *parent = 0);
39 virtual ~ResourceModel();
40 void search(Mlt::Producer *producer);
41 void add(Mlt::Producer *producer, const QString &location = QString());
42 QList<Mlt::Producer> getProducers(const QModelIndexList &indices);
43 bool exists(const QString &hash);
44 int producerCount();
45 Mlt::Producer producer(int index);
46 // Implement QAbstractItemModel
47 int rowCount(const QModelIndex &parent) const;
48 int columnCount(const QModelIndex &parent) const;
49 QVariant data(const QModelIndex &index, int role) const;
50 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
51 QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
52 QModelIndex parent(const QModelIndex &index) const;
53
54private:
55 QList<Mlt::Producer> m_producers;
56 QMap<QString, QString> m_locations;
57};
58
59#endif // RESOURCEMODEL_H