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