* background hints

* constify some methods that were missing it

svn path=/trunk/KDE/kdebase/runtime/; revision=1048735
This commit is contained in:
Aaron J. Seigo 2009-11-13 21:44:51 +00:00
parent 27f4697300
commit 52e72fe5d2
2 changed files with 38 additions and 13 deletions

View File

@ -51,22 +51,22 @@ Plasma::DataEngine* AppletInterface::dataEngine(const QString &name)
return applet()->dataEngine(name); return applet()->dataEngine(name);
} }
AppletInterface::FormFactor AppletInterface::formFactor() AppletInterface::FormFactor AppletInterface::formFactor() const
{ {
return static_cast<FormFactor>(applet()->formFactor()); return static_cast<FormFactor>(applet()->formFactor());
} }
AppletInterface::Location AppletInterface::location() AppletInterface::Location AppletInterface::location() const
{ {
return static_cast<Location>(applet()->location()); return static_cast<Location>(applet()->location());
} }
QString AppletInterface::currentActivity() QString AppletInterface::currentActivity() const
{ {
return applet()->context()->currentActivity(); return applet()->context()->currentActivity();
} }
AppletInterface::AspectRatioMode AppletInterface::aspectRatioMode() AppletInterface::AspectRatioMode AppletInterface::aspectRatioMode() const
{ {
return static_cast<AspectRatioMode>(applet()->aspectRatioMode()); return static_cast<AspectRatioMode>(applet()->aspectRatioMode());
} }
@ -76,7 +76,7 @@ void AppletInterface::setAspectRatioMode(AppletInterface::AspectRatioMode mode)
applet()->setAspectRatioMode(static_cast<Plasma::AspectRatioMode>(mode)); applet()->setAspectRatioMode(static_cast<Plasma::AspectRatioMode>(mode));
} }
bool AppletInterface::shouldConserveResources() bool AppletInterface::shouldConserveResources() const
{ {
return applet()->shouldConserveResources(); return applet()->shouldConserveResources();
} }
@ -86,7 +86,7 @@ void AppletInterface::setFailedToLaunch(bool failed, const QString &reason)
m_appletScriptEngine->setFailedToLaunch(failed, reason); m_appletScriptEngine->setFailedToLaunch(failed, reason);
} }
bool AppletInterface::isBusy() bool AppletInterface::isBusy() const
{ {
return applet()->isBusy(); return applet()->isBusy();
} }
@ -96,6 +96,16 @@ void AppletInterface::setBusy(bool busy)
applet()->setBusy(busy); applet()->setBusy(busy);
} }
AppletInterface::BackgroundHints AppletInterface::backgroundHints() const
{
return static_cast<BackgroundHints>(static_cast<int>(applet()->backgroundHints()));
}
void AppletInterface::setBackgroundHints(BackgroundHints hint)
{
applet()->setBackgroundHints(Plasma::Applet::BackgroundHints(hint));
}
void AppletInterface::setConfigurationRequired(bool needsConfiguring, const QString &reason) void AppletInterface::setConfigurationRequired(bool needsConfiguring, const QString &reason)
{ {
m_appletScriptEngine->setConfigurationRequired(needsConfiguring, reason); m_appletScriptEngine->setConfigurationRequired(needsConfiguring, reason);

View File

@ -24,6 +24,8 @@
#include <QObject> #include <QObject>
#include <QSizePolicy> #include <QSizePolicy>
#include <QScriptValue> #include <QScriptValue>
#include <Plasma/Applet>
#include <Plasma/DataEngine> #include <Plasma/DataEngine>
class QAction; class QAction;
@ -34,7 +36,6 @@ class QSizeF;
namespace Plasma namespace Plasma
{ {
class Applet;
class ConfigLoader; class ConfigLoader;
} // namespace Plasa } // namespace Plasa
@ -44,6 +45,7 @@ class AppletInterface : public QObject
Q_ENUMS(FormFactor) Q_ENUMS(FormFactor)
Q_ENUMS(Location) Q_ENUMS(Location)
Q_ENUMS(AspectRatioMode) Q_ENUMS(AspectRatioMode)
Q_ENUMS(BackgroundHints)
Q_ENUMS(QtOrientation) Q_ENUMS(QtOrientation)
Q_ENUMS(QtAnchorPoint) Q_ENUMS(QtAnchorPoint)
Q_ENUMS(QtCorner) Q_ENUMS(QtCorner)
@ -51,6 +53,7 @@ class AppletInterface : public QObject
Q_ENUMS(QtAlignment) Q_ENUMS(QtAlignment)
Q_PROPERTY(QString activeConfig WRITE setActiveConfig READ activeConfig) Q_PROPERTY(QString activeConfig WRITE setActiveConfig READ activeConfig)
Q_PROPERTY(bool busy WRITE setBusy READ isBusy) Q_PROPERTY(bool busy WRITE setBusy READ isBusy)
Q_PROPERTY(BackgroundHints backgroundHints WRITE setBackgroundHints READ backgroundHints)
public: public:
AppletInterface(SimpleJavaScriptApplet *parent); AppletInterface(SimpleJavaScriptApplet *parent);
@ -75,6 +78,7 @@ enum FormFactor {
Vertical /**< The applet is constrained horizontally, but Vertical /**< The applet is constrained horizontally, but
can expand vertically. */ can expand vertically. */
}; };
enum Location { enum Location {
Floating = 0, /**< Free floating. Neither geometry or z-ordering Floating = 0, /**< Free floating. Neither geometry or z-ordering
is described precisely by this value. */ is described precisely by this value. */
@ -86,6 +90,7 @@ enum Location {
LeftEdge, /**< Along the left side of the screen */ LeftEdge, /**< Along the left side of the screen */
RightEdge /**< Along the right side of the screen */ RightEdge /**< Along the right side of the screen */
}; };
enum AspectRatioMode { enum AspectRatioMode {
InvalidAspectRatioMode = -1, /**< Unsetted mode used for dev convenience InvalidAspectRatioMode = -1, /**< Unsetted mode used for dev convenience
when there is a need to store the when there is a need to store the
@ -131,6 +136,13 @@ enum QtSizePolicy {
QSizePolicyIgnored = QSizePolicy::Ignored QSizePolicyIgnored = QSizePolicy::Ignored
}; };
enum BackgroundHints {
NoBackground = Plasma::Applet::NoBackground,
StandardBackground = Plasma::Applet::StandardBackground,
TranslucentBackground = Plasma::Applet::TranslucentBackground,
DefaultBackground = Plasma::Applet::DefaultBackground
};
enum QtAlignment { enum QtAlignment {
QtAlignLeft = 0x0001, QtAlignLeft = 0x0001,
QtAlignRight = 0x0002, QtAlignRight = 0x0002,
@ -143,24 +155,27 @@ enum QtAlignment {
//------------------------------------------------------------------- //-------------------------------------------------------------------
Q_INVOKABLE FormFactor formFactor(); Q_INVOKABLE FormFactor formFactor() const;
Q_INVOKABLE Location location(); Q_INVOKABLE Location location() const;
Q_INVOKABLE QString currentActivity(); Q_INVOKABLE QString currentActivity() const;
Q_INVOKABLE AspectRatioMode aspectRatioMode(); Q_INVOKABLE AspectRatioMode aspectRatioMode() const;
Q_INVOKABLE void setAspectRatioMode(AspectRatioMode mode); Q_INVOKABLE void setAspectRatioMode(AspectRatioMode mode);
Q_INVOKABLE bool shouldConserveResources(); Q_INVOKABLE bool shouldConserveResources() const;
Q_INVOKABLE void setFailedToLaunch(bool failed, const QString &reason = QString()); Q_INVOKABLE void setFailedToLaunch(bool failed, const QString &reason = QString());
Q_INVOKABLE bool isBusy(); Q_INVOKABLE bool isBusy() const;
Q_INVOKABLE void setBusy(bool busy); Q_INVOKABLE void setBusy(bool busy);
Q_INVOKABLE BackgroundHints backgroundHints() const;
Q_INVOKABLE void setBackgroundHints(BackgroundHints hint);
Q_INVOKABLE void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString()); Q_INVOKABLE void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
Q_INVOKABLE QSizeF size() const; Q_INVOKABLE QSizeF size() const;