get rid of the source limiting; wasn't used, only overhead

This commit is contained in:
Aaron Seigo 2011-11-30 12:55:19 +01:00
parent fee7b32974
commit b31a05c41e
5 changed files with 0 additions and 88 deletions

View File

@ -263,26 +263,6 @@ void DataEngine::addSource(DataContainer *source)
scheduleSourcesUpdated();
}
void DataEngine::setMaxSourceCount(uint limit)
{
if (d->limit == limit) {
return;
}
d->limit = limit;
if (d->limit > 0) {
d->trimQueue();
} else {
d->sourceQueue.clear();
}
}
uint DataEngine::maxSourceCount() const
{
return d->limit;
}
void DataEngine::setMinimumPollingInterval(int minimumMs)
{
d->minPollingInterval = minimumMs;
@ -308,19 +288,6 @@ void DataEngine::removeSource(const QString &source)
SourceDict::iterator it = d->sources.find(source);
if (it != d->sources.end()) {
DataContainer *s = it.value();
// remove it from the limit queue if we're keeping one
if (d->limit > 0) {
QQueue<DataContainer*>::iterator it = d->sourceQueue.begin();
while (it != d->sourceQueue.end()) {
if (*it == s) {
d->sourceQueue.erase(it);
break;
}
++it;
}
}
s->d->store();
s->disconnect(this);
s->deleteLater();
@ -519,7 +486,6 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginInfo &info)
checkSourcesTimerId(0),
updateTimerId(0),
minPollingInterval(-1),
limit(0),
valid(true),
script(0),
package(0),
@ -616,17 +582,6 @@ DataContainer *DataEnginePrivate::source(const QString &sourceName, bool createW
DataEngine::SourceDict::const_iterator it = sources.constFind(sourceName);
if (it != sources.constEnd()) {
DataContainer *s = it.value();
if (limit > 0) {
QQueue<DataContainer*>::iterator it = sourceQueue.begin();
while (it != sourceQueue.end()) {
if (*it == s) {
sourceQueue.erase(it);
break;
}
++it;
}
sourceQueue.enqueue(s);
}
return s;
}
@ -642,10 +597,6 @@ DataContainer *DataEnginePrivate::source(const QString &sourceName, bool createW
QObject::connect(s, SIGNAL(updateRequested(DataContainer*)),
q, SLOT(internalUpdateSource(DataContainer*)));
if (limit > 0) {
trimQueue();
sourceQueue.enqueue(s);
}
return s;
}
@ -733,16 +684,6 @@ DataContainer *DataEnginePrivate::requestSource(const QString &sourceName, bool
return s;
}
void DataEnginePrivate::trimQueue()
{
uint queueCount = sourceQueue.count();
while (queueCount >= limit && !sourceQueue.isEmpty()) {
DataContainer *punted = sourceQueue.dequeue();
q->removeSource(punted->objectName());
queueCount = sourceQueue.count();
}
}
// put all setup routines for script here. at this point we can assume that
// package exists and that we have a script engine
void DataEnginePrivate::setupScriptSupport()

View File

@ -215,14 +215,6 @@ NoAlignment) const;
*/
bool isEmpty() const;
/**
* Returns the maximum number of sources this DataEngine will have
* at any given time.
*
* @return the maximum number of sources; zero means no limit.
*/
uint maxSourceCount() const;
/**
* @return the name of the icon for this data engine; and empty string
* is returned if there is no associated icon.
@ -366,15 +358,6 @@ NoAlignment) const;
**/
void addSource(DataContainer *source);
/**
* Sets an upper limit on the number of data sources to keep in this engine.
* If the limit is exceeded, then the oldest data source, as defined by last
* update, is dropped.
*
* @param limit the maximum number of sources to keep active
**/
void setMaxSourceCount(uint limit);
/**
* Sets the minimum amount of time, in milliseconds, that must pass between
* successive updates of data. This can help prevent too many updates happening

View File

@ -20,7 +20,6 @@
#ifndef DATAENGINE_P_H
#define DATAENGINE_P_H
#include <QQueue>
#include <QTime>
#include <kplugininfo.h>
@ -41,7 +40,6 @@ class DataEnginePrivate
void connectSource(DataContainer *s, QObject *visualization, uint pollingInterval,
Plasma::IntervalAlignment align, bool immediateCall = true);
DataContainer *requestSource(const QString &sourceName, bool *newSource = 0);
void trimQueue();
void internalUpdateSource(DataContainer*);
void setupScriptSupport();
@ -109,9 +107,7 @@ class DataEnginePrivate
int minPollingInterval;
QTime updateTimestamp;
DataEngine::SourceDict sources;
QQueue<DataContainer*> sourceQueue;
QString icon;
uint limit;
bool valid;
DataEngineScript *script;
QString engineName;

View File

@ -130,13 +130,6 @@ void DataEngineScript::removeData(const QString &source, const QString &key)
}
}
void DataEngineScript::setMaxSourceCount(uint limit)
{
if (d->dataEngine) {
d->dataEngine->setMaxSourceCount(limit);
}
}
void DataEngineScript::setMinimumPollingInterval(int minimumMs)
{
if (d->dataEngine) {

View File

@ -130,7 +130,6 @@ protected:
void removeAllData(const QString &source);
void removeData(const QString &source, const QString &key);
void setMaxSourceCount(uint limit);
void setMinimumPollingInterval(int minimumMs);
int minimumPollingInterval() const;
void setPollingInterval(uint frequency);