~ubuntu-branches/ubuntu/saucy/rocs/saucy-proposed

« back to all changes in this revision

Viewing changes to RocsCore/Pointer.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg, Rohan Garg, Philip Muškovac
  • Date: 2013-06-21 02:04:20 UTC
  • mfrom: (1.1.27)
  • Revision ID: package-import@ubuntu.com-20130621020420-lzlui9y7qc6w3xog
Tags: 4:4.10.80-0ubuntu1
[ Rohan Garg ]
* New upstream release

[ Philip Muškovac ]
* Build-depend on libgrantlee-dev and libx11-dev
* Update rocs.install and not-installed 

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "QtScriptBackend.h"
26
26
 
27
27
#include <KDebug>
 
28
#include <KLocale>
28
29
#include <QColor>
29
30
#include <boost/weak_ptr.hpp>
30
31
 
62
63
void Pointer::initialize()
63
64
{
64
65
    // register pointer at endpoints and connect to changes
65
 
    d->from->registerOutPointer(getPointer());
66
 
    d->to->registerInPointer(getPointer());
 
66
    d->from->addPointer(getPointer());
 
67
    d->to->addPointer(getPointer());
67
68
    updateRelativeIndex();
68
69
    connect(d->to.get(), SIGNAL(posChanged(QPointF)), this, SIGNAL(posChanged()));
69
70
    connect(d->from.get(), SIGNAL(pointerListChanged()), this, SLOT(updateRelativeIndex()));
70
 
    connect(d->dataStructure.get(), SIGNAL(complexityChanged(bool)), this, SIGNAL(changed()));
 
71
    connect(d->pointerType.get(), SIGNAL(directionChanged(PointerType::Direction)), this, SIGNAL(changed()));
71
72
    connect(d->from.get(), SIGNAL(posChanged(QPointF)), this, SIGNAL(posChanged()));
72
73
 
73
74
    // register properties and connect to changes
83
84
            this, SLOT(renameDynamicProperty(QString,QString)));
84
85
    connect(d->pointerType.get(), SIGNAL(propertyDefaultValueChanged(QString)),
85
86
            this, SLOT(updateDynamicProperty(QString)));
 
87
    connect(d->pointerType.get(), SIGNAL(visibilityChanged(bool)),
 
88
            this, SLOT(setVisible(bool)));
86
89
    connect(d->pointerType.get(), SIGNAL(propertyVisibilityChanged(QString)),
87
90
            this, SLOT(updateDynamicProperty(QString)));
88
91
}
209
212
    return d->pointerType->direction();
210
213
}
211
214
 
 
215
bool Pointer::isDirected() const
 
216
{
 
217
    return (d->pointerType->direction() == PointerType::Unidirectional);
 
218
}
 
219
 
212
220
void Pointer::setVisible(bool visible)
213
221
{
214
222
    d->visible = visible;
267
275
 
268
276
void Pointer::updateDynamicProperty(const QString& property)
269
277
{
270
 
    if (this->property(property.toStdString().c_str()) == QVariant::Invalid
271
 
        || this->property(property.toStdString().c_str()).toString().isEmpty()
 
278
    if (this->property(property.toLatin1()) == QVariant::Invalid
 
279
        || this->property(property.toLatin1()).toString().isEmpty()
272
280
    ) {
273
 
        this->setProperty(property.toStdString().c_str(), d->pointerType->propertyDefaultValue(property));
 
281
        this->setProperty(property.toLatin1(), d->pointerType->propertyDefaultValue(property));
274
282
    }
275
283
    emit propertyChanged(property);
276
284
}
281
289
        kWarning() << "Property identifier \"" << newName << "\" is not valid: aborting";
282
290
        return;
283
291
    }
284
 
    setProperty(newName.toStdString().c_str(), property(oldName.toStdString().c_str()));
285
 
    setProperty(oldName.toStdString().c_str(), QVariant::Invalid);
 
292
    setProperty(newName.toLatin1(), property(oldName.toLatin1()));
 
293
    setProperty(oldName.toLatin1(), QVariant::Invalid);
286
294
}
287
295
 
288
296
QScriptValue Pointer::set_type(int pointerType)