Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 70186d82 authored by Boudewijn Rempt's avatar Boudewijn Rempt Committed by Boudewijn Rempt

Run kdelibs-astyle + manual cleanup

parent bddeec45
......@@ -25,10 +25,9 @@
#include <kpluginfactory.h>
K_PLUGIN_FACTORY_WITH_JSON(PluginFactory, "calligra_tool_defaults.json",
registerPlugin<Plugin>();)
K_PLUGIN_FACTORY_WITH_JSON(PluginFactory, "calligra_tool_defaults.json", registerPlugin<Plugin>();)
Plugin::Plugin(QObject * parent, const QVariantList &)
Plugin::Plugin(QObject *parent, const QVariantList &)
: QObject(parent)
{
KoToolRegistry::instance()->add(new DefaultToolFactory());
......
......@@ -22,11 +22,12 @@
#include <QObject>
#include <QVariantList>
class Plugin : public QObject {
class Plugin : public QObject
{
Q_OBJECT
public:
Plugin(QObject * parent, const QVariantList &);
Plugin(QObject *parent, const QVariantList &);
~Plugin() {}
};
#endif
/* This file is part of the KDE project
*
*
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
......@@ -21,8 +21,11 @@
#include "AddConnectionPointCommand.h"
#include <KoShape.h>
AddConnectionPointCommand::AddConnectionPointCommand(KoShape* shape, const QPointF& connectionPoint, KUndo2Command* parent)
: KUndo2Command(parent), m_shape(shape), m_connectionPoint(connectionPoint), m_connectionPointId(-1)
AddConnectionPointCommand::AddConnectionPointCommand(KoShape *shape, const QPointF &connectionPoint, KUndo2Command *parent)
: KUndo2Command(parent)
, m_shape(shape)
, m_connectionPoint(connectionPoint)
, m_connectionPointId(-1)
{
Q_ASSERT(m_shape);
}
......@@ -33,7 +36,7 @@ AddConnectionPointCommand::~AddConnectionPointCommand()
void AddConnectionPointCommand::redo()
{
if(m_connectionPointId < 0) {
if (m_connectionPointId < 0) {
m_connectionPointId = m_shape->addConnectionPoint(m_connectionPoint);
} else {
m_shape->setConnectionPoint(m_connectionPointId, m_connectionPoint);
......
/* This file is part of the KDE project
*
*
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
......@@ -40,7 +40,7 @@ public:
private:
void updateRoi();
KoShape * m_shape;
KoShape *m_shape;
QPointF m_connectionPoint;
int m_connectionPointId;
};
......
/* This file is part of the KDE project
*
*
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
......@@ -21,9 +21,12 @@
#include "ChangeConnectionPointCommand.h"
#include <KoShape.h>
ChangeConnectionPointCommand::ChangeConnectionPointCommand(KoShape* shape, int connectionPointId, const KoConnectionPoint &oldPoint, const KoConnectionPoint &newPoint, KUndo2Command* parent)
: KUndo2Command(parent), m_shape(shape), m_connectionPointId(connectionPointId)
, m_oldPoint(oldPoint), m_newPoint(newPoint)
ChangeConnectionPointCommand::ChangeConnectionPointCommand(KoShape *shape, int connectionPointId, const KoConnectionPoint &oldPoint, const KoConnectionPoint &newPoint, KUndo2Command *parent)
: KUndo2Command(parent)
, m_shape(shape)
, m_connectionPointId(connectionPointId)
, m_oldPoint(oldPoint)
, m_newPoint(newPoint)
{
Q_ASSERT(m_shape);
}
......
/* This file is part of the KDE project
*
*
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
......@@ -41,7 +41,7 @@ public:
private:
void updateRoi(const QPointF &position);
KoShape * m_shape;
KoShape *m_shape;
int m_connectionPointId;
KoConnectionPoint m_oldPoint;
KoConnectionPoint m_newPoint;
......
/* This file is part of the KDE project
*
*
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
......@@ -22,8 +22,8 @@
#include "ConnectionTool.h"
#include <QAction>
ConnectionPointWidget::ConnectionPointWidget(ConnectionTool *tool, QWidget * parent)
:QWidget(parent)
ConnectionPointWidget::ConnectionPointWidget(ConnectionTool *tool, QWidget *parent)
: QWidget(parent)
{
widget.setupUi(this);
widget.alignLeft->setDefaultAction(tool->action("align-left"));
......@@ -49,9 +49,10 @@ ConnectionPointWidget::ConnectionPointWidget(ConnectionTool *tool, QWidget * par
void ConnectionPointWidget::toggleEditModeCheckbox(bool checked)
{
widget.toggleEditMode->blockSignals(true);
if (checked)
if (checked) {
widget.toggleEditMode->setCheckState(Qt::Checked);
else
} else {
widget.toggleEditMode->setCheckState(Qt::Unchecked);
}
widget.toggleEditMode->blockSignals(false);
}
/* This file is part of the KDE project
*
*
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
......@@ -37,8 +37,8 @@ private Q_SLOTS:
private:
Ui::ConnectionPointWidget widget;
QButtonGroup * m_horzGroup;
QButtonGroup * m_vertGroup;
QButtonGroup *m_horzGroup;
QButtonGroup *m_vertGroup;
};
#endif // CONNECTIONPOINTWIDGET_H
......@@ -42,29 +42,29 @@ public:
/**
* @brief Constructor
*/
explicit ConnectionTool( KoCanvasBase * canvas );
explicit ConnectionTool(KoCanvasBase *canvas);
/**
* @brief Destructor
*/
~ConnectionTool();
/// reimplemented from superclass
virtual void paint( QPainter &painter, const KoViewConverter &converter );
virtual void paint(QPainter &painter, const KoViewConverter &converter);
/// reimplemented from superclass
virtual void repaintDecorations();
/// reimplemented from superclass
virtual void mousePressEvent( KoPointerEvent *event ) ;
virtual void mousePressEvent(KoPointerEvent *event);
/// reimplemented from superclass
virtual void mouseMoveEvent( KoPointerEvent *event );
virtual void mouseMoveEvent(KoPointerEvent *event);
/// reimplemented from superclass
virtual void mouseReleaseEvent( KoPointerEvent *event );
virtual void mouseReleaseEvent(KoPointerEvent *event);
/// reimplemented from superclass
virtual void mouseDoubleClickEvent(KoPointerEvent *event);
/// reimplemented from superclass
virtual void keyPressEvent( QKeyEvent *event );
virtual void keyPressEvent(QKeyEvent *event);
/// reimplemented from superclass
virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
virtual void activate(ToolActivation toolActivation, const QSet<KoShape *> &shapes);
/// reimplemented from superclass
virtual void deactivate();
/// reimplemented from superclass
......@@ -97,7 +97,7 @@ private:
* @param p2 The second point
* @return The float which is the square of the distance
*/
qreal squareDistance( const QPointF &p1, const QPointF &p2 ) const;
qreal squareDistance(const QPointF &p1, const QPointF &p2) const;
/// Returns nearest connection handle or nearest connection point id of shape
int handleAtPoint(KoShape *shape, const QPointF &mousePoint) const;
......@@ -116,16 +116,16 @@ private:
void resetEditMode();
/// Returns the nearest connection shape within handle grab sensitiviy distance
KoConnectionShape * nearestConnectionShape(const QList<KoShape*> &shapes, const QPointF &mousePos) const;
KoConnectionShape *nearestConnectionShape(const QList<KoShape *> &shapes, const QPointF &mousePos) const;
/// Updates status text depending on edit mode
void updateStatusText();
/// Updates current shape and edit mode dependent on position
KoShape * findShapeAtPosition(const QPointF &position) const;
KoShape *findShapeAtPosition(const QPointF &position) const;
/// Updates current shape and edit mode dependent on position excluding connection shapes
KoShape * findNonConnectionShapeAtPosition(const QPointF &position) const;
KoShape *findNonConnectionShapeAtPosition(const QPointF &position) const;
/// Updates actions
void updateActions();
......@@ -135,7 +135,7 @@ private:
EditMode m_editMode; ///< the current edit mode
KoConnectionShape::Type m_connectionType;
KoShape * m_currentShape; ///< the current shape we are working on
KoShape *m_currentShape; ///< the current shape we are working on
int m_activeHandle; ///< the currently active connection point/connection handle
KoInteractionStrategy *m_currentStrategy; ///< the current editing strategy
KoSnapGuide::Strategies m_oldSnapStrategies; ///< the previously enables snap strategies
......@@ -147,25 +147,25 @@ private:
QActionGroup *m_alignRelative;
QActionGroup *m_escapeDirections;
QAction * m_editConnectionPoint;
QAction * m_alignPercent;
QAction * m_alignLeft;
QAction * m_alignCenterH;
QAction * m_alignRight;
QAction * m_alignTop;
QAction * m_alignCenterV;
QAction * m_alignBottom;
QAction * m_escapeAll;
QAction * m_escapeHorizontal;
QAction * m_escapeVertical;
QAction * m_escapeUp;
QAction * m_escapeLeft;
QAction * m_escapeDown;
QAction * m_escapeRight;
QList<KoShapeConfigWidgetBase*> m_connectionShapeWidgets;
QAction *m_editConnectionPoint;
QAction *m_alignPercent;
QAction *m_alignLeft;
QAction *m_alignCenterH;
QAction *m_alignRight;
QAction *m_alignTop;
QAction *m_alignCenterV;
QAction *m_alignBottom;
QAction *m_escapeAll;
QAction *m_escapeHorizontal;
QAction *m_escapeVertical;
QAction *m_escapeUp;
QAction *m_escapeLeft;
QAction *m_escapeDown;
QAction *m_escapeRight;
QList<KoShapeConfigWidgetBase *> m_connectionShapeWidgets;
};
#endif // KO_CONNECTION_TOOL_H
......@@ -39,7 +39,7 @@ ConnectionToolFactory::~ConnectionToolFactory()
{
}
KoToolBase* ConnectionToolFactory::createTool(KoCanvasBase *canvas)
KoToolBase *ConnectionToolFactory::createTool(KoCanvasBase *canvas)
{
return new ConnectionTool( canvas );
return new ConnectionTool(canvas);
}
......@@ -32,7 +32,7 @@ public:
/// Destructor
~ConnectionToolFactory();
/// reimplemented
KoToolBase* createTool( KoCanvasBase *canvas );
KoToolBase *createTool(KoCanvasBase *canvas);
};
#endif
......@@ -24,8 +24,10 @@
#include <KoToolBase.h>
#include <KoCanvasBase.h>
MoveConnectionPointStrategy::MoveConnectionPointStrategy(KoShape *shape, int connectionPointId, KoToolBase* parent)
: KoInteractionStrategy(parent), m_shape(shape), m_connectionPointId(connectionPointId)
MoveConnectionPointStrategy::MoveConnectionPointStrategy(KoShape *shape, int connectionPointId, KoToolBase *parent)
: KoInteractionStrategy(parent)
, m_shape(shape)
, m_connectionPointId(connectionPointId)
{
Q_ASSERT(m_shape);
m_oldPoint = m_newPoint = m_shape->connectionPoint(m_connectionPointId);
......@@ -35,12 +37,12 @@ MoveConnectionPointStrategy::~MoveConnectionPointStrategy()
{
}
void MoveConnectionPointStrategy::paint(QPainter& painter, const KoViewConverter& converter)
void MoveConnectionPointStrategy::paint(QPainter &painter, const KoViewConverter &converter)
{
KoInteractionStrategy::paint(painter, converter);
}
void MoveConnectionPointStrategy::handleMouseMove(const QPointF& mouseLocation, Qt::KeyboardModifiers /*modifiers*/)
void MoveConnectionPointStrategy::handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers /*modifiers*/)
{
m_newPoint.position = m_shape->documentToShape(mouseLocation);
m_shape->setConnectionPoint(m_connectionPointId, m_newPoint);
......@@ -56,14 +58,15 @@ void MoveConnectionPointStrategy::finishInteraction(Qt::KeyboardModifiers /*modi
{
}
KUndo2Command* MoveConnectionPointStrategy::createCommand()
KUndo2Command *MoveConnectionPointStrategy::createCommand()
{
int grabDistance = grabSensitivity();
const qreal dx = m_newPoint.position.x()-m_oldPoint.position.x();
const qreal dy = m_newPoint.position.y()-m_oldPoint.position.y();
const qreal dx = m_newPoint.position.x() - m_oldPoint.position.x();
const qreal dy = m_newPoint.position.y() - m_oldPoint.position.y();
// check if we have moved the connection point at least a little bit
if(dx*dx+dy*dy < grabDistance*grabDistance)
if (dx * dx + dy * dy < grabDistance * grabDistance) {
return 0;
}
return new ChangeConnectionPointCommand(m_shape, m_connectionPointId, m_oldPoint, m_newPoint);
}
/* This file is part of the KDE project
*
*
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
......
/* This file is part of the KDE project
*
*
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
......@@ -21,8 +21,10 @@
#include "RemoveConnectionPointCommand.h"
#include <KoShape.h>
RemoveConnectionPointCommand::RemoveConnectionPointCommand(KoShape* shape, int connectionPointId, KUndo2Command* parent)
: KUndo2Command(parent), m_shape(shape), m_connectionPointId(connectionPointId)
RemoveConnectionPointCommand::RemoveConnectionPointCommand(KoShape *shape, int connectionPointId, KUndo2Command *parent)
: KUndo2Command(parent)
, m_shape(shape)
, m_connectionPointId(connectionPointId)
{
Q_ASSERT(m_shape);
m_connectionPoint = m_shape->connectionPoint(m_connectionPointId);
......
/* This file is part of the KDE project
*
*
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
......@@ -41,7 +41,7 @@ public:
private:
void updateRoi();
KoShape * m_shape;
KoShape *m_shape;
KoConnectionPoint m_connectionPoint;
int m_connectionPointId;
};
......
......@@ -51,7 +51,7 @@ public:
* and handled by interaction strategies of type KoInteractionStrategy.
* @param canvas the canvas this tool will be working for.
*/
explicit DefaultTool( KoCanvasBase *canvas );
explicit DefaultTool(KoCanvasBase *canvas);
virtual ~DefaultTool();
enum CanvasResource {
......@@ -61,7 +61,7 @@ public:
public:
virtual bool wantsAutoScroll() const;
virtual void paint( QPainter &painter, const KoViewConverter &converter );
virtual void paint(QPainter &painter, const KoViewConverter &converter);
virtual void repaintDecorations();
......@@ -76,7 +76,7 @@ public:
///reimplemented
virtual QStringList supportedPasteMimeTypes() const;
///reimplemented
virtual KoToolSelection* selection();
virtual KoToolSelection *selection();
/**
* Returns which selection handle is at params point (or NoHandle if none).
......@@ -89,7 +89,7 @@ public:
KoFlake::SelectionHandle handleAt(const QPointF &point, bool *innerHandleMeaning = 0);
public Q_SLOTS:
virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
virtual void activate(ToolActivation toolActivation, const QSet<KoShape *> &shapes);
private Q_SLOTS:
void selectionAlignHorizontalLeft();
......@@ -112,14 +112,14 @@ private Q_SLOTS:
public: // Events
virtual void mousePressEvent( KoPointerEvent *event );
virtual void mouseMoveEvent( KoPointerEvent *event );
virtual void mouseReleaseEvent( KoPointerEvent *event );
virtual void mouseDoubleClickEvent( KoPointerEvent *event );
virtual void mousePressEvent(KoPointerEvent *event);
virtual void mouseMoveEvent(KoPointerEvent *event);
virtual void mouseReleaseEvent(KoPointerEvent *event);
virtual void mouseDoubleClickEvent(KoPointerEvent *event);
virtual void keyPressEvent(QKeyEvent *event);
virtual void customMoveEvent( KoPointerEvent * event );
virtual void customMoveEvent(KoPointerEvent *event);
protected:
QList<QPointer<QWidget> > createOptionWidgets();
......@@ -131,28 +131,28 @@ private:
void recalcSelectionBox();
void updateCursor();
/// Returns rotation angle of given handle of the current selection
qreal rotationOfHandle( KoFlake::SelectionHandle handle, bool useEdgeRotation );
qreal rotationOfHandle(KoFlake::SelectionHandle handle, bool useEdgeRotation);
void selectionAlign(KoShapeAlignCommand::Align align);
void selectionReorder(KoShapeReorderCommand::MoveShapeType order );
bool moveSelection( int direction, Qt::KeyboardModifiers modifiers );
void selectionReorder(KoShapeReorderCommand::MoveShapeType order);
bool moveSelection(int direction, Qt::KeyboardModifiers modifiers);
/// Returns selection rectangle adjusted by handle proximity threshold
QRectF handlesSize();
// convenience method;
KoSelection * koSelection();
KoSelection *koSelection();
void canvasResourceChanged( int key, const QVariant & res );
void canvasResourceChanged(int key, const QVariant &res);
/// selects guide line at given position
void selectGuideAtPosition( const QPointF &position );
void selectGuideAtPosition(const QPointF &position);
/// Returns list of editable shapes from the given list of shapes
QList<KoShape*> filterEditableShapes( const QList<KoShape*> &shapes );
QList<KoShape *> filterEditableShapes(const QList<KoShape *> &shapes);
/// Returns the number of editable shapes from the given list of shapes
uint editableShapesCount( const QList<KoShape*> &shapes );
uint editableShapesCount(const QList<KoShape *> &shapes);
KoFlake::SelectionHandle m_lastHandle;
KoFlake::Position m_hotPosition;
......@@ -170,10 +170,10 @@ private:
qreal m_angle;
KoToolSelection *m_selectionHandler;
friend class SelectionHandler;
KoInteractionStrategy * m_customEventStrategy;
KoInteractionStrategy *m_customEventStrategy;
class GuideLine;
GuideLine * m_guideLine;
GuideLine *m_guideLine;
};
#endif
......@@ -23,25 +23,25 @@
#include <KoInteractionTool.h>
#include <QAction>
DefaultToolArrangeWidget::DefaultToolArrangeWidget( KoInteractionTool* tool,
QWidget* parent ) : QWidget( parent )
DefaultToolArrangeWidget::DefaultToolArrangeWidget(KoInteractionTool *tool, QWidget *parent)
: QWidget(parent)
{
m_tool = tool;
setupUi( this );
setupUi(this);
bringToFront->setDefaultAction( m_tool->action( "object_order_front" ) );
raiseLevel->setDefaultAction( m_tool->action( "object_order_raise" ) );
lowerLevel->setDefaultAction( m_tool->action( "object_order_lower" ) );
sendBack->setDefaultAction( m_tool->action( "object_order_back" ) );
bringToFront->setDefaultAction(m_tool->action("object_order_front"));
raiseLevel->setDefaultAction(m_tool->action("object_order_raise"));
lowerLevel->setDefaultAction(m_tool->action("object_order_lower"));
sendBack->setDefaultAction(m_tool->action("object_order_back"));
leftAlign->setDefaultAction( m_tool->action( "object_align_horizontal_left" ) );
hCenterAlign->setDefaultAction( m_tool->action( "object_align_horizontal_center" ) );
rightAlign->setDefaultAction( m_tool->action( "object_align_horizontal_right" ) );
topAlign->setDefaultAction( m_tool->action( "object_align_vertical_top" ) );
vCenterAlign->setDefaultAction( m_tool->action( "object_align_vertical_center" ) );
bottomAlign->setDefaultAction( m_tool->action( "object_align_vertical_bottom" ) );
leftAlign->setDefaultAction(m_tool->action("object_align_horizontal_left"));
hCenterAlign->setDefaultAction(m_tool->action("object_align_horizontal_center"));
rightAlign->setDefaultAction(m_tool->action("object_align_horizontal_right"));
topAlign->setDefaultAction(m_tool->action("object_align_vertical_top"));
vCenterAlign->setDefaultAction(m_tool->action("object_align_vertical_center"));
bottomAlign->setDefaultAction(m_tool->action("object_align_vertical_bottom"));
group->setDefaultAction( m_tool->action( "object_group" ) );
ungroup->setDefaultAction( m_tool->action( "object_ungroup" ) );
group->setDefaultAction(m_tool->action("object_group"));
ungroup->setDefaultAction(m_tool->action("object_ungroup"));
}
......@@ -27,13 +27,14 @@
class KoInteractionTool;
class DefaultToolArrangeWidget : public QWidget, Ui::DefaultToolArrangeWidget {
class DefaultToolArrangeWidget : public QWidget, Ui::DefaultToolArrangeWidget
{
Q_OBJECT
public:
explicit DefaultToolArrangeWidget( KoInteractionTool* tool, QWidget *parent = 0 );
explicit DefaultToolArrangeWidget(KoInteractionTool *tool, QWidget *parent = 0);
private:
KoInteractionTool* m_tool;
KoInteractionTool *m_tool;
};
#endif
......@@ -34,9 +34,11 @@ DefaultToolFactory::DefaultToolFactory()
setActivationShapeId("flake/always");
}
DefaultToolFactory::~DefaultToolFactory() {
DefaultToolFactory::~DefaultToolFactory()
{
}
KoToolBase* DefaultToolFactory::createTool(KoCanvasBase *canvas) {
KoToolBase *DefaultToolFactory::createTool(KoCanvasBase *canvas)
{
return new DefaultTool(canvas);
}
......@@ -24,12 +24,13 @@
#include <KoToolFactoryBase.h>
/// Factory for the KoInteractionTool
class DefaultToolFactory : public KoToolFactoryBase {
class DefaultToolFactory : public KoToolFactoryBase
{
public:
/// constructor
DefaultToolFactory();
~DefaultToolFactory();
KoToolBase* createTool(KoCanvasBase *canvas);
KoToolBase *createTool(KoCanvasBase *canvas);
};
#endif
......@@ -27,16 +27,17 @@
class KoInteractionTool;
class DefaultToolTransformWidget : public QMenu, Ui::DefaultToolTransformWidget {
class DefaultToolTransformWidget : public QMenu, Ui::DefaultToolTransformWidget
{
Q_OBJECT
public:
explicit DefaultToolTransformWidget( KoInteractionTool* tool, QWidget *parent = 0 );
explicit DefaultToolTransformWidget(KoInteractionTool *tool, QWidget *parent = 0);
/// Sets the unit used by the unit aware child widgets
void setUnit( const KoUnit &unit );
void setUnit(const KoUnit &unit);
private Q_SLOTS:
void resourceChanged( int key, const QVariant & res );
void resourceChanged(int key, const QVariant &res);
void rotationChanged();
void shearXChanged();
void shearYChanged();
......@@ -45,7 +46,7 @@ private Q_SLOTS:
void resetTransformations();
private:
KoInteractionTool* m_tool;
KoInteractionTool *m_tool;
};
#endif
......@@ -28,25 +28,26 @@
class KoInteractionTool;
class DefaultToolWidget : public QWidget, Ui::DefaultToolWidget {
class DefaultToolWidget : public QWidget, Ui::DefaultToolWidget
{
Q_OBJECT