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
23#include <QAbstractItemModel>
24
25class ResourceModel : public QAbstractItemModel
26{
27 Q_OBJECT
28
29public:
30
31 enum Columns {
32 COLUMN_INFO = 0,
33 COLUMN_NAME,
34 COLUMN_SIZE,
35 COLUMN_VID_DESCRIPTION,
36 COLUMN_AUD_DESCRIPTION,
37 COLUMN_COUNT,
38 };
39
40 explicit ResourceModel(QObject *parent = 0);
41 virtual ~ResourceModel();
42 void search(Mlt::Producer *producer);
43 void add(Mlt::Producer *producer, const QString &location = QString());
44 QList<Mlt::Producer> getProducers(const QModelIndexList &indices);
45 bool exists(const QString &hash);
46 int producerCount();
47 Mlt::Producer producer(int index);
48 // Implement QAbstractItemModel
49 int rowCount(const QModelIndex &parent) const;
50 int columnCount(const QModelIndex &parent) const;
51 QVariant data(const QModelIndex &index, int role) const;
52 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
53 QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
54 QModelIndex parent(const QModelIndex &index) const;
55
56private:
57
58 QList<Mlt::Producer> m_producers;
59 QMap<QString, QString> m_locations;
60};
61
62#endif // RESOURCEMODEL_H