Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qsproject.h 1.1.5 edited 2006-02-23T15:39:57$ 00003 ** 00004 ** Copyright (C) 2001-2006 Trolltech AS. All rights reserved. 00005 ** 00006 ** This file is part of the Qt Script for Applications framework (QSA). 00007 ** 00008 ** This file may be distributed and/or modified under the terms of the 00009 ** GNU General Public License version 2 as published by the Free Software 00010 ** Foundation and appearing in the file LICENSE.GPL included in the 00011 ** packaging of this file. 00012 ** 00013 ** Licensees holding a valid Qt Script for Applications license may use 00014 ** this file in accordance with the Qt Script for Applications License 00015 ** Agreement provided with the Software. 00016 ** 00017 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00018 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00019 ** 00020 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00021 ** information about QSA Commercial License Agreements. 00022 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00023 ** 00024 ** Contact info@trolltech.com if any conditions of this licensing are 00025 ** not clear to you. 00026 ** 00027 *****************************************************************************/ 00028 00029 #ifndef QSPROJECT_H 00030 #define QSPROJECT_H 00031 00032 #include "qsaglobal.h" 00033 00034 #include <qobject.h> 00035 #include <qobjectlist.h> 00036 #include <qdatetime.h> 00037 #include <qptrlist.h> 00038 #include <qstringlist.h> 00039 00040 #include <qsscript.h> 00041 00042 //### AbanQ 00043 #ifdef QSDEBUGGER 00044 class QuickDebugger; 00045 #endif 00046 //### AbanQ 00047 00048 class QSEditor; 00049 class QSProjectPrivate; 00050 class QSInterpreter; 00051 00052 class QSA_EXPORT QSProject : public QObject 00053 { 00054 friend class QSInterpreter; 00055 friend class QSInterfaceFactory; 00056 friend class QSEditor; 00057 00058 Q_OBJECT 00059 00060 public: 00061 enum StorageMode { 00062 Bundle, 00063 TextFiles 00064 }; 00065 00066 QSProject(QObject *parent = 0, const char *name = 0); 00067 virtual ~QSProject(); 00068 00069 bool editorsModified() const; 00070 bool scriptsModified() const; 00071 00072 QSInterpreter *interpreter() const; 00073 QStringList scriptNames() const; 00074 QPtrList<QSScript> scripts() const; 00075 QSScript *script(const QString &name) const; 00076 QSScript *script(QObject *context) const; 00077 00078 QObject *object(const QString &name) const; 00079 QObjectList objects() const; 00080 00081 QSScript *createScript(QObject *context, const QString &code = QString::null); 00082 QSScript *createScript(const QString &name, const QString &code = QString::null); 00083 00084 void addSignalHandler(QObject *sender, const char *signal, 00085 QObject *receiver, const char *qtscriptFunction); 00086 void addSignalHandler(QObject *sender, const char *signal, 00087 const char *qtscriptFunction); 00088 void removeSignalHandler(QObject *sender, const char *signal, 00089 QObject *receiver, const char *qtscriptFunction); 00090 void removeSignalHandler(QObject *sender, const char *signal, 00091 const char *qtscriptFunction); 00092 00093 QSEditor *activeEditor() const; 00094 QPtrList<QSEditor> editors() const; 00095 QSEditor *editor(QSScript *script) const; 00096 QSEditor *createEditor(QSScript *script, QWidget *parent = 0, const char *name = 0); 00097 00098 void setStorageMode(StorageMode mode); 00099 StorageMode storageMode() const; 00100 00101 //### AbanQ 00102 #ifdef QSDEBUGGER 00103 QuickDebugger *debugger() const; 00104 #endif 00105 //### AbanQ 00106 00107 public slots: 00108 bool load(const QString &fileName); 00109 bool save(const QString &fileName = QString::null); 00110 00111 bool loadFromData(QByteArray data); 00112 bool saveToData(QByteArray data); 00113 00114 void clearObjects(); 00115 void addObject(QObject *object); 00116 void removeObject(const QObject *object); 00117 00118 void commitEditorContents(); 00119 void revertEditorContents(); 00120 00121 signals: 00122 void editorTextChanged(); 00123 void projectChanged(); 00124 void projectEvaluated(); 00125 00126 private slots: 00127 void objectDestroyed(); 00128 void invalidateProject(); 00129 void scriptChanged(); 00130 void evaluate(); 00131 00132 private: 00133 // disabled copy constructor and assignment operator 00134 QSProject(const QSProject &); 00135 QSProject &operator=(const QSProject &); 00136 00137 void initObjects(); 00138 void initEventHandlers(); 00139 00140 QSScript *createScriptInternal(const QString &name, 00141 const QString &code, 00142 QObject *context); 00143 bool saveInternal(QDataStream *strm); 00144 bool loadInternal(QDataStream *strm); 00145 void registerEditor(QSEditor *editor); 00146 void unregisterEditor(QSEditor *editor); 00147 00148 private: 00149 QSProjectPrivate *d; 00150 00151 }; 00152 00153 #endif 00154