QmlJSDebugger: Prefix live editor related classes

AbstractFormEditorTool -> AbstractLiveEditTool
LayerItem -> LiveLayerItem
SelectionIndicator -> LiveSelectionIndicator
SelectionRectangle -> LiveSelectionRectangle
SelectionTool -> LiveSelectionTool
SingleSelectionManipulator -> LiveSingleSelectionManipulator
RubberBandSelectionManipulator -> LiveRubberBandSelectionManipulator
This commit is contained in:
Thorbjørn Lindeijer
2011-02-09 16:59:43 +01:00
parent 350eaa5029
commit f9e65028fd
29 changed files with 182 additions and 228 deletions

View File

@@ -31,7 +31,7 @@
**
**************************************************************************/
#include "abstractformeditortool.h"
#include "abstractliveedittool.h"
#include "qdeclarativeviewobserver.h"
#include "../qdeclarativeviewobserver_p.h"
@@ -43,48 +43,48 @@
namespace QmlJSDebugger {
AbstractFormEditorTool::AbstractFormEditorTool(QDeclarativeViewObserver *editorView)
AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewObserver *editorView)
: QObject(editorView), m_observer(editorView)
{
}
AbstractFormEditorTool::~AbstractFormEditorTool()
AbstractLiveEditTool::~AbstractLiveEditTool()
{
}
QDeclarativeViewObserver *AbstractFormEditorTool::observer() const
QDeclarativeViewObserver *AbstractLiveEditTool::observer() const
{
return m_observer;
}
QDeclarativeView *AbstractFormEditorTool::view() const
QDeclarativeView *AbstractLiveEditTool::view() const
{
return m_observer->declarativeView();
}
QGraphicsScene* AbstractFormEditorTool::scene() const
QGraphicsScene* AbstractLiveEditTool::scene() const
{
return view()->scene();
}
void AbstractFormEditorTool::updateSelectedItems()
void AbstractLiveEditTool::updateSelectedItems()
{
selectedItemsChanged(items());
}
QList<QGraphicsItem*> AbstractFormEditorTool::items() const
QList<QGraphicsItem*> AbstractLiveEditTool::items() const
{
return observer()->selectedItems();
}
void AbstractFormEditorTool::enterContext(QGraphicsItem *itemToEnter)
void AbstractLiveEditTool::enterContext(QGraphicsItem *itemToEnter)
{
observer()->data->enterContext(itemToEnter);
}
bool AbstractFormEditorTool::topItemIsMovable(const QList<QGraphicsItem*> & itemList)
bool AbstractLiveEditTool::topItemIsMovable(const QList<QGraphicsItem*> & itemList)
{
QGraphicsItem *firstSelectableItem = topMovableGraphicsItem(itemList);
if (firstSelectableItem == 0)
@@ -100,7 +100,7 @@ bool AbstractFormEditorTool::topItemIsMovable(const QList<QGraphicsItem*> & item
}
bool AbstractFormEditorTool::topSelectedItemIsMovable(const QList<QGraphicsItem*> &itemList)
bool AbstractLiveEditTool::topSelectedItemIsMovable(const QList<QGraphicsItem*> &itemList)
{
QList<QGraphicsItem*> selectedItems = observer()->selectedItems();
@@ -116,17 +116,17 @@ bool AbstractFormEditorTool::topSelectedItemIsMovable(const QList<QGraphicsItem*
}
bool AbstractFormEditorTool::topItemIsResizeHandle(const QList<QGraphicsItem*> &/*itemList*/)
bool AbstractLiveEditTool::topItemIsResizeHandle(const QList<QGraphicsItem*> &/*itemList*/)
{
return false;
}
QDeclarativeItem *AbstractFormEditorTool::toQDeclarativeItem(QGraphicsItem *item)
QDeclarativeItem *AbstractLiveEditTool::toQDeclarativeItem(QGraphicsItem *item)
{
return dynamic_cast<QDeclarativeItem*>(item->toGraphicsObject());
}
QGraphicsItem *AbstractFormEditorTool::topMovableGraphicsItem(const QList<QGraphicsItem*> &itemList)
QGraphicsItem *AbstractLiveEditTool::topMovableGraphicsItem(const QList<QGraphicsItem*> &itemList)
{
foreach (QGraphicsItem *item, itemList) {
if (item->flags().testFlag(QGraphicsItem::ItemIsMovable))
@@ -135,8 +135,8 @@ QGraphicsItem *AbstractFormEditorTool::topMovableGraphicsItem(const QList<QGraph
return 0;
}
QDeclarativeItem *AbstractFormEditorTool::topMovableDeclarativeItem(const QList<QGraphicsItem*>
&itemList)
QDeclarativeItem *AbstractLiveEditTool::topMovableDeclarativeItem(const QList<QGraphicsItem*>
&itemList)
{
foreach (QGraphicsItem *item, itemList) {
QDeclarativeItem *declarativeItem = toQDeclarativeItem(item);
@@ -147,8 +147,8 @@ QDeclarativeItem *AbstractFormEditorTool::topMovableDeclarativeItem(const QList<
return 0;
}
QList<QGraphicsObject*> AbstractFormEditorTool::toGraphicsObjectList(const QList<QGraphicsItem*>
&itemList)
QList<QGraphicsObject*> AbstractLiveEditTool::toGraphicsObjectList(const QList<QGraphicsItem*>
&itemList)
{
QList<QGraphicsObject*> gfxObjects;
foreach(QGraphicsItem *item, itemList) {
@@ -160,7 +160,7 @@ QList<QGraphicsObject*> AbstractFormEditorTool::toGraphicsObjectList(const QList
return gfxObjects;
}
QString AbstractFormEditorTool::titleForItem(QGraphicsItem *item)
QString AbstractLiveEditTool::titleForItem(QGraphicsItem *item)
{
QString className("QGraphicsItem");
QString objectStringId;

View File

@@ -31,8 +31,8 @@
**
**************************************************************************/
#ifndef ABSTRACTFORMEDITORTOOL_H
#define ABSTRACTFORMEDITORTOOL_H
#ifndef ABSTRACTLIVEEDITTOOL_H
#define ABSTRACTLIVEEDITTOOL_H
#include <QtCore/QList>
#include <QtCore/QObject>
@@ -54,13 +54,13 @@ class QDeclarativeViewObserver;
class FormEditorView;
class AbstractFormEditorTool : public QObject
class AbstractLiveEditTool : public QObject
{
Q_OBJECT
public:
AbstractFormEditorTool(QDeclarativeViewObserver* observer);
AbstractLiveEditTool(QDeclarativeViewObserver *observer);
virtual ~AbstractFormEditorTool();
virtual ~AbstractLiveEditTool();
virtual void mousePressEvent(QMouseEvent *event) = 0;
virtual void mouseMoveEvent(QMouseEvent *event) = 0;
@@ -105,4 +105,4 @@ private:
}
#endif // ABSTRACTFORMEDITORTOOL_H
#endif // ABSTRACTLIVEEDITTOOL_H

View File

@@ -83,7 +83,7 @@ int BoundingBoxPolygonItem::type() const
}
BoundingRectHighlighter::BoundingRectHighlighter(QDeclarativeViewObserver *view) :
LayerItem(view->declarativeView()->scene()),
LiveLayerItem(view->declarativeView()->scene()),
m_view(view),
m_animFrame(0)
{

View File

@@ -50,7 +50,7 @@ namespace QmlJSDebugger {
class QDeclarativeViewObserver;
class BoundingBox;
class BoundingRectHighlighter : public LayerItem
class BoundingRectHighlighter : public LiveLayerItem
{
Q_OBJECT
public:

View File

@@ -45,7 +45,7 @@
namespace QmlJSDebugger {
ColorPickerTool::ColorPickerTool(QDeclarativeViewObserver *view) :
AbstractFormEditorTool(view)
AbstractLiveEditTool(view)
{
m_selectedColor.setRgb(0,0,0);
}

View File

@@ -34,7 +34,7 @@
#ifndef COLORPICKERTOOL_H
#define COLORPICKERTOOL_H
#include "abstractformeditortool.h"
#include "abstractliveedittool.h"
#include <QtGui/QColor>
@@ -42,7 +42,7 @@ QT_FORWARD_DECLARE_CLASS(QPoint)
namespace QmlJSDebugger {
class ColorPickerTool : public AbstractFormEditorTool
class ColorPickerTool : public AbstractLiveEditTool
{
Q_OBJECT
public:
@@ -78,7 +78,6 @@ private:
private:
QColor m_selectedColor;
};
} // namespace QmlJSDebugger

View File

@@ -1,41 +0,0 @@
#ifndef ToolBarColorBox_H
#define ToolBarColorBox_H
#include <QLabel>
#include <QColor>
#include <QPoint>
QT_FORWARD_DECLARE_CLASS(QContextMenuEvent);
QT_FORWARD_DECLARE_CLASS(QAction);
namespace QmlJSDebugger {
class ToolBarColorBox : public QLabel
{
Q_OBJECT
public:
explicit ToolBarColorBox(QWidget *parent = 0);
void setColor(const QColor &color);
protected:
void contextMenuEvent(QContextMenuEvent *ev);
void mouseDoubleClickEvent(QMouseEvent *);
void mousePressEvent(QMouseEvent *ev);
void mouseMoveEvent(QMouseEvent *ev);
private slots:
void copyColorToClipboard();
private:
QPixmap createDragPixmap(int size = 24) const;
private:
bool m_dragStarted;
QPoint m_dragBeginPoint;
QAction *m_copyHexColor;
QColor m_color;
};
} // namespace QmlJSDebugger
#endif // ToolBarColorBox_H

View File

@@ -31,14 +31,14 @@
**
**************************************************************************/
#include "layeritem.h"
#include "livelayeritem.h"
#include "qmlobserverconstants.h"
#include <QGraphicsScene>
namespace QmlJSDebugger {
LayerItem::LayerItem(QGraphicsScene* scene)
LiveLayerItem::LiveLayerItem(QGraphicsScene* scene)
: QGraphicsObject()
{
scene->addItem(this);
@@ -46,31 +46,31 @@ LayerItem::LayerItem(QGraphicsScene* scene)
setFlag(QGraphicsItem::ItemIsMovable, false);
}
LayerItem::~LayerItem()
LiveLayerItem::~LiveLayerItem()
{
}
void LayerItem::paint(QPainter * /*painter*/, const QStyleOptionGraphicsItem * /*option*/,
QWidget * /*widget*/)
void LiveLayerItem::paint(QPainter * /*painter*/, const QStyleOptionGraphicsItem * /*option*/,
QWidget * /*widget*/)
{
}
int LayerItem::type() const
int LiveLayerItem::type() const
{
return Constants::EditorItemType;
}
QRectF LayerItem::boundingRect() const
QRectF LiveLayerItem::boundingRect() const
{
return childrenBoundingRect();
}
QList<QGraphicsItem*> LayerItem::findAllChildItems() const
QList<QGraphicsItem*> LiveLayerItem::findAllChildItems() const
{
return findAllChildItems(this);
}
QList<QGraphicsItem*> LayerItem::findAllChildItems(const QGraphicsItem *item) const
QList<QGraphicsItem*> LiveLayerItem::findAllChildItems(const QGraphicsItem *item) const
{
QList<QGraphicsItem*> itemList(item->childItems());

View File

@@ -31,20 +31,18 @@
**
**************************************************************************/
#ifndef LAYERITEM_H
#define LAYERITEM_H
#ifndef LIVELAYERITEM_H
#define LIVELAYERITEM_H
#include <QtGui/QGraphicsObject>
namespace QmlJSDebugger {
class FormEditorScene;
class LayerItem : public QGraphicsObject
class LiveLayerItem : public QGraphicsObject
{
public:
LayerItem(QGraphicsScene *scene);
~LayerItem();
LiveLayerItem(QGraphicsScene *scene);
~LiveLayerItem();
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget = 0);
QRectF boundingRect() const;
@@ -58,4 +56,4 @@ protected:
}
#endif // LAYERITEM_H
#endif // LIVELAYERITEM_H

View File

@@ -31,7 +31,7 @@
**
**************************************************************************/
#include "rubberbandselectionmanipulator.h"
#include "liverubberbandselectionmanipulator.h"
#include "../qdeclarativeviewobserver_p.h"
#include <QtGui/QGraphicsItem>
@@ -40,8 +40,8 @@
namespace QmlJSDebugger {
RubberBandSelectionManipulator::RubberBandSelectionManipulator(QGraphicsObject *layerItem,
QDeclarativeViewObserver *editorView)
LiveRubberBandSelectionManipulator::LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem,
QDeclarativeViewObserver *editorView)
: m_selectionRectangleElement(layerItem),
m_editorView(editorView),
m_beginFormEditorItem(0),
@@ -50,7 +50,7 @@ RubberBandSelectionManipulator::RubberBandSelectionManipulator(QGraphicsObject *
m_selectionRectangleElement.hide();
}
void RubberBandSelectionManipulator::clear()
void LiveRubberBandSelectionManipulator::clear()
{
m_selectionRectangleElement.clear();
m_isActive = false;
@@ -59,8 +59,8 @@ void RubberBandSelectionManipulator::clear()
m_oldSelectionList.clear();
}
QGraphicsItem *RubberBandSelectionManipulator::topFormEditorItem(const QList<QGraphicsItem*>
&itemList)
QGraphicsItem *LiveRubberBandSelectionManipulator::topFormEditorItem(const QList<QGraphicsItem*>
&itemList)
{
if (itemList.isEmpty())
return 0;
@@ -68,7 +68,7 @@ QGraphicsItem *RubberBandSelectionManipulator::topFormEditorItem(const QList<QGr
return itemList.first();
}
void RubberBandSelectionManipulator::begin(const QPointF& beginPoint)
void LiveRubberBandSelectionManipulator::begin(const QPointF &beginPoint)
{
m_beginPoint = beginPoint;
m_selectionRectangleElement.setRect(m_beginPoint, m_beginPoint);
@@ -80,19 +80,19 @@ void RubberBandSelectionManipulator::begin(const QPointF& beginPoint)
m_oldSelectionList = m_editorView->selectedItems();
}
void RubberBandSelectionManipulator::update(const QPointF& updatePoint)
void LiveRubberBandSelectionManipulator::update(const QPointF &updatePoint)
{
m_selectionRectangleElement.setRect(m_beginPoint, updatePoint);
}
void RubberBandSelectionManipulator::end()
void LiveRubberBandSelectionManipulator::end()
{
m_oldSelectionList.clear();
m_selectionRectangleElement.hide();
m_isActive = false;
}
void RubberBandSelectionManipulator::select(SelectionType selectionType)
void LiveRubberBandSelectionManipulator::select(SelectionType selectionType)
{
QDeclarativeViewObserverPrivate *observerPrivate
= QDeclarativeViewObserverPrivate::get(m_editorView);
@@ -138,17 +138,17 @@ void RubberBandSelectionManipulator::select(SelectionType selectionType)
}
void RubberBandSelectionManipulator::setItems(const QList<QGraphicsItem*> &itemList)
void LiveRubberBandSelectionManipulator::setItems(const QList<QGraphicsItem*> &itemList)
{
m_itemList = itemList;
}
QPointF RubberBandSelectionManipulator::beginPoint() const
QPointF LiveRubberBandSelectionManipulator::beginPoint() const
{
return m_beginPoint;
}
bool RubberBandSelectionManipulator::isActive() const
bool LiveRubberBandSelectionManipulator::isActive() const
{
return m_isActive;
}

View File

@@ -45,7 +45,7 @@ namespace QmlJSDebugger {
class QDeclarativeViewObserver;
class RubberBandSelectionManipulator
class LiveRubberBandSelectionManipulator
{
public:
enum SelectionType {
@@ -54,8 +54,8 @@ public:
RemoveFromSelection
};
RubberBandSelectionManipulator(QGraphicsObject *layerItem,
QDeclarativeViewObserver *editorView);
LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem,
QDeclarativeViewObserver *editorView);
void setItems(const QList<QGraphicsItem*> &itemList);
@@ -77,7 +77,7 @@ protected:
private:
QList<QGraphicsItem*> m_itemList;
QList<QGraphicsItem*> m_oldSelectionList;
SelectionRectangle m_selectionRectangleElement;
LiveSelectionRectangle m_selectionRectangleElement;
QPointF m_beginPoint;
QDeclarativeViewObserver *m_editorView;
QGraphicsItem *m_beginFormEditorItem;

View File

@@ -31,7 +31,7 @@
**
**************************************************************************/
#include "selectionindicator.h"
#include "liveselectionindicator.h"
#include "../qdeclarativeviewobserver_p.h"
#include "qmlobserverconstants.h"
@@ -46,30 +46,30 @@
namespace QmlJSDebugger {
SelectionIndicator::SelectionIndicator(QDeclarativeViewObserver *editorView,
LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewObserver *editorView,
QGraphicsObject *layerItem)
: m_layerItem(layerItem), m_view(editorView)
{
}
SelectionIndicator::~SelectionIndicator()
LiveSelectionIndicator::~LiveSelectionIndicator()
{
clear();
}
void SelectionIndicator::show()
void LiveSelectionIndicator::show()
{
foreach (QGraphicsPolygonItem *item, m_indicatorShapeHash.values())
item->show();
}
void SelectionIndicator::hide()
void LiveSelectionIndicator::hide()
{
foreach (QGraphicsPolygonItem *item, m_indicatorShapeHash.values())
item->hide();
}
void SelectionIndicator::clear()
void LiveSelectionIndicator::clear()
{
if (!m_layerItem.isNull()) {
QHashIterator<QGraphicsItem*, QGraphicsPolygonItem *> iter(m_indicatorShapeHash);
@@ -84,7 +84,7 @@ void SelectionIndicator::clear()
}
QPolygonF SelectionIndicator::addBoundingRectToPolygon(QGraphicsItem *item, QPolygonF &polygon)
QPolygonF LiveSelectionIndicator::addBoundingRectToPolygon(QGraphicsItem *item, QPolygonF &polygon)
{
// ### remove this if statement when QTBUG-12172 gets fixed
if (item->boundingRect() != QRectF(0,0,0,0)) {
@@ -100,7 +100,7 @@ QPolygonF SelectionIndicator::addBoundingRectToPolygon(QGraphicsItem *item, QPol
return polygon;
}
void SelectionIndicator::setItems(const QList<QWeakPointer<QGraphicsObject> > &itemList)
void LiveSelectionIndicator::setItems(const QList<QWeakPointer<QGraphicsObject> > &itemList)
{
clear();

View File

@@ -31,8 +31,8 @@
**
**************************************************************************/
#ifndef SELECTIONINDICATOR_H
#define SELECTIONINDICATOR_H
#ifndef LIVESELECTIONINDICATOR_H
#define LIVESELECTIONINDICATOR_H
#include <QtCore/QWeakPointer>
#include <QtCore/QHash>
@@ -48,11 +48,11 @@ namespace QmlJSDebugger {
class QDeclarativeViewObserver;
class SelectionIndicator
class LiveSelectionIndicator
{
public:
SelectionIndicator(QDeclarativeViewObserver* editorView, QGraphicsObject *layerItem);
~SelectionIndicator();
LiveSelectionIndicator(QDeclarativeViewObserver* editorView, QGraphicsObject *layerItem);
~LiveSelectionIndicator();
void show();
void hide();
@@ -73,4 +73,4 @@ private:
}
#endif // SELECTIONINDICATOR_H
#endif // LIVESELECTIONINDICATOR_H

View File

@@ -31,7 +31,7 @@
**
**************************************************************************/
#include "selectionrectangle.h"
#include "liveselectionrectangle.h"
#include "qmlobserverconstants.h"
#include <QtGui/QPen>
@@ -52,7 +52,7 @@ public:
int type() const { return Constants::EditorItemType; }
};
SelectionRectangle::SelectionRectangle(QGraphicsObject *layerItem)
LiveSelectionRectangle::LiveSelectionRectangle(QGraphicsObject *layerItem)
: m_controlShape(new SelectionRectShape(layerItem)),
m_layerItem(layerItem)
{
@@ -60,32 +60,32 @@ SelectionRectangle::SelectionRectangle(QGraphicsObject *layerItem)
m_controlShape->setBrush(QColor(128, 128, 128, 50));
}
SelectionRectangle::~SelectionRectangle()
LiveSelectionRectangle::~LiveSelectionRectangle()
{
if (m_layerItem)
m_layerItem.data()->scene()->removeItem(m_controlShape);
}
void SelectionRectangle::clear()
void LiveSelectionRectangle::clear()
{
hide();
}
void SelectionRectangle::show()
void LiveSelectionRectangle::show()
{
m_controlShape->show();
}
void SelectionRectangle::hide()
void LiveSelectionRectangle::hide()
{
m_controlShape->hide();
}
QRectF SelectionRectangle::rect() const
QRectF LiveSelectionRectangle::rect() const
{
return m_controlShape->mapFromScene(m_controlShape->rect()).boundingRect();
}
void SelectionRectangle::setRect(const QPointF &firstPoint,
void LiveSelectionRectangle::setRect(const QPointF &firstPoint,
const QPointF &secondPoint)
{
double firstX = std::floor(firstPoint.x()) + 0.5;

View File

@@ -31,8 +31,8 @@
**
**************************************************************************/
#ifndef SELECTIONRECTANGLE_H
#define SELECTIONRECTANGLE_H
#ifndef LIVESELECTIONRECTANGLE_H
#define LIVESELECTIONRECTANGLE_H
#include <QtCore/QWeakPointer>
@@ -43,11 +43,11 @@ QT_FORWARD_DECLARE_CLASS(QRectF)
namespace QmlJSDebugger {
class SelectionRectangle
class LiveSelectionRectangle
{
public:
SelectionRectangle(QGraphicsObject *layerItem);
~SelectionRectangle();
LiveSelectionRectangle(QGraphicsObject *layerItem);
~LiveSelectionRectangle();
void show();
void hide();
@@ -64,6 +64,6 @@ private:
QWeakPointer<QGraphicsObject> m_layerItem;
};
}
} // namespace QmlJSDebugger
#endif // SELECTIONRECTANGLE_H
#endif // LIVESELECTIONRECTANGLE_H

View File

@@ -31,7 +31,7 @@
**
**************************************************************************/
#include "selectiontool.h"
#include "liveselectiontool.h"
#include "layeritem.h"
#include "../qdeclarativeviewobserver_p.h"
@@ -51,8 +51,8 @@
namespace QmlJSDebugger {
SelectionTool::SelectionTool(QDeclarativeViewObserver *editorView) :
AbstractFormEditorTool(editorView),
LiveSelectionTool::LiveSelectionTool(QDeclarativeViewObserver *editorView) :
AbstractLiveEditTool(editorView),
m_rubberbandSelectionMode(false),
m_rubberbandSelectionManipulator(
QDeclarativeViewObserverPrivate::get(editorView)->manipulatorLayer, editorView),
@@ -65,16 +65,16 @@ SelectionTool::SelectionTool(QDeclarativeViewObserver *editorView) :
}
SelectionTool::~SelectionTool()
LiveSelectionTool::~LiveSelectionTool()
{
}
void SelectionTool::setRubberbandSelectionMode(bool value)
void LiveSelectionTool::setRubberbandSelectionMode(bool value)
{
m_rubberbandSelectionMode = value;
}
SingleSelectionManipulator::SelectionType SelectionTool::getSelectionType(Qt::KeyboardModifiers
SingleSelectionManipulator::SelectionType LiveSelectionTool::getSelectionType(Qt::KeyboardModifiers
modifiers)
{
SingleSelectionManipulator::SelectionType selectionType
@@ -87,7 +87,7 @@ SingleSelectionManipulator::SelectionType SelectionTool::getSelectionType(Qt::Ke
return selectionType;
}
bool SelectionTool::alreadySelected(const QList<QGraphicsItem*> &itemList) const
bool LiveSelectionTool::alreadySelected(const QList<QGraphicsItem*> &itemList) const
{
QDeclarativeViewObserverPrivate *observerPrivate
= QDeclarativeViewObserverPrivate::get(observer());
@@ -105,7 +105,7 @@ bool SelectionTool::alreadySelected(const QList<QGraphicsItem*> &itemList) const
return false;
}
void SelectionTool::mousePressEvent(QMouseEvent *event)
void LiveSelectionTool::mousePressEvent(QMouseEvent *event)
{
QDeclarativeViewObserverPrivate *observerPrivate
= QDeclarativeViewObserverPrivate::get(observer());
@@ -126,7 +126,7 @@ void SelectionTool::mousePressEvent(QMouseEvent *event)
}
}
void SelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint globalPos)
void LiveSelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint globalPos)
{
if (!QDeclarativeViewObserverPrivate::get(observer())->mouseInsideContextItem())
return;
@@ -173,7 +173,7 @@ void SelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint glo
m_contextMenuItemList.clear();
}
void SelectionTool::contextMenuElementSelected()
void LiveSelectionTool::contextMenuElementSelected()
{
QAction *senderAction = static_cast<QAction*>(sender());
int itemListIndex = senderAction->data().toInt();
@@ -190,7 +190,7 @@ void SelectionTool::contextMenuElementSelected()
}
}
void SelectionTool::contextMenuElementHovered(QAction *action)
void LiveSelectionTool::contextMenuElementHovered(QAction *action)
{
int itemListIndex = action->data().toInt();
if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) {
@@ -199,7 +199,7 @@ void SelectionTool::contextMenuElementHovered(QAction *action)
}
}
void SelectionTool::mouseMoveEvent(QMouseEvent *event)
void LiveSelectionTool::mouseMoveEvent(QMouseEvent *event)
{
if (m_singleSelectionManipulator.isActive()) {
QPointF mouseMovementVector = m_singleSelectionManipulator.beginPoint() - event->pos();
@@ -220,18 +220,18 @@ void SelectionTool::mouseMoveEvent(QMouseEvent *event)
if (event->modifiers().testFlag(Qt::ControlModifier))
m_rubberbandSelectionManipulator.select(
RubberBandSelectionManipulator::RemoveFromSelection);
LiveRubberBandSelectionManipulator::RemoveFromSelection);
else if (event->modifiers().testFlag(Qt::ShiftModifier))
m_rubberbandSelectionManipulator.select(
RubberBandSelectionManipulator::AddToSelection);
LiveRubberBandSelectionManipulator::AddToSelection);
else
m_rubberbandSelectionManipulator.select(
RubberBandSelectionManipulator::ReplaceSelection);
LiveRubberBandSelectionManipulator::ReplaceSelection);
}
}
}
void SelectionTool::hoverMoveEvent(QMouseEvent * event)
void LiveSelectionTool::hoverMoveEvent(QMouseEvent * event)
{
// ### commented out until move tool is re-enabled
// QList<QGraphicsItem*> itemList = view()->items(event->pos());
@@ -263,7 +263,7 @@ void SelectionTool::hoverMoveEvent(QMouseEvent * event)
QDeclarativeViewObserverPrivate::get(observer())->clearHighlight();
}
void SelectionTool::mouseReleaseEvent(QMouseEvent *event)
void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event)
{
if (m_singleSelectionManipulator.isActive()) {
m_singleSelectionManipulator.end(event->pos());
@@ -290,25 +290,25 @@ void SelectionTool::mouseReleaseEvent(QMouseEvent *event)
if (event->modifiers().testFlag(Qt::ControlModifier))
m_rubberbandSelectionManipulator.select(
RubberBandSelectionManipulator::RemoveFromSelection);
LiveRubberBandSelectionManipulator::RemoveFromSelection);
else if (event->modifiers().testFlag(Qt::ShiftModifier))
m_rubberbandSelectionManipulator.select(
RubberBandSelectionManipulator::AddToSelection);
LiveRubberBandSelectionManipulator::AddToSelection);
else
m_rubberbandSelectionManipulator.select(
RubberBandSelectionManipulator::ReplaceSelection);
LiveRubberBandSelectionManipulator::ReplaceSelection);
m_rubberbandSelectionManipulator.end();
}
}
}
void SelectionTool::mouseDoubleClickEvent(QMouseEvent * /*event*/)
void LiveSelectionTool::mouseDoubleClickEvent(QMouseEvent * /*event*/)
{
}
void SelectionTool::keyPressEvent(QKeyEvent *event)
void LiveSelectionTool::keyPressEvent(QKeyEvent *event)
{
switch(event->key()) {
case Qt::Key_Left:
@@ -322,12 +322,12 @@ void SelectionTool::keyPressEvent(QKeyEvent *event)
}
}
void SelectionTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/)
void LiveSelectionTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/)
{
}
void SelectionTool::wheelEvent(QWheelEvent *event)
void LiveSelectionTool::wheelEvent(QWheelEvent *event)
{
if (event->orientation() == Qt::Horizontal || m_rubberbandSelectionMode)
return;
@@ -366,17 +366,17 @@ void SelectionTool::wheelEvent(QWheelEvent *event)
}
void SelectionTool::setSelectOnlyContentItems(bool selectOnlyContentItems)
void LiveSelectionTool::setSelectOnlyContentItems(bool selectOnlyContentItems)
{
m_selectOnlyContentItems = selectOnlyContentItems;
}
void SelectionTool::itemsAboutToRemoved(const QList<QGraphicsItem*> &/*itemList*/)
void LiveSelectionTool::itemsAboutToRemoved(const QList<QGraphicsItem*> &/*itemList*/)
{
}
void SelectionTool::clear()
void LiveSelectionTool::clear()
{
view()->setCursor(Qt::ArrowCursor);
m_rubberbandSelectionManipulator.clear(),
@@ -385,7 +385,7 @@ void SelectionTool::clear()
//m_resizeIndicator.clear();
}
void SelectionTool::selectedItemsChanged(const QList<QGraphicsItem*> &itemList)
void LiveSelectionTool::selectedItemsChanged(const QList<QGraphicsItem*> &itemList)
{
foreach(QWeakPointer<QGraphicsObject> obj, m_selectedItemList) {
if (!obj.isNull()) {
@@ -413,12 +413,12 @@ void SelectionTool::selectedItemsChanged(const QList<QGraphicsItem*> &itemList)
//m_resizeIndicator.setItems(toGraphicsObjectList(itemList));
}
void SelectionTool::repaintBoundingRects()
void LiveSelectionTool::repaintBoundingRects()
{
m_selectionIndicator.setItems(m_selectedItemList);
}
void SelectionTool::selectUnderPoint(QMouseEvent *event)
void LiveSelectionTool::selectUnderPoint(QMouseEvent *event)
{
m_singleSelectionManipulator.begin(event->pos());

View File

@@ -31,8 +31,8 @@
**
**************************************************************************/
#ifndef SELECTIONTOOL_H
#define SELECTIONTOOL_H
#ifndef LIVESELECTIONTOOL_H
#define LIVESELECTIONTOOL_H
#include "abstractformeditortool.h"
@@ -50,13 +50,13 @@ QT_FORWARD_DECLARE_CLASS(QAction)
namespace QmlJSDebugger {
class SelectionTool : public AbstractFormEditorTool
class LiveSelectionTool : public AbstractLiveEditTool
{
Q_OBJECT
public:
SelectionTool(QDeclarativeViewObserver* editorView);
~SelectionTool();
LiveSelectionTool(QDeclarativeViewObserver* editorView);
~LiveSelectionTool();
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
@@ -96,9 +96,9 @@ private:
private:
bool m_rubberbandSelectionMode;
RubberBandSelectionManipulator m_rubberbandSelectionManipulator;
LiveRubberBandSelectionManipulator m_rubberbandSelectionManipulator;
SingleSelectionManipulator m_singleSelectionManipulator;
SelectionIndicator m_selectionIndicator;
LiveSelectionIndicator m_selectionIndicator;
//ResizeIndicator m_resizeIndicator;
QTime m_mousePressTimer;
bool m_selectOnlyContentItems;
@@ -108,6 +108,6 @@ private:
QList<QGraphicsItem*> m_contextMenuItemList;
};
}
} // namespace QmlJSDebugger
#endif // SELECTIONTOOL_H
#endif // LIVESELECTIONTOOL_H

View File

@@ -31,48 +31,48 @@
**
**************************************************************************/
#include "singleselectionmanipulator.h"
#include "livesingleselectionmanipulator.h"
#include "qdeclarativeviewobserver.h"
#include "../qdeclarativeviewobserver_p.h"
#include <QtDebug>
namespace QmlJSDebugger {
SingleSelectionManipulator::SingleSelectionManipulator(QDeclarativeViewObserver *editorView)
LiveSingleSelectionManipulator::LiveSingleSelectionManipulator(QDeclarativeViewObserver *editorView)
: m_editorView(editorView),
m_isActive(false)
{
}
void SingleSelectionManipulator::begin(const QPointF &beginPoint)
void LiveSingleSelectionManipulator::begin(const QPointF &beginPoint)
{
m_beginPoint = beginPoint;
m_isActive = true;
m_oldSelectionList = QDeclarativeViewObserverPrivate::get(m_editorView)->selectedItems();
}
void SingleSelectionManipulator::update(const QPointF &/*updatePoint*/)
void LiveSingleSelectionManipulator::update(const QPointF &/*updatePoint*/)
{
m_oldSelectionList.clear();
}
void SingleSelectionManipulator::clear()
void LiveSingleSelectionManipulator::clear()
{
m_beginPoint = QPointF();
m_oldSelectionList.clear();
}
void SingleSelectionManipulator::end(const QPointF &/*updatePoint*/)
void LiveSingleSelectionManipulator::end(const QPointF &/*updatePoint*/)
{
m_oldSelectionList.clear();
m_isActive = false;
}
void SingleSelectionManipulator::select(SelectionType selectionType,
const QList<QGraphicsItem*> &items,
bool /*selectOnlyContentItems*/)
void LiveSingleSelectionManipulator::select(SelectionType selectionType,
const QList<QGraphicsItem*> &items,
bool /*selectOnlyContentItems*/)
{
QGraphicsItem *selectedItem = 0;
@@ -120,7 +120,7 @@ void SingleSelectionManipulator::select(SelectionType selectionType,
m_editorView->setSelectedItems(resultList);
}
void SingleSelectionManipulator::select(SelectionType selectionType, bool selectOnlyContentItems)
void LiveSingleSelectionManipulator::select(SelectionType selectionType, bool selectOnlyContentItems)
{
QDeclarativeViewObserverPrivate *observerPrivate =
QDeclarativeViewObserverPrivate::get(m_editorView);
@@ -129,12 +129,12 @@ void SingleSelectionManipulator::select(SelectionType selectionType, bool select
}
bool SingleSelectionManipulator::isActive() const
bool LiveSingleSelectionManipulator::isActive() const
{
return m_isActive;
}
QPointF SingleSelectionManipulator::beginPoint() const
QPointF LiveSingleSelectionManipulator::beginPoint() const
{
return m_beginPoint;
}

View File

@@ -31,8 +31,8 @@
**
**************************************************************************/
#ifndef SINGLESELECTIONMANIPULATOR_H
#define SINGLESELECTIONMANIPULATOR_H
#ifndef LIVESINGLESELECTIONMANIPULATOR_H
#define LIVESINGLESELECTIONMANIPULATOR_H
#include <QtCore/QPointF>
#include <QtCore/QList>
@@ -43,10 +43,10 @@ namespace QmlJSDebugger {
class QDeclarativeViewObserver;
class SingleSelectionManipulator
class LiveSingleSelectionManipulator
{
public:
SingleSelectionManipulator(QDeclarativeViewObserver *editorView);
LiveSingleSelectionManipulator(QDeclarativeViewObserver *editorView);
enum SelectionType {
ReplaceSelection,
@@ -76,6 +76,6 @@ private:
bool m_isActive;
};
}
} // namespace QmlJSDebugger
#endif // SINGLESELECTIONMANIPULATOR_H
#endif // LIVESINGLESELECTIONMANIPULATOR_H

View File

@@ -363,4 +363,4 @@ void QmlToolbar::activateToQml()
emit applyChangesToQmlFileSelected();
}
}
} // namespace QmlJSDebugger

View File

@@ -49,7 +49,7 @@ namespace QmlJSDebugger {
const qreal MaxOpacity = 0.5f;
SubcomponentEditorTool::SubcomponentEditorTool(QDeclarativeViewObserver *view)
: AbstractFormEditorTool(view),
: AbstractLiveEditTool(view),
m_animIncrement(0.05f),
m_animTimer(new QTimer(this))
{

View File

@@ -46,7 +46,7 @@ namespace QmlJSDebugger {
class SubcomponentMaskLayerItem;
class SubcomponentEditorTool : public AbstractFormEditorTool
class SubcomponentEditorTool : public AbstractLiveEditTool
{
Q_OBJECT

View File

@@ -31,8 +31,8 @@
**
**************************************************************************/
#ifndef ToolBarColorBox_H
#define ToolBarColorBox_H
#ifndef TOOLBARCOLORBOX_H
#define TOOLBARCOLORBOX_H
#include <QtGui/QLabel>
#include <QtGui/QColor>
@@ -66,9 +66,8 @@ private:
QPoint m_dragBeginPoint;
QAction *m_copyHexColor;
QColor m_color;
};
} // namespace QmlJSDebugger
#endif // ToolBarColorBox_H
#endif // TOOLBARCOLORBOX_H

View File

@@ -46,7 +46,7 @@
namespace QmlJSDebugger {
ZoomTool::ZoomTool(QDeclarativeViewObserver *view) :
AbstractFormEditorTool(view),
AbstractLiveEditTool(view),
m_rubberbandManipulator(),
m_smoothZoomMultiplier(0.05f),
m_currentScale(1.0f)
@@ -58,9 +58,9 @@ ZoomTool::ZoomTool(QDeclarativeViewObserver *view) :
m_zoomOutAction->setShortcut(QKeySequence(Qt::Key_Minus));
LayerItem *layerItem = QDeclarativeViewObserverPrivate::get(view)->manipulatorLayer;
LiveLayerItem *layerItem = QDeclarativeViewObserverPrivate::get(view)->manipulatorLayer;
QGraphicsObject *layerObject = reinterpret_cast<QGraphicsObject *>(layerItem);
m_rubberbandManipulator = new RubberBandSelectionManipulator(layerObject, view);
m_rubberbandManipulator = new LiveRubberBandSelectionManipulator(layerObject, view);
connect(m_zoomTo100Action, SIGNAL(triggered()), SLOT(zoomTo100()));

View File

@@ -41,7 +41,7 @@ QT_FORWARD_DECLARE_CLASS(QAction);
namespace QmlJSDebugger {
class ZoomTool : public AbstractFormEditorTool
class ZoomTool : public AbstractLiveEditTool
{
Q_OBJECT
public:
@@ -86,7 +86,7 @@ private:
QAction *m_zoomTo100Action;
QAction *m_zoomInAction;
QAction *m_zoomOutAction;
RubberBandSelectionManipulator *m_rubberbandManipulator;
LiveRubberBandSelectionManipulator *m_rubberbandManipulator;
qreal m_smoothZoomMultiplier;
qreal m_currentScale;

View File

@@ -76,8 +76,8 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObje
QObject(parent), data(new QDeclarativeViewObserverPrivate(this))
{
data->view = view;
data->manipulatorLayer = new LayerItem(view->scene());
data->selectionTool = new SelectionTool(this);
data->manipulatorLayer = new LiveLayerItem(view->scene());
data->selectionTool = new LiveSelectionTool(this);
data->zoomTool = new ZoomTool(this);
data->colorPickerTool = new ColorPickerTool(this);
data->boundingRectHighlighter = new BoundingRectHighlighter(this);
@@ -269,7 +269,7 @@ bool QDeclarativeViewObserver::mouseMoveEvent(QMouseEvent *event)
QList<QGraphicsItem*> selItems = data->selectableItems(event->pos());
if (!selItems.isEmpty()) {
declarativeView()->setToolTip(AbstractFormEditorTool::titleForItem(selItems.first()));
declarativeView()->setToolTip(AbstractLiveEditTool::titleForItem(selItems.first()));
} else {
declarativeView()->setToolTip(QString());
}

View File

@@ -44,15 +44,15 @@ namespace QmlJSDebugger {
class JSDebuggerAgent;
class QDeclarativeViewObserver;
class SelectionTool;
class LiveSelectionTool;
class ZoomTool;
class ColorPickerTool;
class LayerItem;
class LiveLayerItem;
class BoundingRectHighlighter;
class SubcomponentEditorTool;
class QmlToolbar;
class CrumblePath;
class AbstractFormEditorTool;
class AbstractLiveEditTool;
class QDeclarativeViewObserverPrivate
{
@@ -75,13 +75,13 @@ public:
QList<QWeakPointer<QGraphicsObject> > currentSelection;
Constants::DesignTool currentToolMode;
AbstractFormEditorTool *currentTool;
AbstractLiveEditTool *currentTool;
SelectionTool *selectionTool;
LiveSelectionTool *selectionTool;
ZoomTool *zoomTool;
ColorPickerTool *colorPickerTool;
SubcomponentEditorTool *subcomponentEditorTool;
LayerItem *manipulatorLayer;
LiveLayerItem *manipulatorLayer;
BoundingRectHighlighter *boundingRectHighlighter;

View File

@@ -27,13 +27,13 @@ contains(CONFIG, dll) {
include/qdeclarativeviewobserver.h \
include/qdeclarativeobserverservice.h \
include/qmlobserverconstants.h \
editor/abstractformeditortool.h \
editor/selectiontool.h \
editor/layeritem.h \
editor/singleselectionmanipulator.h \
editor/rubberbandselectionmanipulator.h \
editor/selectionrectangle.h \
editor/selectionindicator.h \
editor/abstractliveedittool.h \
editor/liveselectiontool.h \
editor/livelayeritem.h \
editor/livesingleselectionmanipulator.h \
editor/liverubberbandselectionmanipulator.h \
editor/liveselectionrectangle.h \
editor/liveselectionindicator.h \
editor/boundingrecthighlighter.h \
editor/subcomponenteditortool.h \
editor/subcomponentmasklayeritem.h \
@@ -46,13 +46,13 @@ contains(CONFIG, dll) {
SOURCES += \
qdeclarativeviewobserver.cpp \
qdeclarativeobserverservice.cpp \
editor/abstractformeditortool.cpp \
editor/selectiontool.cpp \
editor/layeritem.cpp \
editor/singleselectionmanipulator.cpp \
editor/rubberbandselectionmanipulator.cpp \
editor/selectionrectangle.cpp \
editor/selectionindicator.cpp \
editor/abstractliveedittool.cpp \
editor/liveselectiontool.cpp \
editor/livelayeritem.cpp \
editor/livesingleselectionmanipulator.cpp \
editor/liverubberbandselectionmanipulator.cpp \
editor/liveselectionrectangle.cpp \
editor/liveselectionindicator.cpp \
editor/boundingrecthighlighter.cpp \
editor/subcomponenteditortool.cpp \
editor/subcomponentmasklayeritem.cpp \

View File

@@ -70,7 +70,6 @@ private:
QColor m_borderColorOuter;
QColor m_borderColorInner;
};
} // namespace QmlJSInspector