Commit 9afb7a80 authored by Stefan Majewsky's avatar Stefan Majewsky
Browse files

Add ToggleConstraintInteractor.

svn path=/trunk/KDE/kdegames/palapeli/; revision=1118502
parent 8b77baaa
......@@ -18,6 +18,7 @@
#include "interactors.h"
#include "piece.h"
#include "scene.h"
#include "view.h"
#include <QStyle>
......@@ -314,3 +315,21 @@ void Palapeli::RubberBandInteractor::stopInteraction(const Palapeli::MouseEvent&
//END Palapeli::RubberBandInteractor
//BEGIN Palapeli::ToggleConstraintInteractor
Palapeli::ToggleConstraintInteractor::ToggleConstraintInteractor(QGraphicsView* view)
: Palapeli::Interactor(30, Palapeli::MouseInteractor, view) //priority: higher than anything else (this should not depend on what the cursor is currently pointing)
setMetadata(TableInteraction, i18nc("Description (used like a name) for a mouse interaction method", "Toggle lock state of the puzzle table area"), QIcon());
bool Palapeli::ToggleConstraintInteractor::startInteraction(const Palapeli::MouseEvent& event)
Palapeli::Scene* scene = qobject_cast<Palapeli::Scene*>(this->scene());
if (scene)
return (bool) scene;
//END Palapeli::ToggleConstraintInteractor
......@@ -123,6 +123,16 @@ namespace Palapeli
Palapeli::RubberBandItem* m_item;
QPointF m_basePosition;
//This interactor is assigned to nothing by default.
//When the interactor is triggered, the scene constraint is toggled.
class ToggleConstraintInteractor : public Palapeli::Interactor
ToggleConstraintInteractor(QGraphicsView* view);
virtual bool startInteraction(const Palapeli::MouseEvent& event);
......@@ -171,7 +171,7 @@ QByteArray Palapeli::Trigger::serialized() const
QString Palapeli::Trigger::toString() const
const QString actionString = tPrinterData->actionString(m_wheelDirection, m_button);
const QString modifierString = tPrinterData->modifierString(m_modifiers, '|');
const QString modifierString = tPrinterData->modifierString(m_modifiers, '+');
if (modifierString.isEmpty())
return actionString;
......@@ -44,6 +44,7 @@ QMap<QByteArray, Palapeli::Interactor*> Palapeli::TriggerMapper::createInteracto
result["ScrollViewportVert"] = new Palapeli::ScrollViewportInteractor(Qt::Vertical, view);
result["RubberBand"] = new Palapeli::RubberBandInteractor(view);
result["Constraints"] = new Palapeli::ConstraintInteractor(view);
result["ToggleConstraints"] = new Palapeli::ToggleConstraintInteractor(view);
return result;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment