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, 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). */
63 MonitorScene *m_scene;
64 QGraphicsRectItem *m_rect;
65 Mlt::Geometry *m_geometry;
68 /** @brief Makes sure the monitor effect scene is only visible if the clip this geometry belongs to is visible.
69 * @param renderPos Postion of the Monitor / Timeline cursor */
70 void slotCheckPosition(int renderPos);
71 /** @brief Updates the Mlt::Geometry object. */
72 void slotUpdateGeometry();
73 /** @brief Updates the spinBoxes according to the rect. */
74 void slotUpdateProperties();
76 /** @brief Sets the rect's x position to @param value. */
77 void slotSetX(int value);
78 /** @brief Sets the rect's y position to @param value. */
79 void slotSetY(int value);
80 /** @brief Sets the rect's width to @param value. */
81 void slotSetWidth(int value);
82 /** @brief Sets the rect's height to @param value. */
83 void slotSetHeight(int value);
85 /** @brief Resizes the rect by @param value (in perecent) compared to the frame size. */
86 void slotResize(int value);
88 /** @brief Moves the rect to the left frame border (x position = 0). */
90 /** @brief Centers the rect horizontally. */
92 /** @brief Moves the rect to the right frame border (x position = frame width - rect width). */
94 /** @brief Moves the rect to the top frame border (y position = 0). */
96 /** @brief Centers the rect vertically. */
98 /** @brief Moves the rect to the bottom frame border (y position = frame height - rect height). */
99 void slotMoveBottom();
102 void parameterChanged();