From 3d2098c906924befde4087aee05f095102292eea 2017-12-15 16:37:29 From: perrinel Date: 2017-12-15 16:37:29 Subject: [PATCH] Merge pull request #390 from SciQLop-fork develop Develop --- diff --git a/.gitignore b/.gitignore index 062b58d..2e25f0f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ CMakeLists.txt.user core/src/Version.cpp core/include/Version.h 3rdparty/ +subprojects/CatalogueAPI/ +subprojects/QxOrm/ diff --git a/app/src/Main.cpp b/app/src/Main.cpp index 30db0fe..9246498 100644 --- a/app/src/Main.cpp +++ b/app/src/Main.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -41,6 +42,13 @@ const auto PLUGIN_DIRECTORY_NAME = QStringLiteral("plugins"); int main(int argc, char *argv[]) { +#ifdef QT_STATICPLUGIN + Q_IMPORT_PLUGIN(MockPlugin) + Q_IMPORT_PLUGIN(AmdaPlugin) + Q_INIT_RESOURCE(amdaresources); +#endif + Q_INIT_RESOURCE(sqpguiresources); + SqpApplication a{argc, argv}; SqpApplication::setOrganizationName("LPP"); SqpApplication::setOrganizationDomain("lpp.fr"); @@ -75,6 +83,7 @@ int main(int argc, char *argv[]) pluginManager.loadPlugins(directory); } } + pluginManager.loadStaticPlugins(); return a.exec(); } diff --git a/app/src/MainWindow.cpp b/app/src/MainWindow.cpp index c96666f..eda17cd 100644 --- a/app/src/MainWindow.cpp +++ b/app/src/MainWindow.cpp @@ -86,6 +86,8 @@ MainWindow::MainWindow(QWidget *parent) m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false); m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false); + impl->m_CatalogExplorer->setVisualizationWidget(m_Ui->view); + auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane(); auto openLeftInspectorAction = new QAction{QIcon{ diff --git a/core/include/Catalogue/CatalogueController.h b/core/include/Catalogue/CatalogueController.h index 8878f81..9d839af 100644 --- a/core/include/Catalogue/CatalogueController.h +++ b/core/include/Catalogue/CatalogueController.h @@ -11,17 +11,19 @@ #include +#include + +class DBCatalogue; +class DBEvent; + Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueController) class DataSourceItem; class Variable; /** - * @brief The CatalogueController class aims to make the link between SciQlop and its plugins. - * This is the intermediate class that SciQlop has to use in the way to connect a data source. - * Please first use register method to initialize a plugin specified by its metadata name (JSON - * plugin source) then others specifics method will be able to access it. You can load a data source - * driver plugin then create a data source. + * @brief The CatalogueController class aims to handle catalogues and event using the CatalogueAPI + * library. */ class SCIQLOP_CORE_EXPORT CatalogueController : public QObject { Q_OBJECT @@ -29,12 +31,28 @@ public: explicit CatalogueController(QObject *parent = 0); virtual ~CatalogueController(); -signals: - /// Signal emitted when a variable is about to be deleted from SciQlop - void variableAboutToBeDeleted(std::shared_ptr variable); + // DB + // QStringList getRepositories() const; + void addDB(const QString &dbPath); + void saveDB(const QString &destinationPath, const QString &repository); + + // Event + // bool createEvent(const QString &name); + std::list > retrieveEvents(const QString &repository) const; + std::list > retrieveAllEvents() const; + std::list > + retrieveEventsFromCatalogue(std::shared_ptr catalogue) const; + // void updateEvent(std::shared_ptr event); + // void trashEvent(std::shared_ptr event); + // void removeEvent(std::shared_ptr event); + // void restore(QUuid eventId); + // void saveEvent(std::shared_ptr event); - /// Signal emitted when a data acquisition is requested on a range for a variable - void rangeChanged(std::shared_ptr variable, const SqpRange &range); + // Catalogue + // bool createCatalogue(const QString &name, QVector eventList); + std::list > getCatalogues(const QString &repository) const; + // void removeEvent(QUuid catalogueId, const QString &repository); + // void saveCatalogue(std::shared_ptr event); public slots: /// Manage init/end of the controller diff --git a/core/include/Common/MimeTypesDef.h b/core/include/Common/MimeTypesDef.h index 27535fa..cb8113a 100644 --- a/core/include/Common/MimeTypesDef.h +++ b/core/include/Common/MimeTypesDef.h @@ -15,6 +15,7 @@ extern SCIQLOP_CORE_EXPORT const QString MIME_TYPE_VARIABLE_LIST; extern SCIQLOP_CORE_EXPORT const QString MIME_TYPE_PRODUCT_LIST; extern SCIQLOP_CORE_EXPORT const QString MIME_TYPE_TIME_RANGE; extern SCIQLOP_CORE_EXPORT const QString MIME_TYPE_SELECTION_ZONE; +extern SCIQLOP_CORE_EXPORT const QString MIME_TYPE_EVENT_LIST; #endif // SCIQLOP_MIMETYPESDEF_H diff --git a/core/include/Plugin/PluginManager.h b/core/include/Plugin/PluginManager.h index dd76163..025e42b 100644 --- a/core/include/Plugin/PluginManager.h +++ b/core/include/Plugin/PluginManager.h @@ -25,11 +25,16 @@ public: */ void loadPlugins(const QDir &pluginDir); + /** + * Loads static plugins into SciQlop. SciQLOP supports statically linked plugins. + */ + void loadStaticPlugins(); + /// @returns the number of plugins loaded int nbPluginsLoaded() const noexcept; private: - class PluginManagerPrivate; + struct PluginManagerPrivate; spimpl::unique_impl_ptr impl; }; diff --git a/core/src/Catalogue/CatalogueController.cpp b/core/src/Catalogue/CatalogueController.cpp index 4932adf..9e2ad7c 100644 --- a/core/src/Catalogue/CatalogueController.cpp +++ b/core/src/Catalogue/CatalogueController.cpp @@ -4,6 +4,13 @@ #include +#include +#include +#include +#include +#include +#include + #include #include @@ -12,10 +19,18 @@ Q_LOGGING_CATEGORY(LOG_CatalogueController, "CatalogueController") +namespace { + +static QString REPOSITORY_WORK_SUFFIX = QString{"Work"}; + +} + class CatalogueController::CatalogueControllerPrivate { public: QMutex m_WorkingMutex; CatalogueDao m_CatalogueDao; + + std::list m_RepositoryList; }; CatalogueController::CatalogueController(QObject *parent) @@ -32,12 +47,106 @@ CatalogueController::~CatalogueController() this->waitForFinish(); } +void CatalogueController::addDB(const QString &dbPath) +{ + QDir dbDir(dbPath); + if (dbDir.exists()) { + auto dirName = dbDir.dirName(); + + if (std::find(impl->m_RepositoryList.cbegin(), impl->m_RepositoryList.cend(), dirName) + != impl->m_RepositoryList.cend()) { + qCCritical(LOG_CatalogueController()) + << tr("Impossible to addDB that is already loaded"); + } + + if (!impl->m_CatalogueDao.addDB(dbPath, dirName)) { + qCCritical(LOG_CatalogueController()) + << tr("Impossible to addDB %1 from %2 ").arg(dirName, dbPath); + } + else { + impl->m_RepositoryList.push_back(dirName); + } + } + else { + qCCritical(LOG_CatalogueController()) << tr("Impossible to addDB that not exists: ") + << dbPath; + } +} + +void CatalogueController::saveDB(const QString &destinationPath, const QString &repository) +{ + if (!impl->m_CatalogueDao.saveDB(destinationPath, repository)) { + qCCritical(LOG_CatalogueController()) + << tr("Impossible to saveDB %1 from %2 ").arg(repository, destinationPath); + } +} + +std::list > +CatalogueController::retrieveEvents(const QString &repository) const +{ + auto eventsShared = std::list >{}; + auto events = impl->m_CatalogueDao.getEvents(repository); + for (auto event : events) { + eventsShared.push_back(std::make_shared(event)); + } + return eventsShared; +} + +std::list > CatalogueController::retrieveAllEvents() const +{ + auto eventsShared = std::list >{}; + for (auto repository : impl->m_RepositoryList) { + eventsShared.splice(eventsShared.end(), retrieveEvents(repository)); + } + + return eventsShared; +} + +std::list > +CatalogueController::retrieveEventsFromCatalogue(std::shared_ptr catalogue) const +{ + auto eventsShared = std::list >{}; + auto events = impl->m_CatalogueDao.getCatalogueEvents(*catalogue); + for (auto event : events) { + eventsShared.push_back(std::make_shared(event)); + } + return eventsShared; +} + +std::list > +CatalogueController::getCatalogues(const QString &repository) const +{ + auto cataloguesShared = std::list >{}; + auto catalogues = impl->m_CatalogueDao.getCatalogues(repository); + for (auto catalogue : catalogues) { + cataloguesShared.push_back(std::make_shared(catalogue)); + } + return cataloguesShared; +} + void CatalogueController::initialize() { qCDebug(LOG_CatalogueController()) << tr("CatalogueController init") << QThread::currentThread(); impl->m_WorkingMutex.lock(); impl->m_CatalogueDao.initialize(); + auto defaultRepositoryLocation + = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); + + QDir defaultRepositoryLocationDir; + if (defaultRepositoryLocationDir.mkpath(defaultRepositoryLocation)) { + defaultRepositoryLocationDir.cd(defaultRepositoryLocation); + auto defaultRepository = defaultRepositoryLocationDir.absoluteFilePath(REPOSITORY_DEFAULT); + qCInfo(LOG_CatalogueController()) + << tr("Persistant data loading from: ") << defaultRepository; + this->addDB(defaultRepository); + } + else { + qCWarning(LOG_CatalogueController()) + << tr("Cannot load the persistent default repository from ") + << defaultRepositoryLocation; + } + qCDebug(LOG_CatalogueController()) << tr("CatalogueController init END"); } diff --git a/core/src/Common/MimeTypesDef.cpp b/core/src/Common/MimeTypesDef.cpp index c057895..85a5347 100644 --- a/core/src/Common/MimeTypesDef.cpp +++ b/core/src/Common/MimeTypesDef.cpp @@ -6,3 +6,4 @@ const QString MIME_TYPE_VARIABLE_LIST = QStringLiteral("sciqlop/var-list"); const QString MIME_TYPE_PRODUCT_LIST = QStringLiteral("sciqlop/product-list"); const QString MIME_TYPE_TIME_RANGE = QStringLiteral("sciqlop/time-range"); const QString MIME_TYPE_SELECTION_ZONE = QStringLiteral("sciqlop/selection-zone"); +const QString MIME_TYPE_EVENT_LIST = QStringLiteral("sciqlop/event-list"); diff --git a/core/src/Plugin/PluginManager.cpp b/core/src/Plugin/PluginManager.cpp index c1fa918..2f07645 100644 --- a/core/src/Plugin/PluginManager.cpp +++ b/core/src/Plugin/PluginManager.cpp @@ -95,6 +95,15 @@ struct PluginManager::PluginManagerPrivate { loadState.log(); } + void loadStaticPlugins() + { + for (QObject *plugin : QPluginLoader::staticInstances()) + { + qobject_cast(plugin)->initialize(); + m_RegisteredPlugins.insert(plugin->metaObject()->className(), "StaticPlugin"); + } + } + /// Registered plugins (key: plugin name, value: plugin path) QHash m_RegisteredPlugins; }; @@ -118,6 +127,11 @@ void PluginManager::loadPlugins(const QDir &pluginDir) } } +void PluginManager::loadStaticPlugins() +{ + impl->loadStaticPlugins(); +} + int PluginManager::nbPluginsLoaded() const noexcept { return impl->m_RegisteredPlugins.size(); diff --git a/core/src/Variable/VariableController.cpp b/core/src/Variable/VariableController.cpp index b5a2eef..e76989b 100644 --- a/core/src/Variable/VariableController.cpp +++ b/core/src/Variable/VariableController.cpp @@ -669,7 +669,7 @@ AcquisitionZoomType VariableController::getZoomType(const SqpRange &range, const qCDebug(LOG_VariableController()) << "zoomtype: PanLeft"; zoomType = AcquisitionZoomType::PanLeft; } - else if (range.m_TStart > oldRange.m_TStart && oldRange.m_TEnd > range.m_TEnd) { + else if (range.m_TStart >= oldRange.m_TStart && oldRange.m_TEnd >= range.m_TEnd) { qCDebug(LOG_VariableController()) << "zoomtype: ZoomIn"; zoomType = AcquisitionZoomType::ZoomIn; } diff --git a/extern/CatalogueAPI.cmake b/extern/CatalogueAPI.cmake index 7bacfa1..c18078c 100644 --- a/extern/CatalogueAPI.cmake +++ b/extern/CatalogueAPI.cmake @@ -40,7 +40,7 @@ ExternalProject_Add( GIT_REPOSITORY https://perrinel@hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/CatalogueAPI GIT_TAG develop - UPDATE_COMMAND ${GIT_EXECUTABLE} pull + UPDATE_COMMAND ${GIT_EXECUTABLE} pull origin develop PATCH_COMMAND "" SOURCE_DIR "${CATALOGUEAPI_SOURCES_PATH}" diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index dab081d..119546f 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -75,6 +75,16 @@ INSTALL(TARGETS ${SQPGUI_LIBRARY_NAME} ) add_dependencies(${SQPGUI_LIBRARY_NAME} ${SQPCORE_LIBRARY_NAME}) +# Find CATALOGUE_API +include_directories("${CATALOGUEAPI_INCLUDE}") +TARGET_LINK_LIBRARIES(${SQPGUI_LIBRARY_NAME} ${CATALOGUEAPI_LIBRARIES}) +INSTALL(TARGETS ${SQPGUI_LIBRARY_NAME} + RUNTIME DESTINATION ${INSTALL_BINARY_DIR} + LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} + ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} +) + +add_dependencies(${SQPGUI_LIBRARY_NAME} CatalogueAPI) # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order. diff --git a/gui/include/Catalogue/CatalogueEventsModel.h b/gui/include/Catalogue/CatalogueEventsModel.h new file mode 100644 index 0000000..bc0bd70 --- /dev/null +++ b/gui/include/Catalogue/CatalogueEventsModel.h @@ -0,0 +1,46 @@ +#ifndef SCIQLOP_CATALOGUEEVENTSMODEL_H +#define SCIQLOP_CATALOGUEEVENTSMODEL_H + +#include +#include + +class DBEvent; +class DBEventProduct; + +class CatalogueEventsModel : public QAbstractItemModel { +public: + CatalogueEventsModel(QObject *parent = nullptr); + + void setEvents(const QVector > &events); + void addEvent(const std::shared_ptr &event); + void removeEvent(const std::shared_ptr &event); + + enum class ItemType { Root, Event, EventProduct }; + ItemType itemTypeOf(const QModelIndex &index) const; + std::shared_ptr getEvent(const QModelIndex &index) const; + std::shared_ptr getParentEvent(const QModelIndex &index) const; + std::shared_ptr getEventProduct(const QModelIndex &index) const; + + void refreshEvent(const std::shared_ptr &event); + + // Model + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex &index) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + Qt::ItemFlags flags(const QModelIndex &index) const override; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const override; + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override; + + Qt::DropActions supportedDragActions() const override; + QStringList mimeTypes() const override; + QMimeData *mimeData(const QModelIndexList &indexes) const override; + +private: + class CatalogueEventsModelPrivate; + spimpl::unique_impl_ptr impl; +}; + +#endif // SCIQLOP_CATALOGUEEVENTSMODEL_H diff --git a/gui/include/Catalogue/CatalogueEventsWidget.h b/gui/include/Catalogue/CatalogueEventsWidget.h index deae927..e7ce270 100644 --- a/gui/include/Catalogue/CatalogueEventsWidget.h +++ b/gui/include/Catalogue/CatalogueEventsWidget.h @@ -2,24 +2,40 @@ #define SCIQLOP_CATALOGUEEVENTSWIDGET_H #include +#include #include +class DBCatalogue; +class DBEvent; +class DBEventProduct; +class VisualizationWidget; + namespace Ui { class CatalogueEventsWidget; } +Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueEventsWidget) + class CatalogueEventsWidget : public QWidget { Q_OBJECT signals: - void eventSelected(const QString &event); + void eventsSelected(const QVector > &event); + void eventProductsSelected( + const QVector, std::shared_ptr > > + &eventproducts); + void selectionCleared(); public: explicit CatalogueEventsWidget(QWidget *parent = 0); virtual ~CatalogueEventsWidget(); + void setVisualizationWidget(VisualizationWidget *visualization); + + void setEventChanges(const std::shared_ptr &event, bool hasChanges); + public slots: - void populateWithCatalogue(const QString &catalogue); + void populateWithCatalogues(const QVector > &catalogues); private: Ui::CatalogueEventsWidget *ui; diff --git a/gui/include/Catalogue/CatalogueExplorer.h b/gui/include/Catalogue/CatalogueExplorer.h index 0e433f2..9baa58f 100644 --- a/gui/include/Catalogue/CatalogueExplorer.h +++ b/gui/include/Catalogue/CatalogueExplorer.h @@ -1,12 +1,15 @@ #ifndef SCIQLOP_CATALOGUEEXPLORER_H #define SCIQLOP_CATALOGUEEXPLORER_H +#include #include namespace Ui { class CatalogueExplorer; } +class VisualizationWidget; + class CatalogueExplorer : public QDialog { Q_OBJECT @@ -14,8 +17,13 @@ public: explicit CatalogueExplorer(QWidget *parent = 0); virtual ~CatalogueExplorer(); + void setVisualizationWidget(VisualizationWidget *visualization); + private: Ui::CatalogueExplorer *ui; + + class CatalogueExplorerPrivate; + spimpl::unique_impl_ptr impl; }; #endif // SCIQLOP_CATALOGUEEXPLORER_H diff --git a/gui/include/Catalogue/CatalogueInspectorWidget.h b/gui/include/Catalogue/CatalogueInspectorWidget.h index b78fd55..51c42b9 100644 --- a/gui/include/Catalogue/CatalogueInspectorWidget.h +++ b/gui/include/Catalogue/CatalogueInspectorWidget.h @@ -1,15 +1,27 @@ #ifndef SCIQLOP_CATALOGUEINSPECTORWIDGET_H #define SCIQLOP_CATALOGUEINSPECTORWIDGET_H +#include #include +#include namespace Ui { class CatalogueInspectorWidget; } +class DBCatalogue; +class DBEvent; +class DBEventProduct; + class CatalogueInspectorWidget : public QWidget { Q_OBJECT +signals: + void catalogueUpdated(const std::shared_ptr &catalogue); + void eventUpdated(const std::shared_ptr &event); + void eventProductUpdated(const std::shared_ptr &event, + const std::shared_ptr &eventProduct); + public: explicit CatalogueInspectorWidget(QWidget *parent = 0); virtual ~CatalogueInspectorWidget(); @@ -19,14 +31,19 @@ public: Page currentPage() const; - void setEvent(const QString &event); - void setCatalogue(const QString &catalogue); + void setEvent(const std::shared_ptr &event); + void setEventProduct(const std::shared_ptr &event, + const std::shared_ptr &eventProduct); + void setCatalogue(const std::shared_ptr &catalogue); public slots: void showPage(Page page); private: Ui::CatalogueInspectorWidget *ui; + + class CatalogueInspectorWidgetPrivate; + spimpl::unique_impl_ptr impl; }; #endif // SCIQLOP_CATALOGUEINSPECTORWIDGET_H diff --git a/gui/include/Catalogue/CatalogueSideBarWidget.h b/gui/include/Catalogue/CatalogueSideBarWidget.h index b9855dd..0af2b26 100644 --- a/gui/include/Catalogue/CatalogueSideBarWidget.h +++ b/gui/include/Catalogue/CatalogueSideBarWidget.h @@ -2,30 +2,42 @@ #define SCIQLOP_CATALOGUESIDEBARWIDGET_H #include +#include #include #include +class DBCatalogue; + namespace Ui { class CatalogueSideBarWidget; } +Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueSideBarWidget) + class CatalogueSideBarWidget : public QWidget { Q_OBJECT signals: - void catalogueSelected(const QString &catalogue); + void catalogueSelected(const QVector > &catalogues); + void databaseSelected(const QStringList &databases); void allEventsSelected(); void trashSelected(); + void selectionCleared(); public: explicit CatalogueSideBarWidget(QWidget *parent = 0); virtual ~CatalogueSideBarWidget(); + void setCatalogueChanges(const std::shared_ptr &catalogue, bool hasChanges); + private: Ui::CatalogueSideBarWidget *ui; class CatalogueSideBarWidgetPrivate; spimpl::unique_impl_ptr impl; + +private slots: + void onContextMenuRequested(const QPoint &pos); }; #endif // SCIQLOP_CATALOGUESIDEBARWIDGET_H diff --git a/gui/include/Catalogue/CatalogueTreeWidgetItem.h b/gui/include/Catalogue/CatalogueTreeWidgetItem.h new file mode 100644 index 0000000..a8b4f14 --- /dev/null +++ b/gui/include/Catalogue/CatalogueTreeWidgetItem.h @@ -0,0 +1,33 @@ +#ifndef SCIQLOP_CATALOGUETREEWIDGETITEM_H +#define SCIQLOP_CATALOGUETREEWIDGETITEM_H + +#include +#include + +class DBCatalogue; + + +class CatalogueTreeWidgetItem : public QTreeWidgetItem { +public: + CatalogueTreeWidgetItem(std::shared_ptr catalogue, + int type = QTreeWidgetItem::Type); + + QVariant data(int column, int role) const override; + void setData(int column, int role, const QVariant &value) override; + + /// Returns the catalogue represented by the item + std::shared_ptr catalogue() const; + + /// Displays or hides the save and cancel buttons indicating that the catalogue has unsaved + /// changes + void setHasChanges(bool value); + + /// Refreshes the data displayed by the item from the catalogue + void refresh(); + +private: + class CatalogueTreeWidgetItemPrivate; + spimpl::unique_impl_ptr impl; +}; + +#endif // SCIQLOP_CATALOGUETREEWIDGETITEM_H diff --git a/gui/include/SqpApplication.h b/gui/include/SqpApplication.h index 91f5f13..fad8eb6 100644 --- a/gui/include/SqpApplication.h +++ b/gui/include/SqpApplication.h @@ -22,6 +22,7 @@ class VariableController; class VisualizationController; class DragDropGuiController; class ActionsGuiController; +class CatalogueController; /** * @brief The SqpApplication class aims to make the link between SciQlop @@ -45,6 +46,7 @@ public: TimeController &timeController() noexcept; VariableController &variableController() noexcept; VisualizationController &visualizationController() noexcept; + CatalogueController &catalogueController() noexcept; /// Accessors for the differents sciqlop helpers, these helpers classes are like controllers but /// doesn't live in a thread and access gui diff --git a/gui/include/Visualization/VisualizationMultiZoneSelectionDialog.h b/gui/include/Visualization/VisualizationMultiZoneSelectionDialog.h index f3ebcfb..9e17083 100644 --- a/gui/include/Visualization/VisualizationMultiZoneSelectionDialog.h +++ b/gui/include/Visualization/VisualizationMultiZoneSelectionDialog.h @@ -15,7 +15,7 @@ class VisualizationMultiZoneSelectionDialog : public QDialog { public: explicit VisualizationMultiZoneSelectionDialog(QWidget *parent = 0); - ~VisualizationMultiZoneSelectionDialog(); + virtual ~VisualizationMultiZoneSelectionDialog(); void setZones(const QVector &zones); QMap selectedZones() const; diff --git a/gui/include/Visualization/VisualizationTabWidget.h b/gui/include/Visualization/VisualizationTabWidget.h index 4df7113..5299e6e 100644 --- a/gui/include/Visualization/VisualizationTabWidget.h +++ b/gui/include/Visualization/VisualizationTabWidget.h @@ -25,11 +25,19 @@ public: explicit VisualizationTabWidget(const QString &name = {}, QWidget *parent = 0); virtual ~VisualizationTabWidget(); - /// Add a zone widget + /// Adds a zone widget void addZone(VisualizationZoneWidget *zoneWidget); + /// Inserts a zone widget at the specified position void insertZone(int index, VisualizationZoneWidget *zoneWidget); + /// Returns the list of zone widget names in the order they are displayed + QStringList availableZoneWidgets() const; + + /// Returns the zone with the specified name. + /// If multiple zone with the same name exist, the first one is returned. + VisualizationZoneWidget *getZoneWithName(const QString &zoneName); + /** * Creates a zone using a variable. The variable will be displayed in a new graph of the new * zone. The zone is added at the end. diff --git a/gui/include/Visualization/VisualizationWidget.h b/gui/include/Visualization/VisualizationWidget.h index fedb137..adcfe8a 100644 --- a/gui/include/Visualization/VisualizationWidget.h +++ b/gui/include/Visualization/VisualizationWidget.h @@ -30,6 +30,8 @@ public: /// Returns the class which manage the selection of selection zone across the visualization VisualizationSelectionZoneManager &selectionZoneManager() const; + VisualizationTabWidget *currentTabWidget() const; + // IVisualizationWidget interface void accept(IVisualizationWidgetVisitor *visitor) override; bool canDrop(const Variable &variable) const override; diff --git a/gui/include/Visualization/VisualizationZoneWidget.h b/gui/include/Visualization/VisualizationZoneWidget.h index c13f26f..daa2525 100644 --- a/gui/include/Visualization/VisualizationZoneWidget.h +++ b/gui/include/Visualization/VisualizationZoneWidget.h @@ -1,6 +1,7 @@ #ifndef SCIQLOP_VISUALIZATIONZONEWIDGET_H #define SCIQLOP_VISUALIZATIONZONEWIDGET_H +#include "Data/SqpRange.h" #include "Visualization/IVisualizationWidget.h" #include "Visualization/VisualizationDragWidget.h" @@ -27,6 +28,10 @@ public: explicit VisualizationZoneWidget(const QString &name = {}, QWidget *parent = 0); virtual ~VisualizationZoneWidget(); + /// Sets the range of the zone, only works if there is at least one graph in the zone + /// Note: calibrations between graphs are lost. + void setZoneRange(const SqpRange &range); + /// Adds a graph widget void addGraph(VisualizationGraphWidget *graphWidget); diff --git a/gui/meson.build b/gui/meson.build index 55e755d..727fa0d 100644 --- a/gui/meson.build +++ b/gui/meson.build @@ -1,4 +1,7 @@ +qxorm_dep = dependency('QxOrm', required : true, fallback:['QxOrm','qxorm_dep']) +catalogueapi_dep = dependency('CatalogueAPI', required : true, fallback:['CatalogueAPI','CatalogueAPI_dep']) + gui_moc_headers = [ 'include/DataSource/DataSourceWidget.h', 'include/Settings/SqpSettingsDialog.h', @@ -103,7 +106,9 @@ gui_sources = [ 'src/Catalogue/CatalogueExplorer.cpp', 'src/Catalogue/CatalogueEventsWidget.cpp', 'src/Catalogue/CatalogueSideBarWidget.cpp', - 'src/Catalogue/CatalogueInspectorWidget.cpp' + 'src/Catalogue/CatalogueInspectorWidget.cpp', + 'src/Catalogue/CatalogueTreeWidgetItem.cpp', + 'src/Catalogue/CatalogueEventsModel.cpp' ] gui_inc = include_directories(['include']) @@ -112,11 +117,11 @@ sciqlop_gui_lib = library('sciqlopgui', gui_sources, gui_moc_files, include_directories : [gui_inc], - dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core], + dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core, catalogueapi_dep], install : true ) sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib, include_directories : gui_inc, - dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core]) + dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core, catalogueapi_dep]) diff --git a/gui/resources/icones/discard.png b/gui/resources/icones/discard.png new file mode 100644 index 0000000000000000000000000000000000000000..bfc6b097e9fa0c1093924faeca285fd4cf9c262d GIT binary patch literal 1864 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 zohpImp-f1t9HZicones/allEvents.png icones/trash.png icones/database.png + icones/save.png + icones/discard.png diff --git a/gui/src/Catalogue/CatalogueEventsModel.cpp b/gui/src/Catalogue/CatalogueEventsModel.cpp new file mode 100644 index 0000000..ad78d41 --- /dev/null +++ b/gui/src/Catalogue/CatalogueEventsModel.cpp @@ -0,0 +1,381 @@ +#include "Catalogue/CatalogueEventsModel.h" + +#include +#include +#include +#include +#include +#include +#include +#include