|Home | Tutorial | Classes | Functions | QSA Developer | Language | Library | Qt API | QSA Articles Qt Script for Applications

qsproject.h

This is the verbatim text of the qsproject.h include file. It is provided only for illustration; the copyright remains with Trolltech.


/****************************************************************************
** $Id$
**
** Definition of the QSProject class.
**
** Copyright (C) 2001-2002 Trolltech AS.  All rights reserved.
**
** This file is part of the Qt Script for Applications framework (QSA).
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding a valid QSA Beta Evaluation Version license may use
** this file in accordance with the QSA Beta Evaluation Version License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
**   information about QSA Commercial License Agreements.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
*****************************************************************************/

#ifndef QSPROJECT_H
#define QSPROJECT_H

#include "qsaglobal.h"

#include <qobject.h>
#include <qobjectlist.h>
#include <qdatetime.h>

class QSProjectPrivate;
class QSEditor;

class FormWindow;
class MainWindow;
class Project;

class QuickInterpreter;

class QSA_EXPORT QSProject : public QObject
{
    friend class QSInterpreter;
    friend class QSEditor;
    friend class QSADesignerInterface;
    friend class QuickCompletion;
    friend class QuickLanguageInterfaceImpl;
    friend class QuickProgramInterfaceImpl;
    friend class QuickEditorInterfaceImpl;
    friend class QuickEditorToolTip;
    friend class QuickVariableItem;
    friend class QuickEditorBrowser;
    friend class QuickStackView;
    friend class QuickInterpreterInterfaceImpl;
    friend class QuickDebuggerFrontend;

    Q_OBJECT

public:
    enum IDEFlags {
	GUIBuilder = 1,
	Debugger = 2,
	SignalHandlerTab = 4,
	EditableEditor = 8,
	FullIDE = GUIBuilder | Debugger | SignalHandlerTab | EditableEditor,
	OnlyEditor = EditableEditor | SignalHandlerTab,
	OnlySimpleEditor = EditableEditor,
	OnlyEditorAndDebugger = EditableEditor | Debugger | SignalHandlerTab
    };

    QStringList forms() const;
    QStringList scriptFiles() const;
    QString formSource( const QString &formName ) const;
    QString formUi( const QString &formName ) const;
    QString source( const QString &fileName ) const;
    QByteArray projectData() const;

    bool isOpened() const;

    QDateTime lastModified() const;
    QString projectName() const;

    void setInterpreter( QSInterpreter *interp );
    QSInterpreter *interpreter() const;
    QSEditor *activeEditor() const;
    QPtrList<QSEditor> *editors() const;

    bool eventFilter( QObject *, QEvent * );

public slots:
    void open( const QString &scriptProject );
    void open( const QByteArray &projectData, const QString &projectName );

    void addSource( const QString &code, const QString &fileName,
		    bool append = FALSE );
    void removeSource( const QString &fileName );
    QString objectSource( QObject *object ) const;
    void setObjectSource( QObject *object, const QString &code, bool append = FALSE );

    void addForm( const QString &fileName );
    void removeForm( const QString &fileName );

    void openIDE( int flags = FullIDE );
    void closeIDE();
    bool addFunction( const QString &functionName,
		      const QString &functionBody = QString::null,
		      bool openIDE = TRUE );

    void reset();

    virtual void registerEditor( QSEditor *editor );
    virtual void unregisterEditor( QSEditor *editor );

private slots:
    bool checkProject();
    void objectDestroyed( QObject *o );
    void formAdded( FormWindow *fw );

private:
    bool isRunning() const; // ### made private for now, I don't think it makes sense in public API

    void stopProject( bool force = FALSE );
    void setupPluginManagers();
    void setupDesigner();
    void removeObject( QObject *o );
    void closeProject();
    void checkAndStopProject();
    static bool isIDEOpen();
    static QSInterpreter *ideInterpreter();
    static QuickInterpreter *ideQuickInterpreter();

private:
    QSProject();
    virtual ~QSProject();
    // disabled copy constructor and assignment operator
    QSProject( const QSProject & );
    QSProject& operator=( const QSProject & );

private:
    MainWindow *designer;
    Project *project;
    QSProjectPrivate *d;
    QDateTime lastmod;
    QSInterpreter *interp;
    QString projname;
    QPtrList<QSEditor> *listEditors;

    uint running:1;
    uint opened:1;
};

inline QDateTime QSProject::lastModified() const
{
    return lastmod;
}

inline bool QSProject::isRunning() const
{
    return running;
}

inline bool QSProject::isOpened() const
{
    return opened;
}

inline QPtrList<QSEditor> *QSProject::editors() const
{
    return listEditors;
}

#endif


Copyright © 2001-2003 TrolltechTrademarks
QSA version 1.0.0-beta2