X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmonitorscene.h;h=f5efa8e93f0566bebb49cadf907105b361922e39;hb=56aee6aedeeed3efd10ada8fe3c229eddc01ef05;hp=8831eb9ac246c8adb0c81c45fd03c3065215807a;hpb=de1811d8751b054624cc03a9aac180fbd345f9c8;p=kdenlive diff --git a/src/monitorscene.h b/src/monitorscene.h index 8831eb9a..f5efa8e9 100644 --- a/src/monitorscene.h +++ b/src/monitorscene.h @@ -31,7 +31,7 @@ class MonitorScene : public QGraphicsScene { Q_OBJECT public: - MonitorScene(Render *renderer, QObject* parent = 0); + explicit MonitorScene(Render *renderer, QObject* parent = 0); /** @brief Sets m_view to this scenes view. */ void setUp(); @@ -42,26 +42,25 @@ public: /** @brief Makes the background frame fit again after the profile changed (and therefore the resolution might have changed). */ void resetProfile(); - - /** @brief Adds an item to the scene and connects mouse events + change signals if it is a onmonitor item. */ - void addItem(QGraphicsItem *item); + + /** @brief Reset scene size. */ + void cleanup(); + + /** @brief Center view on frame border. */ + void centerView(); protected: - /** @brief Emits signal mousePressed to be used in onmonitor items. */ - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - /** @brief Emits signal mouseMoveEvent to be used in onmonitor items. */ - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - /** @brief Emits signal mouseReleaseEvent to be used in onmonitor items. */ - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); /** @brief Adds a keyframe if scene is disabled. */ - virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + /** @brief Reimplemented to allow zooming using ctrl + mouse wheel. */ + void wheelEvent(QGraphicsSceneWheelEvent *event); public slots: /** @brief Sets the backgrounditem's pixmap to m_backgroundImage (only if a certain amount of time has passed since last update). */ void slotUpdateBackground(); - - /** @brief Sets the KdenliveSetting directupdate with true = update parameters (rerender frame) during mouse move (before mouse button is released) */ - void slotSetDirectUpdate(bool directUpdate); /** @brief Sets the scene's zoom level. * @param value zoom level with 100 = show frame at original size */ @@ -70,16 +69,14 @@ public slots: void slotZoomFit(); /** @brief Shows the frame at it's original size and center. */ void slotZoomOriginal(); - /** @brief Zooms in by 1%. */ - void slotZoomIn(); - /** @brief Zooms out by 1%. */ - void slotZoomOut(); + /** @brief Zooms in by @param by%. */ + void slotZoomIn(int by = 1); + /** @brief Zooms out by @param by%. */ + void slotZoomOut(int by = 1); private slots: /** @brief Sets m_backgroundImage to @param image and requests updating the background item. */ void slotSetBackgroundImage(const QImage &image); - /** @brief Sets the mouse curors to @param cursor for the scene. */ - void slotSetCursor(const QCursor &cursor); private: Render *m_renderer; @@ -90,14 +87,12 @@ private: QImage m_backgroundImage; bool m_enabled; qreal m_zoom; + bool m_groupMove; + QPointF m_lastPos; signals: - void actionFinished(); void zoomChanged(int); void addKeyframe(); - void mouseMoved(QGraphicsSceneMouseEvent *event); - void mousePressed(QGraphicsSceneMouseEvent *event); - void mouseReleased(QGraphicsSceneMouseEvent *event); }; #endif