2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
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
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
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
|
|
|
|
|
|
2011-05-06 13:54:53 +02:00
|
|
|
#include "qt4projectmanager_global.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-03-17 17:45:33 +01:00
|
|
|
#include <projectexplorer/project.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <projectexplorer/projectnodes.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QStringList>
|
|
|
|
|
#include <QMap>
|
|
|
|
|
#include <QFutureInterface>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
#include <QFuture>
|
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
|
|
|
|
|
|
2011-05-20 21:40:53 +02:00
|
|
|
namespace QtSupport {
|
|
|
|
|
class ProFileReader;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace Qt4ProjectManager {
|
2011-05-25 11:23:25 +02:00
|
|
|
class Qt4ProFileNode;
|
2011-09-07 11:52:04 +02:00
|
|
|
class Qt4PriFileNode;
|
2011-08-18 16:46:44 +02:00
|
|
|
class Qt4BaseTarget;
|
|
|
|
|
class Qt4BuildConfiguration;
|
2011-10-28 10:15:04 +00:00
|
|
|
class Qt4Manager;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
namespace Internal {
|
|
|
|
|
class DeployHelperRunStep;
|
|
|
|
|
class FileItem;
|
|
|
|
|
class GCCPreprocessor;
|
|
|
|
|
struct Qt4ProjectFiles;
|
2009-10-29 12:24:25 +01:00
|
|
|
class Qt4ProjectConfigWidget;
|
2011-08-18 16:46:44 +02:00
|
|
|
class Qt4ProjectFile;
|
2010-03-17 17:45:33 +01:00
|
|
|
class Qt4NodesWatcher;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class QMakeStep;
|
|
|
|
|
class MakeStep;
|
|
|
|
|
|
|
|
|
|
class Qt4Project;
|
|
|
|
|
class Qt4RunStep;
|
|
|
|
|
|
2010-08-10 16:27:35 +02:00
|
|
|
namespace Internal {
|
2011-08-18 16:46:44 +02:00
|
|
|
class CentralizedFolderWatcher;
|
2010-08-10 16:27:35 +02:00
|
|
|
}
|
|
|
|
|
|
2011-05-06 13:54:53 +02:00
|
|
|
class QT4PROJECTMANAGER_EXPORT 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;
|
2012-02-14 16:43:51 +01:00
|
|
|
Core::IDocument *document() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
ProjectExplorer::IProjectManager *projectManager() const;
|
|
|
|
|
Qt4Manager *qt4ProjectManager() const;
|
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
Qt4BaseTarget *activeTarget() const;
|
2009-10-09 18:14:12 +02:00
|
|
|
|
2012-02-14 16:43:51 +01:00
|
|
|
QList<Core::IDocument *> dependencies(); //NBS remove
|
2008-12-02 12:01:29 +01:00
|
|
|
QList<ProjectExplorer::Project *>dependsOn();
|
|
|
|
|
|
2011-08-18 16:46:44 +02:00
|
|
|
ProjectExplorer::ProjectNode *rootProjectNode() const;
|
|
|
|
|
Qt4ProFileNode *rootQt4ProjectNode() const;
|
2010-10-27 16:27:22 +02:00
|
|
|
bool validParse(const QString &proFilePath) const;
|
2011-06-10 15:37:10 +02:00
|
|
|
bool parseInProgress(const QString &proFilePath) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
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
|
|
|
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-05-25 11:23:25 +02:00
|
|
|
QList<Qt4ProFileNode *> allProFiles() const;
|
|
|
|
|
QList<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);
|
|
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
2011-05-25 11:23:25 +02:00
|
|
|
QtSupport::ProFileReader *createProFileReader(Qt4ProFileNode *qt4ProFileNode, Qt4BuildConfiguration *bc = 0);
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
2011-10-07 15:40:38 +02:00
|
|
|
ProFileOption *proFileOption();
|
|
|
|
|
/// \internal
|
2011-05-20 21:40:53 +02:00
|
|
|
void destroyProFileReader(QtSupport::ProFileReader *reader);
|
2009-12-07 20:49:39 +01:00
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
2011-05-25 11:23:25 +02:00
|
|
|
void scheduleAsyncUpdate(Qt4ProjectManager::Qt4ProFileNode *node);
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
|
|
|
|
void incrementPendingEvaluateFutures();
|
|
|
|
|
/// \internal
|
|
|
|
|
void decrementPendingEvaluateFutures();
|
|
|
|
|
/// \internal
|
|
|
|
|
bool wasEvaluateCanceled();
|
|
|
|
|
|
2010-11-04 14:02:45 +01:00
|
|
|
// For Qt4ProFileNode after a on disk change
|
|
|
|
|
void updateFileList();
|
2011-09-15 12:15:10 +02:00
|
|
|
void updateCodeModels();
|
2010-10-27 16:27:22 +02:00
|
|
|
|
2011-09-07 11:52:04 +02:00
|
|
|
void watchFolders(const QStringList &l, Qt4PriFileNode *node);
|
|
|
|
|
void unwatchFolders(const QStringList &l, Qt4PriFileNode *node);
|
2011-08-18 16:46:44 +02:00
|
|
|
|
2011-10-28 10:15:04 +00:00
|
|
|
bool needsConfiguration() const;
|
|
|
|
|
|
2009-06-22 15:51:21 +02:00
|
|
|
signals:
|
2011-09-12 13:25:12 +02:00
|
|
|
void proParsingDone();
|
2011-06-10 15:37:10 +02:00
|
|
|
void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *node, bool, bool);
|
2010-02-15 17:33:56 +01:00
|
|
|
void buildDirectoryInitialized();
|
2011-03-18 16:36:25 +01:00
|
|
|
void fromMapFinished();
|
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-12-10 19:02:19 +01:00
|
|
|
void proFileEvaluateNeeded(Qt4ProjectManager::Qt4BaseTarget *target);
|
2010-03-10 16:55:37 +01:00
|
|
|
|
|
|
|
|
void asyncUpdate();
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
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
|
|
|
|
2010-09-21 14:28:55 +02:00
|
|
|
void updateCppCodeModel();
|
|
|
|
|
void updateQmlJSCodeModel();
|
2010-11-04 14:02:45 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-05-25 11:23:25 +02:00
|
|
|
static void collectAllfProFiles(QList<Qt4ProFileNode *> &list, Qt4ProFileNode *node);
|
|
|
|
|
static void collectApplicationProFiles(QList<Qt4ProFileNode *> &list, Qt4ProFileNode *node);
|
|
|
|
|
static void findProFile(const QString& fileName, Qt4ProFileNode *root, QList<Qt4ProFileNode *> &list);
|
2011-09-07 11:52:04 +02:00
|
|
|
static bool hasSubNode(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
|
|
|
|
|
|
|
|
static QString qmakeVarName(ProjectExplorer::FileType type);
|
|
|
|
|
|
|
|
|
|
Qt4Manager *m_manager;
|
2011-05-25 11:23:25 +02:00
|
|
|
Qt4ProFileNode *m_rootProjectNode;
|
2008-12-02 12:01:29 +01:00
|
|
|
Internal::Qt4NodesWatcher *m_nodesWatcher;
|
|
|
|
|
|
2011-08-18 16:46:44 +02:00
|
|
|
Internal::Qt4ProjectFile *m_fileInfo;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// 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;
|
2010-03-11 17:01:06 +01:00
|
|
|
enum AsyncUpdateState { NoState, Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown };
|
2010-03-10 16:55:37 +01:00
|
|
|
AsyncUpdateState m_asyncUpdateState;
|
|
|
|
|
bool m_cancelEvaluate;
|
2011-05-30 13:11:31 +02:00
|
|
|
bool m_codeModelCanceled;
|
2011-05-25 11:23:25 +02:00
|
|
|
QList<Qt4ProFileNode *> m_partialEvaluate;
|
2009-05-04 18:22:40 +02:00
|
|
|
|
2010-03-02 12:51:47 +01:00
|
|
|
QFuture<void> m_codeModelFuture;
|
2009-12-03 18:37:27 +01:00
|
|
|
|
2011-08-18 16:46:44 +02:00
|
|
|
Internal::CentralizedFolderWatcher *m_centralizedFolderWatcher;
|
2010-08-10 16:27:35 +02:00
|
|
|
|
2011-08-18 16:55:45 +02:00
|
|
|
friend class Internal::Qt4ProjectFile;
|
2009-10-29 12:24:25 +01:00
|
|
|
friend class Internal::Qt4ProjectConfigWidget;
|
2011-10-28 10:15:04 +00:00
|
|
|
friend class Qt4Manager; // to schedule a async update if the unconfigured settings change
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Qt4ProjectManager
|
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#endif // QT4PROJECT_H
|