Kross
action.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 KROSS_ACTION_H
00021 #define KROSS_ACTION_H
00022
00023
00024 #include <QtCore/QVariant>
00025 #include <QtCore/QObject>
00026 #include <QtCore/QDir>
00027 #include <QtXml/QDomAttr>
00028 #include <QtGui/QAction>
00029 #include <QtCore/QUrl>
00030
00031 #include "errorinterface.h"
00032 #include "childreninterface.h"
00033
00034 namespace Kross {
00035
00092 class KROSSCORE_EXPORT Action : public QAction, public ChildrenInterface, public ErrorInterface
00093 {
00094 Q_OBJECT
00095
00096 public:
00097
00106 Action(QObject* parent, const QString& name, const QDir& packagepath = QDir());
00107
00119 Action(QObject* parent, const QUrl& url);
00120
00124 virtual ~Action();
00125
00131 void fromDomElement(const QDomElement& element);
00132
00138 QDomElement toDomElement() const;
00139
00145 QMap<QString, QVariant>& options() const;
00146
00152 QVariant option(const QString& name, const QVariant& defaultvalue = QVariant());
00153
00157 bool setOption(const QString& name, const QVariant& value);
00158
00162 QStringList functionNames();
00163
00170 QVariant callFunction(const QString& name, const QVariantList& args = QVariantList());
00171
00181 bool initialize();
00182
00189 void finalize();
00190
00195 bool isFinalized() const;
00196
00197 public Q_SLOTS:
00198
00202 QString name() const;
00203
00208 int version() const;
00209
00213 QString description() const;
00214
00218 void setDescription(const QString& description);
00219
00223 QString iconName() const;
00224
00228 void setIconName(const QString& iconname);
00229
00233 bool isEnabled() const;
00234
00238 void setEnabled(bool enabled);
00239
00243 QString file() const;
00244
00248 bool setFile(const QString& scriptfile);
00249
00253 QByteArray code() const;
00254
00258 void setCode(const QByteArray& code);
00259
00264 QString interpreter() const;
00265
00269 void setInterpreter(const QString& interpretername);
00270
00275 QString currentPath() const;
00276
00277 Q_SIGNALS:
00278
00285 void updated();
00286
00290 void started(Kross::Action*);
00291
00295 void finished(Kross::Action*);
00296
00300 void finalized(Kross::Action*);
00301
00302 private Q_SLOTS:
00303
00309 void slotTriggered();
00310
00311 private:
00313 class Private;
00315 Private* const d;
00316 };
00317
00318 }
00319
00320 #endif
00321