blackmagic/capture.cpp
blackmagic/devices.cpp
stopmotion/stopmotion.cpp
+ onmonitoritems/abstractonmonitoritem.cpp
onmonitoritems/onmonitorrectitem.cpp
monitorscenecontrolwidget.cpp
)
m_geometry->fetch(&item, 0);
delete m_rect;
- m_rect = new OnMonitorRectItem(QRectF(0, 0, item.w(), item.h()));
+ m_rect = new OnMonitorRectItem(QRectF(0, 0, item.w(), item.h()), m_scene);
m_rect->setPos(item.x(), item.y());
m_rect->setZValue(0);
m_scene->addItem(m_rect);
}
}
-void MonitorScene::slotSetDirectUpdate(bool directUpdate)
-{
- KdenliveSettings::setMonitorscene_directupdate(directUpdate);
-}
-
void MonitorScene::slotSetBackgroundImage(const QImage &image)
{
if (m_view && m_view->isVisible()) {
{
QGraphicsScene::addItem(item);
- OnMonitorRectItem *rect = qgraphicsitem_cast<OnMonitorRectItem*>(item);
+ /*OnMonitorRectItem *rect = qgraphicsitem_cast<OnMonitorRectItem*>(item);
if (rect) {
connect(this, SIGNAL(mousePressed(QGraphicsSceneMouseEvent*)), rect, SLOT(slotMousePressed(QGraphicsSceneMouseEvent*)));
connect(this, SIGNAL(mouseReleased(QGraphicsSceneMouseEvent*)), rect, SLOT(slotMouseReleased(QGraphicsSceneMouseEvent*)));
connect(this, SIGNAL(mouseMoved(QGraphicsSceneMouseEvent*)), rect, SLOT(slotMouseMoved(QGraphicsSceneMouseEvent*)));
connect(rect, SIGNAL(actionFinished()), this, SIGNAL(actionFinished()));
connect(rect, SIGNAL(setCursor(const QCursor &)), this, SLOT(slotSetCursor(const QCursor &)));
- }
+ }*/
}
void MonitorScene::slotSetCursor(const QCursor &cursor)
public slots:
/** @brief Sets the backgrounditem's pixmap to m_backgroundImage (only if a certain amount of time has passed since last update). */
void slotUpdateBackground();
-
- /** @brief Sets the KdenliveSetting directupdate with true = update parameters (rerender frame) during mouse move (before mouse button is released) */
- void slotSetDirectUpdate(bool directUpdate);
/** @brief Sets the scene's zoom level.
* @param value zoom level with 100 = show frame at original size */
m_scene->slotZoomFit();
connect(m_ui.buttonShowScene, SIGNAL(toggled(bool)), this, SIGNAL(showScene(bool)));
- connect(m_ui.buttonDirectUpdate, SIGNAL(toggled(bool)), m_scene, SLOT(slotSetDirectUpdate(bool)));
+ connect(m_ui.buttonDirectUpdate, SIGNAL(toggled(bool)), this, SLOT(slotSetDirectUpdate(bool)));
}
MonitorSceneControlWidget::~MonitorSceneControlWidget()
return m_buttonConfig;
}
+void MonitorSceneControlWidget::slotSetDirectUpdate(bool directUpdate)
+{
+ KdenliveSettings::setMonitorscene_directupdate(directUpdate);
+}
+
+
#include "monitorscenecontrolwidget.moc"
/** @brief Returns a button for showing and hiding the monitor scene controls (this widget). */
QToolButton *getShowHideButton();
+private slots:
+ /** @brief Sets the KdenliveSetting directupdate with true = update parameters (rerender frame) during mouse move (before mouse button is released) */
+ void slotSetDirectUpdate(bool directUpdate);
+
private:
Ui::MonitorSceneControlWidget_UI m_ui;
MonitorScene *m_scene;
--- /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 "abstractonmonitoritem.h"
+#include "monitorscene.h"
+
+#include <QGraphicsSceneMouseEvent>
+
+
+AbstractOnMonitorItem::AbstractOnMonitorItem(MonitorScene* scene) :
+ m_modified(false)
+{
+ connect(scene, SIGNAL(mousePressed(QGraphicsSceneMouseEvent*)), this, SLOT(slotMousePressed(QGraphicsSceneMouseEvent*)));
+ connect(scene, SIGNAL(mouseReleased(QGraphicsSceneMouseEvent*)), this, SLOT(slotMouseReleased(QGraphicsSceneMouseEvent*)));
+ connect(scene, SIGNAL(mouseMoved(QGraphicsSceneMouseEvent*)), this, SLOT(slotMouseMoved(QGraphicsSceneMouseEvent*)));
+ connect(this, SIGNAL(actionFinished()), scene, SIGNAL(actionFinished()));
+ connect(this, SIGNAL(requestCursor(const QCursor &)), scene, SLOT(slotSetCursor(const QCursor &)));
+}
+
+void AbstractOnMonitorItem::slotMouseReleased(QGraphicsSceneMouseEvent* event)
+{
+ if (m_modified) {
+ m_modified = false;
+ emit actionFinished();
+ }
+ event->accept();
+}
+
+#include "abstractonmonitoritem.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 ABSTRACTONMONITORITEM_H
+#define ABSTRACTONMONITORITEM_H
+
+#include <QtCore>
+#include <QGraphicsItem>
+
+
+class MonitorScene;
+
+class AbstractOnMonitorItem : public QObject
+{
+ Q_OBJECT
+public:
+ AbstractOnMonitorItem(MonitorScene *scene);
+ //virtual ~AbstractOnMonitorItem() = 0;
+
+protected slots:
+ virtual void slotMousePressed(QGraphicsSceneMouseEvent *event) = 0;
+ /** @brief emits actionFinished signal if item was modified. */
+ virtual void slotMouseReleased(QGraphicsSceneMouseEvent *event);
+ virtual void slotMouseMoved(QGraphicsSceneMouseEvent *event) = 0;
+
+protected:
+ bool m_modified;
+
+signals:
+ void actionFinished();
+ void requestCursor(const QCursor &);
+ //void modified();
+};
+
+#endif
#include <QStyleOptionGraphicsItem>
#include <QCursor>
-OnMonitorRectItem::OnMonitorRectItem(const QRectF &rect, QGraphicsItem* parent) :
+OnMonitorRectItem::OnMonitorRectItem(const QRectF &rect, MonitorScene *scene, QGraphicsItem* parent) :
+ AbstractOnMonitorItem(scene),
QGraphicsRectItem(rect, parent)
{
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
return NoAction;
}
-int OnMonitorRectItem::type() const
+/*int OnMonitorRectItem::type() const
{
return Type;
-}
-
-void OnMonitorRectItem::setEnabled(bool enabled)
-{
- m_enabled = enabled;
-}
+}*/
void OnMonitorRectItem::slotMousePressed(QGraphicsSceneMouseEvent* event)
{
- if (!m_enabled)
+ event->accept();
+
+ if (!isEnabled())
return;
m_clickPoint = event->scenePos();
m_mode = getMode(m_clickPoint.toPoint());
}
-void OnMonitorRectItem::slotMouseReleased(QGraphicsSceneMouseEvent* event)
+void OnMonitorRectItem::slotMouseMoved(QGraphicsSceneMouseEvent* event)
{
- if (m_modified) {
- m_modified = false;
- emit actionFinished();
- }
-
event->accept();
-}
-void OnMonitorRectItem::slotMouseMoved(QGraphicsSceneMouseEvent* event)
-{
- if (!m_enabled) {
- emit setCursor(QCursor(Qt::ArrowCursor));
+ if (!isEnabled()) {
+ emit requestCursor(QCursor(Qt::ArrowCursor));
return;
}
switch (getMode(event->scenePos().toPoint())) {
case ResizeTopLeft:
case ResizeBottomRight:
- emit setCursor(QCursor(Qt::SizeFDiagCursor));
+ emit requestCursor(QCursor(Qt::SizeFDiagCursor));
break;
case ResizeTopRight:
case ResizeBottomLeft:
- emit setCursor(QCursor(Qt::SizeBDiagCursor));
+ emit requestCursor(QCursor(Qt::SizeBDiagCursor));
break;
case ResizeTop:
case ResizeBottom:
- emit setCursor(QCursor(Qt::SizeVerCursor));
+ emit requestCursor(QCursor(Qt::SizeVerCursor));
break;
case ResizeLeft:
case ResizeRight:
- emit setCursor(QCursor(Qt::SizeHorCursor));
+ emit requestCursor(QCursor(Qt::SizeHorCursor));
break;
case Move:
- emit setCursor(QCursor(Qt::OpenHandCursor));
+ emit requestCursor(QCursor(Qt::OpenHandCursor));
break;
default:
- emit setCursor(QCursor(Qt::ArrowCursor));
+ emit requestCursor(QCursor(Qt::ArrowCursor));
break;
}
}
emit actionFinished();
m_modified = false;
}
-
- event->accept();
}
void OnMonitorRectItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
painter->setPen(pen());
painter->drawRect(option->rect);
- if (m_enabled) {
+ if (isEnabled()) {
double handleSize = 6 / painter->matrix().m11();
double halfHandleSize = handleSize / 2;
painter->fillRect(-halfHandleSize, -halfHandleSize, handleSize, handleSize, QColor(Qt::yellow));
}
}
-
-
#include "onmonitorrectitem.moc"
#ifndef ONMONITORRECTITEM_H
#define ONMONITORRECTITEM_H
+#include "abstractonmonitoritem.h"
+
#include <QtCore>
#include <QGraphicsRectItem>
enum rectActions { Move, ResizeTopLeft, ResizeBottomLeft, ResizeTopRight, ResizeBottomRight, ResizeLeft, ResizeRight, ResizeTop, ResizeBottom, NoAction };
-class OnMonitorRectItem : public QObject, public QGraphicsRectItem
+class OnMonitorRectItem : public AbstractOnMonitorItem, public QGraphicsRectItem
{
Q_OBJECT
public:
- OnMonitorRectItem(const QRectF &rect, QGraphicsItem *parent = 0);
-
- /** @brief Enables/Disables the ability to modify the item.
- * @param enabled (default = true) */
- void setEnabled(bool enabled = true);
+ OnMonitorRectItem(const QRectF &rect, MonitorScene *scene, QGraphicsItem *parent = 0);
/** @brief Gets The action mode for the area @param pos +- 4.
* e.g. pos(0,0) returns ResizeTopLeft */
rectActions getMode(QPoint pos);
- enum { Type = UserType + 1};
- /** @brief Reimplemented to make sure casting works. */
- int type() const;
+ /*enum { Type = UserType + 1};
+ /** @brief Reimplemented to make sure casting works. * /
+ int type() const;*/
/** @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 emits actionFinished signal if item was modified. */
- void slotMouseReleased(QGraphicsSceneMouseEvent *event);
/** @brief Modifies item according to mouse position and mode. */
void slotMouseMoved(QGraphicsSceneMouseEvent *event);
private:
rectActions m_mode;
QPointF m_clickPoint;
- bool m_enabled;
- bool m_modified;
-
-signals:
- void actionFinished();
- void setCursor(const QCursor &);
};
#endif