Changeset View
Changeset View
Standalone View
Standalone View
src/part/loadagraphthread.h
Show All 19 Lines | |||||
20 | #ifndef LOADAGRAPHTHREAD_H | 20 | #ifndef LOADAGRAPHTHREAD_H | ||
21 | #define LOADAGRAPHTHREAD_H | 21 | #define LOADAGRAPHTHREAD_H | ||
22 | 22 | | |||
23 | #include <QSemaphore> | 23 | #include <QSemaphore> | ||
24 | #include <QThread> | 24 | #include <QThread> | ||
25 | 25 | | |||
26 | #include <graphviz/gvc.h> | 26 | #include <graphviz/gvc.h> | ||
27 | 27 | | |||
28 | 28 | class LoadAGraphThread : public QThread { | |||
29 | class LoadAGraphThread : public QThread | | |||
30 | { | | |||
31 | Q_OBJECT | 29 | Q_OBJECT | ||
32 | public: | 30 | public: | ||
33 | LoadAGraphThread() : sem(1) {} | 31 | LoadAGraphThread() : sem(1) {} | ||
34 | void loadFile(const QString& dotFileName); | 32 | void loadFile(const QString &dotFileName); | ||
35 | inline graph_t* g() {return m_g;} | 33 | inline graph_t *g() { return m_g; } | ||
36 | inline const QString& dotFileName() {return m_dotFileName;} | 34 | inline const QString &dotFileName() { return m_dotFileName; } | ||
37 | void processed_finished() { sem.release(); } | 35 | void processed_finished() { sem.release(); } | ||
38 | 36 | | |||
39 | // helper method only for DotGraphView::loadLibrarySync() | 37 | // helper method only for DotGraphView::loadLibrarySync() | ||
40 | // see notes next to the call there | 38 | // see notes next to the call there | ||
41 | void setDotFileName(const QString& dotFileName) { m_dotFileName = dotFileName; } | 39 | void setDotFileName(const QString &dotFileName) { | ||
40 | m_dotFileName = dotFileName; | ||||
41 | } | ||||
42 | 42 | | |||
43 | protected: | 43 | protected: | ||
44 | void run() override; | 44 | void run() override; | ||
45 | 45 | | |||
46 | private: | 46 | private: | ||
47 | QSemaphore sem; | 47 | QSemaphore sem; | ||
48 | QString m_dotFileName; | 48 | QString m_dotFileName; | ||
49 | graph_t *m_g; | 49 | graph_t *m_g; | ||
50 | }; | 50 | }; | ||
51 | 51 | | |||
52 | #endif // LOADAGRAPHTHREAD_H | 52 | #endif // LOADAGRAPHTHREAD_H |