Plasma
appletinterface.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef APPLETINTERFACE_H
00021 #define APPLETINTERFACE_H
00022
00023 #include <QObject>
00024 #include <Plasma/DataEngine>
00025
00026 class QAction;
00027 class QGraphicsLayout;
00028 class SimpleJavaScriptApplet;
00029 class QSignalMapper;
00030 class QSizeF;
00031
00032 class KConfigGroup;
00033
00034 namespace Plasma
00035 {
00036 class Applet;
00037 class ConfigLoader;
00038 }
00039
00040 class AppletInterface : public QObject
00041 {
00042 Q_OBJECT
00043 Q_ENUMS(FormFactor)
00044 Q_ENUMS(Location)
00045 Q_ENUMS(AspectRatioMode)
00046 Q_ENUMS(QtOrientation)
00047 Q_PROPERTY(QString activeConfig WRITE setActiveConfig READ activeConfig)
00048
00049 public:
00050 AppletInterface(SimpleJavaScriptApplet *parent);
00051 ~AppletInterface();
00052
00053
00054
00055
00056 enum FormFactor {
00057 Planar = 0,
00062 MediaCenter,
00067 Horizontal,
00069 Vertical
00071 };
00072 enum Location {
00073 Floating = 0,
00075 Desktop,
00077 FullScreen,
00078 TopEdge,
00079 BottomEdge,
00080 LeftEdge,
00081 RightEdge
00082 };
00083 enum AspectRatioMode {
00084 InvalidAspectRatioMode = -1,
00087 IgnoreAspectRatio = 0,
00088 KeepAspectRatio = 1,
00089 Square = 2,
00090 ConstrainedSquare = 3,
00093 FixedSize = 4
00094 };
00095
00096
00097 enum QtOrientation {
00098 QtHorizontal= Qt::Horizontal,
00099 QtVertical = Qt::Vertical
00100 };
00101
00102
00103
00104 Q_INVOKABLE FormFactor formFactor();
00105
00106 Q_INVOKABLE Location location();
00107
00108 Q_INVOKABLE QString currentActivity();
00109
00110 Q_INVOKABLE AspectRatioMode aspectRatioMode();
00111
00112 Q_INVOKABLE void setAspectRatioMode(AspectRatioMode mode);
00113
00114 Q_INVOKABLE bool shouldConserveResources();
00115
00116 Q_INVOKABLE void setFailedToLaunch(bool failed, const QString &reason = QString());
00117
00118 Q_INVOKABLE bool isBusy();
00119
00120 Q_INVOKABLE void setBusy(bool busy);
00121
00122 Q_INVOKABLE void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
00123
00124 Q_INVOKABLE QSizeF size() const;
00125
00126 Q_INVOKABLE void setAction(const QString &name, const QString &text,
00127 const QString &icon = QString(), const QString &shortcut = QString());
00128
00129 Q_INVOKABLE void removeAction(const QString &name);
00130
00131 Q_INVOKABLE void resize(qreal w, qreal h);
00132
00133 Q_INVOKABLE void setMinimumSize(qreal w, qreal h);
00134
00135 Q_INVOKABLE void setPreferredSize(qreal w, qreal h);
00136
00137 Q_INVOKABLE void update();
00138
00139 Q_INVOKABLE QString activeConfig() const;
00140
00141 Q_INVOKABLE void setActiveConfig(const QString &name);
00142
00143 Q_INVOKABLE QVariant readConfig(const QString &entry) const;
00144
00145 Q_INVOKABLE void writeConfig(const QString &entry, const QVariant &value);
00146
00147 Plasma::DataEngine *dataEngine(const QString &name);
00148
00149 const Plasma::Package *package() const;
00150 QList<QAction*> contextualActions() const;
00151 Plasma::Applet *applet() const;
00152
00153 Q_SIGNALS:
00154 void releaseVisualFocus();
00155
00156 void configNeedsSaving();
00157
00158 public Q_SLOTS:
00159 void dataUpdated(QString source, Plasma::DataEngine::Data data);
00160
00161 private:
00162 SimpleJavaScriptApplet *m_appletScriptEngine;
00163 QSet<QString> m_actions;
00164 QSignalMapper *m_actionSignals;
00165 QString m_currentConfig;
00166 QMap<QString, Plasma::ConfigLoader*> m_configs;
00167 };
00168
00169 #endif