Kross
manager.h
Go to the documentation of this file.
00001 /*************************************************************************** 00002 * manager.h 00003 * This file is part of the KDE project 00004 * copyright (C)2004-2007 by Sebastian Sauer (mail@dipe.org) 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this program; see the file COPYING. If not, write to 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 ***************************************************************************/ 00019 00020 #ifndef KROSS_MANAGER_H 00021 #define KROSS_MANAGER_H 00022 00023 #include <QtCore/QStringList> 00024 #include <QtCore/QMap> 00025 #include <QtCore/QObject> 00026 #include <QtCore/QUrl> 00027 #include <QtScript/QScriptable> 00028 00029 #include "krossconfig.h" 00030 #include "childreninterface.h" 00031 #include "metatype.h" 00032 00033 namespace Kross { 00034 00035 // Forward declarations. 00036 class Interpreter; 00037 class Action; 00038 class ActionCollection; 00039 class InterpreterInfo; 00040 00049 class KROSSCORE_EXPORT Manager 00050 : public QObject 00051 , public QScriptable 00052 , public ChildrenInterface 00053 { 00054 Q_OBJECT 00055 00056 public: 00057 00062 static Manager& self(); 00063 00068 QHash<QString, InterpreterInfo*> interpreterInfos() const; 00069 00074 bool hasInterpreterInfo(const QString& interpretername) const; 00075 00081 InterpreterInfo* interpreterInfo(const QString& interpretername) const; 00082 00093 const QString interpreternameForFile(const QString& file); 00094 00104 Interpreter* interpreter(const QString& interpretername) const; 00105 00111 ActionCollection* actionCollection() const; 00112 00119 MetaTypeHandler* metaTypeHandler(const QByteArray& typeName) const; 00120 00132 void registerMetaTypeHandler(const QByteArray& typeName, MetaTypeHandler::FunctionPtr* handler); 00133 00145 void registerMetaTypeHandler(const QByteArray& typeName, MetaTypeHandler::FunctionPtr2* handler); 00146 00158 void registerMetaTypeHandler(const QByteArray& typeName, MetaTypeHandler* handler); 00159 00165 bool strictTypesEnabled() const; 00166 00177 void setStrictTypesEnabled(bool enabled); 00178 00182 bool hasHandlerAssigned(const QByteArray& typeName) const; 00183 public Q_SLOTS: 00184 00190 QStringList interpreters() const; 00191 00197 bool hasAction(const QString& name); 00198 00204 QObject* action(const QString& name); 00205 00215 QObject* module(const QString& modulename); 00216 00223 void deleteModules(); 00224 00229 bool executeScriptFile(const QUrl& file = QUrl()); 00230 00231 void addQObject(QObject* obj, const QString &name = QString()); 00232 QObject* qobject(const QString &name) const; 00233 QStringList qobjectNames() const; 00234 00235 Q_SIGNALS: 00236 00240 void started(Kross::Action*); 00241 00245 void finished(Kross::Action*); 00246 00247 private: 00249 class Private; 00251 Private* const d; 00252 00253 public: 00254 00259 explicit Manager(); 00260 00264 virtual ~Manager(); 00265 }; 00266 00267 } 00268 00269 Q_DECLARE_METATYPE(Kross::Manager*) 00270 00271 #endif 00272
KDE 4.6 API Reference