2008-04-29 03:17:12 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2006-2007 Aaron Seigo <aseigo@kde.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DATAENGINE_P_H
|
|
|
|
#define DATAENGINE_P_H
|
|
|
|
|
|
|
|
#include <QQueue>
|
|
|
|
#include <QTime>
|
2008-10-22 00:22:57 +02:00
|
|
|
#include <KPluginInfo>
|
2008-04-29 03:17:12 +02:00
|
|
|
|
|
|
|
class QTime;
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
2008-07-01 20:56:43 +02:00
|
|
|
class DataEnginePrivate
|
2008-04-29 03:17:12 +02:00
|
|
|
{
|
|
|
|
public:
|
2008-10-12 01:28:20 +02:00
|
|
|
DataEnginePrivate(DataEngine *e, KService::Ptr service);
|
2008-08-23 19:42:36 +02:00
|
|
|
~DataEnginePrivate();
|
2008-10-12 01:28:20 +02:00
|
|
|
DataContainer *source(const QString &sourceName, bool createWhenMissing = true);
|
|
|
|
void connectSource(DataContainer *s, QObject *visualization, uint pollingInterval,
|
2008-04-29 03:17:12 +02:00
|
|
|
Plasma::IntervalAlignment align, bool immediateCall = true);
|
2008-10-12 01:28:20 +02:00
|
|
|
DataContainer *requestSource(const QString &sourceName, bool *newSource = 0);
|
2008-04-29 03:17:12 +02:00
|
|
|
void trimQueue();
|
|
|
|
void queueUpdate();
|
|
|
|
void internalUpdateSource(DataContainer*);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reference counting method. Calling this method increases the count
|
|
|
|
* by one.
|
|
|
|
**/
|
|
|
|
void ref();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reference counting method. Calling this method decreases the count
|
|
|
|
* by one.
|
|
|
|
**/
|
|
|
|
void deref();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reference counting method. Used to determine if this DataEngine is
|
|
|
|
* used.
|
|
|
|
* @return true if the reference count is non-zero
|
|
|
|
**/
|
|
|
|
bool isUsed() const;
|
|
|
|
|
2008-10-12 01:28:20 +02:00
|
|
|
DataEngine *q;
|
2008-10-22 00:22:57 +02:00
|
|
|
KPluginInfo dataEngineDescription;
|
2008-04-29 03:17:12 +02:00
|
|
|
int refCount;
|
|
|
|
int updateTimerId;
|
|
|
|
int minPollingInterval;
|
|
|
|
QTime updateTimestamp;
|
|
|
|
DataEngine::SourceDict sources;
|
|
|
|
QQueue<DataContainer*> sourceQueue;
|
2008-10-12 01:28:20 +02:00
|
|
|
QTimer *updateTimer;
|
2008-04-29 03:17:12 +02:00
|
|
|
QString icon;
|
|
|
|
uint limit;
|
|
|
|
bool valid;
|
2008-10-12 01:28:20 +02:00
|
|
|
DataEngineScript *script;
|
2008-04-29 03:17:12 +02:00
|
|
|
QString engineName;
|
|
|
|
Package *package;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // Plasma namespace
|
|
|
|
|
|
|
|
#endif // multiple inclusion guard
|