VariableController.h
92 lines
| 2.9 KiB
| text/x-c
|
CLexer
|
r106 | #ifndef SCIQLOP_VARIABLECONTROLLER_H | ||
#define SCIQLOP_VARIABLECONTROLLER_H | ||||
r219 | #include <Data/SqpDateTime.h> | |||
|
r106 | #include <QLoggingCategory> | ||
#include <QObject> | ||||
#include <Common/spimpl.h> | ||||
|
r154 | class IDataProvider; | ||
r281 | class QItemSelectionModel; | |||
r179 | class TimeController; | |||
|
r108 | class Variable; | ||
|
r143 | class VariableModel; | ||
|
r106 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableController) | ||
/** | ||||
* @brief The VariableController class aims to handle the variables in SciQlop. | ||||
*/ | ||||
class VariableController : public QObject { | ||||
Q_OBJECT | ||||
public: | ||||
explicit VariableController(QObject *parent = 0); | ||||
virtual ~VariableController(); | ||||
|
r154 | VariableModel *variableModel() noexcept; | ||
r281 | QItemSelectionModel *variableSelectionModel() noexcept; | |||
|
r154 | |||
r179 | void setTimeController(TimeController *timeController) noexcept; | |||
|
r303 | /** | ||
* Deletes from the controller the variable passed in parameter. | ||||
* | ||||
|
r304 | * Delete a variable includes: | ||
|
r310 | * - the deletion of the various references to the variable in SciQlop | ||
|
r306 | * - the deletion of the model variable | ||
|
r304 | * - the deletion of the provider associated with the variable | ||
|
r305 | * - removing the cache associated with the variable | ||
|
r303 | * | ||
* @param variable the variable to delete from the controller. | ||||
*/ | ||||
void deleteVariable(std::shared_ptr<Variable> variable) noexcept; | ||||
/** | ||||
* Deletes from the controller the variables passed in parameter. | ||||
* @param variables the variables to delete from the controller. | ||||
* @sa deleteVariable() | ||||
*/ | ||||
void deleteVariables(const QVector<std::shared_ptr<Variable> > &variables) noexcept; | ||||
r219 | ||||
r388 | /** | |||
* @brief abort the variable retrieve data progression | ||||
*/ | ||||
void abortProgress(std::shared_ptr<Variable> variable); | ||||
|
r154 | signals: | ||
|
r310 | /// Signal emitted when a variable is about to be deleted from the controller | ||
void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); | ||||
|
r154 | |||
public slots: | ||||
r276 | /// Request the data loading of the variable whithin dateTime | |||
void onRequestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); | ||||
|
r108 | /** | ||
|
r154 | * Creates a new variable and adds it to the model | ||
|
r108 | * @param name the name of the new variable | ||
|
r377 | * @param metadata the metadata of the new variable | ||
|
r154 | * @param provider the data provider for the new variable | ||
|
r108 | */ | ||
|
r377 | void createVariable(const QString &name, const QVariantHash &metadata, | ||
std::shared_ptr<IDataProvider> provider) noexcept; | ||||
|
r108 | |||
r281 | /// Update the temporal parameters of every selected variable to dateTime | |||
void onDateTimeOnSelection(const SqpDateTime &dateTime); | ||||
r369 | ||||
void onVariableRetrieveDataInProgress(QUuid identifier, double progress); | ||||
r388 | void onAbortProgressRequested(std::shared_ptr<Variable> variable); | |||
|
r106 | void initialize(); | ||
void finalize(); | ||||
private: | ||||
void waitForFinish(); | ||||
class VariableControllerPrivate; | ||||
spimpl::unique_impl_ptr<VariableControllerPrivate> impl; | ||||
}; | ||||
#endif // SCIQLOP_VARIABLECONTROLLER_H | ||||