summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-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 @@
23 23
24#include <QPainter> 24#include <QPainter>
25 25
26#include "parsetreenode.h"
27
26RBAlbumArt::RBAlbumArt(QGraphicsItem *parent, int x, int y, int maxWidth, 28RBAlbumArt::RBAlbumArt(QGraphicsItem *parent, int x, int y, int maxWidth,
27 int maxHeight, int artWidth, int artHeight, char hAlign, 29 int maxHeight, int artWidth, int artHeight,
28 char vAlign) 30 ParseTreeNode* node, char hAlign, char vAlign)
29 : RBMovable(parent), size(0, 0, maxWidth, 31 : RBMovable(parent), size(0, 0, maxWidth,
30 maxHeight), 32 maxHeight),
31 artWidth(artWidth), artHeight(artHeight), 33 artWidth(artWidth), artHeight(artHeight),
32 hAlign(hAlign), vAlign(vAlign), 34 hAlign(hAlign), vAlign(vAlign),
33 texture(":/render/albumart.png") 35 texture(":/render/albumart.png"), node(node)
34{ 36{
37 setFlag(ItemSendsGeometryChanges, false);
38
35 setPos(x, y); 39 setPos(x, y);
36 hide(); 40 hide();
37} 41}
@@ -99,4 +103,11 @@ void RBAlbumArt::paint(QPainter *painter,
99void RBAlbumArt::saveGeometry() 103void RBAlbumArt::saveGeometry()
100{ 104{
101 105
106 QPointF origin = pos();
107 QRectF bounds = boundingRect();
108
109 node->modParam(static_cast<int>(origin.x()), 0);
110 node->modParam(static_cast<int>(origin.y()), 1);
111 node->modParam(static_cast<int>(bounds.width()), 2);
112 node->modParam(static_cast<int>(bounds.height()), 3);
102} 113}
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 @@
26 26
27#include "rbmovable.h" 27#include "rbmovable.h"
28 28
29class ParseTreeNode;
30
29class RBAlbumArt : public RBMovable 31class RBAlbumArt : public RBMovable
30{ 32{
31public: 33public:
32 RBAlbumArt(QGraphicsItem* parent, int x, int y, int maxWidth, int maxHeight, 34 RBAlbumArt(QGraphicsItem* parent, int x, int y, int maxWidth, int maxHeight,
33 int artWidth, int artHeight, char hAlign = 'c', 35 int artWidth, int artHeight, ParseTreeNode* node,
34 char vAlign = 'c'); 36 char hAlign = 'c', char vAlign = 'c');
35 37
36 QRectF boundingRect() const; 38 QRectF boundingRect() const;
37 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 39 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
38 QWidget *widget); 40 QWidget *widget);
39 41
40 void position(){ this->setPos(size.x(), size.y()); } 42 void position(){ this->setPos(size.x(), size.y()); }
43 void enableMove(){
44 setFlag(ItemSendsGeometryChanges, true);
45 }
41 46
42protected: 47protected:
43 void saveGeometry(); 48 void saveGeometry();
@@ -49,6 +54,8 @@ private:
49 char hAlign; 54 char hAlign;
50 char vAlign; 55 char vAlign;
51 QPixmap texture; 56 QPixmap texture;
57
58 ParseTreeNode* node;
52}; 59};
53 60
54#endif // RBALBUMART_H 61#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:
82 { 82 {
83 albumArt->setParentItem(view); 83 albumArt->setParentItem(view);
84 albumArt->show(); 84 albumArt->show();
85 albumArt->enableMove();
85 } 86 }
86 } 87 }
87 88
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)
819 height = info.device()->data("artheight").toInt(); 819 height = info.device()->data("artheight").toInt();
820 info.screen()->setAlbumArt(new RBAlbumArt(viewport, x, y, maxWidth, 820 info.screen()->setAlbumArt(new RBAlbumArt(viewport, x, y, maxWidth,
821 maxHeight, width, height, 821 maxHeight, width, height,
822 hAlign, vAlign)); 822 this, hAlign, vAlign));
823 return true; 823 return true;
824 } 824 }
825 825