##// END OF EJS Templates
add TimeWidget connection
perrinel -
r192:274725519804
parent child
Show More
@@ -26,6 +26,7
26 #include <DataSource/DataSourceWidget.h>
26 #include <DataSource/DataSourceWidget.h>
27 #include <SidePane/SqpSidePane.h>
27 #include <SidePane/SqpSidePane.h>
28 #include <SqpApplication.h>
28 #include <SqpApplication.h>
29 #include <Time/TimeController.h>
29 #include <TimeWidget/TimeWidget.h>
30 #include <TimeWidget/TimeWidget.h>
30 #include <Variable/Variable.h>
31 #include <Variable/Variable.h>
31 #include <Visualization/VisualizationController.h>
32 #include <Visualization/VisualizationController.h>
@@ -168,12 +169,20 MainWindow::MainWindow(QWidget *parent)
168 this->menuBar()->addAction(tr("File"));
169 this->menuBar()->addAction(tr("File"));
169 auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar"));
170 auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar"));
170
171
171 mainToolBar->addWidget(new TimeWidget{});
172 auto timeWidget = new TimeWidget{};
173 mainToolBar->addWidget(timeWidget);
172
174
173 // Widgets / controllers connections
175 // Widgets / controllers connections
176
177 // DataSource
174 connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)),
178 connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)),
175 m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *)));
179 m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *)));
176
180
181 // Time
182 connect(timeWidget, SIGNAL(timeUpdated(SqpDateTime)), &sqpApp->timeController(),
183 SLOT(onTimeToUpdate(SqpDateTime)));
184
185 // Variable
177 qRegisterMetaType<std::shared_ptr<Variable> >();
186 qRegisterMetaType<std::shared_ptr<Variable> >();
178 connect(&sqpApp->visualizationController(), SIGNAL(variableCreated(std::shared_ptr<Variable>)),
187 connect(&sqpApp->visualizationController(), SIGNAL(variableCreated(std::shared_ptr<Variable>)),
179 m_Ui->view, SLOT(displayVariable(std::shared_ptr<Variable>)));
188 m_Ui->view, SLOT(displayVariable(std::shared_ptr<Variable>)));
@@ -3,6 +3,8
3
3
4 #include <QWidget>
4 #include <QWidget>
5
5
6 #include <Data/SqpDateTime.h>
7
6 namespace Ui {
8 namespace Ui {
7 class TimeWidget;
9 class TimeWidget;
8 } // Ui
10 } // Ui
@@ -14,6 +16,15 public:
14 explicit TimeWidget(QWidget *parent = 0);
16 explicit TimeWidget(QWidget *parent = 0);
15 virtual ~TimeWidget();
17 virtual ~TimeWidget();
16
18
19 signals:
20 /// Signal emitted when the time parameters has beed updated
21 void timeUpdated(SqpDateTime time);
22
23 public slots:
24 /// slot called when time parameters update has ben requested
25 void onTimeUpdateRequested();
26
27
17 private:
28 private:
18 Ui::TimeWidget *ui;
29 Ui::TimeWidget *ui;
19 };
30 };
@@ -1,12 +1,29
1 #include "TimeWidget/TimeWidget.h"
1 #include "TimeWidget/TimeWidget.h"
2 #include "ui_TimeWidget.h"
2 #include "ui_TimeWidget.h"
3
3
4
4 TimeWidget::TimeWidget(QWidget *parent) : QWidget{parent}, ui{new Ui::TimeWidget}
5 TimeWidget::TimeWidget(QWidget *parent) : QWidget{parent}, ui{new Ui::TimeWidget}
5 {
6 {
6 ui->setupUi(this);
7 ui->setupUi(this);
8
9 // Connection
10 connect(ui->startDateTimeEdit, &QDateTimeEdit::dateTimeChanged, this,
11 &TimeWidget::onTimeUpdateRequested);
12
13 connect(ui->endDateTimeEdit, &QDateTimeEdit::dateTimeChanged, this,
14 &TimeWidget::onTimeUpdateRequested);
7 }
15 }
8
16
9 TimeWidget::~TimeWidget()
17 TimeWidget::~TimeWidget()
10 {
18 {
11 delete ui;
19 delete ui;
12 }
20 }
21
22 void TimeWidget::onTimeUpdateRequested()
23 {
24 auto dateTime = SqpDateTime{
25 static_cast<double>(ui->startDateTimeEdit->dateTime().toMSecsSinceEpoch() / 1000.),
26 static_cast<double>(ui->endDateTimeEdit->dateTime().toMSecsSinceEpoch()) / 1000.};
27
28 emit timeUpdated(std::move(dateTime));
29 }
General Comments 0
You need to be logged in to leave comments. Login now