coding style fixes

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=870212
This commit is contained in:
Allen Winter 2008-10-12 01:39:10 +00:00
parent eae853582b
commit e2c26f0a90
8 changed files with 76 additions and 70 deletions

View File

@ -28,7 +28,7 @@ namespace Plasma
class AppletScriptPrivate class AppletScriptPrivate
{ {
public: public:
Applet* applet; Applet *applet;
}; };
AppletScript::AppletScript(QObject *parent) AppletScript::AppletScript(QObject *parent)
@ -48,17 +48,19 @@ void AppletScript::setApplet(Plasma::Applet *applet)
d->applet = applet; d->applet = applet;
} }
Applet* AppletScript::applet() const Applet *AppletScript::applet() const
{ {
Q_ASSERT(d->applet); Q_ASSERT(d->applet);
return d->applet; return d->applet;
} }
void AppletScript::paintInterface(QPainter* painter, const QStyleOptionGraphicsItem* option, const QRect &contentsRect) void AppletScript::paintInterface(QPainter *painter,
const QStyleOptionGraphicsItem *option,
const QRect &contentsRect)
{ {
Q_UNUSED(painter) Q_UNUSED(painter);
Q_UNUSED(option) Q_UNUSED(option);
Q_UNUSED(contentsRect) Q_UNUSED(contentsRect);
} }
QSizeF AppletScript::size() const QSizeF AppletScript::size() const
@ -107,7 +109,7 @@ void AppletScript::configChanged()
{ {
} }
DataEngine* AppletScript::dataEngine(const QString &engine) const DataEngine *AppletScript::dataEngine(const QString &engine) const
{ {
Q_ASSERT(d->applet); Q_ASSERT(d->applet);
return d->applet->dataEngine(engine); return d->applet->dataEngine(engine);
@ -119,7 +121,7 @@ QString AppletScript::mainScript() const
return d->applet->package()->filePath("mainscript"); return d->applet->package()->filePath("mainscript");
} }
const Package* AppletScript::package() const const Package *AppletScript::package() const
{ {
Q_ASSERT(d->applet); Q_ASSERT(d->applet);
return d->applet->package(); return d->applet->package();

View File

@ -20,7 +20,6 @@
#ifndef PLASMA_APPLETSCRIPT_H #ifndef PLASMA_APPLETSCRIPT_H
#define PLASMA_APPLETSCRIPT_H #define PLASMA_APPLETSCRIPT_H
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QRect> #include <QtCore/QRect>
#include <QtCore/QSizeF> #include <QtCore/QSizeF>
@ -68,7 +67,7 @@ public:
/** /**
* Returns the Plasma::Applet associated with this script component * Returns the Plasma::Applet associated with this script component
*/ */
Plasma::Applet* applet() const; Plasma::Applet *applet() const;
/** /**
* Called when the script should paint the applet * Called when the script should paint the applet
@ -76,8 +75,8 @@ public:
* @param painter the QPainter to use * @param painter the QPainter to use
* @param option the style option containing such flags as selection, level of detail, etc * @param option the style option containing such flags as selection, level of detail, etc
*/ */
virtual void paintInterface(QPainter* painter, virtual void paintInterface(QPainter *painter,
const QStyleOptionGraphicsItem* option, const QStyleOptionGraphicsItem *option,
const QRect &contentsRect); const QRect &contentsRect);
/** /**
@ -135,7 +134,7 @@ protected:
* @arg engine name of the engine * @arg engine name of the engine
* @return a data engine associated with this plasmoid * @return a data engine associated with this plasmoid
*/ */
Q_INVOKABLE DataEngine* dataEngine(const QString &engine) const; Q_INVOKABLE DataEngine *dataEngine(const QString &engine) const;
/** /**
* @return absolute path to the main script file for this plasmoid * @return absolute path to the main script file for this plasmoid
@ -147,10 +146,10 @@ protected:
* be used to request resources, such as images and * be used to request resources, such as images and
* interface files. * interface files.
*/ */
const Package* package() const; const Package *package() const;
private: private:
AppletScriptPrivate * const d; AppletScriptPrivate *const d;
}; };
#define K_EXPORT_PLASMA_APPLETSCRIPTENGINE(libname, classname) \ #define K_EXPORT_PLASMA_APPLETSCRIPTENGINE(libname, classname) \

View File

