first batch of small coding style fixes.

these were found while testing the Krazy style checker, which I'm adapting
for the kdelibs style.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=870051
This commit is contained in:
Allen Winter 2008-10-11 16:19:04 +00:00
parent d96cc1d739
commit e88e2faa63
47 changed files with 600 additions and 535 deletions

View File

@ -58,17 +58,19 @@ class PLASMA_EXPORT AbstractRunner : public QObject
public: public:
/** Specifies a nominal speed for the runner */ /** Specifies a nominal speed for the runner */
enum Speed { SlowSpeed, enum Speed {
NormalSpeed SlowSpeed,
}; NormalSpeed
};
/** Specifies a priority for the runner */ /** Specifies a priority for the runner */
enum Priority { LowestPriority = 0, enum Priority {
LowPriority, LowestPriority = 0,
NormalPriority, LowPriority,
HighPriority, NormalPriority,
HighestPriority HighPriority,
}; HighestPriority
};
/** An ordered list of runners */ /** An ordered list of runners */
typedef QList<AbstractRunner*> List; typedef QList<AbstractRunner*> List;
@ -141,13 +143,13 @@ class PLASMA_EXPORT AbstractRunner : public QObject
/** /**
* Returns the OR'ed value of all the Information types (as defined in RunnerContext::Type) * Returns the OR'ed value of all the Information types (as defined in RunnerContext::Type)
* this runner is not interested in. * this runner is not interested in.
* @return OR'ed value of black listed types * @return OR'ed value of black listed types
*/ */
RunnerContext::Types ignoredTypes() const; RunnerContext::Types ignoredTypes() const;
/** /**
* Sets the types this runner will ignore * Sets the types this runner will ignore
* @param types OR'ed listed of ignored types * @param types OR'ed listed of ignored types
*/ */
void setIgnoredTypes(RunnerContext::Types types); void setIgnoredTypes(RunnerContext::Types types);
@ -175,7 +177,7 @@ class PLASMA_EXPORT AbstractRunner : public QObject
* *
* @return the Package object, or 0 if none * @return the Package object, or 0 if none
**/ **/
const Package* package() const; const Package *package() const;
/** /**
* Signal runner to reload its configuration. * Signal runner to reload its configuration.
@ -191,8 +193,8 @@ class PLASMA_EXPORT AbstractRunner : public QObject
* this constructor can not be called directly. Rather a subclass must * this constructor can not be called directly. Rather a subclass must
* be created * be created
*/ */
explicit AbstractRunner(QObject* parent = 0, const QString& serviceId = QString()); explicit AbstractRunner(QObject *parent = 0, const QString &serviceId = QString());
AbstractRunner(QObject* parent, const QVariantList& args); AbstractRunner(QObject *parent, const QVariantList &args);
/** /**
* Provides access to the runner's configuration object. * Provides access to the runner's configuration object.
@ -232,13 +234,13 @@ class PLASMA_EXPORT AbstractRunner : public QObject
KService::List serviceQuery(const QString &serviceType, KService::List serviceQuery(const QString &serviceType,
const QString &constraint = QString()) const; const QString &constraint = QString()) const;
QMutex* bigLock() const; QMutex *bigLock() const;
protected Q_SLOTS: protected Q_SLOTS:
void init(); void init();
private: private:
AbstractRunnerPrivate* const d; AbstractRunnerPrivate *const d;
}; };
} // Plasma namespace } // Plasma namespace
@ -248,7 +250,6 @@ K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(factory("plasma_runner_" #libname)) \ K_EXPORT_PLUGIN(factory("plasma_runner_" #libname)) \
K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION) K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
#define K_EXPORT_RUNNER_CONFIG( name, classname ) \ #define K_EXPORT_RUNNER_CONFIG( name, classname ) \
K_PLUGIN_FACTORY(ConfigFactory, registerPlugin<classname>();) \ K_PLUGIN_FACTORY(ConfigFactory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(ConfigFactory("kcm_krunner_" #name)) \ K_EXPORT_PLUGIN(ConfigFactory("kcm_krunner_" #name)) \

View File

@ -1,6 +1,6 @@
/* /*
* Copyright 2007 Aaron Seigo <aseigo@kde.org> * Copyright 2007 Aaron Seigo <aseigo@kde.org>
* 2007 Alexis Ménard <darktears31@gmail.com> * Copyright 2007 Alexis Ménard <darktears31@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as * it under the terms of the GNU Library General Public License as
@ -57,20 +57,22 @@ public:
virtual Animator::CurveShape elementAnimationCurve(Plasma::Animator::Animation) const; virtual Animator::CurveShape elementAnimationCurve(Plasma::Animator::Animation) const;
// Element animations // Element animations
virtual QPixmap elementAppear(qreal progress, const QPixmap& pixmap); virtual QPixmap elementAppear(qreal progress, const QPixmap &pixmap);
virtual QPixmap elementDisappear(qreal progress, const QPixmap& pixmap); virtual QPixmap elementDisappear(qreal progress, const QPixmap &pixmap);
// Item animations // Item animations
virtual void itemAppear(qreal progress, QGraphicsItem* item); virtual void itemAppear(qreal progress, QGraphicsItem *item);
virtual void itemDisappear(qreal progress, QGraphicsItem* item); virtual void itemDisappear(qreal progress, QGraphicsItem *item);
virtual void itemActivated(qreal progress, QGraphicsItem* item); virtual void itemActivated(qreal progress, QGraphicsItem *item);
// Item movements // Item movements
virtual void itemSlideIn(qreal progress, QGraphicsItem* item, const QPoint &start, const QPoint &destination); virtual void itemSlideIn(qreal progress, QGraphicsItem *item,
virtual void itemSlideOut(qreal progress, QGraphicsItem* item, const QPoint &start, const QPoint &destination); const QPoint &start, const QPoint &destination);
virtual void itemSlideOut(qreal progress, QGraphicsItem *item,
const QPoint &start, const QPoint &destination);
private: private:
AnimationDriverPrivate * const d; AnimationDriverPrivate *const d;
}; };
} // Plasma namespace } // Plasma namespace

View File

@ -42,29 +42,27 @@ class AnimatorPrivate;
class PLASMA_EXPORT Animator : public QObject class PLASMA_EXPORT Animator : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_ENUMS( Animation ) Q_ENUMS(Animation)
Q_ENUMS( CurveShape ) Q_ENUMS(CurveShape)
Q_ENUMS( Movement ) Q_ENUMS(Movement)
public: public:
enum Animation enum Animation {
{ AppearAnimation = 0, /*<< Animate the appearance of an element */
AppearAnimation = 0 /*<< Animate the appearance of an element */, DisappearAnimation, /*<< Animate the disappearance of an element */
DisappearAnimation /*<< Animate the disappearance of an element */, ActivateAnimation /*<< When something is activated or launched,
ActivateAnimation /*<< When something is activated or launched, such as an app icon being clicked */ such as an app icon being clicked */
}; };
enum CurveShape enum CurveShape {
{
EaseInCurve = 0, EaseInCurve = 0,
EaseOutCurve, EaseOutCurve,
EaseInOutCurve, EaseInOutCurve,
LinearCurve LinearCurve
}; };
enum Movement enum Movement {
{
SlideInMovement = 0, SlideInMovement = 0,
SlideOutMovement, SlideOutMovement,
FastSlideInMovement, FastSlideInMovement,
@ -74,7 +72,7 @@ public:
/** /**
* Singleton accessor * Singleton accessor
**/ **/
static Animator* self(); static Animator *self();
/** /**
* Starts a standard animation on a QGraphicsItem. * Starts a standard animation on a QGraphicsItem.
@ -83,7 +81,7 @@ public:
* @arg anim the type of animation to perform * @arg anim the type of animation to perform
* @return the id of the animation * @return the id of the animation
**/ **/
Q_INVOKABLE int animateItem(QGraphicsItem* item, Animation anim); Q_INVOKABLE int animateItem(QGraphicsItem *item, Animation anim);
/** /**
* Stops an item animation before the animation is complete. * Stops an item animation before the animation is complete.
@ -101,7 +99,7 @@ public:
* @arg anim the type of animation to perform * @arg anim the type of animation to perform
* @return the id of the animation * @return the id of the animation
**/ **/
Q_INVOKABLE int moveItem(QGraphicsItem* item, Movement movement, const QPoint &destination); Q_INVOKABLE int moveItem(QGraphicsItem *item, Movement movement, const QPoint &destination);
/** /**
* Stops an item movement before the animation is complete. * Stops an item movement before the animation is complete.
@ -130,7 +128,7 @@ public:
* @return an id that can be used to identify this animation. * @return an id that can be used to identify this animation.
*/ */
Q_INVOKABLE int customAnimation(int frames, int duration, Animator::CurveShape curve, Q_INVOKABLE int customAnimation(int frames, int duration, Animator::CurveShape curve,
QObject* receiver, const char* method); QObject *receiver, const char *method);
/** /**
* Stops a custom animation. Note that it is not necessary to call * Stops a custom animation. Note that it is not necessary to call

View File

@ -134,7 +134,7 @@ Applet::~Applet()
//which isn't very nice. //which isn't very nice.
foreach (ExtenderItem *item, d->extender->attachedItems()) { foreach (ExtenderItem *item, d->extender->attachedItems()) {
if (!item->isDetached() || item->autoExpireDelay()) { if (!item->isDetached() || item->autoExpireDelay()) {
//destroy temporary extender items, or items that aren't detached, so their //destroy temporary extender items, or items that aren't detached, so their
//configuration won't linger after a plasma restart. //configuration won't linger after a plasma restart.
item->destroy(); item->destroy();
} }
@ -991,7 +991,7 @@ void Applet::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW
} }
void Applet::paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, void Applet::paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option,
const QRect & contentsRect) const QRect &contentsRect)
{ {
if (d->script) { if (d->script) {
d->script->paintInterface(painter, option, contentsRect); d->script->paintInterface(painter, option, contentsRect);
@ -1073,7 +1073,7 @@ void Applet::removeAssociatedWidget(QWidget *widget)
Location Applet::location() const Location Applet::location() const
{ {
Containment* c = containment(); Containment *c = containment();
return c ? c->d->location : Plasma::Desktop; return c ? c->d->location : Plasma::Desktop;
} }

View File

@ -89,12 +89,18 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
/** /**
* Description on how draw a background for the applet * Description on how draw a background for the applet
*/ */
enum BackgroundHint { NoBackground = 0 /** Not drawing a background under the applet, the applet has its own implementation */, enum BackgroundHint {
StandardBackground = 1 /** The standard background from the theme is drawn */, NoBackground = 0, /** Not drawing a background under the
TranslucentBackground = 2 /** An alternate version of the background is drawn, usually more translucent */, applet, the applet has its own implementation */
ShadowedBackground = 4 /** The applet has a drop shadow */, StandardBackground = 1, /** The standard background from the theme is drawn */
DefaultBackground = StandardBackground | ShadowedBackground /** Default settings: both standard background and shadow */ TranslucentBackground = 2,/** An alternate version of the background is drawn,
}; usually more translucent */
ShadowedBackground = 4, /** The applet has a drop shadow */
DefaultBackground = StandardBackground | ShadowedBackground
/** Default settings:
both standard background
and shadow */
};
Q_DECLARE_FLAGS(BackgroundHints, BackgroundHint) Q_DECLARE_FLAGS(BackgroundHints, BackgroundHint)
~Applet(); ~Applet();
@ -164,7 +170,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
* *
* @return config skeleton object, or 0 if none * @return config skeleton object, or 0 if none
**/ **/
ConfigXml* configScheme() const; ConfigXml *configScheme() const;
/** /**
* Loads the given DataEngine * Loads the given DataEngine
@ -183,7 +189,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
* or an invalid data engine if the requested engine * or an invalid data engine if the requested engine
* could not be loaded * could not be loaded
*/ */
Q_INVOKABLE DataEngine* dataEngine(const QString& name) const; Q_INVOKABLE DataEngine *dataEngine(const QString &name) const;
/** /**
* Accessor for the associated Package object if any. * Accessor for the associated Package object if any.
@ -191,7 +197,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
* *
* @return the Package object, or 0 if none * @return the Package object, or 0 if none
**/ **/
const Package* package() const; const Package *package() const;
/** /**
* Returns the view this widget is visible on * Returns the view this widget is visible on
@ -296,7 +302,8 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
* @return list of categories * @return list of categories
* @param visibleOnly true if it should only return applets that are marked as visible * @param visibleOnly true if it should only return applets that are marked as visible
*/ */
static QStringList listCategories(const QString &parentApp = QString(), bool visibleOnly = true); static QStringList listCategories(const QString &parentApp = QString(),
bool visibleOnly = true);
/** /**
* Attempts to load an applet * Attempts to load an applet
@ -311,8 +318,8 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
* @param args to send the applet extra arguments * @param args to send the applet extra arguments
* @return a pointer to the loaded applet, or 0 on load failure * @return a pointer to the loaded applet, or 0 on load failure
**/ **/
static Applet* load(const QString &name, uint appletId = 0, static Applet *load(const QString &name, uint appletId = 0,
const QVariantList& args = QVariantList()); const QVariantList &args = QVariantList());
/** /**
* Attempts to load an applet * Attempts to load an applet
@ -327,22 +334,22 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
* @param args to send the applet extra arguments * @param args to send the applet extra arguments
* @return a pointer to the loaded applet, or 0 on load failure * @return a pointer to the loaded applet, or 0 on load failure
**/ **/
static Applet* load(const KPluginInfo& info, uint appletId = 0, static Applet *load(const KPluginInfo &info, uint appletId = 0,
const QVariantList& args = QVariantList()); const QVariantList &args = QVariantList());
/** /**
* Get the category of the given applet * Get the category of the given applet
* *
* @param applet a KPluginInfo object for the applet * @param applet a KPluginInfo object for the applet
*/ */
static QString category(const KPluginInfo& applet); static QString category(const KPluginInfo &applet);
/** /**
* Get the category of the given applet * Get the category of the given applet
* *
* @param appletName the name of the applet * @param appletName the name of the applet
*/ */
static QString category(const QString& appletName); static QString category(const QString &appletName);
/** /**
* This method is called when the interface should be painted. * This method is called when the interface should be painted.
@ -354,7 +361,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
**/ **/
virtual void paintInterface(QPainter *painter, virtual void paintInterface(QPainter *painter,
const QStyleOptionGraphicsItem *option, const QStyleOptionGraphicsItem *option,
const QRect& contentsRect); const QRect &contentsRect);
/** /**
* Returns the user-visible name for the applet, as specified in the * Returns the user-visible name for the applet, as specified in the
@ -398,7 +405,8 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
*/ */
ImmutabilityType immutability() const; ImmutabilityType immutability() const;
void paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paintWindowFrame(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget);
/** /**
* If for some reason, the applet fails to get up on its feet (the * If for some reason, the applet fails to get up on its feet (the
@ -432,7 +440,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
/** /**
* Returns the QAction with the given name from our collection * Returns the QAction with the given name from our collection
*/ */
QAction* action(QString name) const; QAction *action(QString name) const;
/** /**
* Adds the action to our collection under the given name * Adds the action to our collection under the given name
@ -472,12 +480,14 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
* Reimplemented from QGraphicsItem * Reimplemented from QGraphicsItem
**/ **/
int type() const; int type() const;
enum { Type = Plasma::AppletType }; enum {
Type = Plasma::AppletType
};
/** /**
* @return the Containment, if any, this applet belongs to * @return the Containment, if any, this applet belongs to
**/ **/
Containment* containment() const; Containment *containment() const;
/** /**
* Sets the global shorcut to associate with this widget. * Sets the global shorcut to associate with this widget.
@ -509,8 +519,8 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
* @param appletId a unique id used to differentiate between multiple * @param appletId a unique id used to differentiate between multiple
* instances of the same Applet type * instances of the same Applet type
*/ */
explicit Applet(QGraphicsItem* parent = 0, explicit Applet(QGraphicsItem *parent = 0,
const QString& serviceId = QString(), const QString &serviceId = QString(),
uint appletId = 0); uint appletId = 0);
Q_SIGNALS: Q_SIGNALS:
@ -551,7 +561,8 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
public Q_SLOTS: public Q_SLOTS:
/** /**
* Sets the immutability type for this applet (not immutable, user immutable or system immutable) * Sets the immutability type for this applet (not immutable,
* user immutable or system immutable)
* @arg immutable the new immutability type of this applet * @arg immutable the new immutability type of this applet
*/ */
void setImmutability(const ImmutabilityType immutable); void setImmutability(const ImmutabilityType immutable);
@ -639,7 +650,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
* @param args a list of strings containing two entries: the service id * @param args a list of strings containing two entries: the service id
* and the applet id * and the applet id
*/ */
Applet(QObject* parent, const QVariantList& args); Applet(QObject *parent, const QVariantList &args);
/** /**
* Call this method when the applet fails to launch properly. An * Call this method when the applet fails to launch properly. An
@ -653,7 +664,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
* @param reason an optional reason to show the user why the applet * @param reason an optional reason to show the user why the applet
* failed to launch * failed to launch
**/ **/
void setFailedToLaunch(bool failed, const QString& reason = QString()); void setFailedToLaunch(bool failed, const QString &reason = QString());
/** /**
* When called, the Applet should write any information needed as part * When called, the Applet should write any information needed as part
@ -689,7 +700,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
* @param needsConfiguring true if the applet needs to be configured, * @param needsConfiguring true if the applet needs to be configured,
* or false if it doesn't * or false if it doesn't
*/ */
void setConfigurationRequired(bool needsConfiguring, const QString& reason = QString()); void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
/** /**
* Reimplement this method so provide a configuration interface, * Reimplement this method so provide a configuration interface,
@ -715,7 +726,6 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
*/ */
virtual void constraintsEvent(Plasma::Constraints constraints); virtual void constraintsEvent(Plasma::Constraints constraints);
/** /**
* Register the widgets that manage mouse clicks but you still want * Register the widgets that manage mouse clicks but you still want
* to be able to drag the applet around when holding the mouse pointer * to be able to drag the applet around when holding the mouse pointer
@ -743,12 +753,12 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
/** /**
* @internal event filter; used for focus watching * @internal event filter; used for focus watching
**/ **/
bool eventFilter( QObject *o, QEvent *e ); bool eventFilter(QObject *o, QEvent *e);
/** /**
* @internal scene event filter; used to manage applet dragging * @internal scene event filter; used to manage applet dragging
*/ */
bool sceneEventFilter ( QGraphicsItem * watched, QEvent * event ); bool sceneEventFilter (QGraphicsItem *watched, QEvent *event);
/** /**
* @internal manage the mouse movement to drag the applet around * @internal manage the mouse movement to drag the applet around
@ -804,7 +814,8 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
Q_PRIVATE_SLOT(d, void setFocus()) Q_PRIVATE_SLOT(d, void setFocus())
Q_PRIVATE_SLOT(d, void checkImmutability()) Q_PRIVATE_SLOT(d, void checkImmutability())
Q_PRIVATE_SLOT(d, void themeChanged()) Q_PRIVATE_SLOT(d, void themeChanged())
Q_PRIVATE_SLOT(d, void appletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim)) Q_PRIVATE_SLOT(d, void appletAnimationComplete(QGraphicsItem *item,
Plasma::Animator::Animation anim))
Q_PRIVATE_SLOT(d, void selectItemToDestroy()) Q_PRIVATE_SLOT(d, void selectItemToDestroy())
Q_PRIVATE_SLOT(d, void updateRect(const QRectF& rect)) Q_PRIVATE_SLOT(d, void updateRect(const QRectF& rect))
@ -813,7 +824,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
**/ **/
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
AppletPrivate* const d; AppletPrivate *const d;
//Corona needs to access setFailedToLaunch and init //Corona needs to access setFailedToLaunch and init
friend class Corona; friend class Corona;

View File

@ -46,7 +46,7 @@ namespace Plasma
class AppletBrowserWidgetPrivate class AppletBrowserWidgetPrivate
{ {
public: public:
AppletBrowserWidgetPrivate(AppletBrowserWidget* w) AppletBrowserWidgetPrivate(AppletBrowserWidget *w)
: q(w), : q(w),
containment(0), containment(0),
appletList(0), appletList(0),
@ -65,12 +65,12 @@ public:
/** /**
* Tracks a new running applet * Tracks a new running applet
*/ */
void appletAdded(Plasma::Applet* applet); void appletAdded(Plasma::Applet *applet);
/** /**
* A running applet is no more * A running applet is no more
*/ */
void appletRemoved(Plasma::Applet* applet); void appletRemoved(Plasma::Applet *applet);
AppletBrowserWidget *q; AppletBrowserWidget *q;
QString application; QString application;
@ -128,7 +128,7 @@ void AppletBrowserWidgetPrivate::initFilters()
filterModel.addSeparator(i18n("Categories:")); filterModel.addSeparator(i18n("Categories:"));
foreach (const QString& category, Plasma::Applet::listCategories(application)) { foreach (const QString &category, Plasma::Applet::listCategories(application)) {
filterModel.addFilter(category, filterModel.addFilter(category,
KCategorizedItemsViewModels::Filter("category", category)); KCategorizedItemsViewModels::Filter("category", category));
} }
@ -201,7 +201,7 @@ void AppletBrowserWidgetPrivate::initRunningApplets()
itemModel.setRunningApplets(runningApplets); itemModel.setRunningApplets(runningApplets);
} }
void AppletBrowserWidget::setApplication(const QString& app) void AppletBrowserWidget::setApplication(const QString &app)
{ {
d->application = app; d->application = app;
d->initFilters(); d->initFilters();
@ -260,7 +260,7 @@ void AppletBrowserWidget::addApplet()
} }
} }
void AppletBrowserWidgetPrivate::appletAdded(Plasma::Applet* applet) void AppletBrowserWidgetPrivate::appletAdded(Plasma::Applet *applet)
{ {
QString name = applet->name(); QString name = applet->name();
//kDebug() << name; //kDebug() << name;
@ -270,10 +270,10 @@ void AppletBrowserWidgetPrivate::appletAdded(Plasma::Applet* applet)
itemModel.setRunningApplets(name, runningApplets[name]); itemModel.setRunningApplets(name, runningApplets[name]);
} }
void AppletBrowserWidgetPrivate::appletRemoved(Plasma::Applet* applet) void AppletBrowserWidgetPrivate::appletRemoved(Plasma::Applet *applet)
{ {
//kDebug() << (QObject*)applet; //kDebug() << (QObject*)applet;
Plasma::Applet* a = (Plasma::Applet*)applet; //don't care if it's valid, just need the address Plasma::Applet *a = (Plasma::Applet *)applet; //don't care if it's valid, just need the address
QString name = appletNames.take(a); QString name = appletNames.take(a);
@ -394,9 +394,9 @@ AppletBrowser::~AppletBrowser()
saveDialogSize(cg); saveDialogSize(cg);
} }
void AppletBrowser::setApplication(const QString& app) void AppletBrowser::setApplication(const QString &app)
{ {
d->widget->setApplication( app ); d->widget->setApplication(app);
} }
QString AppletBrowser::application() QString AppletBrowser::application()
@ -409,7 +409,7 @@ void AppletBrowser::setContainment(Plasma::Containment *containment)
d->widget->setContainment(containment); d->widget->setContainment(containment);
} }
Containment* AppletBrowser::containment() const Containment *AppletBrowser::containment() const
{ {
return d->widget->containment(); return d->widget->containment();
} }

