diff --git a/Element.cpp b/Element.cpp index 0bcbb10..897407a 100644 --- a/Element.cpp +++ b/Element.cpp @@ -19,8 +19,11 @@ #include "Element.h" +#include + Element::Element(uid id, UidAllocator* allocator) : _name(""), _isLocked(false), _opacity(1.0f), _allocator(allocator) { + qDebug() << "Trying to create Element with allocator " << allocator << " and id " << id << endl; if (id == NULL_UID) id = allocator->allocate(); else diff --git a/Element.h b/Element.h index 7594830..394a685 100644 --- a/Element.h +++ b/Element.h @@ -22,17 +22,21 @@ #include #include +#include #include "UidAllocator.h" +Q_DECLARE_METATYPE(uid) + class Element : public QObject { Q_OBJECT Q_PROPERTY(uid id READ getId) - Q_PROPERTY(QString name READ getName WRITE setName RESET unsetName) - Q_PROPERTY(bool locked READ isLocked WRITE setLocked) + Q_PROPERTY(QString name READ getName WRITE setName RESET unsetName) + Q_PROPERTY(bool locked READ isLocked WRITE setLocked) Q_PROPERTY(float opacity READ getOpacity WRITE setOpacity) + Q_PROPERTY(QIcon icon READ getIcon) public: Element(uid id, UidAllocator* allocator); @@ -55,6 +59,8 @@ public: virtual void build() {} + virtual QIcon getIcon() const { return QIcon(); } + private: uid _id; QString _name; diff --git a/Mapping.h b/Mapping.h index bed8561..85f6b8c 100644 --- a/Mapping.h +++ b/Mapping.h @@ -50,11 +50,11 @@ class Mapping : public Element Q_PROPERTY(bool visible READ isVisible WRITE setVisible) Q_PROPERTY(int depth READ getDepth WRITE setDepth) - Q_PROPERTY(MShape::ptr shape READ getShape) - Q_PROPERTY(MShape::ptr inputShape READ getInputShape) +// Q_PROPERTY(MShape::ptr shape READ getShape) +// Q_PROPERTY(MShape::ptr inputShape READ getInputShape) Q_PROPERTY(bool hasInputShape READ hasInputShape STORED false) - Q_PROPERTY(Paint::ptr paint READ getPaint WRITE setPaint) +// Q_PROPERTY(Paint::ptr paint READ getPaint WRITE setPaint) protected: /// The input Paint instance. @@ -126,6 +126,7 @@ public: */ class ColorMapping : public Mapping { + Q_OBJECT public: ColorMapping(Paint::ptr paint, MShape::ptr shape, uid id=NULL_UID) @@ -143,6 +144,7 @@ public: */ class TextureMapping : public Mapping { + Q_OBJECT private: MShape::ptr _inputShape; diff --git a/Paint.cpp b/Paint.cpp index 695cadb..6fa81c9 100644 --- a/Paint.cpp +++ b/Paint.cpp @@ -45,10 +45,12 @@ bool Image::setUri(const QString &uri) Media::Media(const QString uri_, bool live, double rate, uid id): Texture(id), uri(uri_), + impl_(NULL) { impl_ = new MediaImpl(uri_, live); setRate(rate); + setVolume(1.0); } // vertigo diff --git a/Paint.h b/Paint.h index f23dcf5..9f829ea 100644 --- a/Paint.h +++ b/Paint.h @@ -37,6 +37,8 @@ #include "Element.h" +Q_DECLARE_METATYPE(GLfloat) + /** * A Paint is a style that can be applied when drawing potentially any shape. * @@ -180,6 +182,7 @@ protected: QImage image; public: + Q_INVOKABLE Image(int id=NULL_UID) : Texture(id) {} Image(const QString uri_, uid id=NULL_UID) : Texture(id) { @@ -207,6 +210,8 @@ public: } virtual bool bitsHaveChanged() const { return bitsChanged; } + + virtual QIcon getIcon() const { return QIcon(QPixmap::fromImage(image)); } }; class MediaImpl; // forward declaration