X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=gui%2Fargumentseditor.h;h=27aa491f595cfe1162a44bf642a7ceea170d01e4;hb=f2329b671e784c326b8268186101f965be72202b;hp=fdec85725ca73ade8fdc7867be442b22dd2a852f;hpb=4b3d3bf911c2fd927ce6570e1e52e7b3286746ad;p=apitrace diff --git a/gui/argumentseditor.h b/gui/argumentseditor.h index fdec857..27aa491 100644 --- a/gui/argumentseditor.h +++ b/gui/argumentseditor.h @@ -1,11 +1,18 @@ #ifndef ARGUMENTSEDITOR_H #define ARGUMENTSEDITOR_H +#include "apitracecall.h" #include "ui_argumentseditor.h" + #include +#include #include #include -#include +#include + +#include +#include + class ApiTraceCall; @@ -19,15 +26,117 @@ public: bool value() const; }; -class ArgumentsItemEditorFactory : public QItemEditorFactory + +class BooleanComboBoxEditorCreator : public BooleanComboBox +{ + Q_OBJECT + Q_PROPERTY(bool value READ value WRITE setValue USER true) +public: + BooleanComboBoxEditorCreator(QWidget *widget = 0) : BooleanComboBox(widget) + { + this->setFrame(false); + }; +}; + +class UIntEditorCreator : public QSpinBox +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue USER true) +public: + UIntEditorCreator(QWidget *widget = 0) : QSpinBox(widget) + { + this->setFrame(false); + this->setMaximum(INT_MAX); + }; +}; + +class IntEditorCreator : public QSpinBox +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue USER true) +public: + IntEditorCreator(QWidget *widget = 0) : QSpinBox(widget) + { + this->setFrame(false); + this->setMinimum(INT_MIN); + this->setMaximum(INT_MAX); + }; +}; + +class ULongLongEditorCreator : public QSpinBox +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue USER true) +public: + ULongLongEditorCreator(QWidget *widget = 0) : QSpinBox(widget) + { + this->setFrame(false); + this->setMaximum(INT_MAX); + }; +}; + +class LongLongEditorCreator : public QSpinBox +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue USER true) +public: + LongLongEditorCreator(QWidget *widget = 0) : QSpinBox(widget) + { + this->setFrame(false); + this->setMinimum(INT_MIN); + this->setMaximum(INT_MAX); + }; +}; + +class PixmapEditorCreator : public QLabel +{ + Q_OBJECT + Q_PROPERTY(QString text READ text WRITE setText USER true) +public: + PixmapEditorCreator(QWidget *widget = 0) : QLabel (widget) + { + }; +}; + +class FloatEditorCreator : public QDoubleSpinBox +{ + Q_OBJECT + Q_PROPERTY(double value READ value WRITE setValue USER true) +public: + FloatEditorCreator(QWidget *widget = 0) : QDoubleSpinBox(widget) + { + this->setFrame(false); + this->setMinimum(-FLT_MAX); + this->setMaximum(FLT_MAX); + this->setDecimals(8); + }; +}; + +class DoubleEditorCreator : public QDoubleSpinBox +{ + Q_OBJECT + Q_PROPERTY(double value READ value WRITE setValue USER true) +public: + DoubleEditorCreator(QWidget *widget = 0) : QDoubleSpinBox(widget) + { + this->setFrame(false); + this->setMinimum(-DBL_MAX); + this->setMaximum(DBL_MAX); + this->setDecimals(8); + }; +}; + +class InvalidEditorCreator : public QLabel { + Q_OBJECT + Q_PROPERTY(QString text READ text WRITE setText USER true) public: - ArgumentsItemEditorFactory(); - QWidget *createEditor(QVariant::Type type, QWidget *parent) const; - QByteArray valuePropertyName(QVariant::Type) const; + InvalidEditorCreator(QWidget *widget = 0) : QLabel(widget) + { + }; }; -class ArgumentsEditor : public QWidget +class ArgumentsEditor : public QDialog { Q_OBJECT public: @@ -35,16 +144,27 @@ public: ~ArgumentsEditor(); + virtual void accept(); + void setCall(ApiTraceCall *call); ApiTraceCall *call() const; -signals: - void argumentsEdited(ApiTraceCall *call); - +private slots: + void currentSourceChanged(int idx); + void sourceChanged(); + void revert(); private: void init(); void setupCall(); - void setupShaderEditor(const QList &sources); + void setupShaderEditor(const QVector &sources); + QVariant valueForName(const QString &name, + const QVariant &orignalValue, + bool *changed) const; + QVariant arrayFromIndex(const QModelIndex &index, + const ApiArray &array, + bool *changed) const; + QVariant arrayFromEditor(const ApiArray &origArray, + bool *changed) const; private: Ui_ArgumentsEditor m_ui; QStandardItemModel *m_model;