View File

@ -40,7 +40,7 @@ public:
explicit AppletBrowserWidget(QWidget *parent = 0, Qt::WindowFlags f = 0); explicit AppletBrowserWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
virtual ~AppletBrowserWidget(); virtual ~AppletBrowserWidget();
void setApplication(const QString& application = QString()); void setApplication(const QString &application = QString());
QString application(); QString application();
/** /**
@ -53,7 +53,7 @@ public:
/** /**
* @return the current default containment to add applets to * @return the current default containment to add applets to
*/ */
Containment* containment() const; Containment *containment() const;
public Q_SLOTS: public Q_SLOTS:
/** /**
@ -91,7 +91,7 @@ public:
explicit AppletBrowser(QWidget *parent = 0, Qt::WindowFlags f = 0); explicit AppletBrowser(QWidget *parent = 0, Qt::WindowFlags f = 0);
virtual ~AppletBrowser(); virtual ~AppletBrowser();
void setApplication(const QString& application = QString()); void setApplication(const QString &application = QString());
QString application(); QString application();
/** /**
@ -104,7 +104,7 @@ public:
/** /**
* @return the current default containment to add applets to * @return the current default containment to add applets to
*/ */
Containment* containment() const; Containment *containment() const;
private: private:
AppletBrowserPrivate * const d; AppletBrowserPrivate * const d;

View File

@ -113,7 +113,7 @@ public:
* @arg key the configuration key to find * @arg key the configuration key to find
* @return the associated KConfigSkeletonItem, or 0 if none * @return the associated KConfigSkeletonItem, or 0 if none
*/ */
KConfigSkeletonItem* findItem(const QString &group, const QString &key); KConfigSkeletonItem *findItem(const QString &group, const QString &key);
/** /**
* Check to see if a group exists * Check to see if a group exists

View File

@ -86,8 +86,8 @@ Containment::StyleOption::StyleOption(const QStyleOptionGraphicsItem &other)
type = Type; type = Type;
} }
Containment::Containment(QGraphicsItem* parent, Containment::Containment(QGraphicsItem *parent,
const QString& serviceId, const QString &serviceId,
uint containmentId) uint containmentId)
: Applet(parent, serviceId, containmentId), : Applet(parent, serviceId, containmentId),
d(new ContainmentPrivate(this)) d(new ContainmentPrivate(this))
@ -99,7 +99,7 @@ Containment::Containment(QGraphicsItem* parent,
setContainmentType(CustomContainment); setContainmentType(CustomContainment);
} }
Containment::Containment(QObject* parent, const QVariantList& args) Containment::Containment(QObject *parent, const QVariantList &args)
: Applet(parent, args), : Applet(parent, args),
d(new ContainmentPrivate(this)) d(new ContainmentPrivate(this))
{ {
@ -367,7 +367,7 @@ void Containment::setContainmentType(Containment::Type type)
} }
} }
Corona* Containment::corona() const Corona *Containment::corona() const
{ {
return dynamic_cast<Corona*>(scene()); return dynamic_cast<Corona*>(scene());
} }
@ -376,7 +376,7 @@ void Containment::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{ {
event->ignore(); event->ignore();
if (d->wallpaper) { if (d->wallpaper) {
QGraphicsItem* item = scene()->itemAt(event->scenePos()); QGraphicsItem *item = scene()->itemAt(event->scenePos());
if (item == this) { if (item == this) {
d->wallpaper->mouseMoveEvent(event); d->wallpaper->mouseMoveEvent(event);
} }
@ -392,7 +392,7 @@ void Containment::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
event->ignore(); event->ignore();
if (d->wallpaper) { if (d->wallpaper) {
QGraphicsItem* item = scene()->itemAt(event->scenePos()); QGraphicsItem *item = scene()->itemAt(event->scenePos());
if (item == this) { if (item == this) {
d->wallpaper->mousePressEvent(event); d->wallpaper->mousePressEvent(event);
} }
@ -410,7 +410,7 @@ void Containment::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
event->ignore(); event->ignore();
if (d->wallpaper) { if (d->wallpaper) {
QGraphicsItem* item = scene()->itemAt(event->scenePos()); QGraphicsItem *item = scene()->itemAt(event->scenePos());
if (item == this) { if (item == this) {
d->wallpaper->mouseReleaseEvent(event); d->wallpaper->mouseReleaseEvent(event);
} }
@ -427,7 +427,7 @@ void Containment::showContextMenu(const QPointF &containmentPos, const QPoint &s
d->showContextMenu(mapToScene(containmentPos), screenPos, false); d->showContextMenu(mapToScene(containmentPos), screenPos, false);
} }
void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent* event) void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
//kDebug() << "let's see if we manage to get a context menu here, huh"; //kDebug() << "let's see if we manage to get a context menu here, huh";
if (!isContainment() || !scene() || !KAuthorized::authorizeKAction("desktop_contextmenu")) { if (!isContainment() || !scene() || !KAuthorized::authorizeKAction("desktop_contextmenu")) {
@ -471,7 +471,7 @@ bool ContainmentPrivate::showContextMenu(const QPointF &point, const QPoint &scr
if (includeApplet) { if (includeApplet) {
actions = applet->contextualActions(); actions = applet->contextualActions();
if (!actions.isEmpty()) { if (!actions.isEmpty()) {
foreach(QAction* action, actions) { foreach (QAction *action, actions) {
if (action) { if (action) {
desktopMenu.addAction(action); desktopMenu.addAction(action);
} }
@ -1176,7 +1176,7 @@ void Containment::removeAssociatedWidget(QWidget *widget)
d->focusedApplet->removeAssociatedWidget(widget); d->focusedApplet->removeAssociatedWidget(widget);
} }
foreach (const Applet* applet, d->applets) { foreach (const Applet *applet, d->applets) {
if (applet->d->activationAction) { if (applet->d->activationAction) {
widget->removeAction(applet->d->activationAction); widget->removeAction(applet->d->activationAction);
} }
@ -1380,7 +1380,7 @@ void Containment::destroy(bool confirm)
//FIXME maybe that %1 should be the containment type not the name //FIXME maybe that %1 should be the containment type not the name
if (!confirm || if (!confirm ||
KMessageBox::warningContinueCancel(view(), i18n("Do you really want to remove this %1?", name()), KMessageBox::warningContinueCancel(view(), i18n("Do you really want to remove this %1?", name()),
i18n("Remove %1", name()), KStandardGuiItem::remove()) == KMessageBox::Continue ) { i18n("Remove %1", name()), KStandardGuiItem::remove()) == KMessageBox::Continue) {
//clearApplets(); //clearApplets();
Applet::destroy(); Applet::destroy();
} }
@ -1420,7 +1420,7 @@ void ContainmentPrivate::toggleDesktopImmutability()
QMap<Applet*, AppletHandle*> h = handles; QMap<Applet*, AppletHandle*> h = handles;
handles.clear(); handles.clear();
foreach (AppletHandle* handle, h) { foreach (AppletHandle *handle, h) {
handle->disconnect(q); handle->disconnect(q);
handle->deleteLater(); handle->deleteLater();
} }

View File

@ -78,8 +78,12 @@ class PLASMA_EXPORT Containment : public Applet
explicit StyleOption(const StyleOption &other); explicit StyleOption(const StyleOption &other);
explicit StyleOption(const QStyleOptionGraphicsItem &other); explicit StyleOption(const QStyleOptionGraphicsItem &other);
enum StyleOptionType { Type = SO_CustomBase + 1 }; enum StyleOptionType {
enum StyleOptionVersion { Version = QStyleOptionGraphicsItem::Version + 1 }; Type = SO_CustomBase + 1
};
enum StyleOptionVersion {
Version = QStyleOptionGraphicsItem::Version + 1
};
/** /**
* The View, if any, that this containment is currently * The View, if any, that this containment is currently
@ -89,13 +93,14 @@ class PLASMA_EXPORT Containment : public Applet
Plasma::View *view; Plasma::View *view;
}; };
enum Type { NoContainmentType = -1 /**< @internal */, enum Type {
DesktopContainment = 0 /**< A desktop containment */, NoContainmentType = -1, /**< @internal */
PanelContainment /**< A desktop panel */, DesktopContainment = 0, /**< A desktop containment */
CustomContainment = 127 /**< A containment that is neither a desktop nor a panel, PanelContainment, /**< A desktop panel */
but something application specific */, CustomContainment = 127, /**< A containment that is neither a desktop nor a panel
CustomPanelContainment = 128 /**< A customized desktop panel */ but something application specific */
}; CustomPanelContainment = 128 /**< A customized desktop panel */
};
/** /**
* @param parent the QGraphicsItem this applet is parented to * @param parent the QGraphicsItem this applet is parented to
@ -135,7 +140,7 @@ class PLASMA_EXPORT Containment : public Applet
/** /**
* Returns the Corona (if any) that this Containment is hosted by * Returns the Corona (if any) that this Containment is hosted by
*/ */
Corona* corona() const; Corona *corona() const;
/** /**
* Returns a list of all known containments. * Returns a list of all known containments.
@ -174,7 +179,7 @@ class PLASMA_EXPORT Containment : public Applet
* *
* @return a pointer to the applet on success, or 0 on failure * @return a pointer to the applet on success, or 0 on failure
*/ */
Applet* addApplet(const QString &name, const QVariantList &args = QVariantList(), Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(),
const QRectF &geometry = QRectF(-1, -1, -1, -1)); const QRectF &geometry = QRectF(-1, -1, -1, -1));
/** /**
@ -295,7 +300,7 @@ class PLASMA_EXPORT Containment : public Applet
/** /**
* Return wallpaper plugin. * Return wallpaper plugin.
*/ */
Plasma::Wallpaper* wallpaper() const; Plasma::Wallpaper *wallpaper() const;
/** /**
* Sets the current activity by name * Sets the current activity by name
@ -488,7 +493,8 @@ class PLASMA_EXPORT Containment : public Applet
private: private:
Q_PRIVATE_SLOT(d, void appletDestroyed(QObject*)) Q_PRIVATE_SLOT(d, void appletDestroyed(QObject*))
Q_PRIVATE_SLOT(d, void containmentAppletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim)) Q_PRIVATE_SLOT(d, void containmentAppletAnimationComplete(QGraphicsItem *item,
Plasma::Animator::Animation anim))
Q_PRIVATE_SLOT(d, void triggerShowAddWidgets()) Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
Q_PRIVATE_SLOT(d, void handleDisappeared(AppletHandle *handle)) Q_PRIVATE_SLOT(d, void handleDisappeared(AppletHandle *handle))
Q_PRIVATE_SLOT(d, void positionToolBox()) Q_PRIVATE_SLOT(d, void positionToolBox())
@ -500,10 +506,9 @@ class PLASMA_EXPORT Containment : public Applet
friend class AppletPrivate; friend class AppletPrivate;
friend class CoronaPrivate; friend class CoronaPrivate;
friend class ContainmentPrivate; friend class ContainmentPrivate;
ContainmentPrivate* const d; ContainmentPrivate *const d;
}; };
} // Plasma namespace } // Plasma namespace
#endif // multiple inclusion guard #endif // multiple inclusion guard

View File

@ -88,14 +88,14 @@ public:
* *
* @return a pointer to the containment on success, or 0 on failure * @return a pointer to the containment on success, or 0 on failure
*/ */
Containment* addContainment(const QString& name, const QVariantList& args = QVariantList()); Containment *addContainment(const QString &name, const QVariantList &args = QVariantList());
/** /**
* Returns the Containment, if any, for a given physical screen * Returns the Containment, if any, for a given physical screen
* *
* @param screen number of the physical screen to locate * @param screen number of the physical screen to locate
*/ */
Containment* containmentForScreen(int screen) const; Containment *containmentForScreen(int screen) const;
/** /**
* Adds a widget in the topleft quadrant in the scene. Widgets in the topleft quadrant are * Adds a widget in the topleft quadrant in the scene. Widgets in the topleft quadrant are
@ -143,7 +143,8 @@ public Q_SLOTS:
ImmutabilityType immutability() const; ImmutabilityType immutability() const;
/** /**
* Sets the immutability type for this Corona (not immutable, user immutable or system immutable) * Sets the immutability type for this Corona (not immutable,
* user immutable or system immutable)
* @arg immutable the new immutability type of this applet * @arg immutable the new immutability type of this applet
*/ */
void setImmutability(const ImmutabilityType immutable); void setImmutability(const ImmutabilityType immutable);
@ -204,15 +205,16 @@ protected:
* *
* @return a pointer to the containment on success, or 0 on failure * @return a pointer to the containment on success, or 0 on failure
**/ **/
Containment *addContainmentDelayed(const QString& name, const QVariantList& args = QVariantList()); Containment *addContainmentDelayed(const QString &name,
const QVariantList &args = QVariantList());
//Reimplemented from QGraphicsScene //Reimplemented from QGraphicsScene
void dragEnterEvent(QGraphicsSceneDragDropEvent* event); void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
void dragLeaveEvent(QGraphicsSceneDragDropEvent* event); void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
void dragMoveEvent(QGraphicsSceneDragDropEvent* event); void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
private: private:
CoronaPrivate * const d; CoronaPrivate *const d;
Q_PRIVATE_SLOT(d, void containmentDestroyed(QObject*)) Q_PRIVATE_SLOT(d, void containmentDestroyed(QObject*))
Q_PRIVATE_SLOT(d, void syncConfig()) Q_PRIVATE_SLOT(d, void syncConfig())
@ -224,4 +226,3 @@ private:
#endif #endif

