Changeset View
Changeset View
Standalone View
Standalone View
projectmanagers/cmake/cmakeimportjsonjob.h
Show All 25 Lines | |||||
26 | 26 | | |||
27 | #include <KJob> | 27 | #include <KJob> | ||
28 | 28 | | |||
29 | #include <QFutureWatcher> | 29 | #include <QFutureWatcher> | ||
30 | 30 | | |||
31 | class CMakeFolderItem; | 31 | class CMakeFolderItem; | ||
32 | 32 | | |||
33 | struct ImportData { | 33 | struct ImportData { | ||
34 | CMakeJsonData json; | 34 | CMakeFilesCompilationData compilationData; | ||
35 | QHash<KDevelop::Path, QStringList> targets; | 35 | QHash<KDevelop::Path, QStringList> targets; | ||
36 | QVector<Test> testSuites; | 36 | QVector<Test> testSuites; | ||
37 | }; | 37 | }; | ||
38 | 38 | | |||
39 | namespace KDevelop | 39 | namespace KDevelop | ||
40 | { | 40 | { | ||
41 | class IProject; | 41 | class IProject; | ||
42 | class ReferencedTopDUContext; | 42 | class ReferencedTopDUContext; | ||
43 | } | 43 | } | ||
44 | 44 | | |||
45 | class CMakeImportJob : public KJob | 45 | class CMakeImportJsonJob : public KJob | ||
46 | { | 46 | { | ||
47 | Q_OBJECT | 47 | Q_OBJECT | ||
48 | 48 | | |||
49 | public: | 49 | public: | ||
50 | enum Error { | 50 | enum Error { | ||
51 | FileMissingError = UserDefinedError, ///< JSON file was not found | 51 | FileMissingError = UserDefinedError, ///< JSON file was not found | ||
52 | ReadError ///< Failed to read the JSON file | 52 | ReadError ///< Failed to read the JSON file | ||
53 | }; | 53 | }; | ||
54 | 54 | | |||
55 | CMakeImportJob(KDevelop::IProject* project, QObject* parent); | 55 | CMakeImportJsonJob(KDevelop::IProject* project, QObject* parent); | ||
56 | ~CMakeImportJob() override; | 56 | ~CMakeImportJsonJob() override; | ||
57 | 57 | | |||
58 | void start() override; | 58 | void start() override; | ||
59 | 59 | | |||
60 | KDevelop::IProject* project() const; | 60 | KDevelop::IProject* project() const; | ||
61 | 61 | | |||
62 | /** | 62 | CMakeProjectData projectData() const; | ||
63 | * Return the parsed JSON data | | |||
64 | * | | |||
65 | * @note Only call after the job has finished! | | |||
66 | */ | | |||
67 | CMakeJsonData jsonData() const; | | |||
68 | QHash<KDevelop::Path, QStringList> targets() const { return m_targets; } | | |||
69 | QVector<Test> testSuites() const { return m_testSuites; } | | |||
70 | 63 | | |||
71 | private Q_SLOTS: | 64 | private Q_SLOTS: | ||
72 | void importFinished(); | 65 | void importCompileCommandsJsonFinished(); | ||
73 | 66 | | |||
74 | private: | 67 | private: | ||
75 | KDevelop::IProject* m_project; | 68 | KDevelop::IProject* m_project; | ||
76 | QFutureWatcher<ImportData> m_futureWatcher; | 69 | QFutureWatcher<ImportData> m_futureWatcher; | ||
77 | 70 | | |||
78 | CMakeJsonData m_data; | 71 | CMakeProjectData m_data; | ||
79 | QHash<KDevelop::Path, QStringList> m_targets; | | |||
80 | QVector<Test> m_testSuites; | | |||
81 | }; | 72 | }; | ||
82 | 73 | | |||
83 | #endif // CMAKEIMPORTJSONJOB_H | 74 | #endif // CMAKEIMPORTJSONJOB_H |