X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmonitorscene.h;h=f5efa8e93f0566bebb49cadf907105b361922e39;hb=4ae3260592acc87712db77b7d3fe0cc2be7d76bc;hp=3dccf2b498b774a826f12a27b1720bc37a486e1a;hpb=297e484a74fe72ebd1bcf346d82f208b03bde0b6;p=kdenlive diff --git a/src/monitorscene.h b/src/monitorscene.h index 3dccf2b4..f5efa8e9 100644 --- a/src/monitorscene.h +++ b/src/monitorscene.h @@ -26,54 +26,71 @@ class Render; -enum resizeModes { NoResize, TopLeft, BottomLeft, TopRight, BottomRight, Left, Right, Top, Bottom }; 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(); + + /** @brief Enables/Disables the scene for usage (background still updated). + * @param enabled (default = true) */ void setEnabled(bool enabled = true); + + /** @brief Makes the background frame fit again after the profile changed (and therefore the resolution might have changed). */ void resetProfile(); + + /** @brief Reset scene size. */ + void cleanup(); + + /** @brief Center view on frame border. */ + void centerView(); protected: - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + /** @brief Adds a keyframe if scene is disabled. */ + 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(); - void slotSetDirectUpdate(bool directUpdate); + /** @brief Sets the scene's zoom level. + * @param value zoom level with 100 = show frame at original size */ void slotZoom(int value); + /** @brief Makes the zoom level fit the viewport's size. */ void slotZoomFit(); + /** @brief Shows the frame at it's original size and center. */ void slotZoomOriginal(); - void slotZoomIn(); - 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); private: - resizeModes getResizeMode(QGraphicsRectItem *item, QPoint pos); - Render *m_renderer; QGraphicsPixmapItem *m_background; QGraphicsRectItem *m_frameBorder; QTime m_lastUpdate; QGraphicsView *m_view; - QGraphicsItem *m_selectedItem; - resizeModes m_resizeMode; - QPointF m_clickPoint; QImage m_backgroundImage; bool m_enabled; - bool m_modified; qreal m_zoom; + bool m_groupMove; + QPointF m_lastPos; signals: - void actionFinished(); void zoomChanged(int); void addKeyframe(); };