1 /***************************************************************************
2 * Copyright (C) 2010 by Till Theato (root@ttill.de) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
21 #ifndef MONITORSCENE_H
22 #define MONITORSCENE_H
25 #include <QGraphicsScene>
30 class MonitorScene : public QGraphicsScene
34 MonitorScene(Render *renderer, QObject* parent = 0);
36 /** @brief Sets m_view to this scenes view. */
39 /** @brief Enables/Disables the scene for usage (background still updated).
40 * @param enabled (default = true) */
41 void setEnabled(bool enabled = true);
43 /** @brief Makes the background frame fit again after the profile changed (and therefore the resolution might have changed). */
47 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
48 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
49 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
50 /** @brief Adds a keyframe if scene is disabled. */
51 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
52 /** @brief Reimplemented to allow zooming using ctrl + mouse wheel. */
53 virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
56 /** @brief Sets the backgrounditem's pixmap to m_backgroundImage (only if a certain amount of time has passed since last update). */
57 void slotUpdateBackground();
59 /** @brief Sets the scene's zoom level.
60 * @param value zoom level with 100 = show frame at original size */
61 void slotZoom(int value);
62 /** @brief Makes the zoom level fit the viewport's size. */
64 /** @brief Shows the frame at it's original size and center. */
65 void slotZoomOriginal();
66 /** @brief Zooms in by @param by%. */
67 void slotZoomIn(int by = 1);
68 /** @brief Zooms out by @param by%. */
69 void slotZoomOut(int by = 1);
72 /** @brief Sets m_backgroundImage to @param image and requests updating the background item. */
73 void slotSetBackgroundImage(const QImage &image);
77 QGraphicsPixmapItem *m_background;
78 QGraphicsRectItem *m_frameBorder;
80 QGraphicsView *m_view;
81 QImage m_backgroundImage;
88 void zoomChanged(int);