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 GEOMETRYWIDGET_H
22 #define GEOMETRYWIDGET_H
24 #include "ui_geometrywidget_ui.h"
25 #include <mlt++/Mlt.h>
30 class QGraphicsRectItem;
34 class GeometryWidget : public QWidget
38 /** @brief Sets up the UI and connects it.
39 * @param monitor Project monitor
40 * @param clipPos Position of the clip in timeline
41 * @param parent (optional) Parent widget */
42 GeometryWidget(Monitor *monitor, int clipPos, bool isEffect, QWidget* parent = 0);
43 virtual ~GeometryWidget();
44 /** @brief Gets the geometry as a serialized string. */
45 QString getValue() const;
48 /** @brief Sets up the rect and the geometry object.
49 * @param elem DomElement representing this effect parameter
50 * @param minframe In point of the clip
51 * @param maxframe Out point of the clip */
52 void setupParam(const QDomElement elem, int minframe, int maxframe);
55 Ui::GeometryWidget_UI m_ui;
57 /** Position of the clip in timeline. */
59 /** In point of the clip (crop from start). */
61 /** Out point of the clip (crop from end). */
64 MonitorScene *m_scene;
65 QGraphicsRectItem *m_rect;
66 Mlt::Geometry *m_geometry;
69 /** @brief Makes sure the monitor effect scene is only visible if the clip this geometry belongs to is visible.
70 * @param renderPos Postion of the Monitor / Timeline cursor */
71 void slotCheckPosition(int renderPos);
72 /** @brief Updates the Mlt::Geometry object. */
73 void slotUpdateGeometry();
74 /** @brief Updates the spinBoxes according to the rect. */
75 void slotUpdateProperties();
77 /** @brief Sets the rect's x position to @param value. */
78 void slotSetX(int value);
79 /** @brief Sets the rect's y position to @param value. */
80 void slotSetY(int value);
81 /** @brief Sets the rect's width to @param value. */
82 void slotSetWidth(int value);
83 /** @brief Sets the rect's height to @param value. */
84 void slotSetHeight(int value);
86 /** @brief Resizes the rect by @param value (in perecent) compared to the frame size. */
87 void slotResize(int value);
89 /** @brief Moves the rect to the left frame border (x position = 0). */
91 /** @brief Centers the rect horizontally. */
93 /** @brief Moves the rect to the right frame border (x position = frame width - rect width). */
95 /** @brief Moves the rect to the top frame border (y position = 0). */
97 /** @brief Centers the rect vertically. */
99 /** @brief Moves the rect to the bottom frame border (y position = frame height - rect height). */
100 void slotMoveBottom();
103 void parameterChanged();
104 void checkMonitorPosition(int);