create a single timer for storage event compression
This commit is contained in:
parent
97b37637fa
commit
67dbcb59b8
@ -31,6 +31,8 @@ DataContainer::DataContainer(QObject *parent)
|
||||
: QObject(parent),
|
||||
d(new DataContainerPrivate(this))
|
||||
{
|
||||
d->storageTimer = new QTimer(this);
|
||||
QObject::connect(d->storageTimer, SIGNAL(timeOut()), this, SLOT(store()));
|
||||
}
|
||||
|
||||
DataContainer::~DataContainer()
|
||||
@ -59,7 +61,7 @@ void DataContainer::setData(const QString &key, const QVariant &value)
|
||||
//setData() since the last time it was stored. This
|
||||
//gives us only one singleShot timer.
|
||||
if (isStorageEnabled() || !needsToBeStored()) {
|
||||
QTimer::singleShot(180000, this, SLOT(store()));
|
||||
d->storageTimer->start(180000);
|
||||
}
|
||||
|
||||
setNeedsToBeStored(true);
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include "servicejob.h"
|
||||
#include "storage_p.h"
|
||||
|
||||
class QTimer;
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
class ServiceJob;
|
||||
@ -41,7 +43,8 @@ public:
|
||||
enableStorage(false),
|
||||
isStored(true),
|
||||
storageCount(0)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
SignalRelay *signalRelay(const DataContainer *dc, QObject *visualization,
|
||||
uint pollingInterval, Plasma::IntervalAlignment align,
|
||||
@ -68,6 +71,7 @@ public:
|
||||
DataEngine::Data data;
|
||||
QMap<QObject *, SignalRelay *> relayObjects;
|
||||
QMap<uint, SignalRelay *> relays;
|
||||
QTimer *storageTimer;
|
||||
QTime updateTs;
|
||||
Storage* storage;
|
||||
bool dirty : 1;
|
||||
|
Loading…
Reference in New Issue
Block a user