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 CORNERSWIDGET_H
22 #define CORNERSWIDGET_H
24 #include "ui_cornerswidget_ui.h"
31 class OnMonitorCornersItem;
32 class MonitorSceneControlWidget;
35 class CornersWidget : public QWidget
39 /** @brief Sets up the UI and connects it.
40 * @param monitor Project monitor
41 * @param clipPos Position of the clip in timeline
42 * @param isEffect true if used in an effect, false if used in a transition
43 * @param factor Factor by which the parameters differ from the range 0-1
44 * @param parent (optional) Parent widget */
45 CornersWidget(Monitor *monitor, int clipPos, bool isEffect, int factor, QWidget* parent = 0);
46 virtual ~CornersWidget();
48 /** @brief Returns a polygon representing the corners in the range 0 - factor. */
51 /** @brief Takes a polygon @param points in the range 0 - factor and converts it into range (- frame width|height) - (2*frame width|height). */
52 void setValue(const QPolygon &points);
54 /** @brief Takes in and outpoint of the clip to know when to show the on-monitor scene.
55 * @param minframe In point of the clip
56 * @param maxframe Out point of the clip */
57 void setRange(int minframe, int maxframe);
60 Ui::CornersWidget_UI m_ui;
62 /** Position of the clip in timeline. */
64 /** In point of the clip (crop from start). */
66 /** Out point of the clip (crop from end). */
69 MonitorScene *m_scene;
70 OnMonitorCornersItem *m_item;
72 MonitorSceneControlWidget *m_config;
76 /** @brief Makes sure the monitor effect scene is only visible if the clip this geometry belongs to is visible.
77 * @param renderPos Postion of the Monitor / Timeline cursor */
78 void slotCheckMonitorPosition(int renderPos);
80 /** @brief Switches from normal monitor to monitor scene according to @param show. */
81 void slotShowScene(bool show = true);
83 /** @brief Updates the on-monitor item according to the spinboxes. */
84 void slotUpdateItem();
85 /** @brief Updates the spinboxes according to the on-monitor item.
86 * @param changed (default = true) Whether to emit parameterChanged */
87 void slotUpdateProperties(bool changed = true);
89 /** @brief Shows/Hides the lines connecting the corners in the on-monitor item according to @param show. */
90 void slotShowLines(bool show = true);
93 * These functions reset the positions of the corners.
94 * The default values in the effect XML file are not considered, but
95 * the position the corner would have without this effect applied.
97 void slotResetCorner1();
98 void slotResetCorner2();
99 void slotResetCorner3();
100 void slotResetCorner4();
103 void parameterChanged();
104 void checkMonitorPosition(int);