diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2011-09-11 03:31:14 +0200 |
---|---|---|
committer | Javier <javier@pcjavier.(none)> | 2011-09-11 03:31:14 +0200 |
commit | 0d8b5446e880298d89511dd0bc0dbe328ccfce97 (patch) | |
tree | 3146a1ee224cbd0c75975d842b0fca17c5474f08 /fakeproperty.cpp | |
parent | 94ab9634b2306016a8bc50fb3c67aa853481a5c7 (diff) | |
download | glol-master.tar.gz glol-master.zip |
Diffstat (limited to 'fakeproperty.cpp')
-rw-r--r-- | fakeproperty.cpp | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/fakeproperty.cpp b/fakeproperty.cpp index 38d9040..8eea148 100644 --- a/fakeproperty.cpp +++ b/fakeproperty.cpp @@ -1,16 +1,41 @@ #include "fakeproperty.h" -FakeProperty::FakeProperty(const QString& key, const QVariant& value, QObject *parent) : - QObject(parent), _key(key), _value(value) +FakeProperty::FakeProperty(const QString& key, QObject* parent) : + QObject(parent), _key(key), _value(), _timestamp(0) { } -const QString& FakeProperty::key() const +QString FakeProperty::key() const { return _key; } -const QVariant& FakeProperty::value() const +QVariant FakeProperty::value() const { return _value; } + +quint64 FakeProperty::timestamp() const +{ + return _timestamp; +} + +void FakeProperty::setValue(const QVariant &value) +{ + _value = value; + if (_timestamp) { + emit valueChanged(); + } +} + +void FakeProperty::startFaking() +{ + _timestamp = Q_INT64_C(-1); /* To have priority over other providers */ + emit valueChanged(); +} + +void FakeProperty::stopFaking() +{ + _timestamp = 0; /* To stop having priority over other providers */ + emit valueChanged(); +} |