X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fdvdwizardmenu.h;h=d5daa98964c699b99d8c08a06b92e6db63cfa4da;hb=d679fbf19a2511b181570418dc7fa7c815728bcb;hp=3854d8b950c8d713587a4484fb8ab60b55b31aec;hpb=3b176bab2ad91159c0a4a7dbe5f278f646115218;p=kdenlive diff --git a/src/dvdwizardmenu.h b/src/dvdwizardmenu.h index 3854d8b9..d5daa989 100644 --- a/src/dvdwizardmenu.h +++ b/src/dvdwizardmenu.h @@ -40,7 +40,7 @@ class DvdScene : public QGraphicsScene { - + Q_OBJECT public: DvdScene(QObject * parent = 0): QGraphicsScene(parent) { m_width = 0; m_height = 0; @@ -59,6 +59,26 @@ public: private: int m_width; int m_height; + +protected: + void mouseReleaseEvent( QGraphicsSceneMouseEvent * mouseEvent ) { + QGraphicsScene::mouseReleaseEvent(mouseEvent); + emit sceneChanged(); + } +signals: + void sceneChanged(); +}; + +class DvdButtonUnderline : public QGraphicsRectItem +{ + +public: + DvdButtonUnderline( const QRectF & rect, QGraphicsItem * parent = 0 ) : QGraphicsRectItem(rect, parent) {} + + int type() const { + // Enable the use of qgraphicsitem_cast with this item. + return UserType + 2; + } }; class DvdButton : public QGraphicsTextItem @@ -71,7 +91,7 @@ public: setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); #endif } - void setTarget(int t, QString c) { + void setTarget(int t, const QString &c) { m_target = t; m_command = c; } @@ -101,20 +121,23 @@ protected: virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) { if (change == ItemPositionChange && scene()) { - QPointF newPos = value.toPointF(); + QPoint newPos = value.toPoint(); QRectF sceneShape = sceneBoundingRect(); DvdScene *sc = static_cast < DvdScene * >(scene()); - newPos.setX(qMax(newPos.x(), (qreal)0)); - newPos.setY(qMax(newPos.y(), (qreal)0)); - if (newPos.x() + sceneShape.width() > sc->width()) newPos.setX(sc->width() - sceneShape.width()); - if (newPos.y() + sceneShape.height() > sc->height()) newPos.setY(sc->height() - sceneShape.height()); + newPos.setX(qMax(newPos.x(), 0)); + newPos.setY(qMax(newPos.y(), 0)); + if (newPos.x() + sceneShape.width() > sc->width()) + newPos.setX(sc->width() - sceneShape.width()); + if (newPos.y() + sceneShape.height() > sc->height()) + newPos.setY(sc->height() - sceneShape.height()); sceneShape.translate(newPos - pos()); QList list = scene()->items(sceneShape, Qt::IntersectsItemShape); list.removeAll(this); if (!list.isEmpty()) { - for (int i = 0; i < list.count(); i++) { - if (list.at(i)->type() == Type) return pos(); + for (int i = 0; i < list.count(); ++i) { + if (list.at(i)->type() == Type) + return pos(); } } return newPos; @@ -134,9 +157,9 @@ public: virtual ~DvdWizardMenu(); virtual bool isComplete() const; bool createMenu() const; - void createBackgroundImage(const QString &overlayMenu, const QString &img1); - void createButtonImages(const QString &img1, const QString &img2, const QString &img3, bool letterbox = false); - void setTargets(QStringList list, QStringList targetlist); + void createBackgroundImage(const QString &img1, bool letterbox); + void createButtonImages(const QString &selected_image, const QString &highlighted_image, bool letterbox); + void setTargets(const QStringList &list, const QStringList &targetlist); QMap buttonsInfo(bool letterbox = false); bool loopMovie() const; bool menuMovie() const; @@ -144,7 +167,7 @@ public: int menuMovieLength() const; void changeProfile(DVDFORMAT format); QDomElement toXml() const; - void loadXml(QDomElement xml); + void loadXml(DVDFORMAT format, const QDomElement &xml); void prepareUnderLines(); void resetUnderLines(); @@ -175,7 +198,7 @@ private slots: void setButtonTarget(int ix); void deleteButton(); void updateColor(); - void updateColor(QColor c); + void updateColor(const QColor &c); void updateUnderlineColor(QColor c); void setBackToMenu(bool backToMenu); void slotZoom();