From e439cb403ff9b1b40db989b401bb8c5f0c427034 2017-11-03 16:36:58 From: Thibaud Rabillard Date: 2017-11-03 16:36:58 Subject: [PATCH] Drop of variable, graph and zones on the time widget --- diff --git a/core/include/DataSource/DataSourceController.h b/core/include/DataSource/DataSourceController.h index 13e89a2..cbf2d67 100644 --- a/core/include/DataSource/DataSourceController.h +++ b/core/include/DataSource/DataSourceController.h @@ -64,8 +64,11 @@ public: */ void loadProductItem(const QUuid &dataSourceUid, const DataSourceItem &productItem) noexcept; - QByteArray mimeDataForProductsData(const QVariantList &productsData) const; - QVariantList productsDataForMimeData(const QByteArray &mimeData) const; + /// Returns the MIME data associated to a list of product meta data + static QByteArray mimeDataForProductsData(const QVariantList &productsData); + + /// Returns the list of meta data contained in a MIME data + static QVariantList productsDataForMimeData(const QByteArray &mimeData); public slots: /// Manage init/end of the controller diff --git a/core/include/Time/TimeController.h b/core/include/Time/TimeController.h index 6f1f1fb..7c38e2c 100644 --- a/core/include/Time/TimeController.h +++ b/core/include/Time/TimeController.h @@ -23,6 +23,12 @@ public: SqpRange dateTime() const noexcept; + /// Returns the MIME data associated to a time range + static QByteArray mimeDataForTimeRange(const SqpRange &timeRange); + + /// Returns the time range contained in a MIME data + static SqpRange timeRangeForMimeData(const QByteArray &mimeData); + signals: /// Signal emitted to notify that time parameters has beed updated void timeUpdated(SqpRange time); diff --git a/core/include/Variable/VariableController.h b/core/include/Variable/VariableController.h index b198dcd..984e738 100644 --- a/core/include/Variable/VariableController.h +++ b/core/include/Variable/VariableController.h @@ -68,7 +68,10 @@ public: */ void deleteVariables(const QVector > &variables) noexcept; + /// Returns the MIME data associated to a list of variables QByteArray mimeDataForVariables(const QList > &variables) const; + + /// Returns the list of variables contained in a MIME data QList > variablesForMimeData(const QByteArray &mimeData) const; static AcquisitionZoomType getZoomType(const SqpRange &range, const SqpRange &oldRange); diff --git a/core/src/DataSource/DataSourceController.cpp b/core/src/DataSource/DataSourceController.cpp index 94b62c8..81adfb3 100644 --- a/core/src/DataSource/DataSourceController.cpp +++ b/core/src/DataSource/DataSourceController.cpp @@ -139,7 +139,7 @@ void DataSourceController::loadProductItem(const QUuid &dataSourceUid, } } -QByteArray DataSourceController::mimeDataForProductsData(const QVariantList &productsData) const +QByteArray DataSourceController::mimeDataForProductsData(const QVariantList &productsData) { QByteArray encodedData; QDataStream stream{&encodedData, QIODevice::WriteOnly}; @@ -149,7 +149,7 @@ QByteArray DataSourceController::mimeDataForProductsData(const QVariantList &pro return encodedData; } -QVariantList DataSourceController::productsDataForMimeData(const QByteArray &mimeData) const +QVariantList DataSourceController::productsDataForMimeData(const QByteArray &mimeData) { QDataStream stream{mimeData}; diff --git a/core/src/Time/TimeController.cpp b/core/src/Time/TimeController.cpp index fee9f73..66b9591 100644 --- a/core/src/Time/TimeController.cpp +++ b/core/src/Time/TimeController.cpp @@ -1,5 +1,7 @@ #include "Time/TimeController.h" +#include + Q_LOGGING_CATEGORY(LOG_TimeController, "TimeController") struct TimeController::TimeControllerPrivate { @@ -18,6 +20,26 @@ SqpRange TimeController::dateTime() const noexcept return impl->m_DateTime; } +QByteArray TimeController::mimeDataForTimeRange(const SqpRange &timeRange) +{ + QByteArray encodedData; + QDataStream stream{&encodedData, QIODevice::WriteOnly}; + + stream << timeRange.m_TStart << timeRange.m_TEnd; + + return encodedData; +} + +SqpRange TimeController::timeRangeForMimeData(const QByteArray &mimeData) +{ + QDataStream stream{mimeData}; + + SqpRange timeRange; + stream >> timeRange.m_TStart >> timeRange.m_TEnd; + + return timeRange; +} + void TimeController::onTimeToUpdate(SqpRange dateTime) { impl->m_DateTime = dateTime; diff --git a/core/src/Variable/VariableModel.cpp b/core/src/Variable/VariableModel.cpp index dd26938..f85f179 100644 --- a/core/src/Variable/VariableModel.cpp +++ b/core/src/Variable/VariableModel.cpp @@ -8,7 +8,9 @@ #include -#include +#include +#include