2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Contact: Nokia Corporation (info@qt.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
|
|
|
|
|
** 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
|
|
|
|
|
|
|
|
|
|
#include "qt4nodes.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
#include "qt4target.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>
|
2010-03-17 17:45:33 +01:00
|
|
|
#include <coreplugin/ifile.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
#include <QtCore/QStringList>
|
2009-09-28 17:30:11 +02:00
|
|
|
#include <QtCore/QMap>
|
2010-02-26 12:50:11 +01:00
|
|
|
#include <QtCore/QFutureInterface>
|
2010-03-10 16:55:37 +01:00
|
|
|
#include <QtCore/QTimer>
|
2010-03-17 17:45:33 +01:00
|
|
|
#include <QtCore/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
|
|
|
|
|
|
|
|
|
|
namespace Qt4ProjectManager {
|
|
|
|
|
|
|
|
|
|
namespace Internal {
|
|
|
|
|
class ProFileReader;
|
|
|
|
|
class DeployHelperRunStep;
|
|
|
|
|
class FileItem;
|
|
|
|
|
class Qt4ProFileNode;
|
2010-03-17 17:45:33 +01:00
|
|
|
class Qt4PriFileNode;
|
2008-12-02 12:01:29 +01:00
|
|
|
class GCCPreprocessor;
|
|
|
|
|
struct Qt4ProjectFiles;
|
2009-10-29 12:24:25 +01:00
|
|
|
class Qt4ProjectConfigWidget;
|
2010-03-17 17:45:33 +01:00
|
|
|
|
|
|
|
|
class Qt4NodesWatcher;
|
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);
|
|
|
|
|
|
2011-03-30 13:45:16 +02:00
|
|
|
bool save(QString *errorString, const QString &fileName = QString());
|
2008-12-02 12:01:29 +01:00
|
|
|
QString fileName() const;
|
2010-05-11 14:13:38 +02:00
|
|
|
virtual void rename(const QString &newName);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QString defaultPath() const;
|
|
|
|
|
QString suggestedFileName() const;
|
|
|
|
|
virtual QString mimeType() const;
|
|
|
|
|
|
|
|
|
|
bool isModified() const;
|
|
|
|
|
bool isReadOnly() const;
|
|
|
|
|
bool isSaveAsAllowed() const;
|
|
|
|
|
|
2010-03-19 10:28:05 +01:00
|
|
|
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
|
|
|
|
|
void reload(ReloadFlag flag, ChangeType type);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const QString m_mimeType;
|
|
|
|
|
Qt4Project *m_project;
|
|
|
|
|
QString m_filePath;
|
|
|
|
|
};
|
|
|
|
|
|
2010-08-10 16:27:35 +02:00
|
|
|
/// Watches folders for Qt4PriFile nodes
|
|
|
|
|
/// use one file system watcher to watch all folders
|
|
|
|
|
/// such minimizing system ressouce usage
|
|
|
|
|
namespace Internal {
|
|
|
|
|
class CentralizedFolderWatcher : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
CentralizedFolderWatcher();
|
|
|
|
|
~CentralizedFolderWatcher();
|
|
|
|
|
void watchFolders(const QList<QString> &folders, Qt4PriFileNode *node);
|
|
|
|
|
void unwatchFolders(const QList<QString> &folders, Qt4PriFileNode *node);
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void folderChanged(const QString &folder);
|
2010-10-13 15:33:51 +02:00
|
|
|
void onTimer();
|
|
|
|
|
void delayedFolderChanged(const QString &folder);
|
2010-08-10 16:27:35 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QSet<QString> recursiveDirs(const QString &folder);
|
|
|
|
|
QFileSystemWatcher m_watcher;
|
|
|
|
|
QMultiMap<QString, Qt4PriFileNode *> m_map;
|
|
|
|
|
|
|
|
|
|
QSet<QString> m_recursiveWatchedFolders;
|
2010-10-13 15:33:51 +02:00
|
|
|
QTimer m_compressTimer;
|
|
|
|
|
QSet<QString> m_changedFolders;
|
2010-08-10 16:27:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
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-12-10 19:02:19 +01:00
|
|
|
Qt4BaseTarget *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();
|
|
|
|
|
|
|
|
|
|
Internal::Qt4ProFileNode *rootProjectNode() const;
|
2010-10-27 16:27:22 +02:00
|
|
|
bool validParse(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-01-24 15:36:46 +01:00
|
|
|
QList<Internal::Qt4ProFileNode *> allProFiles() const;
|
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);
|
|
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
2011-01-21 15:37:05 +01:00
|
|
|
Internal::ProFileReader *createProFileReader(Internal::Qt4ProFileNode *qt4ProFileNode, Qt4BuildConfiguration *bc = 0);
|
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();
|
|
|
|
|
|
2010-08-10 16:27:35 +02:00
|
|
|
Internal::CentralizedFolderWatcher *centralizedFolderWatcher();
|
|
|
|
|
|
2010-11-04 14:02:45 +01:00
|
|
|
// For Qt4ProFileNode after a on disk change
|
|
|
|
|
void updateFileList();
|
2010-10-27 16:27:22 +02:00
|
|
|
|
2009-06-22 15:51:21 +02:00
|
|
|
signals:
|
2010-10-27 16:27:22 +02:00
|
|
|
void proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode *node, bool);
|
|
|
|
|
void proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *node);
|
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 updateCodeModels();
|
|
|
|
|
void updateCppCodeModel();
|
|
|
|
|
void updateQmlJSCodeModel();
|
2010-11-04 14:02:45 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-01-24 15:36:46 +01:00
|
|
|
static void collectAllfProFiles(QList<Internal::Qt4ProFileNode *> &list, Internal::Qt4ProFileNode *node);
|
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;
|
|
|
|
|
|
|
|
|
|
Qt4ProjectFile *m_fileInfo;
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
QList<Internal::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
|
|
|
|
2010-08-10 16:27:35 +02:00
|
|
|
Internal::CentralizedFolderWatcher m_centralizedFolderWatcher;
|
|
|
|
|
|
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
|
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#endif // QT4PROJECT_H
|