summaryrefslogtreecommitdiffstats
path: root/utils/themeeditor
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor')
-rw-r--r--utils/themeeditor/graphics/rbalbumart.cpp17
-rw-r--r--utils/themeeditor/graphics/rbalbumart.h11
-rw-r--r--utils/themeeditor/graphics/rbscreen.h1
-rw-r--r--utils/themeeditor/models/parsetreenode.cpp2
4 files changed, 25 insertions, 6 deletions
diff --git a/utils/themeeditor/graphics/rbalbumart.cpp b/utils/themeeditor/graphics/rbalbumart.cpp
index 1dbe2855f8..40c6f05605 100644
--- a/utils/themeeditor/graphics/rbalbumart.cpp
+++ b/utils/themeeditor/graphics/rbalbumart.cpp
@@ -23,15 +23,19 @@
#include <QPainter>
+#include "parsetreenode.h"
+
RBAlbumArt::RBAlbumArt(QGraphicsItem *parent, int x, int y, int maxWidth,
- int maxHeight, int artWidth, int artHeight, char hAlign,
- char vAlign)
+ int maxHeight, int artWidth, int artHeight,
+ ParseTreeNode* node, char hAlign, char vAlign)
: RBMovable(parent), size(0, 0, maxWidth,
maxHeight),
artWidth(artWidth), artHeight(artHeight),
hAlign(hAlign), vAlign(vAlign),
- texture(":/render/albumart.png")
+ texture(":/render/albumart.png"), node(node)
{
+ setFlag(ItemSendsGeometryChanges, false);
+
setPos(x, y);
hide();
}
@@ -99,4 +103,11 @@ void RBAlbumArt::paint(QPainter *painter,
void RBAlbumArt::saveGeometry()
{
+ QPointF origin = pos();
+ QRectF bounds = boundingRect();
+
+ node->modParam(static_cast<int>(origin.x()), 0);
+ node->modParam(static_cast<int>(origin.y()), 1);
+ node->modParam(static_cast<int>(bounds.width()), 2);
+ node->modParam(static_cast<int>(bounds.height()), 3);
}
diff --git a/utils/themeeditor/graphics/rbalbumart.h b/utils/themeeditor/graphics/rbalbumart.h
index 8baf7a2198..2c8090f9c3 100644
--- a/utils/themeeditor/graphics/rbalbumart.h
+++ b/utils/themeeditor/graphics/rbalbumart.h
@@ -26,18 +26,23 @@
#include "rbmovable.h"
+class ParseTreeNode;
+
class RBAlbumArt : public RBMovable
{
public:
RBAlbumArt(QGraphicsItem* parent, int x, int y, int maxWidth, int maxHeight,
- int artWidth, int artHeight, char hAlign = 'c',
- char vAlign = 'c');
+ int artWidth, int artHeight, ParseTreeNode* node,
+ char hAlign = 'c', char vAlign = 'c');
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
void position(){ this->setPos(size.x(), size.y()); }
+ void enableMove(){
+ setFlag(ItemSendsGeometryChanges, true);
+ }
protected:
void saveGeometry();
@@ -49,6 +54,8 @@ private:
char hAlign;
char vAlign;
QPixmap texture;
+
+ ParseTreeNode* node;
};
#endif // RBALBUMART_H
diff --git a/utils/themeeditor/graphics/rbscreen.h b/utils/themeeditor/graphics/rbscreen.h
index c2417aa1b4..2903a29585 100644
--- a/utils/themeeditor/graphics/rbscreen.h
+++ b/utils/themeeditor/graphics/rbscreen.h
@@ -82,6 +82,7 @@ public:
{
albumArt->setParentItem(view);
albumArt->show();
+ albumArt->enableMove();
}
}
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp
index f05bfea954..443d0327f5 100644
--- a/utils/themeeditor/models/parsetreenode.cpp
+++ b/utils/themeeditor/models/parsetreenode.cpp
@@ -819,7 +819,7 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport)
height = info.device()->data("artheight").toInt();
info.screen()->setAlbumArt(new RBAlbumArt(viewport, x, y, maxWidth,
maxHeight, width, height,
- hAlign, vAlign));
+ this, hAlign, vAlign));
return true;
}