2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-03-10 14:20:07 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2009-03-10 14:20:07 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-03-10 14:20:07 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2009-03-10 14:20:07 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-03-10 14:20:07 +01:00
|
|
|
|
2016-02-04 13:08:13 +01:00
|
|
|
#pragma once
|
2009-03-10 14:20:07 +01:00
|
|
|
|
|
|
|
|
#include "genericprojectnodes.h"
|
|
|
|
|
|
|
|
|
|
#include <projectexplorer/project.h>
|
|
|
|
|
#include <projectexplorer/projectnodes.h>
|
2010-02-08 15:50:06 +01:00
|
|
|
#include <projectexplorer/target.h>
|
2011-02-01 18:36:00 +01:00
|
|
|
#include <projectexplorer/toolchain.h>
|
2009-09-24 16:02:02 +02:00
|
|
|
#include <projectexplorer/buildconfiguration.h>
|
2012-02-14 16:43:51 +01:00
|
|
|
#include <coreplugin/idocument.h>
|
2010-09-16 14:59:05 +02:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QFuture>
|
2010-02-25 14:23:11 +01:00
|
|
|
|
2017-02-06 16:59:53 +01:00
|
|
|
namespace CppTools { class CppProjectUpdater; }
|
|
|
|
|
|
2009-03-10 14:20:07 +01:00
|
|
|
namespace GenericProjectManager {
|
2009-03-18 13:33:00 +01:00
|
|
|
namespace Internal {
|
2011-11-24 13:00:01 +01:00
|
|
|
|
2009-03-10 14:20:07 +01:00
|
|
|
class GenericProjectFile;
|
2009-09-24 16:02:02 +02:00
|
|
|
|
2009-03-10 14:20:07 +01:00
|
|
|
class GenericProject : public ProjectExplorer::Project
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2017-02-28 15:13:16 +01:00
|
|
|
explicit GenericProject(const QString &filename);
|
2016-01-07 17:58:34 +01:00
|
|
|
~GenericProject() override;
|
2009-03-10 14:20:07 +01:00
|
|
|
|
2009-03-16 11:49:57 +01:00
|
|
|
QString filesFileName() const;
|
|
|
|
|
QString includesFileName() const;
|
|
|
|
|
QString configFileName() const;
|
|
|
|
|
|
2016-01-07 17:58:34 +01:00
|
|
|
QString displayName() const override;
|
2009-03-10 14:20:07 +01:00
|
|
|
|
2016-01-07 17:58:34 +01:00
|
|
|
QStringList files(FilesMode fileMode) const override;
|
2009-03-10 14:20:07 +01:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
QStringList buildTargets() const;
|
2009-03-12 15:07:54 +01:00
|
|
|
|
2009-06-29 18:04:29 +02:00
|
|
|
bool addFiles(const QStringList &filePaths);
|
2009-06-30 14:07:07 +02:00
|
|
|
bool removeFiles(const QStringList &filePaths);
|
2011-06-20 11:57:20 +02:00
|
|
|
bool setFiles(const QStringList &filePaths);
|
2011-10-24 21:42:11 +02:00
|
|
|
bool renameFile(const QString &filePath, const QString &newFilePath);
|
2009-06-29 18:04:29 +02:00
|
|
|
|
2009-03-19 17:58:56 +01:00
|
|
|
enum RefreshOptions {
|
|
|
|
|
Files = 0x01,
|
|
|
|
|
Configuration = 0x02,
|
|
|
|
|
Everything = Files | Configuration
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void refresh(RefreshOptions options);
|
|
|
|
|
|
2009-03-13 15:12:54 +01:00
|
|
|
QStringList projectIncludePaths() const;
|
2009-03-12 16:31:40 +01:00
|
|
|
QStringList files() const;
|
2011-02-01 18:36:00 +01:00
|
|
|
|
2009-03-10 14:20:07 +01:00
|
|
|
protected:
|
2016-01-07 17:58:34 +01:00
|
|
|
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override;
|
2009-03-10 14:20:07 +01:00
|
|
|
|
|
|
|
|
private:
|
2010-02-10 16:38:50 +01:00
|
|
|
bool saveRawFileList(const QStringList &rawFileList);
|
2014-07-28 14:41:55 +02:00
|
|
|
bool saveRawList(const QStringList &rawList, const QString &fileName);
|
2009-03-19 17:58:56 +01:00
|
|
|
void parseProject(RefreshOptions options);
|
2010-02-11 16:42:23 +01:00
|
|
|
QStringList processEntries(const QStringList &paths,
|
2016-12-25 17:59:17 +01:00
|
|
|
QHash<QString, QString> *map = nullptr) const;
|
2009-03-12 15:07:54 +01:00
|
|
|
|
2014-06-18 16:16:55 +02:00
|
|
|
void refreshCppCodeModel();
|
2016-12-20 22:17:20 +01:00
|
|
|
void activeTargetWasChanged();
|
|
|
|
|
void activeBuildConfigurationWasChanged();
|
2014-06-18 16:16:55 +02:00
|
|
|
|
2009-03-18 12:18:59 +01:00
|
|
|
QString m_filesFileName;
|
|
|
|
|
QString m_includesFileName;
|
|
|
|
|
QString m_configFileName;
|
|
|
|
|
QString m_projectName;
|
2012-02-14 16:43:51 +01:00
|
|
|
GenericProjectFile *m_filesIDocument;
|
|
|
|
|
GenericProjectFile *m_includesIDocument;
|
|
|
|
|
GenericProjectFile *m_configIDocument;
|
2010-02-10 16:38:50 +01:00
|
|
|
QStringList m_rawFileList;
|
2009-03-18 12:18:59 +01:00
|
|
|
QStringList m_files;
|
2010-02-10 16:38:50 +01:00
|
|
|
QHash<QString, QString> m_rawListEntries;
|
2014-07-28 14:41:55 +02:00
|
|
|
QStringList m_rawProjectIncludePaths;
|
2009-03-18 12:18:59 +01:00
|
|
|
QStringList m_projectIncludePaths;
|
|
|
|
|
|
2017-02-06 16:59:53 +01:00
|
|
|
CppTools::CppProjectUpdater *m_cppCodeModelUpdater = nullptr;
|
2016-12-20 22:17:20 +01:00
|
|
|
|
|
|
|
|
ProjectExplorer::Target *m_activeTarget = nullptr;
|
2009-03-10 14:20:07 +01:00
|
|
|
};
|
|
|
|
|
|
2012-02-14 16:43:51 +01:00
|
|
|
class GenericProjectFile : public Core::IDocument
|
2009-03-10 14:20:07 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2011-11-07 17:03:10 +01:00
|
|
|
GenericProjectFile(GenericProject *parent, QString fileName, GenericProject::RefreshOptions options);
|
2009-03-10 14:20:07 +01:00
|
|
|
|
2015-06-04 15:54:10 +02:00
|
|
|
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
|
|
|
|
|
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
|
2009-03-10 14:20:07 +01:00
|
|
|
|
|
|
|
|
private:
|
2009-03-18 12:18:59 +01:00
|
|
|
GenericProject *m_project;
|
2011-11-07 17:03:10 +01:00
|
|
|
GenericProject::RefreshOptions m_options;
|
2009-03-10 14:20:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace GenericProjectManager
|