@ -27,7 +27,7 @@ namespace Plasma
class DataEngineScriptPrivate class DataEngineScriptPrivate
{ {
public: public:
DataEngine* dataEngine; DataEngine *dataEngine;
}; };
DataEngineScript::DataEngineScript(QObject *parent) DataEngineScript::DataEngineScript(QObject *parent)
@ -46,25 +46,25 @@ void DataEngineScript::setDataEngine(DataEngine *dataEngine)
d->dataEngine = dataEngine; d->dataEngine = dataEngine;
} }
DataEngine* DataEngineScript::dataEngine() const DataEngine *DataEngineScript::dataEngine() const
{ {
return d->dataEngine; return d->dataEngine;
} }
bool DataEngineScript::sourceRequestEvent(const QString &name) bool DataEngineScript::sourceRequestEvent(const QString &name)
{ {
Q_UNUSED(name) Q_UNUSED(name);
return false; return false;
} }
bool DataEngineScript::updateSourceEvent(const QString& source) bool DataEngineScript::updateSourceEvent(const QString &source)
{ {
Q_UNUSED(source) Q_UNUSED(source);
return false; return false;
} }
void DataEngineScript::setData(const QString& source, const QString& key, void DataEngineScript::setData(const QString &source, const QString &key,
const QVariant& value) const QVariant &value)
{ {
if (d->dataEngine) { if (d->dataEngine) {
d->dataEngine->setData(source, key, value); d->dataEngine->setData(source, key, value);
@ -78,14 +78,14 @@ void DataEngineScript::setData(const QString &source, const QVariant &value)
} }
} }
void DataEngineScript::removeAllData(const QString& source) void DataEngineScript::removeAllData(const QString &source)
{ {
if (d->dataEngine) { if (d->dataEngine) {
d->dataEngine->removeAllData(source); d->dataEngine->removeAllData(source);
} }
} }
void DataEngineScript::removeData(const QString& source, const QString& key) void DataEngineScript::removeData(const QString &source, const QString &key)
{ {
if (d->dataEngine) { if (d->dataEngine) {
d->dataEngine->removeData(source, key); d->dataEngine->removeData(source, key);

View File

@ -59,7 +59,7 @@ public:
/** /**
* Returns the Plasma::DataEngine associated with this script component * Returns the Plasma::DataEngine associated with this script component
*/ */
DataEngine* dataEngine() const; DataEngine *dataEngine() const;
/** /**
* Called when the script should create a source that does not currently * Called when the script should create a source that does not currently
@ -78,14 +78,14 @@ public:
* @return true if the data was changed, or false if there was no * @return true if the data was changed, or false if there was no
* change or if the change will occur later * change or if the change will occur later
**/ **/
virtual bool updateSourceEvent(const QString& source); virtual bool updateSourceEvent(const QString &source);
protected: protected:
void setData(const QString& source, const QString& key, void setData(const QString &source, const QString &key,
const QVariant& value); const QVariant &value);
void setData(const QString &source, const QVariant &value); void setData(const QString &source, const QVariant &value);
void removeAllData(const QString& source); void removeAllData(const QString &source);
void removeData(const QString& source, const QString& key); void removeData(const QString &source, const QString &key);
void setMaxSourceCount(uint limit); void setMaxSourceCount(uint limit);
void setMinimumPollingInterval(int minimumMs); void setMinimumPollingInterval(int minimumMs);
int minimumPollingInterval() const; int minimumPollingInterval() const;
@ -93,7 +93,7 @@ protected:
void removeAllSources(); void removeAllSources();
private: private:
DataEngineScriptPrivate * const d; DataEngineScriptPrivate *const d;
}; };
#define K_EXPORT_PLASMA_DATAENGINESCRIPTENGINE(libname, classname) \ #define K_EXPORT_PLASMA_DATAENGINESCRIPTENGINE(libname, classname) \

View File

@ -28,7 +28,7 @@ namespace Plasma
class RunnerScriptPrivate class RunnerScriptPrivate
{ {
public: public:
AbstractRunner* runner; AbstractRunner *runner;
}; };
RunnerScript::RunnerScript(QObject *parent) RunnerScript::RunnerScript(QObject *parent)
@ -47,23 +47,23 @@ void RunnerScript::setRunner(AbstractRunner *runner)
d->runner = runner; d->runner = runner;
} }
AbstractRunner* RunnerScript::runner() const AbstractRunner *RunnerScript::runner() const
{ {
return d->runner; return d->runner;
} }
void RunnerScript::match(Plasma::RunnerContext &search) void RunnerScript::match(Plasma::RunnerContext &search)
{ {
Q_UNUSED(search) Q_UNUSED(search);
} }
void RunnerScript::run(const Plasma::RunnerContext &search, const Plasma::QueryMatch &action) void RunnerScript::run(const Plasma::RunnerContext &search, const Plasma::QueryMatch &action)
{ {
Q_UNUSED(search) Q_UNUSED(search);
Q_UNUSED(action) Q_UNUSED(action);
} }
const Package* RunnerScript::package() const const Package *RunnerScript::package() const
{ {
return d->runner ? d->runner->package() : 0; return d->runner ? d->runner->package() : 0;
} }

