2018-05-07 17:04:26 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2018 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://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
|
|
|
|
|
|
2019-09-13 10:49:14 +02:00
|
|
|
#include "clangtoolssettings.h"
|
2018-05-07 17:04:26 +02:00
|
|
|
|
|
|
|
|
#include <projectexplorer/project.h>
|
|
|
|
|
|
|
|
|
|
#include <utils/fileutils.h>
|
|
|
|
|
|
|
|
|
|
namespace ClangTools {
|
|
|
|
|
namespace Internal {
|
2018-05-08 16:47:27 +02:00
|
|
|
class Diagnostic;
|
|
|
|
|
|
|
|
|
|
class SuppressedDiagnostic
|
|
|
|
|
{
|
|
|
|
|
public:
|
2019-07-19 14:47:41 +02:00
|
|
|
SuppressedDiagnostic(const Utils::FilePath &filePath, const QString &description, int uniquifier)
|
2018-05-08 16:47:27 +02:00
|
|
|
: filePath(filePath)
|
|
|
|
|
, description(description)
|
|
|
|
|
, uniquifier(uniquifier)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SuppressedDiagnostic(const Diagnostic &diag);
|
|
|
|
|
|
2021-12-06 05:11:04 +01:00
|
|
|
friend bool operator==(const SuppressedDiagnostic &d1, const SuppressedDiagnostic &d2)
|
|
|
|
|
{
|
|
|
|
|
return d1.filePath == d2.filePath
|
|
|
|
|
&& d1.description == d2.description
|
|
|
|
|
&& d1.uniquifier == d2.uniquifier;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
Utils::FilePath filePath; // Relative for files in project, absolute otherwise.
|
2018-05-08 16:47:27 +02:00
|
|
|
QString description;
|
|
|
|
|
int uniquifier;
|
|
|
|
|
};
|
|
|
|
|
|
2018-11-04 22:30:54 +01:00
|
|
|
using SuppressedDiagnosticsList = QList<SuppressedDiagnostic>;
|
2018-05-07 17:04:26 +02:00
|
|
|
|
|
|
|
|
class ClangToolsProjectSettings : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ClangToolsProjectSettings(ProjectExplorer::Project *project);
|
|
|
|
|
~ClangToolsProjectSettings() override;
|
|
|
|
|
|
2019-09-13 10:49:14 +02:00
|
|
|
bool useGlobalSettings() const { return m_useGlobalSettings; }
|
2020-07-22 14:52:06 +02:00
|
|
|
void setUseGlobalSettings(bool useGlobalSettings);
|
2018-05-14 11:40:40 +02:00
|
|
|
|
2019-09-13 10:49:14 +02:00
|
|
|
RunSettings runSettings() const { return m_runSettings; }
|
2020-07-22 14:52:06 +02:00
|
|
|
void setRunSettings(const RunSettings &settings);
|
2018-05-14 11:40:40 +02:00
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
QSet<Utils::FilePath> selectedDirs() const { return m_selectedDirs; }
|
2020-07-22 14:52:06 +02:00
|
|
|
void setSelectedDirs(const QSet<Utils::FilePath> &value);
|
2018-05-07 17:04:26 +02:00
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
QSet<Utils::FilePath> selectedFiles() const { return m_selectedFiles; }
|
2020-07-22 14:52:06 +02:00
|
|
|
void setSelectedFiles(const QSet<Utils::FilePath> &value);
|
2018-05-07 17:04:26 +02:00
|
|
|
|
2018-05-08 16:47:27 +02:00
|
|
|
SuppressedDiagnosticsList suppressedDiagnostics() const { return m_suppressedDiagnostics; }
|
2020-10-01 10:27:17 +02:00
|
|
|
void addSuppressedDiagnostics(const SuppressedDiagnosticsList &diags);
|
2018-05-08 16:47:27 +02:00
|
|
|
void addSuppressedDiagnostic(const SuppressedDiagnostic &diag);
|
|
|
|
|
void removeSuppressedDiagnostic(const SuppressedDiagnostic &diag);
|
|
|
|
|
void removeAllSuppressedDiagnostics();
|
|
|
|
|
|
2020-01-13 17:38:33 +01:00
|
|
|
using ClangToolsProjectSettingsPtr = QSharedPointer<ClangToolsProjectSettings>;
|
|
|
|
|
static ClangToolsProjectSettingsPtr getSettings(ProjectExplorer::Project *project);
|
|
|
|
|
|
2018-05-08 16:47:27 +02:00
|
|
|
signals:
|
|
|
|
|
void suppressedDiagnosticsChanged();
|
2020-07-22 14:52:06 +02:00
|
|
|
void changed();
|
2018-05-08 16:47:27 +02:00
|
|
|
|
2018-05-07 17:04:26 +02:00
|
|
|
private:
|
|
|
|
|
void load();
|
|
|
|
|
void store();
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::Project *m_project;
|
2019-09-13 10:49:14 +02:00
|
|
|
|
2018-05-14 11:40:40 +02:00
|
|
|
bool m_useGlobalSettings = true;
|
2019-09-13 10:49:14 +02:00
|
|
|
|
|
|
|
|
RunSettings m_runSettings;
|
|
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
QSet<Utils::FilePath> m_selectedDirs;
|
|
|
|
|
QSet<Utils::FilePath> m_selectedFiles;
|
2019-09-13 10:49:14 +02:00
|
|
|
|
2018-05-08 16:47:27 +02:00
|
|
|
SuppressedDiagnosticsList m_suppressedDiagnostics;
|
2018-05-07 17:04:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace ClangTools
|
2020-01-13 17:38:33 +01:00
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(QSharedPointer<ClangTools::Internal::ClangToolsProjectSettings>)
|