@@ -1,84 +1,85 | |||||
1 | #ifndef SCIQLOP_CATALOGUECONTROLLER_H |
|
1 | #ifndef SCIQLOP_CATALOGUECONTROLLER_H | |
2 | #define SCIQLOP_CATALOGUECONTROLLER_H |
|
2 | #define SCIQLOP_CATALOGUECONTROLLER_H | |
3 |
|
3 | |||
4 | #include "CoreGlobal.h" |
|
4 | #include "CoreGlobal.h" | |
5 |
|
5 | |||
6 | #include <Data/SqpRange.h> |
|
6 | #include <Data/SqpRange.h> | |
7 |
|
7 | |||
8 | #include <QLoggingCategory> |
|
8 | #include <QLoggingCategory> | |
9 | #include <QObject> |
|
9 | #include <QObject> | |
10 | #include <QUuid> |
|
10 | #include <QUuid> | |
11 |
|
11 | |||
12 | #include <Common/spimpl.h> |
|
12 | #include <Common/spimpl.h> | |
13 |
|
13 | |||
14 | #include <memory> |
|
14 | #include <memory> | |
15 |
|
15 | |||
16 | class DBCatalogue; |
|
16 | class DBCatalogue; | |
17 | class DBEvent; |
|
17 | class DBEvent; | |
18 | class DBEventProduct; |
|
18 | class DBEventProduct; | |
19 |
|
19 | |||
20 | Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueController) |
|
20 | Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueController) | |
21 |
|
21 | |||
22 | class DataSourceItem; |
|
22 | class DataSourceItem; | |
23 | class Variable; |
|
23 | class Variable; | |
24 |
|
24 | |||
25 | /** |
|
25 | /** | |
26 | * @brief The CatalogueController class aims to handle catalogues and event using the CatalogueAPI |
|
26 | * @brief The CatalogueController class aims to handle catalogues and event using the CatalogueAPI | |
27 | * library. |
|
27 | * library. | |
28 | */ |
|
28 | */ | |
29 | class SCIQLOP_CORE_EXPORT CatalogueController : public QObject { |
|
29 | class SCIQLOP_CORE_EXPORT CatalogueController : public QObject { | |
30 | Q_OBJECT |
|
30 | Q_OBJECT | |
31 | public: |
|
31 | public: | |
32 | explicit CatalogueController(QObject *parent = 0); |
|
32 | explicit CatalogueController(QObject *parent = 0); | |
33 | virtual ~CatalogueController(); |
|
33 | virtual ~CatalogueController(); | |
34 |
|
34 | |||
35 | // DB |
|
35 | // DB | |
36 | QStringList getRepositories() const; |
|
36 | QStringList getRepositories() const; | |
37 | void addDB(const QString &dbPath); |
|
37 | void addDB(const QString &dbPath); | |
38 | void saveDB(const QString &destinationPath, const QString &repository); |
|
38 | void saveDB(const QString &destinationPath, const QString &repository); | |
39 |
|
39 | |||
40 | // Event |
|
40 | // Event | |
41 | /// retrieveEvents with empty repository retrieve them from the default repository |
|
41 | /// retrieveEvents with empty repository retrieve them from the default repository | |
42 | std::list<std::shared_ptr<DBEvent> > retrieveEvents(const QString &repository) const; |
|
42 | std::list<std::shared_ptr<DBEvent> > retrieveEvents(const QString &repository) const; | |
43 | std::list<std::shared_ptr<DBEvent> > retrieveAllEvents() const; |
|
43 | std::list<std::shared_ptr<DBEvent> > retrieveAllEvents() const; | |
44 |
|
44 | |||
45 | void addEvent(std::shared_ptr<DBEvent> event); |
|
45 | void addEvent(std::shared_ptr<DBEvent> event); | |
46 | void updateEvent(std::shared_ptr<DBEvent> event); |
|
46 | void updateEvent(std::shared_ptr<DBEvent> event); | |
47 | void updateEventProduct(std::shared_ptr<DBEventProduct> eventProduct); |
|
47 | void updateEventProduct(std::shared_ptr<DBEventProduct> eventProduct); | |
48 | void removeEvent(std::shared_ptr<DBEvent> event); |
|
48 | void removeEvent(std::shared_ptr<DBEvent> event); | |
49 | // void trashEvent(std::shared_ptr<DBEvent> event); |
|
49 | // void trashEvent(std::shared_ptr<DBEvent> event); | |
50 | // void restore(std::shared_ptr<DBEvent> event); |
|
50 | // void restore(std::shared_ptr<DBEvent> event); | |
51 | void saveEvent(std::shared_ptr<DBEvent> event); |
|
51 | void saveEvent(std::shared_ptr<DBEvent> event); | |
52 | void discardEvent(std::shared_ptr<DBEvent> event, bool &removed); |
|
52 | void discardEvent(std::shared_ptr<DBEvent> event, bool &removed); | |
53 | bool eventHasChanges(std::shared_ptr<DBEvent> event) const; |
|
53 | bool eventHasChanges(std::shared_ptr<DBEvent> event) const; | |
54 |
|
54 | |||
55 | // Catalogue |
|
55 | // Catalogue | |
56 | std::list<std::shared_ptr<DBEvent> > |
|
56 | std::list<std::shared_ptr<DBEvent> > | |
57 | retrieveEventsFromCatalogue(std::shared_ptr<DBCatalogue> catalogue) const; |
|
57 | retrieveEventsFromCatalogue(std::shared_ptr<DBCatalogue> catalogue) const; | |
|
58 | ||||
58 | /// retrieveEvents with empty repository retrieve them from the default repository |
|
59 | /// retrieveEvents with empty repository retrieve them from the default repository | |
59 | std::list<std::shared_ptr<DBCatalogue> > retrieveCatalogues(const QString &repository |
|
60 | std::list<std::shared_ptr<DBCatalogue> > retrieveCatalogues(const QString &repository | |
60 | = QString()) const; |
|
61 | = QString()) const; | |
61 | void addCatalogue(std::shared_ptr<DBCatalogue> catalogue); |
|
62 | void addCatalogue(std::shared_ptr<DBCatalogue> catalogue); | |
62 | void updateCatalogue(std::shared_ptr<DBCatalogue> catalogue); |
|
63 | void updateCatalogue(std::shared_ptr<DBCatalogue> catalogue); | |
63 | void removeCatalogue(std::shared_ptr<DBCatalogue> catalogue); |
|
64 | void removeCatalogue(std::shared_ptr<DBCatalogue> catalogue); | |
64 | void saveCatalogue(std::shared_ptr<DBCatalogue> catalogue); |
|
65 | void saveCatalogue(std::shared_ptr<DBCatalogue> catalogue); | |
65 |
|
66 | |||
66 | void saveAll(); |
|
67 | void saveAll(); | |
67 | bool hasChanges() const; |
|
68 | bool hasChanges() const; | |
68 |
|
69 | |||
69 | /// Returns the MIME data associated to a list of variables |
|
70 | /// Returns the MIME data associated to a list of variables | |
70 | QByteArray mimeDataForEvents(const QVector<std::shared_ptr<DBEvent> > &events) const; |
|
71 | QByteArray mimeDataForEvents(const QVector<std::shared_ptr<DBEvent> > &events) const; | |
71 |
|
72 | |||
72 | /// Returns the list of variables contained in a MIME data |
|
73 | /// Returns the list of variables contained in a MIME data | |
73 | QVector<std::shared_ptr<DBEvent> > eventsForMimeData(const QByteArray &mimeData) const; |
|
74 | QVector<std::shared_ptr<DBEvent> > eventsForMimeData(const QByteArray &mimeData) const; | |
74 |
|
75 | |||
75 | public slots: |
|
76 | public slots: | |
76 | /// Manage init/end of the controller |
|
77 | /// Manage init/end of the controller | |
77 | void initialize(); |
|
78 | void initialize(); | |
78 |
|
79 | |||
79 | private: |
|
80 | private: | |
80 | class CatalogueControllerPrivate; |
|
81 | class CatalogueControllerPrivate; | |
81 | spimpl::unique_impl_ptr<CatalogueControllerPrivate> impl; |
|
82 | spimpl::unique_impl_ptr<CatalogueControllerPrivate> impl; | |
82 | }; |
|
83 | }; | |
83 |
|
84 | |||
84 | #endif // SCIQLOP_CATALOGUECONTROLLER_H |
|
85 | #endif // SCIQLOP_CATALOGUECONTROLLER_H |
General Comments 0
You need to be logged in to leave comments.
Login now