CuteLogger
Fast and simple logging solution for Qt based applications
meltedclipsmodel.h
1 /*
2  * Copyright (c) 2012-2013 Meltytech, LLC
3  * Author: Dan Dennedy <dan@dennedy.org>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef MELTEDCLIPSMODEL_H
20 #define MELTEDCLIPSMODEL_H
21 
22 #include <QtCore>
23 #include "mvcpthread.h"
24 
25 class MeltedClipsModel : public QAbstractItemModel
26 {
27  Q_OBJECT
28 public:
29  explicit MeltedClipsModel(MvcpThread* mvcp, QObject *parent = 0);
30  ~MeltedClipsModel();
31 
32  QStringList mimeTypes() const;
33  QMimeData* mimeData(const QModelIndexList &indexes) const;
34  int rowCount(const QModelIndex &parent = QModelIndex()) const;
35  int columnCount(const QModelIndex &parent = QModelIndex()) const;
36  QVariant data(const QModelIndex &index, int role) const;
37  Qt::ItemFlags flags(const QModelIndex &index) const;
38  QVariant headerData(int section, Qt::Orientation orientation,
39  int role = Qt::DisplayRole) const;
40  QModelIndex index(int row, int column,
41  const QModelIndex &parent = QModelIndex()) const;
42  QModelIndex parent(const QModelIndex &index) const;
43  bool hasChildren(const QModelIndex &parent) const;
44 
45 private:
46  MvcpThread* m_mvcp;
47  QModelIndex m_rootIndex;
48  QObject* m_root;
49  QMutex m_mutex;
50  QList<QModelIndex> m_pending;
51 
52  void fetch(QObject* parent, const QModelIndex& index) const;
53 
54 private slots:
55  void onClsResult(QObject* parent, QObjectList* results);
56 };
57 
58 #endif // MELTEDCLIPSMODEL_H
Definition: mvcp.h:84