]> git.cworth.org Git - vogl/blob - src/vogleditor/vogleditor_qapicalltreemodel.h
91305c86661a4ff3014b43f69774c185485ee5a0
[vogl] / src / vogleditor / vogleditor_qapicalltreemodel.h
1 /**************************************************************************
2  *
3  * Copyright 2013-2014 RAD Game Tools and Valve Software
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  *
24  **************************************************************************/
25
26 #ifndef VOGLEDITOR_QAPICALLTREEMODEL_H
27 #define VOGLEDITOR_QAPICALLTREEMODEL_H
28
29 #include <QAbstractItemModel>
30 #include <QColor>
31 #include <QList>
32 #include <QLinkedList>
33 #include <QVariant>
34
35 #include "vogleditor_frameitem.h"
36 #include "vogleditor_apicalltreeitem.h"
37
38 class vogl_trace_file_reader;
39 struct vogl_trace_gl_entrypoint_packet;
40
41 class vogleditor_QApiCallTreeModel : public QAbstractItemModel
42 {
43    Q_OBJECT
44
45 public:
46    vogleditor_QApiCallTreeModel(vogl_trace_file_reader* reader, QObject* parent = 0);
47    ~vogleditor_QApiCallTreeModel();
48
49    virtual QVariant data(const QModelIndex &index, int role) const;
50    virtual Qt::ItemFlags flags(const QModelIndex &index) const;
51    virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
52    virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
53    virtual QModelIndex parent(const QModelIndex &index) const;
54    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
55    virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
56
57    QModelIndex indexOf(const vogleditor_apiCallTreeItem* pItem) const;
58
59    vogleditor_apiCallTreeItem* root() const
60    {
61       return m_rootItem;
62    }
63
64    QModelIndexList find_search_matches(const QString searchText);
65    QModelIndex find_prev_search_result(vogleditor_apiCallTreeItem* start, const QString searchText);
66    QModelIndex find_next_search_result(vogleditor_apiCallTreeItem* start, const QString searchText);
67
68    vogleditor_apiCallTreeItem* find_prev_snapshot(vogleditor_apiCallTreeItem* start);
69    vogleditor_apiCallTreeItem* find_next_snapshot(vogleditor_apiCallTreeItem* start);
70
71    vogleditor_apiCallTreeItem* find_prev_drawcall(vogleditor_apiCallTreeItem* start);
72    vogleditor_apiCallTreeItem* find_next_drawcall(vogleditor_apiCallTreeItem* start);
73
74    vogleditor_apiCallTreeItem* find_call_number(uint64_t callNumber);
75    vogleditor_apiCallTreeItem* find_frame_number(uint64_t frameNumber);
76
77 signals:
78
79 public slots:
80
81 private:
82    vogleditor_apiCallTreeItem* m_rootItem;
83    vogl_ctypes m_trace_ctypes;
84    QLinkedList<vogleditor_apiCallTreeItem*> m_itemList;
85
86    void setupModelData(vogl_trace_file_reader* pTrace_reader, vogleditor_apiCallTreeItem* parent);
87
88 };
89
90 #endif // VOGLEDITOR_QAPICALLTREEMODEL_H