##// END OF EJS Templates
Merge branch 'feature/timeWidgetAndSidePane' into develop
perrinel -
r128:a642436e9414 merge
parent child
Show More
@@ -0,0 +1,23
1 #ifndef SCIQLOP_TIMEWIDGET_H
2 #define SCIQLOP_TIMEWIDGET_H
3
4 #include <QWidget>
5
6 namespace Ui {
7 class TimeWidget;
8 } // Ui
9
10 class TimeWidget;
11
12 class TimeWidget : public QWidget {
13 Q_OBJECT
14
15 public:
16 explicit TimeWidget(QWidget *parent = 0);
17 virtual ~TimeWidget();
18
19 private:
20 Ui::TimeWidget *ui;
21 };
22
23 #endif // SCIQLOP_ SQPSIDEPANE_H
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,12
1 #include "TimeWidget/TimeWidget.h"
2 #include "ui_TimeWidget.h"
3
4 TimeWidget::TimeWidget(QWidget *parent) : QWidget{parent}, ui{new Ui::TimeWidget}
5 {
6 ui->setupUi(this);
7 }
8
9 TimeWidget::~TimeWidget()
10 {
11 delete ui;
12 }
@@ -0,0 +1,85
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
3 <class>TimeWidget</class>
4 <widget class="QWidget" name="TimeWidget">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>716</width>
10 <height>48</height>
11 </rect>
12 </property>
13 <property name="sizePolicy">
14 <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
15 <horstretch>0</horstretch>
16 <verstretch>0</verstretch>
17 </sizepolicy>
18 </property>
19 <property name="windowTitle">
20 <string>Form</string>
21 </property>
22 <layout class="QHBoxLayout" name="horizontalLayout_2">
23 <item>
24 <widget class="QLabel" name="label">
25 <property name="sizePolicy">
26 <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
27 <horstretch>0</horstretch>
28 <verstretch>0</verstretch>
29 </sizepolicy>
30 </property>
31 <property name="text">
32 <string>TStart :</string>
33 </property>
34 </widget>
35 </item>
36 <item>
37 <widget class="QDateTimeEdit" name="startDateTimeEdit">
38 <property name="sizePolicy">
39 <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
40 <horstretch>0</horstretch>
41 <verstretch>0</verstretch>
42 </sizepolicy>
43 </property>
44 <property name="displayFormat">
45 <string>dd/MM/yyyy HH:mm:ss:zzz</string>
46 </property>
47 <property name="calendarPopup">
48 <bool>true</bool>
49 </property>
50 </widget>
51 </item>
52 <item>
53 <widget class="QLabel" name="label_2">
54 <property name="sizePolicy">
55 <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
56 <horstretch>0</horstretch>
57 <verstretch>0</verstretch>
58 </sizepolicy>
59 </property>
60 <property name="text">
61 <string>TEnd :</string>
62 </property>
63 </widget>
64 </item>
65 <item>
66 <widget class="QDateTimeEdit" name="endDateTimeEdit">
67 <property name="sizePolicy">
68 <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
69 <horstretch>0</horstretch>
70 <verstretch>0</verstretch>
71 </sizepolicy>
72 </property>
73 <property name="displayFormat">
74 <string>dd/MM/yyyy HH:mm:ss:zzz</string>
75 </property>
76 <property name="calendarPopup">
77 <bool>true</bool>
78 </property>
79 </widget>
80 </item>
81 </layout>
82 </widget>
83 <resources/>
84 <connections/>
85 </ui>
@@ -1,224 +1,276
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 <TimeWidget/TimeWidget.h>
29
30
30 #include <QAction>
31 #include <QAction>
31 #include <QDate>
32 #include <QDate>
32 #include <QDateTime>
33 #include <QDateTime>
33 #include <QDir>
34 #include <QDir>
34 #include <QFileDialog>
35 #include <QFileDialog>
35 #include <QToolBar>
36 #include <QToolBar>
36 #include <memory.h>
37 #include <memory.h>
37
38
38 //#include <omp.h>
39 //#include <omp.h>
39 //#include <network/filedownloader.h>
40 //#include <network/filedownloader.h>
40 //#include <qlopdatabase.h>
41 //#include <qlopdatabase.h>
41 //#include <qlopsettings.h>
42 //#include <qlopsettings.h>
42 //#include <qlopgui.h>
43 //#include <qlopgui.h>
43 //#include <spacedata.h>
44 //#include <spacedata.h>
44 //#include "qlopcore.h"
45 //#include "qlopcore.h"
45 //#include "qlopcodecmanager.h"
46 //#include "qlopcodecmanager.h"
46 //#include "cdfcodec.h"
47 //#include "cdfcodec.h"
47 //#include "amdatxtcodec.h"
48 //#include "amdatxtcodec.h"
48 //#include <qlopplotmanager.h>
49 //#include <qlopplotmanager.h>
49
50
50 #include "iostream"
51 #include "iostream"
51
52
52 Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow")
53 Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow")
53
54
54 namespace {
55 namespace {
55 const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0;
56 const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0;
56 const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1;
57 const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1;
57 const auto VIEWPLITTERINDEX = 2;
58 const auto VIEWPLITTERINDEX = 2;
58 const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3;
59 const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3;
59 const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4;
60 const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4;
60 }
61 }
61
62
62 class MainWindow::MainWindowPrivate {
63 class MainWindow::MainWindowPrivate {
63 public:
64 public:
64 QSize m_LastOpenLeftInspectorSize;
65 QSize m_LastOpenLeftInspectorSize;
65 QSize m_LastOpenRightInspectorSize;
66 QSize m_LastOpenRightInspectorSize;
66 };
67 };
67
68
68 MainWindow::MainWindow(QWidget *parent)
69 MainWindow::MainWindow(QWidget *parent)
69 : QMainWindow{parent},
70 : QMainWindow{parent},
70 m_Ui{new Ui::MainWindow},
71 m_Ui{new Ui::MainWindow},
71 impl{spimpl::make_unique_impl<MainWindowPrivate>()}
72 impl{spimpl::make_unique_impl<MainWindowPrivate>()}
72 {
73 {
73 m_Ui->setupUi(this);
74 m_Ui->setupUi(this);
74
75
75 m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false);
76 m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false);
76 m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false);
77 m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false);
77
78
79
80 auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane();
81 auto openLeftInspectorAction = new QAction(
82 QIcon{
83 ":/icones/previous.png",
84 },
85 tr("Show/hide the left inspector"), this);
86
87
88 QWidget *spacerLeftTop = new QWidget();
89 spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
90
91 QWidget *spacerLeftBottom = new QWidget();
92 spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
93
94 leftSidePane->addWidget(spacerLeftTop);
95 leftSidePane->addAction(openLeftInspectorAction);
96 leftSidePane->addWidget(spacerLeftBottom);
97
98
99 auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane();
100 auto openRightInspectorAction = new QAction(
101 QIcon{
102 ":/icones/next.png",
103 },
104 tr("Show/hide the right inspector"), this);
105
106 QWidget *spacerRightTop = new QWidget();
107 spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
108
109 QWidget *spacerRightBottom = new QWidget();
110 spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
111
112 rightSidePane->addWidget(spacerRightTop);
113 rightSidePane->addAction(openRightInspectorAction);
114 rightSidePane->addWidget(spacerRightBottom);
115
116 openLeftInspectorAction->setCheckable(true);
117 openRightInspectorAction->setCheckable(true);
118
119
78 // NOTE: These lambda could be factorized. Be careful of theirs parameters
120 // NOTE: These lambda could be factorized. Be careful of theirs parameters
79 // Lambda that defines what's happened when clicking on the leftSidePaneInspector open button
121 // Lambda that defines what's happened when clicking on the leftSidePaneInspector open button
80 auto openLeftInspector = [this](bool checked) {
122 auto openLeftInspector = [this, openLeftInspectorAction](bool checked) {
123
124 if (checked) {
125 openLeftInspectorAction->setIcon(QIcon{
126 ":/icones/next.png",
127 });
128 }
129 else {
130 openLeftInspectorAction->setIcon(QIcon{
131 ":/icones/previous.png",
132 });
133 }
81
134
82 // Update of the last opened geometry
135 // Update of the last opened geometry
83 if (checked) {
136 if (checked) {
84 impl->m_LastOpenLeftInspectorSize = m_Ui->leftMainInspectorWidget->size();
137 impl->m_LastOpenLeftInspectorSize = m_Ui->leftMainInspectorWidget->size();
85 }
138 }
86
139
87 auto startSize = impl->m_LastOpenLeftInspectorSize;
140 auto startSize = impl->m_LastOpenLeftInspectorSize;
88 auto endSize = startSize;
141 auto endSize = startSize;
89 endSize.setWidth(0);
142 endSize.setWidth(0);
90
143
91 auto currentSizes = m_Ui->splitter->sizes();
144 auto currentSizes = m_Ui->splitter->sizes();
92 if (checked) {
145 if (checked) {
93 // adjust sizes individually here, e.g.
146 // adjust sizes individually here, e.g.
94 currentSizes[LEFTMAININSPECTORWIDGETSPLITTERINDEX]
147 currentSizes[LEFTMAININSPECTORWIDGETSPLITTERINDEX]
95 -= impl->m_LastOpenLeftInspectorSize.width();
148 -= impl->m_LastOpenLeftInspectorSize.width();
96 currentSizes[VIEWPLITTERINDEX] += impl->m_LastOpenLeftInspectorSize.width();
149 currentSizes[VIEWPLITTERINDEX] += impl->m_LastOpenLeftInspectorSize.width();
97 m_Ui->splitter->setSizes(currentSizes);
150 m_Ui->splitter->setSizes(currentSizes);
98 }
151 }
99 else {
152 else {
100 // adjust sizes individually here, e.g.
153 // adjust sizes individually here, e.g.
101 currentSizes[LEFTMAININSPECTORWIDGETSPLITTERINDEX]
154 currentSizes[LEFTMAININSPECTORWIDGETSPLITTERINDEX]
102 += impl->m_LastOpenLeftInspectorSize.width();
155 += impl->m_LastOpenLeftInspectorSize.width();
103 currentSizes[VIEWPLITTERINDEX] -= impl->m_LastOpenLeftInspectorSize.width();
156 currentSizes[VIEWPLITTERINDEX] -= impl->m_LastOpenLeftInspectorSize.width();
104 m_Ui->splitter->setSizes(currentSizes);
157 m_Ui->splitter->setSizes(currentSizes);
105 }
158 }
106
159
107 };
160 };
108
161
109 // Lambda that defines what's happened when clicking on the SidePaneInspector open button
162 // Lambda that defines what's happened when clicking on the SidePaneInspector open button
110 auto openRightInspector = [this](bool checked) {
163 auto openRightInspector = [this, openRightInspectorAction](bool checked) {
164
165 if (checked) {
166 openRightInspectorAction->setIcon(QIcon{
167 ":/icones/previous.png",
168 });
169 }
170 else {
171 openRightInspectorAction->setIcon(QIcon{
172 ":/icones/next.png",
173 });
174 }
175
111
176
112 // Update of the last opened geometry
177 // Update of the last opened geometry
113 if (checked) {
178 if (checked) {
114 impl->m_LastOpenRightInspectorSize = m_Ui->rightMainInspectorWidget->size();
179 impl->m_LastOpenRightInspectorSize = m_Ui->rightMainInspectorWidget->size();
115 }
180 }
116
181
117 auto startSize = impl->m_LastOpenRightInspectorSize;
182 auto startSize = impl->m_LastOpenRightInspectorSize;
118 auto endSize = startSize;
183 auto endSize = startSize;
119 endSize.setWidth(0);
184 endSize.setWidth(0);
120
185
121 auto currentSizes = m_Ui->splitter->sizes();
186 auto currentSizes = m_Ui->splitter->sizes();
122 if (checked) {
187 if (checked) {
123 // adjust sizes individually here, e.g.
188 // adjust sizes individually here, e.g.
124 currentSizes[RIGHTMAININSPECTORWIDGETSPLITTERINDEX]
189 currentSizes[RIGHTMAININSPECTORWIDGETSPLITTERINDEX]
125 -= impl->m_LastOpenRightInspectorSize.width();
190 -= impl->m_LastOpenRightInspectorSize.width();
126 currentSizes[VIEWPLITTERINDEX] += impl->m_LastOpenRightInspectorSize.width();
191 currentSizes[VIEWPLITTERINDEX] += impl->m_LastOpenRightInspectorSize.width();
127 m_Ui->splitter->setSizes(currentSizes);
192 m_Ui->splitter->setSizes(currentSizes);
128 }
193 }
129 else {
194 else {
130 // adjust sizes individually here, e.g.
195 // adjust sizes individually here, e.g.
131 currentSizes[RIGHTMAININSPECTORWIDGETSPLITTERINDEX]
196 currentSizes[RIGHTMAININSPECTORWIDGETSPLITTERINDEX]
132 += impl->m_LastOpenRightInspectorSize.width();
197 += impl->m_LastOpenRightInspectorSize.width();
133 currentSizes[VIEWPLITTERINDEX] -= impl->m_LastOpenRightInspectorSize.width();
198 currentSizes[VIEWPLITTERINDEX] -= impl->m_LastOpenRightInspectorSize.width();
134 m_Ui->splitter->setSizes(currentSizes);
199 m_Ui->splitter->setSizes(currentSizes);
135 }
200 }
136
201
137 };
202 };
138
203
139
204
140 QToolBar *leftSidePane = m_Ui->leftInspectorSidePane->sidePane();
205 connect(openLeftInspectorAction, &QAction::triggered, openLeftInspector);
141 auto openLeftInspectorAction = leftSidePane->addAction(
206 connect(openRightInspectorAction, &QAction::triggered, openRightInspector);
142 QIcon{
143 ":/icones/openInspector.png",
144 },
145 tr("Show/hide the left inspector"), openLeftInspector);
146
147 openLeftInspectorAction->setCheckable(true);
148
149 auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane();
150 auto openRightInspectorAction = rightSidePane->addAction(
151 QIcon{
152 ":/icones/openInspector.png",
153 },
154 tr("Show/hide the right inspector"), openRightInspector);
155
207
156 openRightInspectorAction->setCheckable(true);
157
208
158 this->menuBar()->addAction(tr("File"));
209 this->menuBar()->addAction(tr("File"));
159 auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar"));
210 auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar"));
160 mainToolBar->addAction(QStringLiteral("A1"));
211
212 mainToolBar->addWidget(new TimeWidget());
161
213
162 // Widgets / controllers connections
214 // Widgets / controllers connections
163 connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)),
215 connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)),
164 m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *)));
216 m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *)));
165
217
166 /* QLopGUI::registerMenuBar(menuBar());
218 /* QLopGUI::registerMenuBar(menuBar());
167 this->setWindowIcon(QIcon(":/sciqlopLOGO.svg"));
219 this->setWindowIcon(QIcon(":/sciqlopLOGO.svg"));
168 this->m_progressWidget = new QWidget();
220 this->m_progressWidget = new QWidget();
169 this->m_progressLayout = new QVBoxLayout(this->m_progressWidget);
221 this->m_progressLayout = new QVBoxLayout(this->m_progressWidget);
170 this->m_progressWidget->setLayout(this->m_progressLayout);
222 this->m_progressWidget->setLayout(this->m_progressLayout);
171 this->m_progressWidget->setWindowModality(Qt::WindowModal);
223 this->m_progressWidget->setWindowModality(Qt::WindowModal);
172 m_progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int));
224 m_progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int));
173 for(int i=0;i<OMP_THREADS;i++)
225 for(int i=0;i<OMP_THREADS;i++)
174 {
226 {
175 this->m_progress.append(new QProgressBar(this->m_progressWidget));
227 this->m_progress.append(new QProgressBar(this->m_progressWidget));
176 this->m_progress.last()->setMinimum(0);
228 this->m_progress.last()->setMinimum(0);
177 this->m_progress.last()->setMaximum(100);
229 this->m_progress.last()->setMaximum(100);
178 this->m_progressLayout->addWidget(this->m_progress.last());
230 this->m_progressLayout->addWidget(this->m_progress.last());
179 this->m_progressWidget->hide();
231 this->m_progressWidget->hide();
180 this->m_progressThreadIds[i] = -1;
232 this->m_progressThreadIds[i] = -1;
181 }
233 }
182 this->m_progressWidget->setWindowTitle("Loading File");
234 this->m_progressWidget->setWindowTitle("Loading File");
183 const QList<QLopService*>ServicesToLoad=QList<QLopService*>()
235 const QList<QLopService*>ServicesToLoad=QList<QLopService*>()
184 << QLopCore::self()
236 << QLopCore::self()
185 << QLopPlotManager::self()
237 << QLopPlotManager::self()
186 << QLopCodecManager::self()
238 << QLopCodecManager::self()
187 << FileDownloader::self()
239 << FileDownloader::self()
188 << QLopDataBase::self()
240 << QLopDataBase::self()
189 << SpaceData::self();
241 << SpaceData::self();
190
242
191 CDFCodec::registerToManager();
243 CDFCodec::registerToManager();
192 AMDATXTCodec::registerToManager();
244 AMDATXTCodec::registerToManager();
193
245
194
246
195 for(int i=0;i<ServicesToLoad.count();i++)
247 for(int i=0;i<ServicesToLoad.count();i++)
196 {
248 {
197 qDebug()<<ServicesToLoad.at(i)->serviceName();
249 qDebug()<<ServicesToLoad.at(i)->serviceName();
198 ServicesToLoad.at(i)->initialize(); //must be called before getGUI
250 ServicesToLoad.at(i)->initialize(); //must be called before getGUI
199 QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI();
251 QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI();
200 if(wdgt)
252 if(wdgt)
201 {
253 {
202 wdgt->setAllowedAreas(Qt::AllDockWidgetAreas);
254 wdgt->setAllowedAreas(Qt::AllDockWidgetAreas);
203 this->addDockWidget(Qt::TopDockWidgetArea,wdgt);
255 this->addDockWidget(Qt::TopDockWidgetArea,wdgt);
204 }
256 }
205 PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i));
257 PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i));
206 }*/
258 }*/
207 }
259 }
208
260
209 MainWindow::~MainWindow()
261 MainWindow::~MainWindow()
210 {
262 {
211 }
263 }
212
264
213
265
214 void MainWindow::changeEvent(QEvent *e)
266 void MainWindow::changeEvent(QEvent *e)
215 {
267 {
216 QMainWindow::changeEvent(e);
268 QMainWindow::changeEvent(e);
217 switch (e->type()) {
269 switch (e->type()) {
218 case QEvent::LanguageChange:
270 case QEvent::LanguageChange:
219 m_Ui->retranslateUi(this);
271 m_Ui->retranslateUi(this);
220 break;
272 break;
221 default:
273 default:
222 break;
274 break;
223 }
275 }
224 }
276 }
@@ -1,53 +1,53
1 #include <Variable/VariableController.h>
1 #include <Variable/VariableController.h>
2 #include <Variable/VariableModel.h>
2 #include <Variable/VariableModel.h>
3
3
4 #include <QMutex>
4 #include <QMutex>
5 #include <QThread>
5 #include <QThread>
6
6
7 Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController")
7 Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController")
8
8
9 struct VariableController::VariableControllerPrivate {
9 struct VariableController::VariableControllerPrivate {
10 explicit VariableControllerPrivate()
10 explicit VariableControllerPrivate()
11 : m_WorkingMutex{}, m_VariableModel{std::make_unique<VariableModel>()}
11 : m_WorkingMutex{}, m_VariableModel{std::make_unique<VariableModel>()}
12 {
12 {
13 }
13 }
14
14
15 QMutex m_WorkingMutex;
15 QMutex m_WorkingMutex;
16 std::unique_ptr<VariableModel> m_VariableModel;
16 std::unique_ptr<VariableModel> m_VariableModel;
17 };
17 };
18
18
19 VariableController::VariableController(QObject *parent)
19 VariableController::VariableController(QObject *parent)
20 : QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>()}
20 : QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>()}
21 {
21 {
22 qCDebug(LOG_VariableController())
22 qCDebug(LOG_VariableController()) << tr("VariableController construction")
23 << tr("VariableController construction") << QThread::currentThread();
23 << QThread::currentThread();
24 }
24 }
25
25
26 VariableController::~VariableController()
26 VariableController::~VariableController()
27 {
27 {
28 qCDebug(LOG_VariableController())
28 qCDebug(LOG_VariableController()) << tr("VariableController destruction")
29 << tr("VariableController destruction") << QThread::currentThread();
29 << QThread::currentThread();
30 this->waitForFinish();
30 this->waitForFinish();
31 }
31 }
32
32
33 Variable *VariableController::createVariable(const QString &name) noexcept
33 Variable *VariableController::createVariable(const QString &name) noexcept
34 {
34 {
35 return impl->m_VariableModel->createVariable(name);
35 return impl->m_VariableModel->createVariable(name);
36 }
36 }
37
37
38 void VariableController::initialize()
38 void VariableController::initialize()
39 {
39 {
40 qCDebug(LOG_VariableController()) << tr("VariableController init") << QThread::currentThread();
40 qCDebug(LOG_VariableController()) << tr("VariableController init") << QThread::currentThread();
41 impl->m_WorkingMutex.lock();
41 impl->m_WorkingMutex.lock();
42 qCDebug(LOG_VariableController()) << tr("VariableController init END");
42 qCDebug(LOG_VariableController()) << tr("VariableController init END");
43 }
43 }
44
44
45 void VariableController::finalize()
45 void VariableController::finalize()
46 {
46 {
47 impl->m_WorkingMutex.unlock();
47 impl->m_WorkingMutex.unlock();
48 }
48 }
49
49
50 void VariableController::waitForFinish()
50 void VariableController::waitForFinish()
51 {
51 {
52 QMutexLocker locker{&impl->m_WorkingMutex};
52 QMutexLocker locker{&impl->m_WorkingMutex};
53 }
53 }
@@ -1,5 +1,7
1 <RCC>
1 <RCC>
2 <qresource prefix="/">
2 <qresource prefix="/">
3 <file>icones/openInspector.png</file>
3 <file>icones/openInspector.png</file>
4 <file>icones/next.png</file>
5 <file>icones/previous.png</file>
4 </qresource>
6 </qresource>
5 </RCC>
7 </RCC>
@@ -1,54 +1,47
1 #include "SidePane/SqpSidePane.h"
1 #include "SidePane/SqpSidePane.h"
2 #include "ui_SqpSidePane.h"
2 #include "ui_SqpSidePane.h"
3
3
4 #include <QAction>
4 #include <QAction>
5 #include <QLayout>
5 #include <QLayout>
6 #include <QToolBar>
6 #include <QToolBar>
7
7
8 namespace {
8 namespace {
9 static const QString SQPSIDEPANESTYLESHEET
9 static const QString SQPSIDEPANESTYLESHEET
10 = "QToolBar {"
10 = "QToolBar {"
11 " background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0,"
11 " background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0,"
12 " stop: 0.0 #5a5a5a,"
12 " stop: 0.0 #5a5a5a,"
13 " stop: 1.0 #414141);"
13 " stop: 1.0 #414141);"
14 " border: none;"
14 " border: none;"
15 " border-left: 1px solid #424242;"
15 " border-left: 1px solid #424242;"
16 "border-right: 1px solid #393939;"
16 "border-right: 1px solid #393939;"
17 " }"
17 " }"
18
18
19 " QToolButton {"
19 " QToolButton {"
20 "background: none;"
20 "background: none;"
21 "border: none;"
21 "border: none;"
22 " }";
22 " }";
23 }
23 }
24
24
25 SqpSidePane::SqpSidePane(QWidget *parent) : QWidget{parent}, ui{new Ui::SqpSidePane}
25 SqpSidePane::SqpSidePane(QWidget *parent) : QWidget{parent}, ui{new Ui::SqpSidePane}
26 {
26 {
27 // QVBoxLayout *sidePaneLayout = new QVBoxLayout(this);
27 // QVBoxLayout *sidePaneLayout = new QVBoxLayout(this);
28 // sidePaneLayout->setContentsMargins(0, 0, 0, 0);
28 // sidePaneLayout->setContentsMargins(0, 0, 0, 0);
29 // this->setLayout(sidePaneLayout);
29 // this->setLayout(sidePaneLayout);
30
30
31 ui->setupUi(this);
31 ui->setupUi(this);
32 m_SidePaneToolbar = new QToolBar();
32 m_SidePaneToolbar = new QToolBar();
33 m_SidePaneToolbar->setOrientation(Qt::Vertical);
33 m_SidePaneToolbar->setOrientation(Qt::Vertical);
34 this->layout()->addWidget(m_SidePaneToolbar);
34 this->layout()->addWidget(m_SidePaneToolbar);
35
35
36 m_SidePaneToolbar->setStyleSheet(SQPSIDEPANESTYLESHEET);
36 m_SidePaneToolbar->setStyleSheet(SQPSIDEPANESTYLESHEET);
37
38 this->setStyleSheet(
39 " QWidget {"
40 "background: red;"
41
42 "border: 1px;"
43 " }");
44 }
37 }
45
38
46 SqpSidePane::~SqpSidePane()
39 SqpSidePane::~SqpSidePane()
47 {
40 {
48 delete ui;
41 delete ui;
49 }
42 }
50
43
51 QToolBar *SqpSidePane::sidePane()
44 QToolBar *SqpSidePane::sidePane()
52 {
45 {
53 return m_SidePaneToolbar;
46 return m_SidePaneToolbar;
54 }
47 }
1 NO CONTENT: file renamed from gui/ui/Sidepane/SqpSidePane.ui to gui/ui/SidePane/SqpSidePane.ui
NO CONTENT: file renamed from gui/ui/Sidepane/SqpSidePane.ui to gui/ui/SidePane/SqpSidePane.ui
@@ -1,28 +1,30
1 #include "CosinusProvider.h"
1 #include "CosinusProvider.h"
2
2
3 #include <Data/DataProviderParameters.h>
3 #include <Data/DataProviderParameters.h>
4 #include <Data/ScalarSeries.h>
4 #include <Data/ScalarSeries.h>
5
5
6 #include <cmath>
7
6 std::unique_ptr<IDataSeries>
8 std::unique_ptr<IDataSeries>
7 CosinusProvider::retrieveData(const DataProviderParameters &parameters) const
9 CosinusProvider::retrieveData(const DataProviderParameters &parameters) const
8 {
10 {
9 // Gets the timerange from the parameters
11 // Gets the timerange from the parameters
10 auto start = parameters.m_TStart;
12 auto start = parameters.m_TStart;
11 auto end = parameters.m_TEnd;
13 auto end = parameters.m_TEnd;
12
14
13 // We assure that timerange is valid
15 // We assure that timerange is valid
14 if (end < start) {
16 if (end < start) {
15 std::swap(start, end);
17 std::swap(start, end);
16 }
18 }
17
19
18 // Generates scalar series containing cosinus values (one value per second)
20 // Generates scalar series containing cosinus values (one value per second)
19 auto scalarSeries
21 auto scalarSeries
20 = std::make_unique<ScalarSeries>(end - start, QStringLiteral("t"), QStringLiteral(""));
22 = std::make_unique<ScalarSeries>(end - start, QStringLiteral("t"), QStringLiteral(""));
21
23
22 for (auto time = start; time < end; ++time) {
24 for (auto time = start; time < end; ++time) {
23 auto dataIndex = time - start;
25 auto dataIndex = time - start;
24 scalarSeries->setData(dataIndex, time, std::cos(time));
26 scalarSeries->setData(dataIndex, time, std::cos(time));
25 }
27 }
26
28
27 return scalarSeries;
29 return scalarSeries;
28 }
30 }
General Comments 0
You need to be logged in to leave comments. Login now