View File

@ -29,7 +29,7 @@
namespace Plasma namespace Plasma
{ {
DataContainer::DataContainer(QObject* parent) DataContainer::DataContainer(QObject *parent)
: QObject(parent), : QObject(parent),
d(new DataContainerPrivate) d(new DataContainerPrivate)
{ {
@ -45,7 +45,7 @@ const DataEngine::Data DataContainer::data() const
return d->data; return d->data;
} }
void DataContainer::setData(const QString& key, const QVariant& value) void DataContainer::setData(const QString &key, const QVariant &value)
{ {
if (value.isNull() || !value.isValid()) { if (value.isNull() || !value.isValid()) {
d->data.remove(key); d->data.remove(key);
@ -74,7 +74,8 @@ bool DataContainer::visualizationIsConnected(QObject *visualization) const
return d->relayObjects.contains(visualization); return d->relayObjects.contains(visualization);
} }
void DataContainer::connectVisualization(QObject* visualization, uint pollingInterval, Plasma::IntervalAlignment alignment) void DataContainer::connectVisualization(QObject *visualization, uint pollingInterval,
Plasma::IntervalAlignment alignment)
{ {
//kDebug() << "connecting visualization" << visualization << "at interval of" //kDebug() << "connecting visualization" << visualization << "at interval of"
// << pollingInterval << "to" << objectName(); // << pollingInterval << "to" << objectName();
@ -117,7 +118,6 @@ void DataContainer::connectVisualization(QObject* visualization, uint pollingInt
this, SLOT(disconnectVisualization(QObject*)));//, Qt::QueuedConnection); this, SLOT(disconnectVisualization(QObject*)));//, Qt::QueuedConnection);
} }
if (pollingInterval < 1) { if (pollingInterval < 1) {
//kDebug() << " connecting directly"; //kDebug() << " connecting directly";
d->relayObjects[visualization] = 0; d->relayObjects[visualization] = 0;
@ -129,13 +129,14 @@ void DataContainer::connectVisualization(QObject* visualization, uint pollingInt
// if it is the first visualization, then the source will already have been populated // if it is the first visualization, then the source will already have been populated
// engine's sourceRequested method // engine's sourceRequested method
bool immediateUpdate = connected || d->relayObjects.count() > 1; bool immediateUpdate = connected || d->relayObjects.count() > 1;
SignalRelay *relay = d->signalRelay(this, visualization, pollingInterval, alignment, immediateUpdate); SignalRelay *relay = d->signalRelay(this, visualization, pollingInterval,
alignment, immediateUpdate);
connect(relay, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)), connect(relay, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data))); visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
} }
} }
void DataContainer::disconnectVisualization(QObject* visualization) void DataContainer::disconnectVisualization(QObject *visualization)
{ {
QMap<QObject *, SignalRelay *>::iterator objIt = d->relayObjects.find(visualization); QMap<QObject *, SignalRelay *>::iterator objIt = d->relayObjects.find(visualization);
@ -164,7 +165,7 @@ void DataContainer::checkForUpdate()
if (d->dirty) { if (d->dirty) {
emit dataUpdated(objectName(), d->data); emit dataUpdated(objectName(), d->data);
foreach (SignalRelay* relay, d->relays) { foreach (SignalRelay *relay, d->relays) {
relay->checkQueueing(); relay->checkQueueing();
} }

View File

@ -118,7 +118,8 @@ class PLASMA_EXPORT DataContainer : public QObject
* @param visualization the object to connect to this DataContainer * @param visualization the object to connect to this DataContainer
* @param pollingInterval the time in milliseconds between updates * @param pollingInterval the time in milliseconds between updates
**/ **/
void connectVisualization(QObject *visualization, uint pollingInterval, Plasma::IntervalAlignment alignment); void connectVisualization(QObject *visualization, uint pollingInterval,
Plasma::IntervalAlignment alignment);
public Q_SLOTS: public Q_SLOTS:
/** /**
@ -207,7 +208,7 @@ class PLASMA_EXPORT DataContainer : public QObject
private: private:
friend class SignalRelay; friend class SignalRelay;
DataContainerPrivate* const d; DataContainerPrivate *const d;
}; };
} // Plasma namespace } // Plasma namespace

View File

@ -57,9 +57,9 @@ class DataEnginePrivate;
class PLASMA_EXPORT DataEngine : public QObject class PLASMA_EXPORT DataEngine : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY( QStringList sources READ sources ) Q_PROPERTY(QStringList sources READ sources)
Q_PROPERTY( bool valid READ isValid ) Q_PROPERTY(bool valid READ isValid)
Q_PROPERTY( QString icon READ icon WRITE setIcon ) Q_PROPERTY(QString icon READ icon WRITE setIcon)
public: public:
typedef QHash<QString, DataEngine*> Dict; typedef QHash<QString, DataEngine*> Dict;
@ -73,8 +73,8 @@ class PLASMA_EXPORT DataEngine : public QObject
* @param parent The parent object. * @param parent The parent object.
* @param service pointer to the service that describes the engine * @param service pointer to the service that describes the engine
**/ **/
explicit DataEngine(QObject* parent = 0, KService::Ptr service = KService::Ptr(0)); explicit DataEngine(QObject *parent = 0, KService::Ptr service = KService::Ptr(0));
DataEngine(QObject* parent, const QVariantList& args); DataEngine(QObject *parent, const QVariantList &args);
~DataEngine(); ~DataEngine();
/** /**
@ -99,7 +99,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* is parented to the DataEngine, but may be deleted by the * is parented to the DataEngine, but may be deleted by the
* caller when finished with it * caller when finished with it
*/ */
virtual Service* serviceForSource(const QString &source); virtual Service *serviceForSource(const QString &source);
/** /**
* Returns the engine name for the DataEngine * Returns the engine name for the DataEngine
@ -127,9 +127,10 @@ class PLASMA_EXPORT DataEngine : public QObject
* If the data has not changed, no update will be sent. * If the data has not changed, no update will be sent.
* @param intervalAlignment the number of ms to align the interval to * @param intervalAlignment the number of ms to align the interval to
**/ **/
Q_INVOKABLE void connectSource(const QString& source, QObject* visualization, Q_INVOKABLE void connectSource(
uint pollingInterval = 0, const QString &source, QObject *visualization,
Plasma::IntervalAlignment intervalAlignment = NoAlignment) const; uint pollingInterval = 0,
Plasma::IntervalAlignment intervalAlignment = NoAlignment) const;
/** /**
* Connects all currently existing sources to an object for data updates. * Connects all currently existing sources to an object for data updates.
@ -158,8 +159,9 @@ class PLASMA_EXPORT DataEngine : public QObject
* If the data has not changed, no update will be sent. * If the data has not changed, no update will be sent.
* @param intervalAlignment the number of ms to align the interval to * @param intervalAlignment the number of ms to align the interval to
**/ **/
Q_INVOKABLE void connectAllSources(QObject* visualization, uint pollingInterval = 0, Q_INVOKABLE void connectAllSources(
Plasma::IntervalAlignment intervalAlignment = NoAlignment) const; QObject *visualization, uint pollingInterval = 0,
Plasma::IntervalAlignment intervalAlignment = NoAlignment) const;
/** /**
* Disconnects a source to an object that was receiving data updates. * Disconnects a source to an object that was receiving data updates.
@ -167,7 +169,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* @param source the name of the data source * @param source the name of the data source
* @param visualization the object to connect the data source to * @param visualization the object to connect the data source to
**/ **/
Q_INVOKABLE void disconnectSource(const QString& source, QObject* visualization) const; Q_INVOKABLE void disconnectSource(const QString &source, QObject *visualization) const;
/** /**
* Retrevies a pointer to the DataContainer for a given source. This method * Retrevies a pointer to the DataContainer for a given source. This method
@ -179,7 +181,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* @param source the name of the source. * @param source the name of the source.
* @return pointer to a DataContainer, or zero on failure * @return pointer to a DataContainer, or zero on failure
**/ **/
Q_INVOKABLE DataContainer* containerForSource(const QString &source); Q_INVOKABLE DataContainer *containerForSource(const QString &source);
/** /**
* Gets the Data associated with a data source. * Gets the Data associated with a data source.
@ -191,7 +193,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* @return the Data associated with the source; if the source doesn't * @return the Data associated with the source; if the source doesn't
* exist an empty data set is returned * exist an empty data set is returned
**/ **/
Q_INVOKABLE DataEngine::Data query(const QString& source) const; Q_INVOKABLE DataEngine::Data query(const QString &source) const;
/** /**
* Returns true if this engine is valid, otherwise returns false * Returns true if this engine is valid, otherwise returns false
@ -223,7 +225,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* *
* @return the Package object, or 0 if none * @return the Package object, or 0 if none
**/ **/
const Package* package() const; const Package *package() const;
Q_SIGNALS: Q_SIGNALS:
/** /**
@ -236,7 +238,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* *
* @param source the name of the new data source * @param source the name of the new data source
**/ **/
void sourceAdded(const QString& source); void sourceAdded(const QString &source);
/** /**
* Emitted when a data source is removed. * Emitted when a data source is removed.
@ -248,7 +250,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* *
* @param source the name of the data source that was removed * @param source the name of the data source that was removed
**/ **/
void sourceRemoved(const QString& source); void sourceRemoved(const QString &source);
protected: protected:
/** /**
@ -283,7 +285,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* @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);
/** /**
* Sets a value for a data source. If the source * Sets a value for a data source. If the source
@ -302,7 +304,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* @param key the key to use for the data * @param key the key to use for the data
* @param value the data to associated with the source * @param value the data to associated with the source
**/ **/
void setData(const QString& source, const QString& key, const QVariant& value); void setData(const QString &source, const QString &key, const QVariant &value);
/** /**
* Adds a set of data to a data source. If the source * Adds a set of data to a data source. If the source
@ -318,7 +320,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* *
* @param source the name of the data source * @param source the name of the data source
**/ **/
void removeAllData(const QString& source); void removeAllData(const QString &source);
/** /**
* Removes a data entry from a source * Removes a data entry from a source
@ -326,7 +328,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* @param source the name of the data source * @param source the name of the data source
* @param key the data entry to remove * @param key the data entry to remove
**/ **/
void removeData(const QString& source, const QString& key); void removeData(const QString &source, const QString &key);
/** /**
* Adds an already constructed data source. The DataEngine takes * Adds an already constructed data source. The DataEngine takes
@ -335,7 +337,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* *
* @param source the DataContainer to add to the DataEngine * @param source the DataContainer to add to the DataEngine
**/ **/
void addSource(DataContainer* source); void addSource(DataContainer *source);
/** /**
* Sets an upper limit on the number of data sources to keep in this engine. * Sets an upper limit on the number of data sources to keep in this engine.
@ -415,7 +417,7 @@ class PLASMA_EXPORT DataEngine : public QObject
/** /**
* Sets the icon for this data engine * Sets the icon for this data engine
**/ **/
void setIcon(const QString& icon); void setIcon(const QString &icon);
protected Q_SLOTS: protected Q_SLOTS:
/** /**
@ -429,7 +431,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* Removes a data source. * Removes a data source.
* @param source the name of the data source to remove * @param source the name of the data source to remove
**/ **/
void removeSource(const QString& source); void removeSource(const QString &source);
private: private:
friend class DataEnginePrivate; friend class DataEnginePrivate;
@ -437,9 +439,9 @@ class PLASMA_EXPORT DataEngine : public QObject
friend class DataEngineManager; friend class DataEngineManager;
friend class NullEngine; friend class NullEngine;
Q_PRIVATE_SLOT(d, void internalUpdateSource(DataContainer* source)) Q_PRIVATE_SLOT(d, void internalUpdateSource(DataContainer *source))
DataEnginePrivate* const d; DataEnginePrivate *const d;
}; };
} // Plasma namespace } // Plasma namespace

View File

@ -43,7 +43,7 @@ class PLASMA_EXPORT DataEngineManager: public QObject
/** /**
* Singleton pattern accessor. * Singleton pattern accessor.
*/ */
static DataEngineManager* self(); static DataEngineManager *self();
/** /**
* Returns a data engine object if one is loaded and available. * Returns a data engine object if one is loaded and available.
@ -52,7 +52,7 @@ class PLASMA_EXPORT DataEngineManager: public QObject
* *
* @param name the name of the engine * @param name the name of the engine
*/ */
Plasma::DataEngine* engine(const QString& name) const; Plasma::DataEngine *engine(const QString &name) const;
/** /**
* Loads a data engine and increases the reference count on it. * Loads a data engine and increases the reference count on it.
@ -63,13 +63,13 @@ class PLASMA_EXPORT DataEngineManager: public QObject
* @param name the name of the engine * @param name the name of the engine
* @return the data engine that was loaded, or the NullEngine on failure. * @return the data engine that was loaded, or the NullEngine on failure.
*/ */
Plasma::DataEngine* loadEngine(const QString& name); Plasma::DataEngine *loadEngine(const QString &name);
/** /**
* Decreases the reference count on the engine. If the count reaches * Decreases the reference count on the engine. If the count reaches
* zero, then the engine is deleted to save resources. * zero, then the engine is deleted to save resources.
*/ */
void unloadEngine(const QString& name); void unloadEngine(const QString &name);
/** /**
* Returns a listing of all known engines by name * Returns a listing of all known engines by name
@ -84,7 +84,7 @@ class PLASMA_EXPORT DataEngineManager: public QObject
DataEngineManager(); DataEngineManager();
~DataEngineManager(); ~DataEngineManager();
DataEngineManagerPrivate* const d; DataEngineManagerPrivate *const d;
friend class DataEngineManagerSingleton; friend class DataEngineManagerSingleton;
}; };

View File

@ -1,4 +1,4 @@
/* /*
Copyright 2007 Robert Knight <robertknight@gmail.com> Copyright 2007 Robert Knight <robertknight@gmail.com>
Copyright 2008 Marco Martin <notmart@gmail.com> Copyright 2008 Marco Martin <notmart@gmail.com>
@ -39,9 +39,11 @@ class DelegatePrivate;
* *
* The delegate makes use of its own data roles that are: * The delegate makes use of its own data roles that are:
* SubTitleRole: the text of the subtitle * SubTitleRole: the text of the subtitle
* SubTitleMandatoryRole: if the subtitle is to always be displayed (as default the subtitle is displayed only on mouse over) * SubTitleMandatoryRole: if the subtitle is to always be displayed
* (as default the subtitle is displayed only on mouse over)
* ColumnTypeRole: if the column is a main column (with title and subtitle) * ColumnTypeRole: if the column is a main column (with title and subtitle)
* or a secondary action column (only a little icon that appears on mouse over is displayed) * or a secondary action column (only a little icon that appears on mouse
* over is displayed)
*/ */
class PLASMA_EXPORT Delegate : public QAbstractItemDelegate class PLASMA_EXPORT Delegate : public QAbstractItemDelegate
{ {
@ -49,14 +51,14 @@ class PLASMA_EXPORT Delegate : public QAbstractItemDelegate
public: public:
enum SpecificRoles { enum SpecificRoles {
SubTitleRole = Qt::UserRole + 1, SubTitleRole = Qt::UserRole + 1,
SubTitleMandatoryRole = Qt::UserRole + 2, SubTitleMandatoryRole = Qt::UserRole + 2,
ColumnTypeRole = Qt::UserRole + 3 ColumnTypeRole = Qt::UserRole + 3
}; };
enum ColumnType { enum ColumnType {
MainColumn = 1, MainColumn = 1,
SecondaryActionColumn = 2 SecondaryActionColumn = 2
}; };
Delegate(QObject *parent = 0); Delegate(QObject *parent = 0);
@ -74,18 +76,20 @@ public:
int roleMapping(SpecificRoles role) const; int roleMapping(SpecificRoles role) const;
//Reimplemented //Reimplemented
virtual void paint(QPainter *painter,const QStyleOptionViewItem& option,const QModelIndex& index) const; virtual void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const;
protected: protected:
/** /**
* Returns the empty area after the title. * Returns the empty area after the title.
* The height is the height of the subtitle. * The height is the height of the subtitle.
* It can be used by subclasses that wants to paint additional data after calling the paint function of the superclass. * It can be used by subclasses that wants to paint additional data after
* calling the paint function of the superclass.
* *
* @param option options for the title text * @param option options for the title text
* @param index model index that we want to compute the free area * @param index model index that we want to compute the free area
*/ */
QRect rectAfterTitle(const QStyleOptionViewItem& option, const QModelIndex& index) const; QRect rectAfterTitle(const QStyleOptionViewItem &option, const QModelIndex &index) const;
/** /**
* Returns the empty area after the subtitle. * Returns the empty area after the subtitle.
@ -95,7 +99,7 @@ protected:
* @param option options for the subtitle text * @param option options for the subtitle text
* @param index model index that we want to compute the free area * @param index model index that we want to compute the free area
*/ */
QRect rectAfterSubTitle(const QStyleOptionViewItem& option, const QModelIndex& index) const; QRect rectAfterSubTitle(const QStyleOptionViewItem &option, const QModelIndex &index) const;
/** /**
* Returns the empty area after both the title and the subtitle. * Returns the empty area after both the title and the subtitle.
@ -105,14 +109,14 @@ protected:
* @param option options for the title and subtitle text * @param option options for the title and subtitle text
* @param index model index that we want to compute the free area * @param index model index that we want to compute the free area
*/ */
QRect emptyRect(const QStyleOptionViewItem& option, const QModelIndex& index) const; QRect emptyRect(const QStyleOptionViewItem &option, const QModelIndex &index) const;
virtual QSize sizeHint(const QStyleOptionViewItem& option , const QModelIndex& index) const; virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
private: private:
DelegatePrivate * const d; DelegatePrivate *const d;
}; };
} }
#endif // PLASMA_DELEGATE_H #endif // PLASMA_DELEGATE_H

