Auto status change to "Under Review"
@@ -29,6 +29,7 | |||
|
29 | 29 | #include <Time/TimeController.h> |
|
30 | 30 | #include <TimeWidget/TimeWidget.h> |
|
31 | 31 | #include <Variable/Variable.h> |
|
32 | #include <Variable/VariableController.h> | |
|
32 | 33 | #include <Visualization/VisualizationController.h> |
|
33 | 34 | |
|
34 | 35 | #include <QAction> |
@@ -182,6 +183,10 MainWindow::MainWindow(QWidget *parent) | |||
|
182 | 183 | connect(timeWidget, SIGNAL(timeUpdated(SqpDateTime)), &sqpApp->timeController(), |
|
183 | 184 | SLOT(onTimeToUpdate(SqpDateTime))); |
|
184 | 185 | |
|
186 | qRegisterMetaType<SqpDateTime>(); | |
|
187 | connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpDateTime)), | |
|
188 | &sqpApp->variableController(), SLOT(onDateTimeOnSelection(SqpDateTime))); | |
|
189 | ||
|
185 | 190 | // Widgets / widgets connections |
|
186 | 191 | qRegisterMetaType<std::shared_ptr<Variable> >(); |
|
187 | 192 |
@@ -26,9 +26,12 signals: | |||
|
26 | 26 | void timeUpdated(SqpDateTime time); |
|
27 | 27 | |
|
28 | 28 | public slots: |
|
29 |
/// Slot called when a new dateTime has been defined. |
|
|
29 | /// Slot called when a new dateTime has been defined. | |
|
30 | 30 | void onTimeToUpdate(SqpDateTime dateTime); |
|
31 | 31 | |
|
32 | /// Slot called when the dateTime has to be notified. Call timeUpdated signal | |
|
33 | void onTimeNotify(); | |
|
34 | ||
|
32 | 35 | private: |
|
33 | 36 | class TimeControllerPrivate; |
|
34 | 37 | spimpl::unique_impl_ptr<TimeControllerPrivate> impl; |
@@ -44,7 +44,6 public slots: | |||
|
44 | 44 | signals: |
|
45 | 45 | void updated(); |
|
46 | 46 | |
|
47 | ||
|
48 | 47 | private: |
|
49 | 48 | class VariablePrivate; |
|
50 | 49 | spimpl::unique_impl_ptr<VariablePrivate> impl; |
@@ -8,8 +8,8 | |||
|
8 | 8 | |
|
9 | 9 | #include <Common/spimpl.h> |
|
10 | 10 | |
|
11 | ||
|
12 | 11 | class IDataProvider; |
|
12 | class QItemSelectionModel; | |
|
13 | 13 | class TimeController; |
|
14 | 14 | class Variable; |
|
15 | 15 | class VariableModel; |
@@ -26,6 +26,7 public: | |||
|
26 | 26 | virtual ~VariableController(); |
|
27 | 27 | |
|
28 | 28 | VariableModel *variableModel() noexcept; |
|
29 | QItemSelectionModel *variableSelectionModel() noexcept; | |
|
29 | 30 | |
|
30 | 31 | void setTimeController(TimeController *timeController) noexcept; |
|
31 | 32 | |
@@ -44,6 +45,9 public slots: | |||
|
44 | 45 | */ |
|
45 | 46 | void createVariable(const QString &name, std::shared_ptr<IDataProvider> provider) noexcept; |
|
46 | 47 | |
|
48 | /// Update the temporal parameters of every selected variable to dateTime | |
|
49 | void onDateTimeOnSelection(const SqpDateTime &dateTime); | |
|
50 | ||
|
47 | 51 | void initialize(); |
|
48 | 52 | void finalize(); |
|
49 | 53 |
@@ -21,6 +21,9 SqpDateTime TimeController::dateTime() const noexcept | |||
|
21 | 21 | void TimeController::onTimeToUpdate(SqpDateTime dateTime) |
|
22 | 22 | { |
|
23 | 23 | impl->m_DateTime = dateTime; |
|
24 | } | |
|
24 | 25 | |
|
25 | emit timeUpdated(dateTime); | |
|
26 | void TimeController::onTimeNotify() | |
|
27 | { | |
|
28 | emit timeUpdated(impl->m_DateTime); | |
|
26 | 29 | } |
@@ -55,7 +55,7 void VariableCacheController::addDateTime(std::shared_ptr<Variable> variable, | |||
|
55 | 55 | impl->m_VariableToSqpDateTimeListMap.at(variable), 0); |
|
56 | 56 | } |
|
57 | 57 | catch (const std::out_of_range &e) { |
|
58 |
qC |
|
|
58 | qCWarning(LOG_VariableCacheController()) << e.what(); | |
|
59 | 59 | } |
|
60 | 60 | } |
|
61 | 61 | } |
@@ -77,7 +77,7 VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr<Variable> | |||
|
77 | 77 | notInCache, 0, dateTime.m_TStart); |
|
78 | 78 | } |
|
79 | 79 | catch (const std::out_of_range &e) { |
|
80 |
qC |
|
|
80 | qCWarning(LOG_VariableCacheController()) << e.what(); | |
|
81 | 81 | } |
|
82 | 82 | |
|
83 | 83 | return notInCache; |
@@ -90,7 +90,7 VariableCacheController::dateCacheList(std::shared_ptr<Variable> variable) const | |||
|
90 | 90 | return impl->m_VariableToSqpDateTimeListMap.at(variable); |
|
91 | 91 | } |
|
92 | 92 | catch (const std::out_of_range &e) { |
|
93 |
qC |
|
|
93 | qCWarning(LOG_VariableCacheController()) << e.what(); | |
|
94 | 94 | return QVector<SqpDateTime>{}; |
|
95 | 95 | } |
|
96 | 96 | } |
@@ -11,6 +11,7 | |||
|
11 | 11 | #include <QDateTime> |
|
12 | 12 | #include <QMutex> |
|
13 | 13 | #include <QThread> |
|
14 | #include <QtCore/QItemSelectionModel> | |
|
14 | 15 | |
|
15 | 16 | #include <unordered_map> |
|
16 | 17 | |
@@ -34,6 +35,7 struct VariableController::VariableControllerPrivate { | |||
|
34 | 35 | explicit VariableControllerPrivate(VariableController *parent) |
|
35 | 36 | : m_WorkingMutex{}, |
|
36 | 37 | m_VariableModel{new VariableModel{parent}}, |
|
38 | m_VariableSelectionModel{new QItemSelectionModel{m_VariableModel, parent}}, | |
|
37 | 39 | m_VariableCacheController{std::make_unique<VariableCacheController>()} |
|
38 | 40 | { |
|
39 | 41 | } |
@@ -41,6 +43,7 struct VariableController::VariableControllerPrivate { | |||
|
41 | 43 | QMutex m_WorkingMutex; |
|
42 | 44 | /// Variable model. The VariableController has the ownership |
|
43 | 45 | VariableModel *m_VariableModel; |
|
46 | QItemSelectionModel *m_VariableSelectionModel; | |
|
44 | 47 | |
|
45 | 48 | |
|
46 | 49 | TimeController *m_TimeController{nullptr}; |
@@ -69,6 +72,11 VariableModel *VariableController::variableModel() noexcept | |||
|
69 | 72 | return impl->m_VariableModel; |
|
70 | 73 | } |
|
71 | 74 | |
|
75 | QItemSelectionModel *VariableController::variableSelectionModel() noexcept | |
|
76 | { | |
|
77 | return impl->m_VariableSelectionModel; | |
|
78 | } | |
|
79 | ||
|
72 | 80 | void VariableController::setTimeController(TimeController *timeController) noexcept |
|
73 | 81 | { |
|
74 | 82 | impl->m_TimeController = timeController; |
@@ -110,6 +118,18 void VariableController::createVariable(const QString &name, | |||
|
110 | 118 | } |
|
111 | 119 | } |
|
112 | 120 | |
|
121 | void VariableController::onDateTimeOnSelection(const SqpDateTime &dateTime) | |
|
122 | { | |
|
123 | auto selectedRows = impl->m_VariableSelectionModel->selectedRows(); | |
|
124 | ||
|
125 | for (const auto &selectedRow : qAsConst(selectedRows)) { | |
|
126 | if (auto selectedVariable = impl->m_VariableModel->variable(selectedRow.row())) { | |
|
127 | selectedVariable->setDateTime(dateTime); | |
|
128 | this->onRequestDataLoading(selectedVariable, dateTime); | |
|
129 | } | |
|
130 | } | |
|
131 | } | |
|
132 | ||
|
113 | 133 | |
|
114 | 134 | void VariableController::onRequestDataLoading(std::shared_ptr<Variable> variable, |
|
115 | 135 | const SqpDateTime &dateTime) |
@@ -1,19 +1,38 | |||
|
1 | 1 | #include "TimeWidget/TimeWidget.h" |
|
2 | 2 | #include "ui_TimeWidget.h" |
|
3 | 3 | |
|
4 | #include <SqpApplication.h> | |
|
5 | #include <Time/TimeController.h> | |
|
4 | 6 | |
|
5 | 7 | TimeWidget::TimeWidget(QWidget *parent) : QWidget{parent}, ui{new Ui::TimeWidget} |
|
6 | 8 | { |
|
7 | 9 | ui->setupUi(this); |
|
8 | 10 | |
|
11 | ui->applyToolButton->setIcon(sqpApp->style()->standardIcon(QStyle::SP_DialogApplyButton)); | |
|
12 | ||
|
9 | 13 | // Connection |
|
10 | 14 | connect(ui->startDateTimeEdit, &QDateTimeEdit::dateTimeChanged, this, |
|
11 | 15 | &TimeWidget::onTimeUpdateRequested); |
|
12 | 16 | |
|
13 | 17 | connect(ui->endDateTimeEdit, &QDateTimeEdit::dateTimeChanged, this, |
|
14 | 18 | &TimeWidget::onTimeUpdateRequested); |
|
19 | ||
|
20 | ||
|
21 | connect(ui->applyToolButton, &QToolButton::clicked, &sqpApp->timeController(), | |
|
22 | &TimeController::onTimeNotify); | |
|
23 | ||
|
24 | // Initialisation | |
|
25 | ui->startDateTimeEdit->setDateTime( | |
|
26 | QDateTime::currentDateTime().addSecs(-3600)); // one hour berefore | |
|
27 | ui->endDateTimeEdit->setDateTime(QDateTime::currentDateTime()); | |
|
28 | ||
|
29 | auto dateTime | |
|
30 | = SqpDateTime{QDateTime::currentDateTime().addSecs(-3600).toMSecsSinceEpoch() / 1000.0, | |
|
31 | QDateTime::currentDateTime().toMSecsSinceEpoch() / 1000.0}; | |
|
32 | sqpApp->timeController().onTimeToUpdate(dateTime); | |
|
15 | 33 | } |
|
16 | 34 | |
|
35 | ||
|
17 | 36 | TimeWidget::~TimeWidget() |
|
18 | 37 | { |
|
19 | 38 | delete ui; |
@@ -18,10 +18,11 VariableInspectorWidget::VariableInspectorWidget(QWidget *parent) | |||
|
18 | 18 | ui->setupUi(this); |
|
19 | 19 | |
|
20 | 20 | // Sets model for table |
|
21 | auto sortFilterModel = new QSortFilterProxyModel{this}; | |
|
22 | sortFilterModel->setSourceModel(sqpApp->variableController().variableModel()); | |
|
21 | // auto sortFilterModel = new QSortFilterProxyModel{this}; | |
|
22 | // sortFilterModel->setSourceModel(sqpApp->variableController().variableModel()); | |
|
23 | 23 | |
|
24 |
ui->tableView->setModel(s |
|
|
24 | ui->tableView->setModel(sqpApp->variableController().variableModel()); | |
|
25 | ui->tableView->setSelectionModel(sqpApp->variableController().variableSelectionModel()); | |
|
25 | 26 | |
|
26 | 27 | // Fixes column sizes |
|
27 | 28 | auto model = ui->tableView->model(); |
General Comments 1
You need to be logged in to leave comments.
Login now