2008-11-04 00:08:39 +01: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-11-04 03:39:56 +01:00
|
|
|
|
|
|
|
#include <kplugininfo.h>
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
class QTime;
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
2009-09-02 04:27:16 +02:00
|
|
|
class Service;
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
class DataEnginePrivate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DataEnginePrivate(DataEngine *e, KService::Ptr service);
|
|
|
|
~DataEnginePrivate();
|
|
|
|
DataContainer *source(const QString &sourceName, bool createWhenMissing = true);
|
|
|
|
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*);
|
2009-11-12 07:38:16 +01:00
|
|
|
void setupScriptSupport();
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
2009-11-12 07:38:16 +01:00
|
|
|
|
2009-09-02 04:27:16 +02:00
|
|
|
/**
|
|
|
|
* @param methods ways to announce this engine on the network.
|
|
|
|
*/
|
|
|
|
void publish(AnnouncementMethods methods, const QString &name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* remove this engine from the network.
|
|
|
|
*/
|
|
|
|
void unpublish(const QString &name = QString());
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return whether or not this engine is published.
|
|
|
|
*/
|
|
|
|
bool isPublished() const;
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2010-06-09 20:04:28 +02:00
|
|
|
/**
|
|
|
|
* a datacontainer has been destroyed, clean up stuff
|
|
|
|
*/
|
|
|
|
void sourceDestroyed(QObject *object);
|
|
|
|
|
2010-07-12 22:51:12 +02:00
|
|
|
/**
|
|
|
|
* stores the source
|
|
|
|
* @param sourceName the name of the source to store
|
|
|
|
*/
|
|
|
|
void storeSource(const QString &sourceName) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* stores all sources marked for storage
|
|
|
|
*/
|
|
|
|
void storeAllSources();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* retrieves source data
|
|
|
|
* @param the data container to populate
|
|
|
|
*/
|
|
|
|
void retrieveStoredData(DataContainer *s);
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
DataEngine *q;
|
|
|
|
KPluginInfo dataEngineDescription;
|
|
|
|
int refCount;
|
2009-05-09 02:32:45 +02:00
|
|
|
int checkSourcesTimerId;
|
2008-11-04 00:08:39 +01:00
|
|
|
int updateTimerId;
|
|
|
|
int minPollingInterval;
|
|
|
|
QTime updateTimestamp;
|
|
|
|
DataEngine::SourceDict sources;
|
|
|
|
QQueue<DataContainer*> sourceQueue;
|
|
|
|
QString icon;
|
|
|
|
uint limit;
|
|
|
|
bool valid;
|
|
|
|
DataEngineScript *script;
|
|
|
|
QString engineName;
|
2010-05-14 19:41:40 +02:00
|
|
|
QString serviceName;
|
2008-11-04 00:08:39 +01:00
|
|
|
Package *package;
|
2009-09-02 04:27:16 +02:00
|
|
|
Service *publishedService;
|
2008-11-04 00:08:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // Plasma namespace
|
|
|
|
|
|
|
|
#endif // multiple inclusion guard
|