CatalogueController.h
84 lines
| 2.9 KiB
| text/x-c
|
CLexer
r1059 | #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> | ||||
r1125 | #include <memory> | |||
class DBCatalogue; | ||||
class DBEvent; | ||||
r1227 | class DBEventProduct; | |||
r1125 | ||||
r1059 | Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueController) | |||
class DataSourceItem; | ||||
class Variable; | ||||
/** | ||||
r1125 | * @brief The CatalogueController class aims to handle catalogues and event using the CatalogueAPI | |||
* library. | ||||
r1059 | */ | |||
class SCIQLOP_CORE_EXPORT CatalogueController : public QObject { | ||||
Q_OBJECT | ||||
public: | ||||
explicit CatalogueController(QObject *parent = 0); | ||||
virtual ~CatalogueController(); | ||||
r1125 | // DB | |||
r1159 | QStringList getRepositories() const; | |||
r1125 | void addDB(const QString &dbPath); | |||
void saveDB(const QString &destinationPath, const QString &repository); | ||||
// Event | ||||
r1159 | /// retrieveEvents with empty repository retrieve them from the default repository | |||
r1125 | std::list<std::shared_ptr<DBEvent> > retrieveEvents(const QString &repository) const; | |||
std::list<std::shared_ptr<DBEvent> > retrieveAllEvents() const; | ||||
r1256 | ||||
r1159 | void addEvent(std::shared_ptr<DBEvent> event); | |||
void updateEvent(std::shared_ptr<DBEvent> event); | ||||
r1227 | void updateEventProduct(std::shared_ptr<DBEventProduct> eventProduct); | |||
r1159 | void removeEvent(std::shared_ptr<DBEvent> event); | |||
r1128 | // void trashEvent(std::shared_ptr<DBEvent> event); | |||
r1243 | // void restore(std::shared_ptr<DBEvent> event); | |||
r1159 | void saveEvent(std::shared_ptr<DBEvent> event); | |||
r1260 | void discardEvent(std::shared_ptr<DBEvent> event, bool &removed); | |||
r1237 | bool eventHasChanges(std::shared_ptr<DBEvent> event) const; | |||
r1059 | ||||
r1125 | // Catalogue | |||
r1256 | std::list<std::shared_ptr<DBEvent> > | |||
retrieveEventsFromCatalogue(std::shared_ptr<DBCatalogue> catalogue) const; | ||||
r1128 | // bool createCatalogue(const QString &name, QVector<QUuid> eventList); | |||
r1159 | /// retrieveEvents with empty repository retrieve them from the default repository | |||
r1164 | std::list<std::shared_ptr<DBCatalogue> > retrieveCatalogues(const QString &repository | |||
= QString()) const; | ||||
r1159 | void updateCatalogue(std::shared_ptr<DBCatalogue> catalogue); | |||
void removeCatalogue(std::shared_ptr<DBCatalogue> catalogue); | ||||
void saveCatalogue(std::shared_ptr<DBCatalogue> catalogue); | ||||
void saveAll(); | ||||
r1239 | bool hasChanges() const; | |||
r1059 | ||||
r1230 | /// 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; | ||||
r1059 | public slots: | |||
/// Manage init/end of the controller | ||||
void initialize(); | ||||
private: | ||||
class CatalogueControllerPrivate; | ||||
spimpl::unique_impl_ptr<CatalogueControllerPrivate> impl; | ||||
}; | ||||
#endif // SCIQLOP_CATALOGUECONTROLLER_H | ||||