View File

@ -128,7 +128,7 @@ void DialogPrivate::adjustView()
} }
} }
Dialog::Dialog( QWidget * parent, Qt::WindowFlags f ) Dialog::Dialog(QWidget *parent, Qt::WindowFlags f)
: QWidget(parent, f), : QWidget(parent, f),
d(new DialogPrivate(this)) d(new DialogPrivate(this))
{ {
@ -163,12 +163,12 @@ void Dialog::paintEvent(QPaintEvent *e)
//we set the resize handlers //we set the resize handlers
d->resizeAreas.clear(); d->resizeAreas.clear();
if (d->resizeCorners & Dialog::NorthEast) { if (d->resizeCorners & Dialog::NorthEast) {
d->resizeAreas[Dialog::NorthEast] = QRect(rect().right() - resizeAreaMargin, 0, d->resizeAreas[Dialog::NorthEast] = QRect(rect().right() - resizeAreaMargin, 0,
resizeAreaMargin, resizeAreaMargin); resizeAreaMargin, resizeAreaMargin);
} }
if (d->resizeCorners & Dialog::NorthWest) { if (d->resizeCorners & Dialog::NorthWest) {
d->resizeAreas[Dialog::NorthWest] = QRect(0,0, resizeAreaMargin, resizeAreaMargin); d->resizeAreas[Dialog::NorthWest] = QRect(0, 0, resizeAreaMargin, resizeAreaMargin);
} }
if (d->resizeCorners & Dialog::SouthEast) { if (d->resizeCorners & Dialog::SouthEast) {
@ -383,6 +383,5 @@ bool Dialog::inControlArea(const QPoint &point)
return false; return false;
} }
} }
#include "dialog.moc" #include "dialog.moc"

View File

@ -55,13 +55,14 @@ class PLASMA_EXPORT Dialog : public QWidget
/** /**
* Use these flags to choose the active resize corners. * Use these flags to choose the active resize corners.
*/ */
enum ResizeCorner { NoCorner = 0, enum ResizeCorner {
NorthEast = 1, NoCorner = 0,
SouthEast = 2, NorthEast = 1,
NorthWest = 4, SouthEast = 2,
SouthWest = 8, NorthWest = 4,
All = NorthEast | SouthEast | NorthWest | SouthWest SouthWest = 8,
}; All = NorthEast | SouthEast | NorthWest | SouthWest
};
Q_DECLARE_FLAGS(ResizeCorners, ResizeCorner) Q_DECLARE_FLAGS(ResizeCorners, ResizeCorner)
/** /**
@ -103,26 +104,25 @@ class PLASMA_EXPORT Dialog : public QWidget
void paintEvent(QPaintEvent *e); void paintEvent(QPaintEvent *e);
void resizeEvent(QResizeEvent *e); void resizeEvent(QResizeEvent *e);
bool eventFilter(QObject *watched, QEvent *event); bool eventFilter(QObject *watched, QEvent *event);
void hideEvent (QHideEvent * event); void hideEvent (QHideEvent *event);
void showEvent (QShowEvent * event); void showEvent (QShowEvent *event);
void mouseMoveEvent (QMouseEvent * event); void mouseMoveEvent (QMouseEvent *event);
void mousePressEvent (QMouseEvent * event); void mousePressEvent (QMouseEvent *event);
void mouseReleaseEvent (QMouseEvent * event); void mouseReleaseEvent (QMouseEvent *event);
/** /**
* Convenience method to know whether the point is in a control area (e.g. resize area) * Convenience method to know whether the point is in a control area (e.g. resize area)
* or not. * or not.
* @return true if the point is in the control area. * @return true if the point is in the control area.
*/ */
bool inControlArea(const QPoint &point); bool inControlArea(const QPoint &point);
private: private:
DialogPrivate * const d; DialogPrivate *const d;
friend class DialogPrivate; friend class DialogPrivate;
/** /**
* React to theme changes * React to theme changes
*/ */
Q_PRIVATE_SLOT(d, void themeUpdated()) Q_PRIVATE_SLOT(d, void themeUpdated())
}; };

View File

@ -51,8 +51,7 @@ class Applet;
class PLASMA_EXPORT Extender : public QGraphicsWidget class PLASMA_EXPORT Extender : public QGraphicsWidget
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString emptyExtenderMessage READ emptyExtenderMessage Q_PROPERTY(QString emptyExtenderMessage READ emptyExtenderMessage WRITE setEmptyExtenderMessage)
WRITE setEmptyExtenderMessage)
public: public:
/** /**
@ -179,7 +178,7 @@ class PLASMA_EXPORT Extender : public QGraphicsWidget
void geometryChanged(); void geometryChanged();
private: private:
ExtenderPrivate* const d; ExtenderPrivate *const d;
friend class ExtenderPrivate; friend class ExtenderPrivate;
friend class ExtenderItem; friend class ExtenderItem;

View File

@ -108,8 +108,8 @@ class PLASMA_EXPORT ExtenderItem : public QGraphicsWidget
QString name() const; QString name() const;
/** /**
* @param icon the icon name to display in the extender item's drag handle. Defaults to * @param icon the icon name to display in the extender item's
* the source applet's icon. * drag handle. Defaults to the source applet's icon.
*/ */
void setIcon(const QString &icon); void setIcon(const QString &icon);

View File

