<name>C0rners</name>
<description>Four corners geometry engine</description>
<author>Marko Cebokli</author>
-
- <parameter type="constant" name="Corner 1 X" default="2000" min="0" max="6000" factor="6000">
+
+ <!-- No actual parameter: Represents the corners widget (used to edit corners on the monitor) -->
+ <parameter type="corners" default="0" xpoints="Corner %i X" ypoints="Corner %i Y" factor="6000">
+ <name>Corners widget</name>
+ </parameter>
+
+ <parameter type="fixed" name="Corner 1 X" default="2000" min="0" max="6000" factor="6000">
<name>Corner 1 X</name>
</parameter>
- <parameter type="constant" name="Corner 1 Y" default="2000" min="0" max="6000" factor="6000">
+ <parameter type="fixed" name="Corner 1 Y" default="2000" min="0" max="6000" factor="6000">
<name>Corner 1 Y</name>
</parameter>
- <parameter type="constant" name="Corner 2 X" default="4000" min="0" max="6000" factor="6000">
+ <parameter type="fixed" name="Corner 2 X" default="4000" min="0" max="6000" factor="6000">
<name>Corner 2 X</name>
</parameter>
- <parameter type="constant" name="Corner 2 Y" default="2000" min="0" max="6000" factor="6000">
+ <parameter type="fixed" name="Corner 2 Y" default="2000" min="0" max="6000" factor="6000">
<name>Corner 2 Y</name>
</parameter>
- <parameter type="constant" name="Corner 3 X" default="4000" min="0" max="6000" factor="6000">
+ <parameter type="fixed" name="Corner 3 X" default="4000" min="0" max="6000" factor="6000">
<name>Corner 3 X</name>
</parameter>
- <parameter type="constant" name="Corner 3 Y" default="4000" min="0" max="6000" factor="6000">
+ <parameter type="fixed" name="Corner 3 Y" default="4000" min="0" max="6000" factor="6000">
<name>Corner 3 Y</name>
</parameter>
- <parameter type="constant" name="Corner 4 X" default="2000" min="0" max="6000" factor="6000">
+ <parameter type="fixed" name="Corner 4 X" default="2000" min="0" max="6000" factor="6000">
<name>Corner 4 X</name>
</parameter>
- <parameter type="constant" name="Corner 4 Y" default="4000" min="0" max="6000" factor="6000">
+ <parameter type="fixed" name="Corner 4 Y" default="4000" min="0" max="6000" factor="6000">
<name>Corner 4 Y</name>
</parameter>
-
<parameter type="bool" name="Enable Stretch" default="0">
<name>Enable Stretch</name>
</parameter>
<parameter type="list" name="Luma formula" default="1" paramlist="0,1" paramlistdisplay="Rec. 601,Rec. 709">
<name>Luma formula</name>
</parameter>
- <parameter type="curve" default="0" depends="Channel" number="Curve point number" inpoints="Point %i input value" outpoints="Point %i output value" min="1" max="5">
+
+ <!-- No actual parameter: Represents the curve widget -->
+ <parameter type="curve" default="0" depends="Channel" number="Curve point number" inpoints="Point %i input value" outpoints="Point %i output value" min="1" max="5">
<name>Curve Widget</name>
</parameter>
+
<parameter type="fixed" name="Curve point number" default="2" min="2" max="5">
<name>Number of curve points</name>
</parameter>
widgets/geometrywidget_ui.ui
widgets/stopmotion_ui.ui
widgets/monitorscenecontrolwidget_ui.ui
+ widgets/cornerswidget_ui.ui
)
set(kdenlive_SRCS
stopmotion/stopmotion.cpp
onmonitoritems/abstractonmonitoritem.cpp
onmonitoritems/onmonitorrectitem.cpp
+ onmonitoritems/onmonitorcornersitem.cpp
monitorscenecontrolwidget.cpp
+ cornerswidget.cpp
)
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2010 by Till Theato (root@ttill.de) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "cornerswidget.h"
+#include "monitor.h"
+#include "monitorscene.h"
+#include "monitorscenecontrolwidget.h"
+#include "onmonitoritems/onmonitorcornersitem.h"
+#include "renderer.h"
+
+#include <QGraphicsView>
+#include <QHBoxLayout>
+
+#include <KIcon>
+
+CornersWidget::CornersWidget(Monitor* monitor, int clipPos, bool isEffect, int factor, QWidget* parent) :
+ QWidget(parent),
+ m_monitor(monitor),
+ m_clipPos(clipPos),
+ m_inPoint(0),
+ m_outPoint(1),
+ m_isEffect(isEffect),
+ m_showScene(true),
+ m_factor(factor)
+{
+ m_ui.setupUi(this);
+
+ m_scene = monitor->getEffectScene();
+
+ m_item = new OnMonitorCornersItem(m_scene);
+ m_scene->addItem(m_item);
+
+ m_config = new MonitorSceneControlWidget(m_scene, m_ui.frameConfig);
+ QHBoxLayout *layout = new QHBoxLayout(m_ui.frameConfig);
+ layout->addWidget(m_config->getShowHideButton());
+ layout->addWidget(m_config);
+
+ int width = m_monitor->render->frameRenderWidth();
+ int height = m_monitor->render->renderHeight();
+
+ m_ui.spinX1->setRange(-width, width * 2);
+ m_ui.spinX2->setRange(-width, width * 2);
+ m_ui.spinX3->setRange(-width, width * 2);
+ m_ui.spinX4->setRange(-width, width * 2);
+ m_ui.spinY1->setRange(-height, height * 2);
+ m_ui.spinY2->setRange(-height, height * 2);
+ m_ui.spinY3->setRange(-height, height * 2);
+ m_ui.spinY4->setRange(-height, height * 2);
+
+ m_ui.toolReset1->setIcon(KIcon("edit-undo"));
+ m_ui.toolReset1->setToolTip(i18n("Reset Corner 1"));
+ m_ui.toolReset2->setIcon(KIcon("edit-undo"));
+ m_ui.toolReset2->setToolTip(i18n("Reset Corner 2"));
+ m_ui.toolReset3->setIcon(KIcon("edit-undo"));
+ m_ui.toolReset3->setToolTip(i18n("Reset Corner 3"));
+ m_ui.toolReset4->setIcon(KIcon("edit-undo"));
+ m_ui.toolReset4->setToolTip(i18n("Reset Corner 4"));
+
+ connect(m_ui.spinX1, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateItem()));
+ connect(m_ui.spinX2, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateItem()));
+ connect(m_ui.spinX3, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateItem()));
+ connect(m_ui.spinX4, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateItem()));
+ connect(m_ui.spinY1, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateItem()));
+ connect(m_ui.spinY2, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateItem()));
+ connect(m_ui.spinY3, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateItem()));
+ connect(m_ui.spinY4, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateItem()));
+
+ connect(m_config, SIGNAL(showScene(bool)), this, SLOT(slotShowScene(bool)));
+ connect(m_monitor, SIGNAL(renderPosition(int)), this, SLOT(slotCheckMonitorPosition(int)));
+ connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateProperties()));
+}
+
+CornersWidget::~CornersWidget()
+{
+ delete m_config;
+ m_scene->removeItem(m_item);
+ delete m_item;
+ if (m_monitor)
+ m_monitor->slotEffectScene(false);
+}
+
+void CornersWidget::setRange(int minframe, int maxframe)
+{
+ m_inPoint = minframe;
+ m_outPoint = maxframe;
+ slotCheckMonitorPosition(m_monitor->render->seekFramePosition());
+}
+
+void CornersWidget::slotUpdateItem()
+{
+ QPointF c1(m_ui.spinX1->value(), m_ui.spinY1->value());
+ QPointF c2(m_ui.spinX2->value(), m_ui.spinY2->value());
+ QPointF c3(m_ui.spinX3->value(), m_ui.spinY3->value());
+ QPointF c4(m_ui.spinX4->value(), m_ui.spinY4->value());
+
+ m_item->setPolygon(QPolygonF() << c1 << c2 << c3 << c4);
+
+ emit parameterChanged();
+}
+
+void CornersWidget::slotUpdateProperties(bool changed)
+{
+ QPolygon pol = m_item->polygon().toPolygon();
+ blockSignals(true);
+ m_ui.spinX1->setValue(pol.at(0).x());
+ m_ui.spinX2->setValue(pol.at(1).x());
+ m_ui.spinX3->setValue(pol.at(2).x());
+ m_ui.spinX4->setValue(pol.at(3).x());
+ m_ui.spinY1->setValue(pol.at(0).y());
+ m_ui.spinY2->setValue(pol.at(1).y());
+ m_ui.spinY3->setValue(pol.at(2).y());
+ m_ui.spinY4->setValue(pol.at(3).y());
+ blockSignals(false);
+
+ if (changed)
+ emit parameterChanged();
+}
+
+
+QPolygon CornersWidget::getValue()
+{
+ qreal width = m_monitor->render->frameRenderWidth();
+ qreal height = m_monitor->render->renderHeight();
+ QPolygon corners = m_item->polygon().toPolygon();
+ QPolygon points;
+ QPoint p;
+ for (int i = 0; i < 4; ++i) {
+ p = corners.at(i);
+ p.setX((p.x() / width + 1) / 3.0 * m_factor);
+ p.setY((p.y() / height + 1) / 3.0 * m_factor);
+ points << p;
+ }
+ return points;
+}
+
+void CornersWidget::setValue(const QPolygon& points)
+{
+ int width = m_monitor->render->frameRenderWidth();
+ int height = m_monitor->render->renderHeight();
+ QPolygonF corners;
+ QPoint p;
+ for (int i = 0; i < 4; ++i) {
+ p = points.at(i);
+ p.setX((p.x() / (qreal)m_factor * 3 - 1) * width);
+ p.setY((p.y() / (qreal)m_factor * 3 - 1) * height);
+ corners << p;
+ }
+ m_item->setPolygon(corners);
+
+ slotUpdateProperties(false);
+}
+
+void CornersWidget::slotCheckMonitorPosition(int renderPos)
+{
+ if (m_showScene) {
+ /*
+ We do only get the position in timeline if this geometry belongs to a transition,
+ therefore we need two ways here.
+ */
+ if (m_isEffect) {
+ emit checkMonitorPosition(renderPos);
+ } else {
+ if (renderPos >= m_clipPos && renderPos <= m_clipPos + m_outPoint - m_inPoint) {
+ if (!m_scene->views().at(0)->isVisible())
+ m_monitor->slotEffectScene(true);
+ } else {
+ m_monitor->slotEffectScene(false);
+ }
+ }
+ }
+}
+
+void CornersWidget::slotShowScene(bool show)
+{
+ m_showScene = show;
+ if (!m_showScene)
+ m_monitor->slotEffectScene(false);
+ else
+ slotCheckMonitorPosition(m_monitor->render->seekFramePosition());
+}
+
+#include "cornerswidget.moc"
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2010 by Till Theato (root@ttill.de) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+
+#ifndef CORNERSWIDGET_H
+#define CORNERSWIDGET_H
+
+#include "ui_cornerswidget_ui.h"
+
+#include <QWidget>
+
+class QDomElement;
+class Monitor;
+class MonitorScene;
+class OnMonitorCornersItem;
+class MonitorSceneControlWidget;
+
+
+class CornersWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ /** @brief Sets up the UI and connects it.
+ * @param monitor Project monitor
+ * @param clipPos Position of the clip in timeline
+ * @param isEffect true if used in an effect, false if used in a transition
+ * @param factor Factor by which the parameters differ from the range 0-1
+ * @param parent (optional) Parent widget */
+ CornersWidget(Monitor *monitor, int clipPos, bool isEffect, int factor, QWidget* parent = 0);
+ virtual ~CornersWidget();
+
+ /** @brief Returns a polygon representing the corners in the range 0 - factor. */
+ QPolygon getValue();
+
+ /** @brief Takes a polygon @param points in the range 0 - factor and converts it into range (- frame width|height) - (2*frame width|height). */
+ void setValue(const QPolygon &points);
+
+ /** @brief Takes in and outpoint of the clip to know when to show the on-monitor scene.
+ * @param minframe In point of the clip
+ * @param maxframe Out point of the clip */
+ void setRange(int minframe, int maxframe);
+
+private:
+ Ui::CornersWidget_UI m_ui;
+ Monitor *m_monitor;
+ /** Position of the clip in timeline. */
+ int m_clipPos;
+ /** In point of the clip (crop from start). */
+ int m_inPoint;
+ /** Out point of the clip (crop from end). */
+ int m_outPoint;
+ bool m_isEffect;
+ MonitorScene *m_scene;
+ OnMonitorCornersItem *m_item;
+ bool m_showScene;
+ MonitorSceneControlWidget *m_config;
+ int m_factor;
+
+private slots:
+ /** @brief Makes sure the monitor effect scene is only visible if the clip this geometry belongs to is visible.
+ * @param renderPos Postion of the Monitor / Timeline cursor */
+ void slotCheckMonitorPosition(int renderPos);
+
+ /** @brief Switches from normal monitor to monitor scene according to @param show. */
+ void slotShowScene(bool show = true);
+
+ /** @brief Updates the on-monitor item according to the spinboxes. */
+ void slotUpdateItem();
+ /** @brief Updates the spinboxes according to the on-monitor item.
+ * @param changed (default = true) Whether to emit parameterChanged */
+ void slotUpdateProperties(bool changed = true);
+
+signals:
+ void parameterChanged();
+ void checkMonitorPosition(int);
+};
+
+#endif
#include "geometrywidget.h"
#include "colortools.h"
#include "doubleparameterwidget.h"
+#include "cornerswidget.h"
#include <KDebug>
#include <KLocale>
QString depends = pa.attribute("depends");
if (!depends.isEmpty())
meetDependency(paramName, type, EffectsList::parameter(e, depends));
+ } else if (type == "corners") {
+ CornersWidget *corners = new CornersWidget(m_monitor, pos, isEffect, pa.attribute("factor").toInt(), this);
+ connect(corners, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
+ if (minFrame == maxFrame)
+ corners->setRange(m_in, m_out);
+ else
+ corners->setRange(minFrame, maxFrame);
+
+ QString xName = pa.attribute("xpoints");
+ QString yName = pa.attribute("ypoints");
+ QPolygon points;
+ int x, y;
+ for (int j = 1; j <= 4; ++j) {
+ x = EffectsList::parameter(e, QString(xName).replace("%i", QString::number(j))).toInt();
+ y = EffectsList::parameter(e, QString(yName).replace("%i", QString::number(j))).toInt();
+ points << QPoint(x, y);
+ }
+ corners->setValue(points);
+
+ m_vbox->addWidget(corners);
+ connect(corners, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
+ m_valueItems[paramName] = corners;
} else if (type == "wipe") {
Wipeval *wpval = new Wipeval;
wpval->setupUi(toFillin);
QString depends = pa.attributes().namedItem("depends").nodeValue();
if (!depends.isEmpty())
meetDependency(paramName, type, EffectsList::parameter(newparam, depends));
+ } else if (type == "corners") {
+ CornersWidget *corners = ((CornersWidget*)m_valueItems.value(paramName));
+ QString xName = pa.attributes().namedItem("xpoints").nodeValue();
+ QString yName = pa.attributes().namedItem("ypoints").nodeValue();
+ QPolygon points = corners->getValue();
+ QPoint p;
+ for (int j = 1; j <= 4; ++j) {
+ p = points.at(j - 1);
+ EffectsList::setParameter(newparam, QString(xName).replace("%i", QString::number(j)), QString::number(p.x()));
+ EffectsList::setParameter(newparam, QString(yName).replace("%i", QString::number(j)), QString::number(p.y()));
+ }
} else if (type == "wipe") {
Wipeval *wp = (Wipeval*)m_valueItems.value(paramName);
wipeInfo info;
#include <QtCore>
#include <QGraphicsView>
-#include <QGraphicsRectItem>
#include <QVBoxLayout>
#include <QGridLayout>
GeometryWidget::~GeometryWidget()
{
+ m_scene->setEnabled(true);
delete m_timePos;
delete m_timeline;
m_scene->removeItem(m_rect);
public:
/** @brief Sets up the UI and connects it.
* @param monitor Project monitor
+ * @param timecode Timecode needed by timecode display widget
* @param clipPos Position of the clip in timeline
+ * @param isEffect true if used in an effect, false if used in a transition
* @param parent (optional) Parent widget */
GeometryWidget(Monitor *monitor, Timecode timecode, int clipPos, bool isEffect, QWidget* parent = 0);
virtual ~GeometryWidget();
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2010 by Till Theato (root@ttill.de) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "onmonitorcornersitem.h"
+#include "kdenlivesettings.h"
+
+#include <QGraphicsSceneMouseEvent>
+#include <QPainter>
+#include <QStyleOptionGraphicsItem>
+#include <QCursor>
+
+OnMonitorCornersItem::OnMonitorCornersItem(MonitorScene* scene, QGraphicsItem* parent) :
+ AbstractOnMonitorItem(scene),
+ QGraphicsPolygonItem(parent)
+{
+ setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+
+ QPen framepen(Qt::SolidLine);
+ framepen.setColor(Qt::yellow);
+ setPen(framepen);
+ setBrush(Qt::transparent);
+}
+
+cornersActions OnMonitorCornersItem::getMode(QPoint pos)
+{
+ /*pos = mapFromScene(pos).toPoint();
+ // Item mapped coordinates
+ QPolygon pol(rect().normalized().toRect());
+
+ QPainterPath top(pol.point(0));
+ top.lineTo(pol.point(1));
+ QPainterPath bottom(pol.point(2));
+ bottom.lineTo(pol.point(3));
+ QPainterPath left(pol.point(0));
+ left.lineTo(pol.point(3));
+ QPainterPath right(pol.point(1));
+ right.lineTo(pol.point(2));
+
+ QPainterPath mouseArea;
+ mouseArea.addRect(pos.x() - 4, pos.y() - 4, 8, 8);
+
+ // Check for collisions between the mouse and the borders
+ if (mouseArea.contains(pol.point(0)))
+ return ResizeTopLeft;
+ else if (mouseArea.contains(pol.point(2)))
+ return ResizeBottomRight;
+ else if (mouseArea.contains(pol.point(1)))
+ return ResizeTopRight;
+ else if (mouseArea.contains(pol.point(3)))
+ return ResizeBottomLeft;
+ else if (top.intersects(mouseArea))
+ return ResizeTop;
+ else if (bottom.intersects(mouseArea))
+ return ResizeBottom;
+ else if (right.intersects(mouseArea))
+ return ResizeRight;
+ else if (left.intersects(mouseArea))
+ return ResizeLeft;
+ else if (rect().normalized().contains(pos))
+ return Move;
+ else
+ return NoAction;*/
+ return NoAction;
+}
+
+void OnMonitorCornersItem::slotMousePressed(QGraphicsSceneMouseEvent* event)
+{
+ event->accept();
+
+ if (!isEnabled())
+ return;
+
+ m_clickPoint = event->scenePos();
+ m_mode = getMode(m_clickPoint.toPoint());
+}
+
+void OnMonitorCornersItem::slotMouseMoved(QGraphicsSceneMouseEvent* event)
+{
+ event->accept();
+
+ if (!isEnabled()) {
+ emit requestCursor(QCursor(Qt::ArrowCursor));
+ return;
+ }
+
+ /*if (event->buttons() != Qt::NoButton && (event->screenPos() - m_screenClickPoint).manhattanLength() < QApplication::startDragDistance()) {
+ * event->accept();
+ * return;
+ }*/
+
+ QPointF mousePos = event->scenePos();
+
+ if (event->buttons() & Qt::LeftButton) {
+ m_clickPoint = mousePos;
+ switch (m_mode) {
+ case Corner1:
+
+ break;
+ case Corner2:
+
+ break;
+ case Corner3:
+
+ break;
+ case Corner4:
+
+ break;
+ default:
+ break;
+ }
+ } else {
+ switch (getMode(event->scenePos().toPoint())) {
+ case NoAction:
+ emit requestCursor(QCursor(Qt::ArrowCursor));
+ break;
+ default:
+ emit requestCursor(QCursor(Qt::OpenHandCursor));
+ break;
+ }
+ }
+ if (m_modified && KdenliveSettings::monitorscene_directupdate()) {
+ emit actionFinished();
+ m_modified = false;
+ }
+}
+
+/*void OnMonitorRectItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
+{
+ Q_UNUSED(widget);
+
+ painter->setPen(pen());
+ painter->drawRect(option->rect);
+
+ if (isEnabled()) {
+ double handleSize = 6 / painter->matrix().m11();
+ double halfHandleSize = handleSize / 2;
+ painter->fillRect(-halfHandleSize, -halfHandleSize, handleSize, handleSize, QColor(Qt::yellow));
+ painter->fillRect(option->rect.width() - halfHandleSize, -halfHandleSize, handleSize, handleSize, QColor(Qt::yellow));
+ painter->fillRect(option->rect.width() - halfHandleSize, option->rect.height() - halfHandleSize, handleSize, handleSize, QColor(Qt::yellow));
+ painter->fillRect(-halfHandleSize, option->rect.height() - halfHandleSize, handleSize, handleSize, QColor(Qt::yellow));
+ }
+}*/
+
+#include "onmonitorcornersitem.moc"
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2010 by Till Theato (root@ttill.de) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+
+#ifndef ONMONITORCORNERSITEM_H
+#define ONMONITORCORNERSITEM_H
+
+#include "abstractonmonitoritem.h"
+
+#include <QtCore>
+#include <QGraphicsPolygonItem>
+
+enum cornersActions { Corner1, Corner2, Corner3, Corner4, NoAction };
+
+class OnMonitorCornersItem : public AbstractOnMonitorItem, public QGraphicsPolygonItem
+{
+ Q_OBJECT
+public:
+ OnMonitorCornersItem(MonitorScene *scene, QGraphicsItem *parent = 0);
+
+ /** @brief Gets The action mode for the area @param pos +- 4. */
+ cornersActions getMode(QPoint pos);
+
+ /** @brief Reimplemented to draw the handles. */
+ //virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 );
+
+public slots:
+ /** @brief Saves current mouse position and mode. */
+ void slotMousePressed(QGraphicsSceneMouseEvent *event);
+ /** @brief Modifies item according to mouse position and mode. */
+ void slotMouseMoved(QGraphicsSceneMouseEvent *event);
+
+private:
+ cornersActions m_mode;
+ QPointF m_clickPoint;
+};
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CornersWidget_UI</class>
+ <widget class="QWidget" name="CornersWidget_UI">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>291</width>
+ <height>184</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Corner</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="label_2">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>X</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLabel" name="label_3">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Y</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>1</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="spinX1"/>
+ </item>
+ <item row="1" column="2">
+ <widget class="QSpinBox" name="spinY1"/>
+ </item>
+ <item row="2" column="1">
+ <widget class="QSpinBox" name="spinX2"/>
+ </item>
+ <item row="3" column="1">
+ <widget class="QSpinBox" name="spinX3"/>
+ </item>
+ <item row="4" column="1">
+ <widget class="QSpinBox" name="spinX4"/>
+ </item>
+ <item row="2" column="2">
+ <widget class="QSpinBox" name="spinY2"/>
+ </item>
+ <item row="3" column="2">
+ <widget class="QSpinBox" name="spinY3"/>
+ </item>
+ <item row="4" column="2">
+ <widget class="QSpinBox" name="spinY4"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>2</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>3</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>4</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="QToolButton" name="toolReset1">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3">
+ <widget class="QToolButton" name="toolReset2">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="3">
+ <widget class="QToolButton" name="toolReset3">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="3">
+ <widget class="QToolButton" name="toolReset4">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="4" rowspan="5">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="0" colspan="5">
+ <widget class="QFrame" name="frameConfig">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>10</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" colspan="5">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>