CatalogueController.h
83 lines
| 2.8 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; | ||||
r1258 | 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; | ||||
r1161 | std::list<std::shared_ptr<DBEvent> > | |||
r1176 | retrieveEventsFromCatalogue(std::shared_ptr<DBCatalogue> catalogue) const; | |||
r1191 | void addEvent(std::shared_ptr<DBEvent> event); | |||
void updateEvent(std::shared_ptr<DBEvent> event); | ||||
r1258 | void updateEventProduct(std::shared_ptr<DBEventProduct> eventProduct); | |||
r1191 | void removeEvent(std::shared_ptr<DBEvent> event); | |||
r1161 | // void trashEvent(std::shared_ptr<DBEvent> event); | |||
r1275 | // void restore(std::shared_ptr<DBEvent> event); | |||
r1191 | void saveEvent(std::shared_ptr<DBEvent> event); | |||
r1275 | void discardEvent(std::shared_ptr<DBEvent> event); | |||
r1268 | bool eventHasChanges(std::shared_ptr<DBEvent> event) const; | |||
r1097 | ||||
r1158 | // Catalogue | |||
r1161 | // bool createCatalogue(const QString &name, QVector<QUuid> eventList); | |||
r1191 | /// retrieveEvents with empty repository retrieve them from the default repository | |||
r1196 | std::list<std::shared_ptr<DBCatalogue> > retrieveCatalogues(const QString &repository | |||
= QString()) const; | ||||
r1191 | void updateCatalogue(std::shared_ptr<DBCatalogue> catalogue); | |||
void removeCatalogue(std::shared_ptr<DBCatalogue> catalogue); | ||||
void saveCatalogue(std::shared_ptr<DBCatalogue> catalogue); | ||||
void saveAll(); | ||||
r1270 | bool hasChanges() const; | |||
r1097 | ||||
r1261 | /// 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; | ||||
r1097 | public slots: | |||
/// Manage init/end of the controller | ||||
void initialize(); | ||||
private: | ||||
class CatalogueControllerPrivate; | ||||
spimpl::unique_impl_ptr<CatalogueControllerPrivate> impl; | ||||
}; | ||||
#endif // SCIQLOP_CATALOGUECONTROLLER_H | ||||