@ -96,8 +96,9 @@ GLApplet::~GLApplet()
GLuint GLApplet::bindTexture(const QImage &image, GLenum target) GLuint GLApplet::bindTexture(const QImage &image, GLenum target)
{ {
Q_ASSERT(d->pbuf); Q_ASSERT(d->pbuf);
if (!d->dummy->isValid()) if (!d->dummy->isValid()) {
return 0; return 0;
}
return d->dummy->bindTexture(image, target); return d->dummy->bindTexture(image, target);
} }
@ -120,15 +121,18 @@ static inline QPainterPath headerPath(const QRectF &r, int roundness,
QPainterPath path; QPainterPath path;
int xRnd = roundness; int xRnd = roundness;
int yRnd = roundness; int yRnd = roundness;
if (r.width() > r.height()) if (r.width() > r.height()) {
xRnd = int(roundness * r.height()/r.width()); xRnd = int(roundness * r.height()/r.width());
else } else {
yRnd = int(roundness * r.width()/r.height()); yRnd = int(roundness * r.width()/r.height());
}
if(xRnd >= 100) // fix ranges if(xRnd >= 100) { // fix ranges
xRnd = 99; xRnd = 99;
if(yRnd >= 100) }
if(yRnd >= 100) {
yRnd = 99; yRnd = 99;
}
if(xRnd <= 0 || yRnd <= 0) { // add normal rectangle if(xRnd <= 0 || yRnd <= 0) { // add normal rectangle
path.addRect(r); path.addRect(r);
return path; return path;
@ -143,23 +147,25 @@ static inline QPainterPath headerPath(const QRectF &r, int roundness,
qreal y = rect.y(); qreal y = rect.y();
qreal w = rect.width(); qreal w = rect.width();
qreal h = rect.height(); qreal h = rect.height();
qreal rxx = w*xRnd/200; qreal rxx = w * xRnd / 200;
qreal ryy = h*yRnd/200; qreal ryy = h * yRnd / 200;
// were there overflows? // were there overflows?
if (rxx < 0) if (rxx < 0) {
rxx = w/200*xRnd; rxx = w / 200 * xRnd;
if (ryy < 0) }
ryy = h/200*yRnd; if (ryy < 0) {
ryy = h / 200 * yRnd;
}
qreal rxx2 = 2*rxx; qreal rxx2 = 2*rxx;
qreal ryy2 = 2*ryy; qreal ryy2 = 2*ryy;
path.arcMoveTo(x, y, rxx2, ryy2, 90); path.arcMoveTo(x, y, rxx2, ryy2, 90);
path.arcTo(x, y, rxx2, ryy2, 90, 90); path.arcTo(x, y, rxx2, ryy2, 90, 90);
QPointF pt = path.currentPosition(); QPointF pt = path.currentPosition();
path.lineTo(x, pt.y()+headerHeight); path.lineTo(x, pt.y()+headerHeight);
path.lineTo(x+w, pt.y()+headerHeight); path.lineTo(x + w, pt.y() + headerHeight);
path.lineTo(x+w, pt.y()); path.lineTo(x + w, pt.y());
path.arcTo(x+w-rxx2, y, rxx2, ryy2, 0, 90); path.arcTo(x + w - rxx2, y, rxx2, ryy2, 0, 90);
path.closeSubpath(); path.closeSubpath();
return path; return path;

View File

@ -48,7 +48,7 @@ class PLASMA_EXPORT Package
* @arg package the name of the package * @arg package the name of the package
* @arg structure the package structure describing this package * @arg structure the package structure describing this package
**/ **/
Package(const QString& packageRoot, const QString& package, Package(const QString &packageRoot, const QString &package,
PackageStructure::Ptr structure); PackageStructure::Ptr structure);
/** /**
@ -77,7 +77,7 @@ class PLASMA_EXPORT Package
* @arg filename the name of the file * @arg filename the name of the file
* @return path to the file on disk. QString() if not found. * @return path to the file on disk. QString() if not found.
**/ **/
QString filePath(const char* fileType, const QString& filename) const; QString filePath(const char *fileType, const QString &filename) const;
/** /**
* Get the path to a given file. * Get the path to a given file.
@ -87,7 +87,7 @@ class PLASMA_EXPORT Package
* in the package structure and not a directory. * in the package structure and not a directory.
* @return path to the file on disk. QString() if not found * @return path to the file on disk. QString() if not found
**/ **/
QString filePath(const char* fileType) const; QString filePath(const char *fileType) const;
/** /**
* Get the list of files of a given type. * Get the list of files of a given type.
@ -96,7 +96,7 @@ class PLASMA_EXPORT Package
* package structure. * package structure.
* @return list of files by name, suitable for passing to filePath * @return list of files by name, suitable for passing to filePath
**/ **/
QStringList entryList(const char* fileType) const; QStringList entryList(const char *fileType) const;
/** /**
* @return the package metadata object. * @return the package metadata object.
@ -146,7 +146,6 @@ class PLASMA_EXPORT Package
const QString &packageRoot, const QString &packageRoot,
const QString &servicePrefix); const QString &servicePrefix);
/** /**
* Registers a package described by the given desktop file * Registers a package described by the given desktop file
* *

View File

@ -56,7 +56,7 @@ PackageMetadata::PackageMetadata()
{ {
} }
PackageMetadata::PackageMetadata(const QString& path) PackageMetadata::PackageMetadata(const QString &path)
: d(new PackageMetadataPrivate) : d(new PackageMetadataPrivate)
{ {
read(path); read(path);
@ -98,7 +98,7 @@ void PackageMetadata::write(const QString &filename) const
config.writeEntry("X-KDE-Plasmagik-RequiredVersion", d->requiredVersion); config.writeEntry("X-KDE-Plasmagik-RequiredVersion", d->requiredVersion);
} }
void PackageMetadata::read(const QString& filename) void PackageMetadata::read(const QString &filename)
{ {
KConfig cfg(filename); KConfig cfg(filename);
KConfigGroup config(&cfg, "Desktop Entry"); KConfigGroup config(&cfg, "Desktop Entry");
@ -183,7 +183,7 @@ QString PackageMetadata::implementationApi() const
return d->api; return d->api;
} }
void PackageMetadata::setImplementationApi(const QString& api) void PackageMetadata::setImplementationApi(const QString &api)
{ {
d->api = api; d->api = api;
} }
@ -253,11 +253,10 @@ void PackageMetadata::setRequiredVersion(const QString &requiredVersion)
d->requiredVersion = requiredVersion; d->requiredVersion = requiredVersion;
} }
void PackageMetadata::setType(const QString& type) void PackageMetadata::setType(const QString &type)
{ {
d->type = type; d->type = type;
} }
} // namespace Plasma } // namespace Plasma

View File

@ -47,7 +47,7 @@ public:
* *
* @param path path to a metadata.desktop file * @param path path to a metadata.desktop file
**/ **/
PackageMetadata(const QString& path); PackageMetadata(const QString &path);
~PackageMetadata(); ~PackageMetadata();
bool isValid() const; bool isValid() const;
@ -60,7 +60,7 @@ public:
* *
* @arg filename path to the file to write to * @arg filename path to the file to write to
**/ **/
void write(const QString& filename) const; void write(const QString &filename) const;
/** /**
* Reads in metadata from a file, which should be a .desktop * Reads in metadata from a file, which should be a .desktop
@ -157,7 +157,7 @@ public:
* Set the type of the package. If not defined this * Set the type of the package. If not defined this
* defaults to "Service" in the desktop file. * defaults to "Service" in the desktop file.
*/ */
void setType(const QString& type); void setType(const QString &type);
/** /**
* Set the plugin name of the package. * Set the plugin name of the package.
@ -168,12 +168,12 @@ public:
* QString service = KStandardDirs::locateLocal("services", serviceName + ".desktop"); * QString service = KStandardDirs::locateLocal("services", serviceName + ".desktop");
* @endcode * @endcode
*/ */
void setPluginName(const QString& name); void setPluginName(const QString &name);
/** /**
* Set the implementation API this package uses. * Set the implementation API this package uses.
*/ */
void setImplementationApi(const QString& api); void setImplementationApi(const QString &api);
private: private:
PackageMetadataPrivate * const d; PackageMetadataPrivate * const d;

View File

@ -43,7 +43,7 @@ class ContentStructure
{ {
} }
ContentStructure(const ContentStructure& other) ContentStructure(const ContentStructure &other)
{ {
path = other.path; path = other.path;
name = other.name; name = other.name;
@ -59,7 +59,6 @@ class ContentStructure
bool required; bool required;
}; };
class PackageStructurePrivate class PackageStructurePrivate
{ {
public: public:
@ -104,18 +103,21 @@ PackageStructure::Ptr PackageStructure::load(const QString &packageFormat)
// first we check for plugins in sycoca // first we check for plugins in sycoca
QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(packageFormat); QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(packageFormat);
KService::List offers = KServiceTypeTrader::self()->query("Plasma/PackageStructure", constraint); KService::List offers =
KServiceTypeTrader::self()->query("Plasma/PackageStructure", constraint);
QVariantList args; QVariantList args;
QString error; QString error;
foreach (const KService::Ptr &offer, offers) { foreach (const KService::Ptr &offer, offers) {
PackageStructure::Ptr structure(offer->createInstance<Plasma::PackageStructure>(0, args, &error)); PackageStructure::Ptr structure(
offer->createInstance<Plasma::PackageStructure>(0, args, &error));
if (structure) { if (structure) {
return structure; return structure;
} }
kDebug() << "Couldn't load PackageStructure for" << packageFormat << "! reason given: " << error; kDebug() << "Couldn't load PackageStructure for" << packageFormat
<< "! reason given: " << error;
} }
// if that didn't give us any love, then we try to load from a config file // if that didn't give us any love, then we try to load from a config file
@ -152,7 +154,7 @@ PackageStructure::Ptr PackageStructure::load(const QString &packageFormat)
return structure; return structure;
} }
PackageStructure& PackageStructure::operator=(const PackageStructure& rhs) PackageStructure &PackageStructure::operator=(const PackageStructure &rhs)
{ {
if (this == &rhs) { if (this == &rhs) {
return *this; return *this;
@ -220,7 +222,8 @@ QList<const char*> PackageStructure::requiredFiles() const
return files; return files;
} }
void PackageStructure::addDirectoryDefinition(const char* key, const QString& path, const QString& name) void PackageStructure::addDirectoryDefinition(const char *key,
const QString &path, const QString &name)
{ {
ContentStructure s; ContentStructure s;
s.name = name; s.name = name;
@ -230,7 +233,7 @@ void PackageStructure::addDirectoryDefinition(const char* key, const QString& pa
d->contents[key] = s; d->contents[key] = s;
} }
void PackageStructure::addFileDefinition(const char* key, const QString& path, const QString& name) void PackageStructure::addFileDefinition(const char *key, const QString &path, const QString &name)
{ {
ContentStructure s; ContentStructure s;
s.name = name; s.name = name;
@ -240,7 +243,7 @@ void PackageStructure::addFileDefinition(const char* key, const QString& path, c
d->contents[key] = s; d->contents[key] = s;
} }
QString PackageStructure::path(const char* key) const QString PackageStructure::path(const char *key) const
{ {
//kDebug() << "looking for" << key; //kDebug() << "looking for" << key;
QMap<QByteArray, ContentStructure>::const_iterator it = d->contents.find(key); QMap<QByteArray, ContentStructure>::const_iterator it = d->contents.find(key);
@ -252,7 +255,7 @@ QString PackageStructure::path(const char* key) const
return it.value().path; return it.value().path;
} }
QString PackageStructure::name(const char* key) const QString PackageStructure::name(const char *key) const
{ {
QMap<QByteArray, ContentStructure>::const_iterator it = d->contents.find(key); QMap<QByteArray, ContentStructure>::const_iterator it = d->contents.find(key);
if (it == d->contents.constEnd()) { if (it == d->contents.constEnd()) {
@ -262,7 +265,7 @@ QString PackageStructure::name(const char* key) const
return it.value().name; return it.value().name;
} }
void PackageStructure::setRequired(const char* key, bool required) void PackageStructure::setRequired(const char *key, bool required)
{ {
QMap<QByteArray, ContentStructure>::iterator it = d->contents.find(key); QMap<QByteArray, ContentStructure>::iterator it = d->contents.find(key);
if (it == d->contents.end()) { if (it == d->contents.end()) {
@ -272,7 +275,7 @@ void PackageStructure::setRequired(const char* key, bool required)
it.value().required = required; it.value().required = required;
} }
bool PackageStructure::isRequired(const char* key) const bool PackageStructure::isRequired(const char *key) const
{ {
QMap<QByteArray, ContentStructure>::const_iterator it = d->contents.find(key); QMap<QByteArray, ContentStructure>::const_iterator it = d->contents.find(key);
if (it == d->contents.constEnd()) { if (it == d->contents.constEnd()) {
@ -287,7 +290,7 @@ void PackageStructure::setDefaultMimetypes(QStringList mimetypes)
d->mimetypes = mimetypes; d->mimetypes = mimetypes;
} }
void PackageStructure::setMimetypes(const char* key, QStringList mimetypes) void PackageStructure::setMimetypes(const char *key, QStringList mimetypes)
{ {
QMap<QByteArray, ContentStructure>::iterator it = d->contents.find(key); QMap<QByteArray, ContentStructure>::iterator it = d->contents.find(key);
if (it == d->contents.end()) { if (it == d->contents.end()) {
@ -297,7 +300,7 @@ void PackageStructure::setMimetypes(const char* key, QStringList mimetypes)
it.value().mimetypes = mimetypes; it.value().mimetypes = mimetypes;
} }
QStringList PackageStructure::mimetypes(const char* key) const QStringList PackageStructure::mimetypes(const char *key) const
{ {
QMap<QByteArray, ContentStructure>::const_iterator it = d->contents.find(key); QMap<QByteArray, ContentStructure>::const_iterator it = d->contents.find(key);
if (it == d->contents.constEnd()) { if (it == d->contents.constEnd()) {

View File

@ -90,7 +90,7 @@ public:
/** /**
* Assignment operator * Assignment operator
**/ **/
PackageStructure& operator=(const PackageStructure& rhs); PackageStructure &operator=(const PackageStructure &rhs);
/** /**
* Loads a package format by name. * Loads a package format by name.
@ -135,7 +135,7 @@ public:
* @param path the path within the package for this directory * @param path the path within the package for this directory
* @param name the user visible (translated) name for the directory * @param name the user visible (translated) name for the directory
**/ **/
void addDirectoryDefinition(const char* key, const QString& path, const QString& name); void addDirectoryDefinition(const char *key, const QString &path, const QString &name);
/** /**
* Adds a file to the structure of the package. It is added as * Adds a file to the structure of the package. It is added as
@ -145,17 +145,17 @@ public:
* @param path the path within the package for this file * @param path the path within the package for this file
* @param name the user visible (translated) name for the file * @param name the user visible (translated) name for the file
**/ **/
void addFileDefinition(const char* key, const QString& path, const QString& name); void addFileDefinition(const char *key, const QString &path, const QString &name);
/** /**
* @return path relative to the package root for the given entry * @return path relative to the package root for the given entry
**/ **/
QString path(const char* key) const; QString path(const char *key) const;
/** /**
* @return user visible name for the given entry * @return user visible name for the given entry
**/ **/
QString name(const char* key) const; QString name(const char *key) const;
/** /**
* Sets whether or not a given part of the structure is required or not. * Sets whether or not a given part of the structure is required or not.
@ -165,12 +165,12 @@ public:
* @param path the path of the entry within the package * @param path the path of the entry within the package
* @param required true if this entry is required, false if not * @param required true if this entry is required, false if not
*/ */
void setRequired(const char* key, bool required); void setRequired(const char *key, bool required);
/** /**
* @return true if the item at path exists and is required * @return true if the item at path exists and is required
**/ **/
bool isRequired(const char* key) const; bool isRequired(const char *key) const;
/** /**
* Defines the default mimetypes for any definitions that do not have * Defines the default mimetypes for any definitions that do not have
@ -189,12 +189,12 @@ public:
* @param path the path of the entry within the package * @param path the path of the entry within the package
* @param mimetypes a list of mimetypes * @param mimetypes a list of mimetypes
**/ **/
void setMimetypes(const char* key, QStringList mimetypes); void setMimetypes(const char *key, QStringList mimetypes);
/** /**
* @return the mimetypes associated with the path, if any * @return the mimetypes associated with the path, if any
**/ **/
QStringList mimetypes(const char* key) const; QStringList mimetypes(const char *key) const;
/** /**
* Sets the path to the package. Useful for package formats * Sets the path to the package. Useful for package formats
@ -235,7 +235,7 @@ public:
* @arg packageRoot path to the directory where the package should be installed to * @arg packageRoot path to the directory where the package should be installed to
* @return true on successful removal of the package, false otherwise * @return true on successful removal of the package, false otherwise
*/ */
virtual bool uninstallPackage(const QString& packageName, const QString& packageRoot); virtual bool uninstallPackage(const QString &packageName, const QString &packageRoot);
/** /**
* @return the prefix inserted between the base path and content entries * @return the prefix inserted between the base path and content entries

View File

@ -47,16 +47,16 @@ PLASMA_EXPORT void shadowBlur(QImage &image, int radius, const QColor &color);
* Returns a pixmap containing text with blurred shadow. * Returns a pixmap containing text with blurred shadow.
* Text and shadow colors default to Plasma::Theme colors. * Text and shadow colors default to Plasma::Theme colors.
*/ */
PLASMA_EXPORT QPixmap shadowText(QString text, PLASMA_EXPORT QPixmap shadowText(QString text,
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor), QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor),
QColor shadowColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor), QColor shadowColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor),
QPoint offset = QPoint(1,1), QPoint offset = QPoint(1,1),
int radius = 2); int radius = 2);
/** /**
* Returns a nicely rounded rectanglular path for painting. * Returns a nicely rounded rectanglular path for painting.
*/ */
PLASMA_EXPORT QPainterPath roundedRectangle(const QRectF& rect, qreal radius); PLASMA_EXPORT QPainterPath roundedRectangle(const QRectF &rect, qreal radius);
/** /**
* Blends a pixmap into another * Blends a pixmap into another

View File

@ -107,7 +107,7 @@ public:
QHash<QString, PanelData*> panels; QHash<QString, PanelData*> panels;
}; };
PanelSvg::PanelSvg(QObject* parent) PanelSvg::PanelSvg(QObject *parent)
: Svg(parent), : Svg(parent),
d(new PanelSvgPrivate(this)) d(new PanelSvgPrivate(this))
{ {
@ -120,7 +120,7 @@ PanelSvg::~PanelSvg()
delete d; delete d;
} }
void PanelSvg::setImagePath(const QString& path) void PanelSvg::setImagePath(const QString &path)
{ {
if (path == imagePath()) { if (path == imagePath()) {
return; return;
@ -247,7 +247,7 @@ QString PanelSvg::prefix()
return d->prefix.left(d->prefix.size() - 1); return d->prefix.left(d->prefix.size() - 1);
} }
void PanelSvg::resizePanel(const QSizeF& size) void PanelSvg::resizePanel(const QSizeF &size)
{ {
if (size.isEmpty()) { if (size.isEmpty()) {
kWarning() << "Invalid size" << size; kWarning() << "Invalid size" << size;
@ -322,7 +322,8 @@ QRectF PanelSvg::contentsRect() const
QRectF rect(QPointF(0, 0), size); QRectF rect(QPointF(0, 0), size);
PanelData *panel = d->panels[d->prefix]; PanelData *panel = d->panels[d->prefix];
return rect.adjusted(panel->leftMargin, panel->topMargin, -panel->rightMargin, -panel->bottomMargin); return rect.adjusted(panel->leftMargin, panel->topMargin,
-panel->rightMargin, -panel->bottomMargin);
} else { } else {
return QRectF(); return QRectF();
} }
@ -331,13 +332,14 @@ QRectF PanelSvg::contentsRect() const
QBitmap PanelSvg::mask() const QBitmap PanelSvg::mask() const
{ {
PanelData *panel = d->panels[d->prefix]; PanelData *panel = d->panels[d->prefix];
if (!panel->cachedMask) { if (!panel->cachedMask) {
if (!panel->cachedBackground) { if (!panel->cachedBackground) {
d->generateBackground(panel); d->generateBackground(panel);
Q_ASSERT(panel->cachedBackground); Q_ASSERT(panel->cachedBackground);
} }
panel->cachedMask = new QBitmap(panel->cachedBackground->alphaChannel().createMaskFromColor(Qt::black)); panel->cachedMask =
new QBitmap(panel->cachedBackground->alphaChannel().createMaskFromColor(Qt::black));
} }
return *(panel->cachedMask); return *(panel->cachedMask);
} }
@ -382,7 +384,7 @@ QPixmap PanelSvg::panelPixmap()
return *panel->cachedBackground; return *panel->cachedBackground;
} }
void PanelSvg::paintPanel(QPainter* painter, const QRectF& target, const QRectF& source) void PanelSvg::paintPanel(QPainter *painter, const QRectF &target, const QRectF &source)
{ {
PanelData *panel = d->panels[d->prefix]; PanelData *panel = d->panels[d->prefix];
if (!panel->cachedBackground) { if (!panel->cachedBackground) {
@ -393,7 +395,7 @@ void PanelSvg::paintPanel(QPainter* painter, const QRectF& target, const QRectF&
painter->drawPixmap(target, *(panel->cachedBackground), source.isValid() ? source : target); painter->drawPixmap(target, *(panel->cachedBackground), source.isValid() ? source : target);
} }
void PanelSvg::paintPanel(QPainter* painter, const QPointF& pos) void PanelSvg::paintPanel(QPainter *painter, const QPointF &pos)
{ {
PanelData *panel = d->panels[d->prefix]; PanelData *panel = d->panels[d->prefix];
if (!panel->cachedBackground) { if (!panel->cachedBackground) {
@ -436,10 +438,9 @@ void PanelSvgPrivate::generateBackground(PanelData *panel)
p.setCompositionMode(QPainter::CompositionMode_Source); p.setCompositionMode(QPainter::CompositionMode_Source);
p.setRenderHint(QPainter::SmoothPixmapTransform); p.setRenderHint(QPainter::SmoothPixmapTransform);
//if we must stretch the center or the borders we compute how much we will have to stretch //if we must stretch the center or the borders we compute how much we will have to stretch
//the svg to get the desired element sizes //the svg to get the desired element sizes
QSizeF scaledContentSize(0,0); QSizeF scaledContentSize(0, 0);
if (q->elementSize(prefix + "center").width() > 0 && if (q->elementSize(prefix + "center").width() > 0 &&
q->elementSize(prefix + "center").height() > 0 && q->elementSize(prefix + "center").height() > 0 &&
(!panel->tileCenter || panel->stretchBorders)) { (!panel->tileCenter || panel->stretchBorders)) {
@ -511,32 +512,38 @@ void PanelSvgPrivate::generateBackground(PanelData *panel)
if (panel->enabledBorders & PanelSvg::LeftBorder || panel->enabledBorders & PanelSvg::RightBorder) { if (panel->enabledBorders & PanelSvg::LeftBorder || panel->enabledBorders & PanelSvg::RightBorder) {
q->resize(q->size().width(), scaledContentSize.height()); q->resize(q->size().width(), scaledContentSize.height());
if (q->hasElement(prefix + "left") && panel->enabledBorders & PanelSvg::LeftBorder) { if (q->hasElement(prefix + "left") &&
panel->enabledBorders & PanelSvg::LeftBorder) {
q->paint(&p, QRect(leftOffset, contentTop, panel->leftWidth, contentHeight), prefix + "left"); q->paint(&p, QRect(leftOffset, contentTop, panel->leftWidth, contentHeight), prefix + "left");
} }
if (q->hasElement(prefix + "right") && panel->enabledBorders & PanelSvg::RightBorder) { if (q->hasElement(prefix + "right") &&
panel->enabledBorders & PanelSvg::RightBorder) {
q->paint(&p, QRect(rightOffset, contentTop, panel->rightWidth, contentHeight), prefix + "right"); q->paint(&p, QRect(rightOffset, contentTop, panel->rightWidth, contentHeight), prefix + "right");
} }
q->resize(); q->resize();
} }
if (panel->enabledBorders & PanelSvg::TopBorder || panel->enabledBorders & PanelSvg::BottomBorder) { if (panel->enabledBorders & PanelSvg::TopBorder ||
panel->enabledBorders & PanelSvg::BottomBorder) {
q->resize(scaledContentSize.width(), q->size().height()); q->resize(scaledContentSize.width(), q->size().height());
if (q->hasElement(prefix + "top") && panel->enabledBorders & PanelSvg::TopBorder) { if (q->hasElement(prefix + "top") &&
panel->enabledBorders & PanelSvg::TopBorder) {
q->paint(&p, QRect(contentLeft, topOffset, contentWidth, panel->topHeight), prefix + "top"); q->paint(&p, QRect(contentLeft, topOffset, contentWidth, panel->topHeight), prefix + "top");
} }
if (q->hasElement(prefix + "bottom") && panel->enabledBorders & PanelSvg::BottomBorder) { if (q->hasElement(prefix + "bottom") &&
panel->enabledBorders & PanelSvg::BottomBorder) {
q->paint(&p, QRect(contentLeft, bottomOffset, contentWidth, panel->bottomHeight), prefix + "bottom"); q->paint(&p, QRect(contentLeft, bottomOffset, contentWidth, panel->bottomHeight), prefix + "bottom");
} }
q->resize(); q->resize();
} }
} else { } else {
if (q->hasElement(prefix + "left") && panel->enabledBorders & PanelSvg::LeftBorder) { if (q->hasElement(prefix + "left") &&
panel->enabledBorders & PanelSvg::LeftBorder) {
QPixmap left(panel->leftWidth, leftHeight); QPixmap left(panel->leftWidth, leftHeight);
left.fill(Qt::transparent); left.fill(Qt::transparent);
@ -600,7 +607,7 @@ void PanelSvgPrivate::updateSizes()
q->Svg::resize(); q->Svg::resize();
if (panel->enabledBorders & PanelSvg::TopBorder) { if (panel->enabledBorders & PanelSvg::TopBorder) {
panel->topHeight = q->elementSize(prefix + "top").height(); panel->topHeight = q->elementSize(prefix + "top").height();
if (q->hasElement(prefix + "hint-top-margin")) { if (q->hasElement(prefix + "hint-top-margin")) {
panel->topMargin = q->elementSize(prefix + "hint-top-margin").height(); panel->topMargin = q->elementSize(prefix + "hint-top-margin").height();
} else { } else {
@ -612,7 +619,7 @@ void PanelSvgPrivate::updateSizes()
if (panel->enabledBorders & PanelSvg::LeftBorder) { if (panel->enabledBorders & PanelSvg::LeftBorder) {
panel->leftWidth = q->elementSize(prefix + "left").width(); panel->leftWidth = q->elementSize(prefix + "left").width();
if (q->hasElement(prefix + "hint-left-margin")) { if (q->hasElement(prefix + "hint-left-margin")) {
panel->leftMargin = q->elementSize(prefix + "hint-left-margin").height(); panel->leftMargin = q->elementSize(prefix + "hint-left-margin").height();
} else { } else {
@ -624,7 +631,7 @@ void PanelSvgPrivate::updateSizes()
if (panel->enabledBorders & PanelSvg::RightBorder) { if (panel->enabledBorders & PanelSvg::RightBorder) {
panel->rightWidth = q->elementSize(prefix + "right").width(); panel->rightWidth = q->elementSize(prefix + "right").width();
if (q->hasElement(prefix + "hint-right-margin")) { if (q->hasElement(prefix + "hint-right-margin")) {
panel->rightMargin = q->elementSize(prefix + "hint-right-margin").height(); panel->rightMargin = q->elementSize(prefix + "hint-right-margin").height();
} else { } else {
@ -636,7 +643,7 @@ void PanelSvgPrivate::updateSizes()
if (panel->enabledBorders & PanelSvg::BottomBorder) { if (panel->enabledBorders & PanelSvg::BottomBorder) {
panel->bottomHeight = q->elementSize(prefix + "bottom").height(); panel->bottomHeight = q->elementSize(prefix + "bottom").height();
if (q->hasElement(prefix + "hint-bottom-margin")) { if (q->hasElement(prefix + "hint-bottom-margin")) {
panel->bottomMargin = q->elementSize(prefix + "hint-bottom-margin").height(); panel->bottomMargin = q->elementSize(prefix + "hint-bottom-margin").height();
} else { } else {

View File

@ -80,14 +80,14 @@ class PLASMA_EXPORT PanelSvg : public Svg
/** /**
* These flags represents what borders should be drawn * These flags represents what borders should be drawn
*/ */
enum EnabledBorder { NoBorder = 0, enum EnabledBorder {
TopBorder = 1, NoBorder = 0,
BottomBorder = 2, TopBorder = 1,
LeftBorder = 4, BottomBorder = 2,
RightBorder = 8, LeftBorder = 4,
AllBorders = TopBorder | BottomBorder | RightBorder = 8,
LeftBorder | RightBorder AllBorders = TopBorder | BottomBorder | LeftBorder | RightBorder
}; };
Q_DECLARE_FLAGS(EnabledBorders, EnabledBorder) Q_DECLARE_FLAGS(EnabledBorders, EnabledBorder)
/** /**
@ -99,14 +99,14 @@ class PLASMA_EXPORT PanelSvg : public Svg
* *
* @related Plasma::Theme * @related Plasma::Theme
*/ */
explicit PanelSvg(QObject* parent = 0); explicit PanelSvg(QObject *parent = 0);
~PanelSvg(); ~PanelSvg();
/** /**
* Loads a new Svg * Loads a new Svg
* @arg imagePath the new file * @arg imagePath the new file
*/ */
void setImagePath(const QString& path); void setImagePath(const QString &path);
/** /**
* Sets what borders should be painted * Sets what borders should be painted
@ -124,7 +124,7 @@ class PLASMA_EXPORT PanelSvg : public Svg
* Resize the panel maintaining the same border size * Resize the panel maintaining the same border size
* @arg size the new size of the panel * @arg size the new size of the panel
*/ */
void resizePanel(const QSizeF& size); void resizePanel(const QSizeF &size);
/** /**
* @returns the size of the panel * @returns the size of the panel
@ -184,7 +184,7 @@ class PLASMA_EXPORT PanelSvg : public Svg
bool hasElementPrefix(const QString & prefix) const; bool hasElementPrefix(const QString & prefix) const;
/** /**
* This is an overloaded method provided for convenience equivalent to * This is an overloaded method provided for convenience equivalent to
* hasElementPrefix("north"), hasElementPrefix("south") * hasElementPrefix("north"), hasElementPrefix("south")
* hasElementPrefix("west") and hasElementPrefix("east") * hasElementPrefix("west") and hasElementPrefix("east")
* @return true if the svg has the necessary elements with the given prefix * @return true if the svg has the necessary elements with the given prefix
@ -209,19 +209,19 @@ class PLASMA_EXPORT PanelSvg : public Svg
* Sets whether saving all the rendered prefixes in a cache or not * Sets whether saving all the rendered prefixes in a cache or not
* @arg cache if use the cache or not * @arg cache if use the cache or not
*/ */
void setCacheAllRenderedPanels(bool cache); void setCacheAllRenderedPanels(bool cache);
/** /**
* @return if all the different prefixes should be kept in a cache when rendered * @return if all the different prefixes should be kept in a cache when rendered
*/ */
bool cacheAllRenderedPanels() const; bool cacheAllRenderedPanels() const;
/** /**
* Deletes the internal cache freeing memory: use this if you want to switch the rendered * Deletes the internal cache freeing memory: use this if you want to switch the rendered
* element and you don't plan to switch back to the previous one for a long time and you * element and you don't plan to switch back to the previous one for a long time and you
* used setUseCache(true) * used setUseCache(true)
*/ */
void clearCache(); void clearCache();
/** /**
* Returns a pixmap of the SVG represented by this object. * Returns a pixmap of the SVG represented by this object.
@ -238,8 +238,8 @@ class PLASMA_EXPORT PanelSvg : public Svg
* @arg target the target rectangle on the paint device * @arg target the target rectangle on the paint device
* @arg source the portion rectangle of the source image * @arg source the portion rectangle of the source image
*/ */
Q_INVOKABLE void paintPanel(QPainter* painter, const QRectF& target, Q_INVOKABLE void paintPanel(QPainter *painter, const QRectF &target,
const QRectF& source = QRectF()); const QRectF &source = QRectF());
/** /**
* Paints the loaded SVG with the elements that represents the border * Paints the loaded SVG with the elements that represents the border
@ -247,10 +247,10 @@ class PLASMA_EXPORT PanelSvg : public Svg
* @arg painter the QPainter to use * @arg painter the QPainter to use
* @arg pos where to paint the svg * @arg pos where to paint the svg
*/ */
Q_INVOKABLE void paintPanel(QPainter* painter, const QPointF& pos = QPointF(0, 0)); Q_INVOKABLE void paintPanel(QPainter *painter, const QPointF &pos = QPointF(0, 0));
private: private:
PanelSvgPrivate * const d; PanelSvgPrivate *const d;
Q_PRIVATE_SLOT(d, void updateSizes()) Q_PRIVATE_SLOT(d, void updateSizes())
Q_PRIVATE_SLOT(d, void updateNeeded()) Q_PRIVATE_SLOT(d, void updateNeeded())

228
plasma.h
View File

@ -40,16 +40,17 @@ namespace Plasma
* objects have managed for them and which they may wish to react to, * objects have managed for them and which they may wish to react to,
* for instance in Applet::constraintsUpdated * for instance in Applet::constraintsUpdated
*/ */
enum Constraint { NoConstraint = 0, enum Constraint {
FormFactorConstraint = 1 /** The FormFactor for an object */, NoConstraint = 0,
LocationConstraint = 2 /** The Location of an object */, FormFactorConstraint = 1, /** The FormFactor for an object */
ScreenConstraint = 4 /** Which screen an object is on */, LocationConstraint = 2, /** The Location of an object */
SizeConstraint = 8 /** the size of the applet was changed */, ScreenConstraint = 4, /** Which screen an object is on */
ImmutableConstraint = 16 /** the immutability (locked) nature of the applet changed */, SizeConstraint = 8, /** the size of the applet was changed */
StartupCompletedConstraint = 32 /** application startup has completed */, ImmutableConstraint = 16, /** the immutability (locked) nature of the applet changed */
ContextConstraint = 64 /** the desktop context has changed */, StartupCompletedConstraint = 32, /** application startup has completed */
AllConstraints = FormFactorConstraint | LocationConstraint | ScreenConstraint | ContextConstraint = 64, /** the desktop context has changed */
SizeConstraint | ImmutableConstraint | ContextConstraint AllConstraints = FormFactorConstraint | LocationConstraint | ScreenConstraint |
SizeConstraint | ImmutableConstraint | ContextConstraint
}; };
Q_DECLARE_FLAGS(Constraints, Constraint) Q_DECLARE_FLAGS(Constraints, Constraint)
@ -58,21 +59,22 @@ Q_DECLARE_FLAGS(Constraints, Constraint)
* itself. The value is derived from the container managing the Applet * itself. The value is derived from the container managing the Applet
* (e.g. in Plasma, a Corona on the desktop or on a panel). * (e.g. in Plasma, a Corona on the desktop or on a panel).
**/ **/
enum FormFactor { Planar = 0 /**< The applet lives in a plane and has two enum FormFactor {
degrees of freedom to grow. Optimize for Planar = 0, /**< The applet lives in a plane and has two
desktop, laptop or tablet usage: a high degrees of freedom to grow. Optimize for
resolution screen 1-3 feet distant from the desktop, laptop or tablet usage: a high
viewer. */, resolution screen 1-3 feet distant from the
MediaCenter /**< As with Planar, the applet lives in a plane viewer. */
but the interface should be optimized for MediaCenter, /**< As with Planar, the applet lives in a plane
medium-to-high resolution screens that are but the interface should be optimized for
5-15 feet distant from the viewer. Sometimes medium-to-high resolution screens that are
referred to as a "ten foot interface".*/, 5-15 feet distant from the viewer. Sometimes
Horizontal /**< The applet is constrained vertically, but referred to as a "ten foot interface".*/
can expand horizontally. */, Horizontal, /**< The applet is constrained vertically, but
Vertical /**< The applet is constrained horizontally, but can expand horizontally. */
can expand vertically. */ Vertical /**< The applet is constrained horizontally, but
}; can expand vertically. */
};
/** /**
* The Direction enumeration describes in which direction, relative to the * The Direction enumeration describes in which direction, relative to the
@ -80,129 +82,157 @@ enum FormFactor { Planar = 0 /**< The applet lives in a plane and has two
* message boxes, arrows and other such visually associated widgets should * message boxes, arrows and other such visually associated widgets should
* appear in. This is usually the oposite of the Location. * appear in. This is usually the oposite of the Location.
**/ **/
enum Direction { Down = 0 /**< Display downards */ , enum Direction {
Up /**< Display upwards */, Down = 0, /**< Display downards */
Left /**< Display to the left */, Up, /**< Display upwards */
Right /**< Display to the right */ Left, /**< Display to the left */
}; Right /**< Display to the right */
};
/** /**
* The direction of a zoom action. * The direction of a zoom action.
*/ */
enum ZoomDirection { ZoomIn = 0 /**< Zoom in one step */, enum ZoomDirection {
ZoomOut = 1 /**< Zoom out one step */ ZoomIn = 0, /**< Zoom in one step */
}; ZoomOut = 1 /**< Zoom out one step */
};
/** /**
* The Location enumeration describes where on screen an element, such as an * The Location enumeration describes where on screen an element, such as an
* Applet or its managing container, is positioned on the screen. * Applet or its managing container, is positioned on the screen.
**/ **/
enum Location { Floating = 0 /**< Free floating. Neither geometry or z-ordering enum Location {
is described precisely by this value. */, Floating = 0, /**< Free floating. Neither geometry or z-ordering
Desktop /**< On the planar desktop layer, extending across is described precisely by this value. */
the full screen from edge to edge */, Desktop, /**< On the planar desktop layer, extending across
FullScreen /**< Full screen */, the full screen from edge to edge */
TopEdge /**< Along the top of the screen*/, FullScreen, /**< Full screen */
BottomEdge /**< Along the bottom of the screen*/, TopEdge, /**< Along the top of the screen*/
LeftEdge /**< Along the left side of the screen */, BottomEdge, /**< Along the bottom of the screen*/
RightEdge /**< Along the right side of the screen */ LeftEdge, /**< Along the left side of the screen */
}; RightEdge /**< Along the right side of the screen */
};
/** /**
* The position enumeration * The position enumeration
* *
**/ **/
enum Position { LeftPositioned /**< Positioned left */, enum Position {
RightPositioned /**< Positioned right */, LeftPositioned, /**< Positioned left */
TopPositioned /**< Positioned top */, RightPositioned, /**< Positioned right */
BottomPositioned /**< Positioned bottom */, TopPositioned, /**< Positioned top */
CenterPositioned /**< Positioned in the center */ BottomPositioned, /**< Positioned bottom */
}; CenterPositioned /**< Positioned in the center */
};
/** /**
* The popup position enumeration relatively to his attached widget * The popup position enumeration relatively to his attached widget
* *
**/ **/
enum PopupPlacement { FloatingPopup = 0 /**< Free floating, non attached popup */, enum PopupPlacement {
TopPosedLeftAlignedPopup /**< Popup positioned on the top, aligned to the left of the wigdet */, FloatingPopup = 0, /**< Free floating, non attached popup */
TopPosedRightAlignedPopup /**< Popup positioned on the top, aligned to the right of the widget */, TopPosedLeftAlignedPopup, /**< Popup positioned on the top, aligned
LeftPosedTopAlignedPopup /**< Popup positioned on the left, aligned to the right of the wigdet */, to the left of the wigdet */
LeftPosedBottomAlignedPopup /**< Popup positioned on the left, aligned to the bottom of the widget */, TopPosedRightAlignedPopup, /**< Popup positioned on the top, aligned
BottomPosedLeftAlignedPopup /**< Popup positioned on the bottom, aligned to the left of the wigdet */, to the right of the widget */
BottomPosedRightAlignedPopup /**< Popup positioned on the bottom, aligned to the right of the widget */, LeftPosedTopAlignedPopup, /**< Popup positioned on the left, aligned
RightPosedTopAlignedPopup /**< Popup positioned on the right, aligned to the top of the wigdet */, to the right of the wigdet */
RightPosedBottomAlignedPopup /**< Popup positioned on the right, aligned to the bottom of the widget */ LeftPosedBottomAlignedPopup, /**< Popup positioned on the left, aligned
}; to the bottom of the widget */
BottomPosedLeftAlignedPopup, /**< Popup positioned on the bottom, aligned
to the left of the wigdet */
BottomPosedRightAlignedPopup, /**< Popup positioned on the bottom, aligned
to the right of the widget */
RightPosedTopAlignedPopup, /**< Popup positioned on the right, aligned
to the top of the wigdet */
RightPosedBottomAlignedPopup /**< Popup positioned on the right, aligned
to the bottom of the widget */
};
/** /**
* Flip enumeration * Flip enumeration
*/ */
enum FlipDirection { NoFlip = 0 /**< Do not flip */, enum FlipDirection {
HorizontalFlip = 1 /**< Flip horizontally */, NoFlip = 0, /**< Do not flip */
VerticalFlip = 2 /**< Flip vertically */ HorizontalFlip = 1, /**< Flip horizontally */
}; VerticalFlip = 2 /**< Flip vertically */
};
Q_DECLARE_FLAGS(Flip, FlipDirection) Q_DECLARE_FLAGS(Flip, FlipDirection)
/** /**
* Zoom levels that Plasma is aware of... * Zoom levels that Plasma is aware of...
**/ **/
enum ZoomLevel { DesktopZoom = 0 /**< Normal desktop usage, plasmoids are painted normally and have full interaction */, enum ZoomLevel {
GroupZoom /**< Plasmoids are shown as icons in visual groups; drag and drop and limited context menu interaction only */ , DesktopZoom = 0, /**< Normal desktop usage, plasmoids are painted normally
OverviewZoom /**< Groups become icons themselves */ and have full interaction */
}; GroupZoom, /**< Plasmoids are shown as icons in visual groups; drag
and drop and limited context menu interaction only */
OverviewZoom /**< Groups become icons themselves */
};
/** /**
* Possible timing alignments * Possible timing alignments
**/ **/
enum IntervalAlignment { NoAlignment = 0, enum IntervalAlignment {
AlignToMinute, NoAlignment = 0,
AlignToHour }; AlignToMinute,
AlignToHour
};
enum ItemTypes {
enum ItemTypes { AppletType = QGraphicsItem::UserType + 1, AppletType = QGraphicsItem::UserType + 1,
LineEditType = QGraphicsItem::UserType + 2 LineEditType = QGraphicsItem::UserType + 2
}; };
/** /**
* Defines the immutability of items like applets, corona and containments * Defines the immutability of items like applets, corona and containments
* they can be free to modify, locked down by the user or locked down by the system (e.g. kiosk setups) * they can be free to modify, locked down by the user or locked down by the
* system (e.g. kiosk setups).
*/ */
enum ImmutabilityType { Mutable = 1 /**< The item can be modified in any way **/, enum ImmutabilityType {
UserImmutable = 2 /**< The user has requested a lock down, and can undo the lock down at any time **/, Mutable = 1, /**< The item can be modified in any way **/
SystemImmutable = 4 /**< the item is locked down by the system, the user can't unlock it **/ UserImmutable = 2, /**< The user has requested a lock down, and can undo
the lock down at any time **/
}; SystemImmutable = 4 /**< the item is locked down by the system, the user
can't unlock it **/
};
/** /**
* Defines the aspect ratio used when scaling an applet * Defines the aspect ratio used when scaling an applet
*/ */
enum AspectRatioMode { InvalidAspectRatioMode = -1 /**< Unsetted mode used for dev convenience when there is a need to store the enum AspectRatioMode {
aspectRatioMode somewhere */, InvalidAspectRatioMode = -1, /**< Unsetted mode used for dev convenience
IgnoreAspectRatio = 0 /**< The applet can be freely resized */, when there is a need to store the
KeepAspectRatio = 1 /**< The applet keeps a fixed aspect ratio */, aspectRatioMode somewhere */
Square = 2 /**< The applet is always a square */, IgnoreAspectRatio = 0, /**< The applet can be freely resized */
ConstrainedSquare = 3 /** The applet is no wider (in horizontal formfactors) or no higher (in vertical ones) than a square */, KeepAspectRatio = 1, /**< The applet keeps a fixed aspect ratio */
FixedSize = 4 /** The applet cannot be resized */ Square = 2, /**< The applet is always a square */
}; ConstrainedSquare = 3, /**< The applet is no wider (in horizontal
formfactors) or no higher (in vertical
ones) than a square */
FixedSize = 4 /** The applet cannot be resized */
};
/** /**
* The ComonentType enumeration refers to the various types of components, * The ComonentType enumeration refers to the various types of components,
* or plugins, supported by plasma. * or plugins, supported by plasma.
*/ */
enum ComponentType { AppletComponent = 1 /**< Plasma::Applet based plugins **/, enum ComponentType {
DataEngineComponent = 2 /**< Plasma::DataEngine based plugins **/, AppletComponent = 1, /**< Plasma::Applet based plugins **/
RunnerComponent = 4 /**< Plasma::AbstractRunner based plugsin **/, DataEngineComponent = 2, /**< Plasma::DataEngine based plugins **/
AnimatorComponent = 8 /**< Plasma::Animator based plugins **/, RunnerComponent = 4, /**< Plasma::AbstractRunner based plugsin **/
ContainmentComponent = 16 /**< Plasma::Containment based plugins **/ AnimatorComponent = 8, /**< Plasma::Animator based plugins **/
}; ContainmentComponent = 16 /**< Plasma::Containment based plugins **/
};
Q_DECLARE_FLAGS(ComponentTypes, ComponentType) Q_DECLARE_FLAGS(ComponentTypes, ComponentType)
enum MarginEdge { TopMargin = 0, enum MarginEdge {
BottomMargin, TopMargin = 0,
LeftMargin, BottomMargin,
RightMargin LeftMargin,
}; RightMargin
};
/** /**
* @return the scaling factor (0..1) for a ZoomLevel * @return the scaling factor (0..1) for a ZoomLevel

View File

@ -25,10 +25,10 @@
#ifndef PLASMA_EXPORT #ifndef PLASMA_EXPORT
# if defined(MAKE_PLASMA_LIB) # if defined(MAKE_PLASMA_LIB)
/* We are building this library */ /* We are building this library */
# define PLASMA_EXPORT KDE_EXPORT # define PLASMA_EXPORT KDE_EXPORT
# else # else
/* We are using this library */ /* We are using this library */
# define PLASMA_EXPORT KDE_IMPORT # define PLASMA_EXPORT KDE_IMPORT
# endif # endif
#endif #endif

View File

@ -95,11 +95,13 @@ public:
Plasma::PopupPlacement popupPlacement() const; Plasma::PopupPlacement popupPlacement() const;
/** /**
* This event handler can be reimplemented in a subclass to receive an event before the popup is shown or hidden. * This event handler can be reimplemented in a subclass to receive an
* @arg show true if the popup is going to be shown, false if the popup is going to be hidden. * event before the popup is shown or hidden.
* @arg show true if the popup is going to be shown, false if the popup
* is going to be hidden.
* Note that showing and hiding the popup on click is already done in PopupApplet. * Note that showing and hiding the popup on click is already done in PopupApplet.
*/ */
virtual void popupEvent(bool show); virtual void popupEvent(bool show);
public Q_SLOTS: public Q_SLOTS:
/** /**

View File

@ -47,21 +47,22 @@ class PLASMA_EXPORT QueryMatch
/** /**
* The type of match. Value is important here as it is used for sorting * The type of match. Value is important here as it is used for sorting
*/ */
enum Type { NoMatch = 0 /**< Null match */, enum Type {
CompletionMatch = 10 /**< Possible completion for the data of the query */, NoMatch = 0, /**< Null match */
PossibleMatch = 30 /**< Something that may match the query */, CompletionMatch = 10, /**< Possible completion for the data of the query */
InformationalMatch = 50 /**< A purely informational, non-actionable match, PossibleMatch = 30, /**< Something that may match the query */
such as the answer to a question or calculation*/, InformationalMatch = 50, /**< A purely informational, non-actionable match,
HelperMatch = 70 /**< A match that represents an action not directly related such as the answer to a question or calculation*/
to activating the given search term, such as a search HelperMatch = 70, /**< A match that represents an action not directly related
in an external tool or a command learning trigger. Helper to activating the given search term, such as a search
matches tend to be generic to the query and should not in an external tool or a command learning trigger. Helper
be autoactivated just because the user hits "Enter" matches tend to be generic to the query and should not
while typing. They must be explicitly selected to be autoactivated just because the user hits "Enter"
be activated, but unlike InformationalMatch cause while typing. They must be explicitly selected to
an action to be triggered. */, be activated, but unlike InformationalMatch cause
ExactMatch = 100 /**< An exact match to the query */}; an action to be triggered. */
ExactMatch = 100 /**< An exact match to the query */
};
/** /**
* Constructs a PossibleMatch associated with a given RunnerContext * Constructs a PossibleMatch associated with a given RunnerContext
@ -110,7 +111,7 @@ class PLASMA_EXPORT QueryMatch
/** /**
* The runner associated with this action * The runner associated with this action
*/ */
AbstractRunner* runner() const; AbstractRunner *runner() const;
/** /**
* A string that can be used as an ID for this match, * A string that can be used as an ID for this match,
@ -128,8 +129,8 @@ class PLASMA_EXPORT QueryMatch
QIcon icon() const; QIcon icon() const;
bool isEnabled() const; bool isEnabled() const;
bool operator<(const QueryMatch& other) const; bool operator<(const QueryMatch &other) const;
QueryMatch& operator=(const QueryMatch &other); QueryMatch &operator=(const QueryMatch &other);
/** /**
* Requests this match to activae using the given context * Requests this match to activae using the given context
@ -147,7 +148,7 @@ class PLASMA_EXPORT QueryMatch
* as an id, the runner may generate its own id and set that * as an id, the runner may generate its own id and set that
* with setId(const QString&) directly after calling setData * with setId(const QString&) directly after calling setData
*/ */
void setData(const QVariant& data); void setData(const QVariant &data);
/** /**
* Sets the id for this match; useful if the id does not * Sets the id for this match; useful if the id does not
@ -160,9 +161,9 @@ class PLASMA_EXPORT QueryMatch
*/ */
void setId(const QString &id); void setId(const QString &id);
void setText(const QString& text); void setText(const QString &text);
void setSubtext(const QString& text); void setSubtext(const QString &text);
void setIcon(const QIcon& icon); void setIcon(const QIcon &icon);
void setEnabled(bool enable); void setEnabled(bool enable);
private: private:

View File

@ -47,16 +47,17 @@ class PLASMA_EXPORT RunnerContext : public QObject
Q_OBJECT Q_OBJECT
public: public:
enum Type { None = 0, enum Type {
UnknownType = 1, None = 0,
Directory = 2, UnknownType = 1,
File = 4, Directory = 2,
NetworkLocation = 8, File = 4,
Executable = 16, NetworkLocation = 8,
ShellCommand = 32, Executable = 16,
Help = 64, ShellCommand = 32,
FileSystem = Directory | File | Executable | ShellCommand Help = 64,
}; FileSystem = Directory | File | Executable | ShellCommand
};
Q_DECLARE_FLAGS(Types, Type) Q_DECLARE_FLAGS(Types, Type)
@ -65,11 +66,10 @@ class PLASMA_EXPORT RunnerContext : public QObject
/** /**
* Copy constructor * Copy constructor
*/ */
explicit RunnerContext(RunnerContext& other, QObject *parent = 0); explicit RunnerContext(RunnerContext &other, QObject *parent = 0);
~RunnerContext(); ~RunnerContext();
/** /**
* Resets the search term for this object. * Resets the search term for this object.
* This removes all current matches in the process. * This removes all current matches in the process.
@ -80,7 +80,7 @@ class PLASMA_EXPORT RunnerContext : public QObject
* Sets the query term for this object and attempts to determine * Sets the query term for this object and attempts to determine
* the type of the search. * the type of the search.
*/ */
void setQuery(const QString& term); void setQuery(const QString &term);
/** /**
* @return the current search query term. * @return the current search query term.
@ -110,7 +110,7 @@ class PLASMA_EXPORT RunnerContext : public QObject
* *
* @return true if matches were added, false if matches were e.g. outdated * @return true if matches were added, false if matches were e.g. outdated
*/ */
bool addMatches(const QString& term, const QList<QueryMatch> &matches); bool addMatches(const QString &term, const QList<QueryMatch> &matches);
/** /**
* Appends a match to the existing list of matches. * Appends a match to the existing list of matches.

View File

@ -59,7 +59,7 @@ class RunnerRestrictionPolicy : public ThreadWeaver::QueuePolicy
public: public:
~RunnerRestrictionPolicy(); ~RunnerRestrictionPolicy();
static RunnerRestrictionPolicy& instance(); static RunnerRestrictionPolicy &instance();
void setCap(int cap) void setCap(int cap)
{ {
@ -93,7 +93,7 @@ RunnerRestrictionPolicy::~RunnerRestrictionPolicy()
{ {
} }
RunnerRestrictionPolicy& RunnerRestrictionPolicy::instance() RunnerRestrictionPolicy &RunnerRestrictionPolicy::instance()
{ {
static RunnerRestrictionPolicy policy; static RunnerRestrictionPolicy policy;
return policy; return policy;
@ -138,7 +138,7 @@ public:
FindMatchesJob(Plasma::AbstractRunner *runner, Plasma::RunnerContext *context, QObject *parent = 0); FindMatchesJob(Plasma::AbstractRunner *runner, Plasma::RunnerContext *context, QObject *parent = 0);
int priority() const; int priority() const;
Plasma::AbstractRunner* runner() const; Plasma::AbstractRunner *runner() const;
protected: protected:
void run(); void run();
@ -169,7 +169,7 @@ int FindMatchesJob::priority() const
return m_runner->priority(); return m_runner->priority();
} }
Plasma::AbstractRunner* FindMatchesJob::runner() const Plasma::AbstractRunner *FindMatchesJob::runner() const
{ {
return m_runner; return m_runner;
} }
@ -205,10 +205,10 @@ public:
{ {
config = conf; config = conf;
//The number of threads used scales with the number of processors. //The number of threads used scales with the number of processors.
const int numProcs = qMax(Solid::Device::listFromType(Solid::DeviceInterface::Processor).count(), 1); const int numProcs = qMax(Solid::Device::listFromType(Solid::DeviceInterface::Processor).count(), 1);
//This entry allows to define a hard upper limit independent of the number of processors. //This entry allows to define a hard upper limit independent of the number of processors.
const int maxThreads = config.readEntry("maxThreads",16); const int maxThreads = config.readEntry("maxThreads", 16);
const int numThreads = qMin(maxThreads, 2 + ((numProcs - 1) * 2)); const int numThreads = qMin(maxThreads, 2 + ((numProcs - 1) * 2));
//kDebug() << "setting up" << numThreads << "threads for" << numProcs << "processors"; //kDebug() << "setting up" << numThreads << "threads for" << numProcs << "processors";
Weaver::instance()->setMaximumNumberOfThreads(numThreads); Weaver::instance()->setMaximumNumberOfThreads(numThreads);
@ -339,7 +339,7 @@ void RunnerManager::reloadConfiguration()
d->loadRunners(); d->loadRunners();
} }
AbstractRunner* RunnerManager::runner(const QString &name) const AbstractRunner *RunnerManager::runner(const QString &name) const
{ {
if (d->runners.isEmpty()) { if (d->runners.isEmpty()) {
d->loadRunners(); d->loadRunners();
@ -348,7 +348,7 @@ AbstractRunner* RunnerManager::runner(const QString &name) const
return d->runners.value(name); return d->runners.value(name);
} }
RunnerContext* RunnerManager::searchContext() const RunnerContext *RunnerManager::searchContext() const
{ {
return &d->context; return &d->context;
} }
@ -483,7 +483,7 @@ QString RunnerManager::query() const
void RunnerManager::reset() void RunnerManager::reset()
{ {
// If ThreadWeaver is idle, it is safe to clear previous jobs // If ThreadWeaver is idle, it is safe to clear previous jobs
if (Weaver::instance()->isIdle()) { if (Weaver::instance()->isIdle()) {
qDeleteAll(d->searchJobs); qDeleteAll(d->searchJobs);
d->searchJobs.clear(); d->searchJobs.clear();

View File

@ -47,7 +47,6 @@ class PLASMA_EXPORT RunnerManager : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit RunnerManager(QObject *parent=0); explicit RunnerManager(QObject *parent=0);
explicit RunnerManager(KConfigGroup &config, QObject *parent=0); explicit RunnerManager(KConfigGroup &config, QObject *parent=0);
@ -58,16 +57,16 @@ class PLASMA_EXPORT RunnerManager : public QObject
* @arg name the name of the runner * @arg name the name of the runner
* @return Pointer to the runner * @return Pointer to the runner
*/ */
AbstractRunner* runner(const QString &name) const; AbstractRunner *runner(const QString &name) const;
/** /**
* Retrieves the current context * Retrieves the current context
* @return pointer to the current context * @return pointer to the current context
*/ */
RunnerContext* searchContext() const; RunnerContext *searchContext() const;
/** /**
* Retrieves all available matches found so far for the previously launched query * Retrieves all available matches found so far for the previously launched query
* @return List of matches * @return List of matches
*/ */
QList<QueryMatch> matches() const; QList<QueryMatch> matches() const;
@ -76,13 +75,13 @@ class PLASMA_EXPORT RunnerManager : public QObject
* Runs a given match * Runs a given match
* @arg match the match to be executed * @arg match the match to be executed
*/ */
void run(const QueryMatch &match); void run(const QueryMatch &match);
/** /**
* Runs a given match * Runs a given match
* @arg id the id of the match to run * @arg id the id of the match to run
*/ */
void run(const QString &id); void run(const QString &id);
/** /**
* @return the current query term * @return the current query term

View File

@ -88,7 +88,7 @@ public:
* *
* @return a Service object, guaranteed to be not null. * @return a Service object, guaranteed to be not null.
*/ */
static Service* load(const QString &name, QObject *parent = 0); static Service *load(const QString &name, QObject *parent = 0);
/** /**
* Sets the destination for this Service to operate on * Sets the destination for this Service to operate on
@ -123,7 +123,7 @@ public:
* @return a started ServiceJob; the consumer may connect to relevant * @return a started ServiceJob; the consumer may connect to relevant
* signals before returning to the event loop * signals before returning to the event loop
*/ */
ServiceJob* startOperationCall(const KConfigGroup &description, QObject *parent = 0); ServiceJob *startOperationCall(const KConfigGroup &description, QObject *parent = 0);
/** /**
* Query to find if an operation is enabled or not. * Query to find if an operation is enabled or not.
@ -186,7 +186,7 @@ Q_SIGNALS:
/** /**
* Emitted when a job associated with this Service completes its task * Emitted when a job associated with this Service completes its task
*/ */
void finished(Plasma::ServiceJob* job); void finished(Plasma::ServiceJob *job);
/** /**
* Emitted when the Service's operations change. For example, a * Emitted when the Service's operations change. For example, a
@ -215,7 +215,7 @@ protected:
* @param parameters the parameters set by the user for the operation * @param parameters the parameters set by the user for the operation
* @return a ServiceJob that can be started and monitored by the consumer * @return a ServiceJob that can be started and monitored by the consumer
*/ */
virtual ServiceJob* createJob(const QString &operation, virtual ServiceJob *createJob(const QString &operation,
QMap<QString, QVariant> &parameters) = 0; QMap<QString, QVariant> &parameters) = 0;
/** /**

View File

@ -41,7 +41,7 @@ public:
q->start(); q->start();
} }
ServiceJob* q; ServiceJob *q;
QString destination; QString destination;
QString operation; QString operation;
QMap<QString, QVariant> parameters; QMap<QString, QVariant> parameters;

12
svg.cpp
View File

@ -356,12 +356,12 @@ QSize Svg::size() const
return d->size.toSize(); return d->size.toSize();
} }
void Svg::resize( qreal width, qreal height ) void Svg::resize(qreal width, qreal height)
{ {
resize( QSize( width, height ) ); resize(QSize(width, height));
} }
void Svg::resize( const QSizeF& size ) void Svg::resize(const QSizeF &size)
{ {
d->createRenderer(); d->createRenderer();
d->size = size; d->size = size;
@ -373,17 +373,17 @@ void Svg::resize()
d->size = d->renderer->defaultSize(); d->size = d->renderer->defaultSize();
} }
QSize Svg::elementSize(const QString& elementId) const QSize Svg::elementSize(const QString &elementId) const
{ {
return d->elementSize(elementId); return d->elementSize(elementId);
} }
QRectF Svg::elementRect(const QString& elementId) const QRectF Svg::elementRect(const QString &elementId) const
{ {
return d->elementRect(elementId); return d->elementRect(elementId);
} }
bool Svg::hasElement(const QString& elementId) const bool Svg::hasElement(const QString &elementId) const
{ {
d->createRenderer(); d->createRenderer();
return d->renderer->elementExists(elementId); return d->renderer->elementExists(elementId);

13
svg.h
View File

@ -75,10 +75,9 @@ class PLASMA_EXPORT Svg : public QObject
* *
* @related Plasma::Theme * @related Plasma::Theme
*/ */
explicit Svg(QObject* parent = 0); explicit Svg(QObject *parent = 0);
~Svg(); ~Svg();
/** /**
* Returns a pixmap of the SVG represented by this object. * Returns a pixmap of the SVG represented by this object.
* *
@ -140,7 +139,7 @@ class PLASMA_EXPORT Svg : public QObject
* the next call to paint. * the next call to paint.
* @arg size the new size of the image * @arg size the new size of the image
**/ **/
Q_INVOKABLE void resize( const QSizeF& size ); Q_INVOKABLE void resize(const QSizeF &size);
/** /**
* Resizes the rendered image to the natural size of the SVG. * Resizes the rendered image to the natural size of the SVG.
@ -153,21 +152,21 @@ class PLASMA_EXPORT Svg : public QObject
* @arg elementId the id of the element to check * @arg elementId the id of the element to check
* @return the current size of a given element, given the current size of the Svg * @return the current size of a given element, given the current size of the Svg
**/ **/
Q_INVOKABLE QSize elementSize( const QString& elementId ) const; Q_INVOKABLE QSize elementSize(const QString &elementId) const;
/** /**
* The bounding rect of a given element * The bounding rect of a given element
* @arg elementId the id of the element to check * @arg elementId the id of the element to check
* @return the current rect of a given element, given the current size of the Svg * @return the current rect of a given element, given the current size of the Svg
**/ **/
Q_INVOKABLE QRectF elementRect(const QString& elementId) const; Q_INVOKABLE QRectF elementRect(const QString &elementId) const;
/** /**
* Check when an element exists in the loaded Svg * Check when an element exists in the loaded Svg
* @arg elementId the id of the element to check * @arg elementId the id of the element to check
* @return true if the element is defined in the Svg, otherwise false * @return true if the element is defined in the Svg, otherwise false
**/ **/
Q_INVOKABLE bool hasElement( const QString& elementId ) const; Q_INVOKABLE bool hasElement(const QString &elementId) const;
/** /**
* Returns the element (by id) at the given point. An empty string is * Returns the element (by id) at the given point. An empty string is
@ -209,7 +208,7 @@ class PLASMA_EXPORT Svg : public QObject
void repaintNeeded(); void repaintNeeded();
private: private:
SvgPrivate* const d; SvgPrivate *const d;
Q_PRIVATE_SLOT(d, void themeChanged()) Q_PRIVATE_SLOT(d, void themeChanged())
Q_PRIVATE_SLOT(d, void colorsChanged()) Q_PRIVATE_SLOT(d, void colorsChanged())

33
theme.h
View File

@ -55,33 +55,32 @@ class ThemePrivate;
class PLASMA_EXPORT Theme : public QObject class PLASMA_EXPORT Theme : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY( QString themeName READ themeName ) Q_PROPERTY(QString themeName READ themeName)
public: public:
enum ColorRole enum ColorRole {
{ TextColor = 0, /**< the text color to be used by items resting on the background */
TextColor = 0 /**< the text color to be used by items resting on the background */, HighlightColor = 1, /**< the text higlight color to be used by items resting
HighlightColor = 1 /**< the text higlight color to be used by items resting on the background */, on the background */
BackgroundColor = 2 /**< the default background color */, BackgroundColor = 2, /**< the default background color */
ButtonTextColor = 4 /** text color for buttons */, ButtonTextColor = 4, /** text color for buttons */
ButtonBackgroundColor = 8 /** background color for buttons*/ ButtonBackgroundColor = 8 /** background color for buttons*/
}; };
enum FontRole enum FontRole {
{ DefaultFont = 0, /**< The standard text font */
DefaultFont = 0 /**< The standard text font */,
DesktopFont /**< The standard text font */ DesktopFont /**< The standard text font */
}; };
/** /**
* Singleton pattern accessor * Singleton pattern accessor
**/ **/
static Theme* defaultTheme(); static Theme *defaultTheme();
/** /**
* Default constructor. Usually you want to use the singleton instead. * Default constructor. Usually you want to use the singleton instead.
*/ */
explicit Theme( QObject* parent = 0 ); explicit Theme(QObject *parent = 0);
~Theme(); ~Theme();
/** /**
@ -106,16 +105,16 @@ class PLASMA_EXPORT Theme : public QObject
* ".svg" part or a leading slash) * ".svg" part or a leading slash)
* @return the full path to the requested file for the current theme * @return the full path to the requested file for the current theme
*/ */
Q_INVOKABLE QString imagePath(const QString& name) const; Q_INVOKABLE QString imagePath(const QString &name) const;
/** /**
* Retreives the default wallpaper associated with this theme. * Retreives the default wallpaper associated with this theme.
* *
* @arg size the target height and width of the wallpaper; if an invalid size * @arg size the target height and width of the wallpaper; if an invalid size
* is passed in, then a default size will be provided instead. * is passed in, then a default size will be provided instead.
* @return the full path to the wallpaper image * @return the full path to the wallpaper image
*/ */
Q_INVOKABLE QString wallpaperPath(const QSize &size = QSize()) const; Q_INVOKABLE QString wallpaperPath(const QSize &size = QSize()) const;
/** /**
* Checks if this theme has an image named in a certain way * Checks if this theme has an image named in a certain way
@ -124,7 +123,7 @@ class PLASMA_EXPORT Theme : public QObject
* ".svg" part or a leading slash) * ".svg" part or a leading slash)
* @return true if the image exists for this theme * @return true if the image exists for this theme
*/ */
Q_INVOKABLE bool currentThemeHasImage(const QString& name) const; Q_INVOKABLE bool currentThemeHasImage(const QString &name) const;
/** /**
* Returns the color scheme configurationthat goes along this theme. * Returns the color scheme configurationthat goes along this theme.
@ -197,7 +196,7 @@ class PLASMA_EXPORT Theme : public QObject
private: private:
friend class ThemeSingleton; friend class ThemeSingleton;
friend class ThemePrivate; friend class ThemePrivate;
ThemePrivate* const d; ThemePrivate *const d;
Q_PRIVATE_SLOT(d, void compositingChanged()) Q_PRIVATE_SLOT(d, void compositingChanged())
}; };

View File

@ -103,7 +103,7 @@ public:
* *
* You should normall use self() instead. * You should normall use self() instead.
*/ */
explicit ToolTipManager(QObject* parent = 0); explicit ToolTipManager(QObject *parent = 0);
/** /**
* Default destructor. * Default destructor.
@ -211,7 +211,7 @@ private:
friend class ToolTipManagerSingleton; friend class ToolTipManagerSingleton;
bool eventFilter(QObject *watched, QEvent *event); bool eventFilter(QObject *watched, QEvent *event);
ToolTipManagerPrivate* const d; ToolTipManagerPrivate *const d;
Q_PRIVATE_SLOT(d, void showToolTip()) Q_PRIVATE_SLOT(d, void showToolTip())
Q_PRIVATE_SLOT(d, void resetShownState()) Q_PRIVATE_SLOT(d, void resetShownState())
Q_PRIVATE_SLOT(d, void onWidgetDestroyed(QObject*)) Q_PRIVATE_SLOT(d, void onWidgetDestroyed(QObject*))

View File

@ -44,9 +44,9 @@ public:
QStringList layouts; QStringList layouts;
}; };
UiLoader::UiLoader( QObject *parent ) UiLoader::UiLoader(QObject *parent)
: QObject( parent ), : QObject(parent),
d( new UiLoaderPrivate() ) d(new UiLoaderPrivate())
{ {
d->widgets d->widgets
<< "CheckBox" << "CheckBox"
@ -74,46 +74,46 @@ QStringList UiLoader::availableWidgets() const
return d->widgets; return d->widgets;
} }
QGraphicsWidget *UiLoader::createWidget( const QString &className, QGraphicsWidget *parent ) QGraphicsWidget *UiLoader::createWidget(const QString &className, QGraphicsWidget *parent)
{ {
if (className == QString("CheckBox")) { if (className == QString("CheckBox")) {
return new CheckBox( parent ); return new CheckBox(parent);
} }
else if (className == QString("ComboBox")) { else if (className == QString("ComboBox")) {
return new ComboBox( parent ); return new ComboBox(parent);
} }
else if (className == QString("Flash")) { else if (className == QString("Flash")) {
return new Flash( parent ); return new Flash(parent);
} }
else if (className == QString("Frame")) { else if (className == QString("Frame")) {
return new Frame( parent ); return new Frame(parent);
} }
else if (className == QString("GroupBox")) { else if (className == QString("GroupBox")) {
return new GroupBox( parent ); return new GroupBox(parent);
} }
else if (className == QString("Icon")) { else if (className == QString("Icon")) {
return new Icon( parent ); return new Icon(parent);
} }
else if (className == QString("Label")) { else if (className == QString("Label")) {
return new Label( parent ); return new Label(parent);
} }
else if (className == QString("LineEdit")) { else if (className == QString("LineEdit")) {
return new LineEdit( parent ); return new LineEdit(parent);
} }
else if (className == QString("PushButton")) { else if (className == QString("PushButton")) {
return new PushButton( parent ); return new PushButton(parent);
} }
else if (className == QString("RadioButton")) { else if (className == QString("RadioButton")) {
return new RadioButton( parent ); return new RadioButton(parent);
} }
else if (className == QString("Slider")) { else if (className == QString("Slider")) {
return new Slider( parent ); return new Slider(parent);
} }
else if (className == QString("TabBar")) { else if (className == QString("TabBar")) {
return new TabBar( parent ); return new TabBar(parent);
} }
else if (className == QString("TextEdit")) { else if (className == QString("TextEdit")) {
return new TextEdit( parent ); return new TextEdit(parent);
} }
return 0; return 0;

View File

@ -43,7 +43,7 @@
* Compile time macro for the version number of libplasma * Compile time macro for the version number of libplasma
*/ */
#define PLASMA_VERSION \ #define PLASMA_VERSION \
PLASMA_MAKE_VERSION(PLASMA_VERSION_MAJOR,PLASMA_VERSION_MINOR,PLASMA_VERSION_RELEASE) PLASMA_MAKE_VERSION(PLASMA_VERSION_MAJOR, PLASMA_VERSION_MINOR, PLASMA_VERSION_RELEASE)
/** /**
* Compile-time macro for checking the plasma version. Not useful for * Compile-time macro for checking the plasma version. Not useful for
@ -87,7 +87,6 @@ PLASMA_EXPORT const char *versionString();
*/ */
PLASMA_EXPORT bool isPluginVersionCompatible(unsigned int version); PLASMA_EXPORT bool isPluginVersionCompatible(unsigned int version);
} // Plasma namespace } // Plasma namespace
#endif // multiple inclusion guard #endif // multiple inclusion guard

View File

@ -128,7 +128,6 @@ View::View(Containment *containment, int viewId, QWidget *parent)
} }
} }
View::~View() View::~View()
{ {
delete d; delete d;
@ -240,15 +239,15 @@ void View::setContainment(Plasma::Containment *containment)
connect(containment, SIGNAL(geometryChanged()), this, SLOT(updateSceneRect())); connect(containment, SIGNAL(geometryChanged()), this, SLOT(updateSceneRect()));
} }
Containment* View::containment() const Containment *View::containment() const
{ {
return d->containment; return d->containment;
} }
Containment* View::swapContainment(const QString& name, const QVariantList& args) Containment *View::swapContainment(const QString &name, const QVariantList &args)
{ {
Containment *old = d->containment; Containment *old = d->containment;
Plasma::Corona* corona = old->corona(); Plasma::Corona *corona = old->corona();
Plasma::Containment *c = corona->addContainment(name, args); Plasma::Containment *c = corona->addContainment(name, args);
if (c) { if (c) {
KConfigGroup oldConfig = old->config(); KConfigGroup oldConfig = old->config();
@ -265,7 +264,7 @@ Containment* View::swapContainment(const QString& name, const QVariantList& args
// load the configuration of the old containment into the new one // load the configuration of the old containment into the new one
c->restore(newConfig); c->restore(newConfig);
foreach(Applet* applet, c->applets()) { foreach (Applet *applet, c->applets()) {
applet->init(); applet->init();
// We have to flush the applet constraints manually // We have to flush the applet constraints manually
applet->flushPendingConstraintsEvents(); applet->flushPendingConstraintsEvents();

7
view.h
View File

@ -119,7 +119,7 @@ public:
/** /**
* @return the containment associated with this view, or 0 if none is * @return the containment associated with this view, or 0 if none is
*/ */
Containment* containment() const; Containment *containment() const;
/** /**
* Swap the containment for this view, which will also cause the view * Swap the containment for this view, which will also cause the view
@ -128,8 +128,8 @@ public:
* @param name the plugin name for the new containment. * @param name the plugin name for the new containment.
* @param args argument list to pass to the containment * @param args argument list to pass to the containment
*/ */
Containment* swapContainment(const QString& name, Containment *swapContainment(const QString &name,
const QVariantList& args = QVariantList()); const QVariantList &args = QVariantList());
/** /**
* Set whether or not the view should adjust its size when the associated * Set whether or not the view should adjust its size when the associated
@ -199,4 +199,3 @@ private:
#endif #endif

View File

@ -79,7 +79,7 @@ class PLASMA_EXPORT Wallpaper : public QObject
* @param args to send the wallpaper extra arguments * @param args to send the wallpaper extra arguments
* @return a pointer to the loaded wallpaper, or 0 on load failure * @return a pointer to the loaded wallpaper, or 0 on load failure
**/ **/
static Wallpaper* load(const QString &name, const QVariantList& args = QVariantList()); static Wallpaper *load(const QString &name, const QVariantList &args = QVariantList());
/** /**
* Attempts to load an wallpaper * Attempts to load an wallpaper
@ -92,7 +92,7 @@ class PLASMA_EXPORT Wallpaper : public QObject
* @param args to send the wallpaper extra arguments * @param args to send the wallpaper extra arguments
* @return a pointer to the loaded wallpaper, or 0 on load failure * @return a pointer to the loaded wallpaper, or 0 on load failure
**/ **/
static Wallpaper* load(const KPluginInfo& info, const QVariantList& args = QVariantList()); static Wallpaper *load(const KPluginInfo &info, const QVariantList &args = QVariantList());
/** /**
* Returns the user-visible name for the wallpaper, as specified in the * Returns the user-visible name for the wallpaper, as specified in the
@ -131,7 +131,7 @@ class PLASMA_EXPORT Wallpaper : public QObject
/** /**
* Sets bounding rectangle * Sets bounding rectangle
*/ */
void setBoundingRect(const QRectF& boundingRect); void setBoundingRect(const QRectF &boundingRect);
/** /**
* This method is called when the wallpaper should be painted. * This method is called when the wallpaper should be painted.
@ -139,7 +139,7 @@ class PLASMA_EXPORT Wallpaper : public QObject
* @param painter the QPainter to use to do the painting * @param painter the QPainter to use to do the painting
* @param exposedRect the rect to paint within * @param exposedRect the rect to paint within
**/ **/
virtual void paint(QPainter *painter, const QRectF& exposedRect) = 0; virtual void paint(QPainter *painter, const QRectF &exposedRect) = 0;
/** /**
* This method should be called once the wallpaper is loaded or mode is changed. * This method should be called once the wallpaper is loaded or mode is changed.
@ -208,7 +208,7 @@ class PLASMA_EXPORT Wallpaper : public QObject
* @param parent a QObject parent; you probably want to pass in 0 * @param parent a QObject parent; you probably want to pass in 0
* @param args a list of strings containing one entry: the service id * @param args a list of strings containing one entry: the service id
*/ */
Wallpaper(QObject* parent, const QVariantList& args); Wallpaper(QObject *parent, const QVariantList &args);
/** /**
* This method is called once the wallpaper is loaded or mode is changed. * This method is called once the wallpaper is loaded or mode is changed.
@ -220,7 +220,7 @@ class PLASMA_EXPORT Wallpaper : public QObject
virtual void init(const KConfigGroup &config); virtual void init(const KConfigGroup &config);
private: private:
WallpaperPrivate* const d; WallpaperPrivate *const d;
}; };
} // Plasma namespace } // Plasma namespace