]> git.cworth.org Git - vogl/blob - src/vogleditor/vogleditor_apicalltreeitem.h
UI: Add 'GL Context' column to API call tree to help with multi-context debugging.
[vogl] / src / vogleditor / vogleditor_apicalltreeitem.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_APICALLTREEITEM_H
27 #define VOGLEDITOR_APICALLTREEITEM_H
28
29 #include <QList>
30 #include <QVariant>
31
32 #include "vogleditor_frameitem.h"
33
34 class vogl_trace_file_reader;
35 struct vogl_trace_gl_entrypoint_packet;
36
37 class vogleditor_QApiCallTreeModel;
38
39 enum VOGL_API_CALL_TREE_COLUMN
40 {
41     VOGL_ACTC_APICALL,
42     VOGL_ACTC_INDEX,
43     VOGL_ACTC_GLCONTEXT,
44     VOGL_ACTC_FLAGS,
45 //    VOGL_ACTC_BEGINTIME,
46 //    VOGL_ACTC_ENDTIME,
47     VOGL_ACTC_DURATION,
48     VOGL_MAX_ACTC
49 };
50
51 class vogleditor_apiCallTreeItem
52 {
53 public:
54    // Constructor for the root node
55    vogleditor_apiCallTreeItem(vogleditor_QApiCallTreeModel* pModel);
56
57    // Constructor for frame nodes
58    vogleditor_apiCallTreeItem(vogleditor_frameItem* frameItem, vogleditor_apiCallTreeItem* parent);
59
60    // Constructor for apiCall nodes
61    vogleditor_apiCallTreeItem(QString nodeText, vogleditor_apiCallItem* apiCallItem, vogleditor_apiCallTreeItem* parent);
62
63    ~vogleditor_apiCallTreeItem();
64
65    vogleditor_apiCallTreeItem* parent() const;
66
67    void appendChild(vogleditor_apiCallTreeItem* pChild);
68
69    int childCount() const;
70
71    vogleditor_apiCallTreeItem* child(int index) const;
72
73    vogleditor_apiCallItem* apiCallItem() const;
74
75    vogleditor_frameItem* frameItem() const;
76
77    void set_snapshot(vogleditor_gl_state_snapshot* pSnapshot);
78
79    bool has_snapshot() const;
80
81    vogleditor_gl_state_snapshot* get_snapshot() const;
82
83    int columnCount() const;
84
85    QVariant columnData(int column, int role) const;
86
87    int row() const;
88
89 private:
90    QList<vogleditor_apiCallTreeItem*> m_childItems;
91    QVariant m_columnData[VOGL_MAX_ACTC];
92    vogleditor_apiCallTreeItem* m_parentItem;
93    vogleditor_apiCallItem* m_pApiCallItem;
94    vogleditor_frameItem* m_pFrameItem;
95    vogleditor_QApiCallTreeModel* m_pModel;
96 };
97
98 #endif // VOGLEDITOR_APICALLTREEITEM_H