Auto status change to "Under Review"
@@ -1,239 +1,248 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SciQLop Software |
|
2 | -- This file is a part of the SciQLop Software | |
3 | -- Copyright (C) 2017, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2017, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "MainWindow.h" |
|
22 | #include "MainWindow.h" | |
23 | #include "ui_MainWindow.h" |
|
23 | #include "ui_MainWindow.h" | |
24 |
|
24 | |||
25 | #include <DataSource/DataSourceController.h> |
|
25 | #include <DataSource/DataSourceController.h> | |
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> | |
32 |
|
33 | |||
33 | #include <QAction> |
|
34 | #include <QAction> | |
34 | #include <QDate> |
|
35 | #include <QDate> | |
35 | #include <QDateTime> |
|
36 | #include <QDateTime> | |
36 | #include <QDir> |
|
37 | #include <QDir> | |
37 | #include <QFileDialog> |
|
38 | #include <QFileDialog> | |
38 | #include <QToolBar> |
|
39 | #include <QToolBar> | |
39 | #include <QToolButton> |
|
40 | #include <QToolButton> | |
40 | #include <memory.h> |
|
41 | #include <memory.h> | |
41 |
|
42 | |||
42 | //#include <omp.h> |
|
43 | //#include <omp.h> | |
43 | //#include <network/filedownloader.h> |
|
44 | //#include <network/filedownloader.h> | |
44 | //#include <qlopdatabase.h> |
|
45 | //#include <qlopdatabase.h> | |
45 | //#include <qlopsettings.h> |
|
46 | //#include <qlopsettings.h> | |
46 | //#include <qlopgui.h> |
|
47 | //#include <qlopgui.h> | |
47 | //#include <spacedata.h> |
|
48 | //#include <spacedata.h> | |
48 | //#include "qlopcore.h" |
|
49 | //#include "qlopcore.h" | |
49 | //#include "qlopcodecmanager.h" |
|
50 | //#include "qlopcodecmanager.h" | |
50 | //#include "cdfcodec.h" |
|
51 | //#include "cdfcodec.h" | |
51 | //#include "amdatxtcodec.h" |
|
52 | //#include "amdatxtcodec.h" | |
52 | //#include <qlopplotmanager.h> |
|
53 | //#include <qlopplotmanager.h> | |
53 |
|
54 | |||
54 | #include "iostream" |
|
55 | #include "iostream" | |
55 |
|
56 | |||
56 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") |
|
57 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") | |
57 |
|
58 | |||
58 | namespace { |
|
59 | namespace { | |
59 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; |
|
60 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; | |
60 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; |
|
61 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; | |
61 | const auto VIEWPLITTERINDEX = 2; |
|
62 | const auto VIEWPLITTERINDEX = 2; | |
62 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; |
|
63 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; | |
63 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; |
|
64 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; | |
64 | } |
|
65 | } | |
65 |
|
66 | |||
66 | class MainWindow::MainWindowPrivate { |
|
67 | class MainWindow::MainWindowPrivate { | |
67 | public: |
|
68 | public: | |
68 | QSize m_LastOpenLeftInspectorSize; |
|
69 | QSize m_LastOpenLeftInspectorSize; | |
69 | QSize m_LastOpenRightInspectorSize; |
|
70 | QSize m_LastOpenRightInspectorSize; | |
70 | }; |
|
71 | }; | |
71 |
|
72 | |||
72 | MainWindow::MainWindow(QWidget *parent) |
|
73 | MainWindow::MainWindow(QWidget *parent) | |
73 | : QMainWindow{parent}, |
|
74 | : QMainWindow{parent}, | |
74 | m_Ui{new Ui::MainWindow}, |
|
75 | m_Ui{new Ui::MainWindow}, | |
75 | impl{spimpl::make_unique_impl<MainWindowPrivate>()} |
|
76 | impl{spimpl::make_unique_impl<MainWindowPrivate>()} | |
76 | { |
|
77 | { | |
77 | m_Ui->setupUi(this); |
|
78 | m_Ui->setupUi(this); | |
78 |
|
79 | |||
79 | m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false); |
|
80 | m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false); | |
80 | m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false); |
|
81 | m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false); | |
81 |
|
82 | |||
82 |
|
83 | |||
83 | auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane(); |
|
84 | auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane(); | |
84 | auto openLeftInspectorAction = new QAction{QIcon{ |
|
85 | auto openLeftInspectorAction = new QAction{QIcon{ | |
85 | ":/icones/previous.png", |
|
86 | ":/icones/previous.png", | |
86 | }, |
|
87 | }, | |
87 | tr("Show/hide the left inspector"), this}; |
|
88 | tr("Show/hide the left inspector"), this}; | |
88 |
|
89 | |||
89 |
|
90 | |||
90 | auto spacerLeftTop = new QWidget{}; |
|
91 | auto spacerLeftTop = new QWidget{}; | |
91 | spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
92 | spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
92 |
|
93 | |||
93 | auto spacerLeftBottom = new QWidget{}; |
|
94 | auto spacerLeftBottom = new QWidget{}; | |
94 | spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
95 | spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
95 |
|
96 | |||
96 | leftSidePane->addWidget(spacerLeftTop); |
|
97 | leftSidePane->addWidget(spacerLeftTop); | |
97 | leftSidePane->addAction(openLeftInspectorAction); |
|
98 | leftSidePane->addAction(openLeftInspectorAction); | |
98 | leftSidePane->addWidget(spacerLeftBottom); |
|
99 | leftSidePane->addWidget(spacerLeftBottom); | |
99 |
|
100 | |||
100 |
|
101 | |||
101 | auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane(); |
|
102 | auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane(); | |
102 | auto openRightInspectorAction = new QAction{QIcon{ |
|
103 | auto openRightInspectorAction = new QAction{QIcon{ | |
103 | ":/icones/next.png", |
|
104 | ":/icones/next.png", | |
104 | }, |
|
105 | }, | |
105 | tr("Show/hide the right inspector"), this}; |
|
106 | tr("Show/hide the right inspector"), this}; | |
106 |
|
107 | |||
107 | auto spacerRightTop = new QWidget{}; |
|
108 | auto spacerRightTop = new QWidget{}; | |
108 | spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
109 | spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
109 |
|
110 | |||
110 | auto spacerRightBottom = new QWidget{}; |
|
111 | auto spacerRightBottom = new QWidget{}; | |
111 | spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
112 | spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
112 |
|
113 | |||
113 | rightSidePane->addWidget(spacerRightTop); |
|
114 | rightSidePane->addWidget(spacerRightTop); | |
114 | rightSidePane->addAction(openRightInspectorAction); |
|
115 | rightSidePane->addAction(openRightInspectorAction); | |
115 | rightSidePane->addWidget(spacerRightBottom); |
|
116 | rightSidePane->addWidget(spacerRightBottom); | |
116 |
|
117 | |||
117 | openLeftInspectorAction->setCheckable(true); |
|
118 | openLeftInspectorAction->setCheckable(true); | |
118 | openRightInspectorAction->setCheckable(true); |
|
119 | openRightInspectorAction->setCheckable(true); | |
119 |
|
120 | |||
120 | auto openInspector = [this](bool checked, bool right, auto action) { |
|
121 | auto openInspector = [this](bool checked, bool right, auto action) { | |
121 |
|
122 | |||
122 | action->setIcon(QIcon{(checked xor right) ? ":/icones/next.png" : ":/icones/previous.png"}); |
|
123 | action->setIcon(QIcon{(checked xor right) ? ":/icones/next.png" : ":/icones/previous.png"}); | |
123 |
|
124 | |||
124 | auto &lastInspectorSize |
|
125 | auto &lastInspectorSize | |
125 | = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize; |
|
126 | = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize; | |
126 |
|
127 | |||
127 | auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size() |
|
128 | auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size() | |
128 | : m_Ui->leftMainInspectorWidget->size(); |
|
129 | : m_Ui->leftMainInspectorWidget->size(); | |
129 |
|
130 | |||
130 | // Update of the last opened geometry |
|
131 | // Update of the last opened geometry | |
131 | if (checked) { |
|
132 | if (checked) { | |
132 | lastInspectorSize = nextInspectorSize; |
|
133 | lastInspectorSize = nextInspectorSize; | |
133 | } |
|
134 | } | |
134 |
|
135 | |||
135 | auto startSize = lastInspectorSize; |
|
136 | auto startSize = lastInspectorSize; | |
136 | auto endSize = startSize; |
|
137 | auto endSize = startSize; | |
137 | endSize.setWidth(0); |
|
138 | endSize.setWidth(0); | |
138 |
|
139 | |||
139 | auto splitterInspectorIndex |
|
140 | auto splitterInspectorIndex | |
140 | = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX; |
|
141 | = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX; | |
141 |
|
142 | |||
142 | auto currentSizes = m_Ui->splitter->sizes(); |
|
143 | auto currentSizes = m_Ui->splitter->sizes(); | |
143 | if (checked) { |
|
144 | if (checked) { | |
144 | // adjust sizes individually here, e.g. |
|
145 | // adjust sizes individually here, e.g. | |
145 | currentSizes[splitterInspectorIndex] -= lastInspectorSize.width(); |
|
146 | currentSizes[splitterInspectorIndex] -= lastInspectorSize.width(); | |
146 | currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width(); |
|
147 | currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width(); | |
147 | m_Ui->splitter->setSizes(currentSizes); |
|
148 | m_Ui->splitter->setSizes(currentSizes); | |
148 | } |
|
149 | } | |
149 | else { |
|
150 | else { | |
150 | // adjust sizes individually here, e.g. |
|
151 | // adjust sizes individually here, e.g. | |
151 | currentSizes[splitterInspectorIndex] += lastInspectorSize.width(); |
|
152 | currentSizes[splitterInspectorIndex] += lastInspectorSize.width(); | |
152 | currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width(); |
|
153 | currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width(); | |
153 | m_Ui->splitter->setSizes(currentSizes); |
|
154 | m_Ui->splitter->setSizes(currentSizes); | |
154 | } |
|
155 | } | |
155 |
|
156 | |||
156 | }; |
|
157 | }; | |
157 |
|
158 | |||
158 |
|
159 | |||
159 | connect(openLeftInspectorAction, &QAction::triggered, |
|
160 | connect(openLeftInspectorAction, &QAction::triggered, | |
160 | [openInspector, openLeftInspectorAction](bool checked) { |
|
161 | [openInspector, openLeftInspectorAction](bool checked) { | |
161 | openInspector(checked, false, openLeftInspectorAction); |
|
162 | openInspector(checked, false, openLeftInspectorAction); | |
162 | }); |
|
163 | }); | |
163 | connect(openRightInspectorAction, &QAction::triggered, |
|
164 | connect(openRightInspectorAction, &QAction::triggered, | |
164 | [openInspector, openRightInspectorAction](bool checked) { |
|
165 | [openInspector, openRightInspectorAction](bool checked) { | |
165 | openInspector(checked, true, openRightInspectorAction); |
|
166 | openInspector(checked, true, openRightInspectorAction); | |
166 | }); |
|
167 | }); | |
167 |
|
168 | |||
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 |
|
|
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>))); | |
180 |
|
189 | |||
181 | /* QLopGUI::registerMenuBar(menuBar()); |
|
190 | /* QLopGUI::registerMenuBar(menuBar()); | |
182 | this->setWindowIcon(QIcon(":/sciqlopLOGO.svg")); |
|
191 | this->setWindowIcon(QIcon(":/sciqlopLOGO.svg")); | |
183 | this->m_progressWidget = new QWidget(); |
|
192 | this->m_progressWidget = new QWidget(); | |
184 | this->m_progressLayout = new QVBoxLayout(this->m_progressWidget); |
|
193 | this->m_progressLayout = new QVBoxLayout(this->m_progressWidget); | |
185 | this->m_progressWidget->setLayout(this->m_progressLayout); |
|
194 | this->m_progressWidget->setLayout(this->m_progressLayout); | |
186 | this->m_progressWidget->setWindowModality(Qt::WindowModal); |
|
195 | this->m_progressWidget->setWindowModality(Qt::WindowModal); | |
187 | m_progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int)); |
|
196 | m_progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int)); | |
188 | for(int i=0;i<OMP_THREADS;i++) |
|
197 | for(int i=0;i<OMP_THREADS;i++) | |
189 | { |
|
198 | { | |
190 | this->m_progress.append(new QProgressBar(this->m_progressWidget)); |
|
199 | this->m_progress.append(new QProgressBar(this->m_progressWidget)); | |
191 | this->m_progress.last()->setMinimum(0); |
|
200 | this->m_progress.last()->setMinimum(0); | |
192 | this->m_progress.last()->setMaximum(100); |
|
201 | this->m_progress.last()->setMaximum(100); | |
193 | this->m_progressLayout->addWidget(this->m_progress.last()); |
|
202 | this->m_progressLayout->addWidget(this->m_progress.last()); | |
194 | this->m_progressWidget->hide(); |
|
203 | this->m_progressWidget->hide(); | |
195 | this->m_progressThreadIds[i] = -1; |
|
204 | this->m_progressThreadIds[i] = -1; | |
196 | } |
|
205 | } | |
197 | this->m_progressWidget->setWindowTitle("Loading File"); |
|
206 | this->m_progressWidget->setWindowTitle("Loading File"); | |
198 | const QList<QLopService*>ServicesToLoad=QList<QLopService*>() |
|
207 | const QList<QLopService*>ServicesToLoad=QList<QLopService*>() | |
199 | << QLopCore::self() |
|
208 | << QLopCore::self() | |
200 | << QLopPlotManager::self() |
|
209 | << QLopPlotManager::self() | |
201 | << QLopCodecManager::self() |
|
210 | << QLopCodecManager::self() | |
202 | << FileDownloader::self() |
|
211 | << FileDownloader::self() | |
203 | << QLopDataBase::self() |
|
212 | << QLopDataBase::self() | |
204 | << SpaceData::self(); |
|
213 | << SpaceData::self(); | |
205 |
|
214 | |||
206 | CDFCodec::registerToManager(); |
|
215 | CDFCodec::registerToManager(); | |
207 | AMDATXTCodec::registerToManager(); |
|
216 | AMDATXTCodec::registerToManager(); | |
208 |
|
217 | |||
209 |
|
218 | |||
210 | for(int i=0;i<ServicesToLoad.count();i++) |
|
219 | for(int i=0;i<ServicesToLoad.count();i++) | |
211 | { |
|
220 | { | |
212 | qDebug()<<ServicesToLoad.at(i)->serviceName(); |
|
221 | qDebug()<<ServicesToLoad.at(i)->serviceName(); | |
213 | ServicesToLoad.at(i)->initialize(); //must be called before getGUI |
|
222 | ServicesToLoad.at(i)->initialize(); //must be called before getGUI | |
214 | QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI(); |
|
223 | QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI(); | |
215 | if(wdgt) |
|
224 | if(wdgt) | |
216 | { |
|
225 | { | |
217 | wdgt->setAllowedAreas(Qt::AllDockWidgetAreas); |
|
226 | wdgt->setAllowedAreas(Qt::AllDockWidgetAreas); | |
218 | this->addDockWidget(Qt::TopDockWidgetArea,wdgt); |
|
227 | this->addDockWidget(Qt::TopDockWidgetArea,wdgt); | |
219 | } |
|
228 | } | |
220 | PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i)); |
|
229 | PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i)); | |
221 | }*/ |
|
230 | }*/ | |
222 | } |
|
231 | } | |
223 |
|
232 | |||
224 | MainWindow::~MainWindow() |
|
233 | MainWindow::~MainWindow() | |
225 | { |
|
234 | { | |
226 | } |
|
235 | } | |
227 |
|
236 | |||
228 |
|
237 | |||
229 | void MainWindow::changeEvent(QEvent *e) |
|
238 | void MainWindow::changeEvent(QEvent *e) | |
230 | { |
|
239 | { | |
231 | QMainWindow::changeEvent(e); |
|
240 | QMainWindow::changeEvent(e); | |
232 | switch (e->type()) { |
|
241 | switch (e->type()) { | |
233 | case QEvent::LanguageChange: |
|
242 | case QEvent::LanguageChange: | |
234 | m_Ui->retranslateUi(this); |
|
243 | m_Ui->retranslateUi(this); | |
235 | break; |
|
244 | break; | |
236 | default: |
|
245 | default: | |
237 | break; |
|
246 | break; | |
238 | } |
|
247 | } | |
239 | } |
|
248 | } |
@@ -1,21 +1,32 | |||||
1 | #ifndef SCIQLOP_TIMEWIDGET_H |
|
1 | #ifndef SCIQLOP_TIMEWIDGET_H | |
2 | #define SCIQLOP_TIMEWIDGET_H |
|
2 | #define SCIQLOP_TIMEWIDGET_H | |
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 | |
9 |
|
11 | |||
10 | class TimeWidget : public QWidget { |
|
12 | class TimeWidget : public QWidget { | |
11 | Q_OBJECT |
|
13 | Q_OBJECT | |
12 |
|
14 | |||
13 | public: |
|
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 | }; | |
20 |
|
31 | |||
21 | #endif // SCIQLOP_ SQPSIDEPANE_H |
|
32 | #endif // SCIQLOP_ SQPSIDEPANE_H |
@@ -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 4
Pull request updated. Auto status change to "Under Review"
Changed commits: * 1 added * 0 removed Changed files: * M gui/include/Visualization/VisualizationGraphWidget.h * M gui/src/Visualization/VisualizationGraphWidget.cpp
Status change > Approved
You need to be logged in to leave comments.
Login now