View File

@ -61,7 +61,7 @@ public:
/** /**
* Returns the Plasma::AbstractRunner associated with this script component * Returns the Plasma::AbstractRunner associated with this script component
*/ */
AbstractRunner* runner() const; AbstractRunner *runner() const;
/** /**
* Called when the script should create QueryMatch instances through * Called when the script should create QueryMatch instances through
@ -87,10 +87,10 @@ protected:
* be used to request resources, such as images and * be used to request resources, such as images and
* interface files. * interface files.
*/ */
const Package* package() const; const Package *package() const;
private: private:
RunnerScriptPrivate * const d; RunnerScriptPrivate *const d;
}; };
#define K_EXPORT_PLASMA_RUNNERSCRIPTENGINE(libname, classname) \ #define K_EXPORT_PLASMA_RUNNERSCRIPTENGINE(libname, classname) \

View File

@ -52,7 +52,7 @@ bool ScriptEngine::init()
return true; return true;
} }
const Package* ScriptEngine::package() const const Package *ScriptEngine::package() const
{ {
return 0; return 0;
} }
@ -95,7 +95,8 @@ QStringList knownLanguages(ComponentTypes types)
} }
KService::List offers = KServiceTypeTrader::self()->query("Plasma/ScriptEngine", constraint); KService::List offers = KServiceTypeTrader::self()->query("Plasma/ScriptEngine", constraint);
//kDebug() << "Applet::knownApplets constraint was '" << constraint << "' which got us " << offers.count() << " matches"; //kDebug() << "Applet::knownApplets constraint was '" << constraint
// << "' which got us " << offers.count() << " matches";
QStringList languages; QStringList languages;
foreach (const KService::Ptr &service, offers) { foreach (const KService::Ptr &service, offers) {
@ -148,7 +149,7 @@ KService::List engineOffers(const QString &language, ComponentType type)
return offers; return offers;
} }
ScriptEngine* loadEngine(const QString &language, ComponentType type, QObject *parent) ScriptEngine *loadEngine(const QString &language, ComponentType type, QObject *parent)
{ {
KService::List offers = engineOffers(language, type); KService::List offers = engineOffers(language, type);
@ -176,15 +177,17 @@ ScriptEngine* loadEngine(const QString &language, ComponentType type, QObject *p
return engine; return engine;
} }
kDebug() << "Couldn't load script engine for language " << language << "! error reported: " << error; kDebug() << "Couldn't load script engine for language " << language
<< "! error reported: " << error;
} }
return 0; return 0;
} }
AppletScript* loadScriptEngine(const QString &language, Applet *applet) AppletScript *loadScriptEngine(const QString &language, Applet *applet)
{ {
AppletScript *engine = static_cast<AppletScript*>(loadEngine(language, AppletComponent, applet)); AppletScript *engine =
static_cast<AppletScript*>(loadEngine(language, AppletComponent, applet));
if (engine) { if (engine) {
engine->setApplet(applet); engine->setApplet(applet);
@ -193,9 +196,10 @@ AppletScript* loadScriptEngine(const QString &language, Applet *applet)
return engine; return engine;
} }
DataEngineScript* loadScriptEngine(const QString &language, DataEngine *dataEngine) DataEngineScript *loadScriptEngine(const QString &language, DataEngine *dataEngine)
{ {
DataEngineScript *engine = static_cast<DataEngineScript*>(loadEngine(language, DataEngineComponent, dataEngine)); DataEngineScript *engine =
static_cast<DataEngineScript*>(loadEngine(language, DataEngineComponent, dataEngine));
if (engine) { if (engine) {
engine->setDataEngine(dataEngine); engine->setDataEngine(dataEngine);
@ -204,9 +208,10 @@ DataEngineScript* loadScriptEngine(const QString &language, DataEngine *dataEngi
return engine; return engine;
} }
RunnerScript* loadScriptEngine(const QString &language, AbstractRunner *runner) RunnerScript *loadScriptEngine(const QString &language, AbstractRunner *runner)
{ {
RunnerScript* engine = static_cast<RunnerScript*>(loadEngine(language, RunnerComponent, runner)); RunnerScript *engine =
static_cast<RunnerScript*>(loadEngine(language, RunnerComponent, runner));
if (engine) { if (engine) {
engine->setRunner(runner); engine->setRunner(runner);
@ -218,21 +223,21 @@ RunnerScript* loadScriptEngine(const QString &language, AbstractRunner *runner)
PackageStructure::Ptr defaultPackageStructure(ComponentType type) PackageStructure::Ptr defaultPackageStructure(ComponentType type)
{ {
switch (type) { switch (type) {
case AppletComponent: case AppletComponent:
return PackageStructure::Ptr(new PlasmoidPackage()); return PackageStructure::Ptr(new PlasmoidPackage());
break; break;
case RunnerComponent: case RunnerComponent:
case DataEngineComponent: case DataEngineComponent:
{ {
PackageStructure::Ptr structure(new PackageStructure()); PackageStructure::Ptr structure(new PackageStructure());
structure->addFileDefinition("mainscript", "code/main", i18n("Main Script File")); structure->addFileDefinition("mainscript", "code/main", i18n("Main Script File"));
structure->setRequired("mainscript", true); structure->setRequired("mainscript", true);
return structure; return structure;
break; break;
} }
default: default:
// TODO: we don't have any special structures for other components yet // TODO: we don't have any special structures for other components yet
break; break;
} }
return PackageStructure::Ptr(new PackageStructure()); return PackageStructure::Ptr(new PackageStructure());

View File

@ -85,10 +85,10 @@ protected:
* be used to request resources, such as images and * be used to request resources, such as images and
* interface files. * interface files.
*/ */
virtual const Package* package() const; virtual const Package *package() const;
private: private:
ScriptEnginePrivate * const d; ScriptEnginePrivate *const d;
}; };
/** /**
@ -106,7 +106,7 @@ PLASMA_EXPORT QStringList knownLanguages(ComponentTypes types);
* @return pointer to the AppletScript or 0 on failure; the caller is responsible * @return pointer to the AppletScript or 0 on failure; the caller is responsible
* for the return object which will be parented to the Applet * for the return object which will be parented to the Applet
**/ **/
PLASMA_EXPORT AppletScript* loadScriptEngine(const QString &language, Applet *applet); PLASMA_EXPORT AppletScript *loadScriptEngine(const QString &language, Applet *applet);
/** /**
* Loads an DataEngine script engine for the given language. * Loads an DataEngine script engine for the given language.
@ -116,7 +116,7 @@ PLASMA_EXPORT AppletScript* loadScriptEngine(const QString &language, Applet *ap
* @return pointer to the DataEngineScript or 0 on failure; the caller is responsible * @return pointer to the DataEngineScript or 0 on failure; the caller is responsible
* for the return object which will be parented to the DataEngine * for the return object which will be parented to the DataEngine
**/ **/
PLASMA_EXPORT DataEngineScript* loadScriptEngine(const QString &language, DataEngine *dataEngine); PLASMA_EXPORT DataEngineScript *loadScriptEngine(const QString &language, DataEngine *dataEngine);
/** /**
* Loads an Applet script engine for the given language. * Loads an Applet script engine for the given language.
@ -126,7 +126,7 @@ PLASMA_EXPORT DataEngineScript* loadScriptEngine(const QString &language, DataEn
* @return pointer to the RunnerScript or 0 on failure; the caller is responsible * @return pointer to the RunnerScript or 0 on failure; the caller is responsible
* for the return object which will be parented to the AbstractRunner * for the return object which will be parented to the AbstractRunner
**/ **/
PLASMA_EXPORT RunnerScript* loadScriptEngine(const QString &language, AbstractRunner *runner); PLASMA_EXPORT RunnerScript *loadScriptEngine(const QString &language, AbstractRunner *runner);
/** /**
* Loads an appropriate PackageStructure for the given language and type * Loads an appropriate PackageStructure for the given language and type