2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-08-14 09:30:56 +02:00
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifndef QT4PROJECT_H
|
|
|
|
|
#define QT4PROJECT_H
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
#include "profileevaluator.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "qt4nodes.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
#include "qt4target.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "qmakestep.h"
|
|
|
|
|
#include "makestep.h"
|
2009-04-28 12:43:04 +02:00
|
|
|
#include "qtversionmanager.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
#include <coreplugin/ifile.h>
|
|
|
|
|
#include <projectexplorer/applicationrunconfiguration.h>
|
|
|
|
|
#include <projectexplorer/projectnodes.h>
|
2009-02-10 15:34:25 +01:00
|
|
|
#include <projectexplorer/toolchain.h>
|
2009-09-24 16:02:02 +02:00
|
|
|
#include <projectexplorer/buildconfiguration.h>
|
2009-05-04 18:22:40 +02:00
|
|
|
#include <cpptools/cppmodelmanagerinterface.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
#include <QtCore/QList>
|
|
|
|
|
#include <QtCore/QStringList>
|
|
|
|
|
#include <QtCore/QPointer>
|
2009-09-28 17:30:11 +02:00
|
|
|
#include <QtCore/QMap>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <QtGui/QDirModel>
|
2010-02-26 12:50:11 +01:00
|
|
|
#include <QtCore/QFutureInterface>
|
2010-03-10 16:55:37 +01:00
|
|
|
#include <QtCore/QTimer>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
2009-12-09 16:56:01 +01:00
|
|
|
struct ProFileOption;
|
2008-12-02 12:01:29 +01:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Qt4ProjectManager {
|
|
|
|
|
|
|
|
|
|
namespace Internal {
|
|
|
|
|
class ProFileReader;
|
|
|
|
|
class DeployHelperRunStep;
|
|
|
|
|
class FileItem;
|
|
|
|
|
class Qt4ProFileNode;
|
|
|
|
|
class Qt4RunConfiguration;
|
|
|
|
|
class GCCPreprocessor;
|
|
|
|
|
struct Qt4ProjectFiles;
|
2009-10-29 12:24:25 +01:00
|
|
|
class Qt4ProjectConfigWidget;
|
2010-03-10 16:55:37 +01:00
|
|
|
class Qt4Target;
|
2009-05-04 18:22:40 +02:00
|
|
|
|
|
|
|
|
class CodeModelInfo
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QByteArray defines;
|
|
|
|
|
QStringList includes;
|
|
|
|
|
QStringList frameworkPaths;
|
2010-01-12 13:13:22 +01:00
|
|
|
QStringList precompiledHeader;
|
2009-05-04 18:22:40 +02:00
|
|
|
};
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class QMakeStep;
|
|
|
|
|
class MakeStep;
|
|
|
|
|
|
|
|
|
|
class Qt4Manager;
|
|
|
|
|
class Qt4Project;
|
|
|
|
|
class Qt4RunStep;
|
|
|
|
|
|
2009-03-19 16:33:44 +01:00
|
|
|
class Qt4ProjectFile : public Core::IFile
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Qt4ProjectFile(Qt4Project *project, const QString &filePath, QObject *parent = 0);
|
|
|
|
|
|
|
|
|
|
bool save(const QString &fileName = QString());
|
|
|
|
|
QString fileName() const;
|
|
|
|
|
|
|
|
|
|
QString defaultPath() const;
|
|
|
|
|
QString suggestedFileName() const;
|
|
|
|
|
virtual QString mimeType() const;
|
|
|
|
|
|
|
|
|
|
bool isModified() const;
|
|
|
|
|
bool isReadOnly() const;
|
|
|
|
|
bool isSaveAsAllowed() const;
|
|
|
|
|
|
|
|
|
|
void modified(Core::IFile::ReloadBehavior *behavior);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const QString m_mimeType;
|
|
|
|
|
Qt4Project *m_project;
|
|
|
|
|
QString m_filePath;
|
|
|
|
|
};
|
|
|
|
|
|
2009-03-19 16:33:44 +01:00
|
|
|
class Qt4Project : public ProjectExplorer::Project
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2010-02-17 15:16:59 +01:00
|
|
|
Qt4Project(Qt4Manager *manager, const QString &proFile);
|
2008-12-02 12:01:29 +01:00
|
|
|
virtual ~Qt4Project();
|
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
QString displayName() const;
|
2010-01-22 15:59:44 +01:00
|
|
|
QString id() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
Core::IFile *file() const;
|
|
|
|
|
ProjectExplorer::IProjectManager *projectManager() const;
|
|
|
|
|
Qt4Manager *qt4ProjectManager() const;
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
Internal::Qt4TargetFactory *targetFactory() const;
|
|
|
|
|
|
|
|
|
|
Internal::Qt4Target *activeTarget() const;
|
2009-10-09 18:14:12 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
QList<Core::IFile *> dependencies(); //NBS remove
|
|
|
|
|
QList<ProjectExplorer::Project *>dependsOn();
|
|
|
|
|
|
|
|
|
|
bool isApplication() const;
|
|
|
|
|
|
|
|
|
|
Internal::Qt4ProFileNode *rootProjectNode() const;
|
|
|
|
|
|
|
|
|
|
virtual QStringList files(FilesMode fileMode) const;
|
2009-12-03 16:23:15 +01:00
|
|
|
virtual QString generatedUiHeader(const QString &formFile) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
|
|
|
|
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QList<Internal::Qt4ProFileNode *> applicationProFiles() const;
|
2010-01-19 13:41:02 +01:00
|
|
|
bool hasApplicationProFile(const QString &path) const;
|
|
|
|
|
QStringList applicationProFilePathes(const QString &prepend = QString()) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2008-12-02 18:14:06 +01:00
|
|
|
void notifyChanged(const QString &name);
|
|
|
|
|
|
2009-05-04 18:22:40 +02:00
|
|
|
virtual QByteArray predefinedMacros(const QString &fileName) const;
|
|
|
|
|
virtual QStringList includePaths(const QString &fileName) const;
|
|
|
|
|
virtual QStringList frameworkPaths(const QString &fileName) const;
|
|
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
2009-12-07 20:49:39 +01:00
|
|
|
Internal::ProFileReader *createProFileReader(Internal::Qt4ProFileNode *qt4ProFileNode);
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
2009-12-07 20:49:39 +01:00
|
|
|
void destroyProFileReader(Internal::ProFileReader *reader);
|
|
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
|
|
|
|
void scheduleAsyncUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *node);
|
|
|
|
|
/// \internal
|
|
|
|
|
void incrementPendingEvaluateFutures();
|
|
|
|
|
/// \internal
|
|
|
|
|
void decrementPendingEvaluateFutures();
|
|
|
|
|
/// \internal
|
|
|
|
|
bool wasEvaluateCanceled();
|
|
|
|
|
|
2009-06-22 15:51:21 +02:00
|
|
|
signals:
|
2010-03-10 16:55:37 +01:00
|
|
|
/// emitted after parse
|
2009-12-03 18:37:27 +01:00
|
|
|
void proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode *node);
|
2010-02-15 17:33:56 +01:00
|
|
|
void buildDirectoryInitialized();
|
2009-06-22 15:51:21 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
public slots:
|
|
|
|
|
void proFileParseError(const QString &errorMessage);
|
2010-02-08 15:50:06 +01:00
|
|
|
void update();
|
2010-03-10 16:55:37 +01:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual bool fromMap(const QVariantMap &map);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
private slots:
|
2010-03-10 16:55:37 +01:00
|
|
|
void proFileEvaluateNeeded(Qt4ProjectManager::Internal::Qt4Target *target);
|
|
|
|
|
|
|
|
|
|
void asyncUpdate();
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
void qtVersionsChanged();
|
|
|
|
|
void onAddedTarget(ProjectExplorer::Target *t);
|
2010-03-10 16:55:37 +01:00
|
|
|
void activeTargetWasChanged();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void scheduleAsyncUpdate();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
void checkForNewApplicationProjects();
|
|
|
|
|
void checkForDeletedApplicationProjects();
|
2010-03-10 16:55:37 +01:00
|
|
|
void updateCodeModel();
|
|
|
|
|
void updateFileList();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
static void collectApplicationProFiles(QList<Internal::Qt4ProFileNode *> &list, Internal::Qt4ProFileNode *node);
|
2008-12-02 18:14:06 +01:00
|
|
|
static void findProFile(const QString& fileName, Internal::Qt4ProFileNode *root, QList<Internal::Qt4ProFileNode *> &list);
|
2008-12-05 14:29:18 +01:00
|
|
|
static bool hasSubNode(Internal::Qt4PriFileNode *root, const QString &path);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
static bool equalFileList(const QStringList &a, const QStringList &b);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
void addDefaultBuild();
|
|
|
|
|
|
|
|
|
|
static QString qmakeVarName(ProjectExplorer::FileType type);
|
|
|
|
|
|
|
|
|
|
Qt4Manager *m_manager;
|
|
|
|
|
Internal::Qt4ProFileNode *m_rootProjectNode;
|
|
|
|
|
Internal::Qt4NodesWatcher *m_nodesWatcher;
|
2010-02-08 15:50:06 +01:00
|
|
|
Internal::Qt4TargetFactory *m_targetFactory;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
Qt4ProjectFile *m_fileInfo;
|
|
|
|
|
bool m_isApplication;
|
|
|
|
|
|
|
|
|
|
// Current configuration
|
|
|
|
|
QString m_oldQtIncludePath;
|
|
|
|
|
QString m_oldQtLibsPath;
|
|
|
|
|
|
|
|
|
|
// cached lists of all of files
|
|
|
|
|
Internal::Qt4ProjectFiles *m_projectFiles;
|
|
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
// cached data during project rescan
|
|
|
|
|
ProFileOption *m_proFileOption;
|
|
|
|
|
int m_proFileOptionRefCnt;
|
|
|
|
|
|
|
|
|
|
QTimer m_asyncUpdateTimer;
|
|
|
|
|
QFutureInterface<void> *m_asyncUpdateFutureInterface;
|
|
|
|
|
int m_pendingEvaluateFuturesCount;
|
|
|
|
|
enum AsyncUpdateState { NoState, Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress };
|
|
|
|
|
AsyncUpdateState m_asyncUpdateState;
|
|
|
|
|
bool m_cancelEvaluate;
|
|
|
|
|
QList<Internal::Qt4ProFileNode *> m_partialEvaluate;
|
2009-05-04 18:22:40 +02:00
|
|
|
|
|
|
|
|
QMap<QString, Internal::CodeModelInfo> m_codeModelInfo;
|
2009-12-03 18:37:27 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
friend class Qt4ProjectFile;
|
2009-10-29 12:24:25 +01:00
|
|
|
friend class Internal::Qt4ProjectConfigWidget;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Qt4ProjectManager
|
|
|
|
|
|
|
|
|
|
#endif // QT4PROJECT_H
|