From 3328d293aec317921eccf17d1aae4d1fc6efe4e2 Mon Sep 17 00:00:00 2001 From: "Ryan P. Bitanga" Date: Tue, 8 Jan 2008 00:21:10 +0000 Subject: [PATCH] Give runners priority levels svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=758482 --- abstractrunner.cpp | 28 +++++++++++++++++++++++++++- abstractrunner.h | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 3 deletions(-) diff --git a/abstractrunner.cpp b/abstractrunner.cpp index 23b5b4f4a..8f22e36f9 100644 --- a/abstractrunner.cpp +++ b/abstractrunner.cpp @@ -31,9 +31,14 @@ class AbstractRunner::Private public: bool hasMatchOptions; bool hasConfig; + Priority priority; Speed speed; + int tier; + Private() - : speed(NormalSpeed) + : priority(NormalPriority), + speed(NormalSpeed), + tier(0) {} }; @@ -121,6 +126,27 @@ void AbstractRunner::setSpeed(Speed speed) d->speed = speed; } +// For 4.1: +// int AbstractRunner::tier() const +// { +// return d->tier; +// } +// +// void AbstractRunner::setTier(int tier) +// { +// d->tier = tier; +// } + +AbstractRunner::Priority AbstractRunner::priority() const +{ + return d->priority; +} + +void AbstractRunner::setPriority(Priority priority) +{ + d->priority = priority; +} + void AbstractRunner::exec(Plasma::SearchMatch *action) { Q_UNUSED(action) diff --git a/abstractrunner.h b/abstractrunner.h index 34608d207..b919e830a 100644 --- a/abstractrunner.h +++ b/abstractrunner.h @@ -43,7 +43,15 @@ class PLASMA_EXPORT AbstractRunner : public QObject public: enum Speed { NormalSpeed, - SlowSpeed }; + SlowSpeed + }; + + enum Priority { LowestPriority = 0, + LowPriority, + NormalPriority, + HighPriority, + HighestPriority + }; typedef QList List; @@ -124,8 +132,22 @@ class PLASMA_EXPORT AbstractRunner : public QObject /** * The nominal speed of the runner. + * @see setSpeed */ - Speed speed() const; + Speed speed() const; + +// For 4.1 +// /** +// * The tier of the runner. +// * @see setTier +// */ +// int tier() const; + + /** + * The priority of the runner. + * @see setPriority + */ + Priority priority() const; protected: /** @@ -146,6 +168,20 @@ class PLASMA_EXPORT AbstractRunner : public QObject */ void setSpeed(Speed newSpeed); +//For 4.1 +// /** +// * Sets the run tier of the runner. Higher tier runners execute only +// * after all lower-level runners execute. Call this method if your runner +// * depends on the output of previous runners. +// */ +// void setTier(int tier); + + /** + * Sets the priority of the runner. Lower priority runners are executed + * only after higher priority runners. + */ + void setPriority(Priority newPriority); + private: class Private; Private* const d;