]> git.cworth.org Git - apitrace/blob - gui/argumentseditor.h
Check for ARB_sampler_objects before dumping its state.
[apitrace] / gui / argumentseditor.h
1 #ifndef ARGUMENTSEDITOR_H
2 #define ARGUMENTSEDITOR_H
3
4 #include "apitracecall.h"
5 #include "ui_argumentseditor.h"
6
7 #include <QComboBox>
8 #include <QDialog>
9 #include <QItemEditorFactory>
10 #include <QStandardItemModel>
11 #include <QSpinBox>
12 #include <QTextEdit>
13
14 #include <limits.h>
15 #include <float.h>
16
17
18 class ApiTraceCall;
19
20 class BooleanComboBox : public QComboBox
21 {
22     Q_OBJECT
23     Q_PROPERTY(bool value READ value WRITE setValue USER true)
24 public:
25     BooleanComboBox(QWidget *parent);
26     void setValue(bool);
27     bool value() const;
28 };
29
30
31 class BooleanComboBoxEditorCreator : public BooleanComboBox
32 {
33     Q_OBJECT
34     Q_PROPERTY(bool value READ value WRITE setValue USER true)
35 public:
36     BooleanComboBoxEditorCreator(QWidget *widget = 0) : BooleanComboBox(widget)
37     {
38         this->setFrame(false);
39     };
40 };
41
42 class UIntEditorCreator : public QSpinBox
43 {
44     Q_OBJECT
45     Q_PROPERTY(int value READ value WRITE setValue USER true)
46 public:
47     UIntEditorCreator(QWidget *widget = 0) : QSpinBox(widget)
48     {
49         this->setFrame(false);
50         this->setMaximum(INT_MAX);
51     };
52 };
53
54 class IntEditorCreator : public QSpinBox
55 {
56     Q_OBJECT
57     Q_PROPERTY(int value READ value WRITE setValue USER true)
58 public:
59     IntEditorCreator(QWidget *widget = 0) : QSpinBox(widget)
60     {
61         this->setFrame(false);
62         this->setMinimum(INT_MIN);
63         this->setMaximum(INT_MAX);
64     };
65 };
66
67 class ULongLongEditorCreator : public QSpinBox
68 {
69     Q_OBJECT
70     Q_PROPERTY(int value READ value WRITE setValue USER true)
71 public:
72     ULongLongEditorCreator(QWidget *widget = 0) : QSpinBox(widget)
73     {
74         this->setFrame(false);
75         this->setMaximum(INT_MAX);
76     };
77 };
78
79 class LongLongEditorCreator : public QSpinBox
80 {
81     Q_OBJECT
82     Q_PROPERTY(int value READ value WRITE setValue USER true)
83 public:
84     LongLongEditorCreator(QWidget *widget = 0) : QSpinBox(widget)
85     {
86         this->setFrame(false);
87         this->setMinimum(INT_MIN);
88         this->setMaximum(INT_MAX);
89     };
90 };
91
92 class PixmapEditorCreator : public QLabel
93 {
94     Q_OBJECT
95     Q_PROPERTY(QString text READ text WRITE setText USER true)
96 public:
97     PixmapEditorCreator(QWidget *widget = 0) : QLabel (widget)
98     {
99     };
100 };
101
102 class FloatEditorCreator : public QDoubleSpinBox
103 {
104     Q_OBJECT
105     Q_PROPERTY(double value READ value WRITE setValue USER true)
106 public:
107     FloatEditorCreator(QWidget *widget = 0) : QDoubleSpinBox(widget)
108     {
109         this->setFrame(false);
110         this->setMinimum(-FLT_MAX);
111         this->setMaximum(FLT_MAX);
112         this->setDecimals(8);
113     };
114 };
115
116 class DoubleEditorCreator : public QDoubleSpinBox
117 {
118     Q_OBJECT
119     Q_PROPERTY(double value READ value WRITE setValue USER true)
120 public:
121     DoubleEditorCreator(QWidget *widget = 0) : QDoubleSpinBox(widget)
122     {
123         this->setFrame(false);
124         this->setMinimum(-DBL_MAX);
125         this->setMaximum(DBL_MAX);
126         this->setDecimals(8);
127     };
128 };
129
130 class StringEditorCreator : public QTextEdit
131 {
132     Q_OBJECT
133     Q_PROPERTY(QString plainText READ toPlainText WRITE setPlainText USER true)
134 public:
135     StringEditorCreator(QWidget *widget = 0) : QTextEdit(widget)
136     {
137     };
138 };
139
140 class InvalidEditorCreator : public QLabel
141 {
142     Q_OBJECT
143     Q_PROPERTY(QString text READ text WRITE setText USER true)
144 public:
145     InvalidEditorCreator(QWidget *widget = 0) :  QLabel(widget)
146     {
147     };
148 };
149
150 class ArgumentsEditor : public QDialog
151 {
152     Q_OBJECT
153 public:
154     ArgumentsEditor(QWidget *parent=0);
155     ~ArgumentsEditor();
156
157
158     virtual void accept();
159
160     void setCall(ApiTraceCall *call);
161     ApiTraceCall *call() const;
162
163 private slots:
164     void currentSourceChanged(int idx);
165     void sourceChanged();
166     void revert();
167 private:
168     void init();
169     void setupCall();
170     void setupShaderEditor(const QVector<QVariant> &sources);
171     QVariant valueForName(const QString &name,
172                           const QVariant &orignalValue,
173                           bool *changed) const;
174     QVariant arrayFromIndex(const QModelIndex &index,
175                             const ApiArray &array,
176                             bool *changed) const;
177     QVariant arrayFromEditor(const ApiArray &origArray,
178                              bool *changed) const;
179 private:
180     Ui_ArgumentsEditor m_ui;
181     QStandardItemModel *m_model;
182
183     ApiTraceCall *m_call;
184 };
185
186 #endif