#ifndef SCIQLOP_CATALOGUECONTROLLER_H #define SCIQLOP_CATALOGUECONTROLLER_H #include "CoreGlobal.h" #include #include #include #include #include #include #include #include class DBCatalogue; class DBEvent; class DBEventProduct; Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueController) class DataSourceItem; class Variable; /** * @brief The CatalogueController class aims to handle catalogues and event * using the CatalogueAPI library. */ class SCIQLOP_CORE_EXPORT CatalogueController : public QObject { using time_t = double; using Repository_t = CatalogiCpp::Repository; using Event_t = Repository_t::Event_t; using Event_ptr = Repository_t::Event_ptr; using Catalogue_t = Repository_t::Catalogue_t; using Catalogue_ptr = typename Repository_t::Catalogue_ptr; using uuid_t = Repository_t::uuid_t; std::map> _lastSavedRepos; std::map> _currentRepos; Q_OBJECT public: explicit CatalogueController(QObject* parent = nullptr); virtual ~CatalogueController(); QStringList getRepositories() const; void loadRepository(const QString& path, const QString& name); void saveRepository(const QString& path, const QString& name); std::vector events(); std::vector events(const QString& repository); std::vector catalogues(); std::vector catalogues(const QString& repository); bool hasUnsavedChanges(Event_ptr event); std::optional repository(Event_ptr event); std::optional repository(Catalogue_ptr catalogue); void save(Event_ptr event); void save(Catalogue_ptr catalogue); void save(const QString& repository); // // Event // /// retrieveEvents with empty repository retrieve them from the default // repository std::list> retrieveEvents(const // QString& repository) const; std::list> // retrieveAllEvents() const; // void addEvent(std::shared_ptr event); // void updateEvent(std::shared_ptr event); // void updateEventProduct(std::shared_ptr eventProduct); // void removeEvent(std::shared_ptr event); // // void trashEvent(std::shared_ptr event); // // void restore(std::shared_ptr event); // void saveEvent(std::shared_ptr event); // void discardEvent(std::shared_ptr event, bool& removed); // bool eventHasChanges(std::shared_ptr event) const; // // Catalogue // std::list> retrieveEventsFromCatalogue( // std::shared_ptr catalogue) const; // /// retrieveEvents with empty repository retrieve them from the default // repository std::list> retrieveCatalogues( // const QString& repository = QString()) const; // void addCatalogue(std::shared_ptr catalogue); // void updateCatalogue(std::shared_ptr catalogue); // void removeCatalogue(std::shared_ptr catalogue); // void saveCatalogue(std::shared_ptr catalogue); // void discardCatalogue(std::shared_ptr catalogue, bool& // removed); // void saveAll(); // bool hasChanges() const; // /// Returns the MIME data associated to a list of variables // QByteArray mimeDataForEvents(const QVector>& // events) const; // /// Returns the list of variables contained in a MIME data // QVector> eventsForMimeData(const QByteArray& // mimeData) const; // /// Returns the MIME data associated to a list of variables // QByteArray mimeDataForCatalogues(const // QVector>& catalogues) const; // /// Returns the list of variables contained in a MIME data // QVector> cataloguesForMimeData(const // QByteArray& mimeData) const; // public slots: // /// Manage init/end of the controller // void initialize(); private: // class CatalogueControllerPrivate; // spimpl::unique_impl_ptr impl; }; #endif // SCIQLOP_CATALOGUECONTROLLER_H