From eb6ce8cd853b72e6f2f5dfdc5980d0e7fb7acabc 2017-07-07 12:47:25 From: Alexandre Leroux Date: 2017-07-07 12:47:25 Subject: [PATCH] Merge branch 'develop' of https://hephaistos.lpp.polytechnique.fr/rhodecode/GIT_REPOSITORIES/LPP/Users/mperrinel/SCIQLOP-Initialisation into develop --- diff --git a/core/include/Data/IDataProvider.h b/core/include/Data/IDataProvider.h index 6f4b5b6..c627123 100644 --- a/core/include/Data/IDataProvider.h +++ b/core/include/Data/IDataProvider.h @@ -26,10 +26,6 @@ class IDataProvider : public QObject { public: virtual ~IDataProvider() noexcept = default; - virtual std::shared_ptr - retrieveData(const DataProviderParameters ¶meters) const = 0; - - virtual void requestDataLoading(const QVector &dateTimeList) = 0; signals: diff --git a/core/include/Network/NetworkController.h b/core/include/Network/NetworkController.h new file mode 100644 index 0000000..0e36901 --- /dev/null +++ b/core/include/Network/NetworkController.h @@ -0,0 +1,30 @@ +#ifndef SCIQLOP_NETWORKCONTROLLER_H +#define SCIQLOP_NETWORKCONTROLLER_H + +#include +#include + +#include + +Q_DECLARE_LOGGING_CATEGORY(LOG_NetworkController) + +/** + * @brief The NetworkController class aims to handle all network connection of SciQlop. + */ +class NetworkController : public QObject { + Q_OBJECT +public: + explicit NetworkController(QObject *parent = 0); + + + void initialize(); + void finalize(); + +private: + void waitForFinish(); + + class NetworkControllerPrivate; + spimpl::unique_impl_ptr impl; +}; + +#endif // SCIQLOP_NETWORKCONTROLLER_H diff --git a/core/src/Network/NetworkController.cpp b/core/src/Network/NetworkController.cpp new file mode 100644 index 0000000..e015af4 --- /dev/null +++ b/core/src/Network/NetworkController.cpp @@ -0,0 +1,33 @@ +#include "Network/NetworkController.h" + +#include +#include + +Q_LOGGING_CATEGORY(LOG_NetworkController, "NetworkController") + +struct NetworkController::NetworkControllerPrivate { + explicit NetworkControllerPrivate(NetworkController *parent) : m_WorkingMutex{} {} + QMutex m_WorkingMutex; +}; + +NetworkController::NetworkController(QObject *parent) + : QObject(parent), impl{spimpl::make_unique_impl(this)} +{ +} + +void NetworkController::initialize() +{ + qCDebug(LOG_NetworkController()) << tr("NetworkController init") << QThread::currentThread(); + impl->m_WorkingMutex.lock(); + qCDebug(LOG_NetworkController()) << tr("NetworkController init END"); +} + +void NetworkController::finalize() +{ + impl->m_WorkingMutex.unlock(); +} + +void NetworkController::waitForFinish() +{ + QMutexLocker locker{&impl->m_WorkingMutex}; +} diff --git a/core/src/Variable/VariableController.cpp b/core/src/Variable/VariableController.cpp index 0e58f7e..350c766 100644 --- a/core/src/Variable/VariableController.cpp +++ b/core/src/Variable/VariableController.cpp @@ -17,20 +17,6 @@ Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController") -namespace { - -/// @todo Generates default dataseries, according to the provider passed in parameter. This method -/// will be deleted when the timerange is recovered from SciQlop -std::shared_ptr generateDefaultDataSeries(const IDataProvider &provider, - const SqpDateTime &dateTime) noexcept -{ - auto parameters = DataProviderParameters{dateTime}; - - return provider.retrieveData(parameters); -} - -} // namespace - struct VariableController::VariableControllerPrivate { explicit VariableControllerPrivate(VariableController *parent) : m_WorkingMutex{}, diff --git a/gui/include/SqpApplication.h b/gui/include/SqpApplication.h index 87bc813..a23bd7f 100644 --- a/gui/include/SqpApplication.h +++ b/gui/include/SqpApplication.h @@ -16,6 +16,7 @@ Q_DECLARE_LOGGING_CATEGORY(LOG_SqpApplication) #define sqpApp (static_cast(QCoreApplication::instance())) class DataSourceController; +class NetworkController; class TimeController; class VariableController; class VisualizationController; @@ -38,6 +39,7 @@ public: /// Accessors for the differents sciqlop controllers DataSourceController &dataSourceController() noexcept; + NetworkController &networkController() noexcept; TimeController &timeController() noexcept; VariableController &variableController() noexcept; VisualizationController &visualizationController() noexcept; diff --git a/gui/src/SqpApplication.cpp b/gui/src/SqpApplication.cpp index c79f0f7..a50fa86 100644 --- a/gui/src/SqpApplication.cpp +++ b/gui/src/SqpApplication.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include