CatalogueController.h
93 lines
| 3.2 KiB
| text/x-c
|
CLexer
r1097 | #ifndef SCIQLOP_CATALOGUECONTROLLER_H | |||
#define SCIQLOP_CATALOGUECONTROLLER_H | ||||
#include "CoreGlobal.h" | ||||
#include <Data/SqpRange.h> | ||||
#include <QLoggingCategory> | ||||
#include <QObject> | ||||
#include <QUuid> | ||||
#include <Common/spimpl.h> | ||||
r1158 | #include <memory> | |||
class DBCatalogue; | ||||
class DBEvent; | ||||
r1282 | class DBEventProduct; | |||
r1158 | ||||
r1097 | Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueController) | |||
class DataSourceItem; | ||||
class Variable; | ||||
/** | ||||
r1158 | * @brief The CatalogueController class aims to handle catalogues and event using the CatalogueAPI | |||
* library. | ||||
r1097 | */ | |||
class SCIQLOP_CORE_EXPORT CatalogueController : public QObject { | ||||
Q_OBJECT | ||||
public: | ||||
explicit CatalogueController(QObject *parent = 0); | ||||
virtual ~CatalogueController(); | ||||
r1158 | // DB | |||
r1191 | QStringList getRepositories() const; | |||
r1158 | void addDB(const QString &dbPath); | |||
void saveDB(const QString &destinationPath, const QString &repository); | ||||
// Event | ||||
r1191 | /// retrieveEvents with empty repository retrieve them from the default repository | |||
r1158 | std::list<std::shared_ptr<DBEvent> > retrieveEvents(const QString &repository) const; | |||
std::list<std::shared_ptr<DBEvent> > retrieveAllEvents() const; | ||||
r1310 | ||||
r1191 | void addEvent(std::shared_ptr<DBEvent> event); | |||
void updateEvent(std::shared_ptr<DBEvent> event); | ||||
r1282 | void updateEventProduct(std::shared_ptr<DBEventProduct> eventProduct); | |||
r1191 | void removeEvent(std::shared_ptr<DBEvent> event); | |||
r1161 | // void trashEvent(std::shared_ptr<DBEvent> event); | |||
r1298 | // void restore(std::shared_ptr<DBEvent> event); | |||
r1191 | void saveEvent(std::shared_ptr<DBEvent> event); | |||
r1314 | void discardEvent(std::shared_ptr<DBEvent> event, bool &removed); | |||
r1292 | bool eventHasChanges(std::shared_ptr<DBEvent> event) const; | |||
r1097 | ||||
r1158 | // Catalogue | |||
r1310 | std::list<std::shared_ptr<DBEvent> > | |||
retrieveEventsFromCatalogue(std::shared_ptr<DBCatalogue> catalogue) const; | ||||
r1353 | ||||
r1191 | /// retrieveEvents with empty repository retrieve them from the default repository | |||
r1196 | std::list<std::shared_ptr<DBCatalogue> > retrieveCatalogues(const QString &repository | |||
= QString()) const; | ||||
mperrinel
|
r1352 | void addCatalogue(std::shared_ptr<DBCatalogue> catalogue); | ||
r1191 | void updateCatalogue(std::shared_ptr<DBCatalogue> catalogue); | |||
void removeCatalogue(std::shared_ptr<DBCatalogue> catalogue); | ||||
void saveCatalogue(std::shared_ptr<DBCatalogue> catalogue); | ||||
r1356 | void discardCatalogue(std::shared_ptr<DBCatalogue> catalogue, bool &removed); | |||
r1191 | ||||
void saveAll(); | ||||
r1294 | bool hasChanges() const; | |||
r1097 | ||||
r1285 | /// Returns the MIME data associated to a list of variables | |||
QByteArray mimeDataForEvents(const QVector<std::shared_ptr<DBEvent> > &events) const; | ||||
/// Returns the list of variables contained in a MIME data | ||||
QVector<std::shared_ptr<DBEvent> > eventsForMimeData(const QByteArray &mimeData) const; | ||||
r1362 | /// Returns the MIME data associated to a list of variables | |||
QByteArray | ||||
mimeDataForCatalogues(const QVector<std::shared_ptr<DBCatalogue> > &catalogues) const; | ||||
/// Returns the list of variables contained in a MIME data | ||||
QVector<std::shared_ptr<DBCatalogue> > cataloguesForMimeData(const QByteArray &mimeData) const; | ||||
r1097 | public slots: | |||
/// Manage init/end of the controller | ||||
void initialize(); | ||||
private: | ||||
class CatalogueControllerPrivate; | ||||
spimpl::unique_impl_ptr<CatalogueControllerPrivate> impl; | ||||
}; | ||||
#endif // SCIQLOP_CATALOGUECONTROLLER_H | ||||