2019-08-19 12:31:25 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** 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
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <projectexplorer/buildsystem.h>
|
|
|
|
|
#include <projectexplorer/treescanner.h>
|
|
|
|
|
|
|
|
|
|
#include <utils/filesystemwatcher.h>
|
|
|
|
|
|
2020-08-31 14:28:10 +02:00
|
|
|
namespace ProjectExplorer { class Kit; }
|
|
|
|
|
|
2019-08-19 12:31:25 +02:00
|
|
|
namespace Nim {
|
|
|
|
|
|
2020-08-31 14:28:10 +02:00
|
|
|
Utils::FilePath nimPathFromKit(ProjectExplorer::Kit *kit);
|
|
|
|
|
Utils::FilePath nimblePathFromKit(ProjectExplorer::Kit *kit);
|
|
|
|
|
|
2019-11-22 12:41:15 +01:00
|
|
|
class NimProjectScanner : public QObject
|
2019-08-19 12:31:25 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2019-11-22 12:41:15 +01:00
|
|
|
explicit NimProjectScanner(ProjectExplorer::Project *project);
|
|
|
|
|
|
|
|
|
|
void setFilter(const ProjectExplorer::TreeScanner::FileFilter &filter);
|
|
|
|
|
void startScan();
|
|
|
|
|
void watchProjectFilePath();
|
|
|
|
|
|
|
|
|
|
void setExcludedFiles(const QStringList &list);
|
|
|
|
|
QStringList excludedFiles() const;
|
2019-08-19 12:31:25 +02:00
|
|
|
|
|
|
|
|
bool addFiles(const QStringList &filePaths);
|
2019-11-22 12:41:15 +01:00
|
|
|
ProjectExplorer::RemovedFilesFromProject removeFiles(const QStringList &filePaths);
|
|
|
|
|
bool renameFile(const QString &from, const QString &to);
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void finished();
|
|
|
|
|
void requestReparse();
|
2020-02-17 00:18:40 +01:00
|
|
|
void directoryChanged(const QString &path);
|
2019-11-22 12:41:15 +01:00
|
|
|
void fileChanged(const QString &path);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void loadSettings();
|
|
|
|
|
void saveSettings();
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::Project *m_project = nullptr;
|
|
|
|
|
ProjectExplorer::TreeScanner m_scanner;
|
|
|
|
|
Utils::FileSystemWatcher m_directoryWatcher;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NimBuildSystem : public ProjectExplorer::BuildSystem
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit NimBuildSystem(ProjectExplorer::Target *target);
|
2019-08-19 12:31:25 +02:00
|
|
|
|
2019-10-22 14:55:51 +02:00
|
|
|
bool supportsAction(ProjectExplorer::Node *,
|
|
|
|
|
ProjectExplorer::ProjectAction action,
|
2019-11-22 12:41:15 +01:00
|
|
|
const ProjectExplorer::Node *node) const final;
|
2019-10-22 14:55:51 +02:00
|
|
|
bool addFiles(ProjectExplorer::Node *node,
|
2019-11-22 12:41:15 +01:00
|
|
|
const QStringList &filePaths, QStringList *) final;
|
2019-10-22 14:55:51 +02:00
|
|
|
ProjectExplorer::RemovedFilesFromProject removeFiles(ProjectExplorer::Node *node,
|
|
|
|
|
const QStringList &filePaths,
|
|
|
|
|
QStringList *) override;
|
2019-11-22 12:41:15 +01:00
|
|
|
bool deleteFiles(ProjectExplorer::Node *, const QStringList &) final;
|
2019-10-22 14:55:51 +02:00
|
|
|
bool renameFile(ProjectExplorer::Node *,
|
2019-11-22 12:41:15 +01:00
|
|
|
const QString &filePath, const QString &newFilePath) final;
|
2019-08-19 12:31:25 +02:00
|
|
|
|
2019-11-29 10:19:46 +01:00
|
|
|
void triggerParsing() override;
|
2019-08-19 12:31:25 +02:00
|
|
|
|
2019-09-16 22:43:27 +02:00
|
|
|
protected:
|
2019-10-25 09:55:32 +02:00
|
|
|
ParseGuard m_guard;
|
2019-11-22 12:41:15 +01:00
|
|
|
NimProjectScanner m_projectScanner;
|
2019-08-19 12:31:25 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Nim
|