1 /* 2 SPDX-FileCopyrightText: 2014 Kevin Funk <kfunk@kde.org> 3 4 SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #ifndef CMAKEIMPORTJSONJOB_H 8 #define CMAKEIMPORTJSONJOB_H 9 10 #include "cmakeprojectdata.h" 11 #include <util/path.h> 12 13 #include <KJob> 14 15 #include <QFutureWatcher> 16 17 class CMakeFolderItem; 18 19 struct ImportData { 20 CMakeFilesCompilationData compilationData; 21 QHash<KDevelop::Path, QVector<CMakeTarget>> targets; 22 QVector<CMakeTest> testSuites; 23 }; 24 25 namespace KDevelop 26 { 27 class IProject; 28 class ReferencedTopDUContext; 29 } 30 31 class CMakeImportJsonJob : public KJob 32 { 33 Q_OBJECT 34 35 public: 36 enum Error { 37 FileMissingError = UserDefinedError, ///< JSON file was not found 38 ReadError ///< Failed to read the JSON file 39 }; 40 41 CMakeImportJsonJob(KDevelop::IProject* project, QObject* parent); 42 ~CMakeImportJsonJob() override; 43 44 void start() override; 45 46 KDevelop::IProject* project() const; 47 48 CMakeProjectData projectData() const; 49 50 private Q_SLOTS: 51 void importCompileCommandsJsonFinished(); 52 53 private: 54 KDevelop::IProject* m_project; 55 QFutureWatcher<ImportData> m_futureWatcher; 56 57 CMakeProjectData m_data; 58 }; 59 60 #endif // CMAKEIMPORTJSONJOB_H 61