@@ -0,0 +1,12 | |||
|
1 | #ifndef SCIQLOP_COREGLOBAL_H | |
|
2 | #define SCIQLOP_COREGLOBAL_H | |
|
3 | ||
|
4 | #include <QtCore/QtGlobal> | |
|
5 | ||
|
6 | #ifdef CORE_LIB | |
|
7 | #define SCIQLOP_CORE_EXPORT Q_DECL_EXPORT | |
|
8 | #else | |
|
9 | #define SCIQLOP_CORE_EXPORT Q_DECL_IMPORT | |
|
10 | #endif | |
|
11 | ||
|
12 | #endif // SCIQLOP_COREGLOBAL_H |
@@ -0,0 +1,21 | |||
|
1 | #ifndef SCIQLOP_ISQPSETTINGSBINDABLE_H | |
|
2 | #define SCIQLOP_ISQPSETTINGSBINDABLE_H | |
|
3 | ||
|
4 | #include <QSettings> | |
|
5 | ||
|
6 | /** | |
|
7 | * @brief The ISqpSettingsBindable interface represents an object that can bind a variable | |
|
8 | */ | |
|
9 | class ISqpSettingsBindable { | |
|
10 | ||
|
11 | public: | |
|
12 | virtual ~ISqpSettingsBindable() = default; | |
|
13 | ||
|
14 | /// Loads settings into the object | |
|
15 | virtual void loadSettings() = 0; | |
|
16 | ||
|
17 | /// Saves settings from the object | |
|
18 | virtual void saveSettings() const = 0; | |
|
19 | }; | |
|
20 | ||
|
21 | #endif // SCIQLOP_ISQPSETTINGSBINDABLE_H |
@@ -0,0 +1,18 | |||
|
1 | #ifndef SCIQLOP_SQPSETTINGSDEFS_H | |
|
2 | #define SCIQLOP_SQPSETTINGSDEFS_H | |
|
3 | ||
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
6 | #include <QString> | |
|
7 | ||
|
8 | // //////////////// // | |
|
9 | // General settings // | |
|
10 | // //////////////// // | |
|
11 | ||
|
12 | extern SCIQLOP_CORE_EXPORT const QString GENERAL_TOLERANCE_AT_INIT_KEY; | |
|
13 | extern SCIQLOP_CORE_EXPORT const double GENERAL_TOLERANCE_AT_INIT_DEFAULT_VALUE; | |
|
14 | ||
|
15 | extern SCIQLOP_CORE_EXPORT const QString GENERAL_TOLERANCE_AT_UPDATE_KEY; | |
|
16 | extern SCIQLOP_CORE_EXPORT const double GENERAL_TOLERANCE_AT_UPDATE_DEFAULT_VALUE; | |
|
17 | ||
|
18 | #endif // SCIQLOP_SQPSETTINGSDEFS_H |
@@ -0,0 +1,7 | |||
|
1 | #include "Settings/SqpSettingsDefs.h" | |
|
2 | ||
|
3 | const QString GENERAL_TOLERANCE_AT_INIT_KEY = QStringLiteral("toleranceInit"); | |
|
4 | const double GENERAL_TOLERANCE_AT_INIT_DEFAULT_VALUE = 0.2; | |
|
5 | ||
|
6 | const QString GENERAL_TOLERANCE_AT_UPDATE_KEY = QStringLiteral("toleranceUpdate"); | |
|
7 | const double GENERAL_TOLERANCE_AT_UPDATE_DEFAULT_VALUE = 0.2; |
@@ -0,0 +1,40 | |||
|
1 | #ifndef SCIQLOP_SQPSETTINGSDIALOG_H | |
|
2 | #define SCIQLOP_SQPSETTINGSDIALOG_H | |
|
3 | ||
|
4 | #include "Settings/ISqpSettingsBindable.h" | |
|
5 | ||
|
6 | #include <QDialog> | |
|
7 | ||
|
8 | namespace Ui { | |
|
9 | class SqpSettingsDialog; | |
|
10 | } // Ui | |
|
11 | ||
|
12 | /** | |
|
13 | * @brief The SqpSettingsDialog class represents the dialog in which the parameters of SciQlop are | |
|
14 | * set | |
|
15 | */ | |
|
16 | class SqpSettingsDialog : public QDialog, public ISqpSettingsBindable { | |
|
17 | Q_OBJECT | |
|
18 | ||
|
19 | public: | |
|
20 | explicit SqpSettingsDialog(QWidget *parent = 0); | |
|
21 | virtual ~SqpSettingsDialog() noexcept; | |
|
22 | ||
|
23 | /// @sa ISqpSettingsBindable::loadSettings() | |
|
24 | void loadSettings() override final; | |
|
25 | ||
|
26 | /// @sa ISqpSettingsBindable::saveSettings() | |
|
27 | void saveSettings() const override final; | |
|
28 | ||
|
29 | /** | |
|
30 | * Registers a widget into the dialog | |
|
31 | * @param name the name under which the widget will appear in the dialog | |
|
32 | * @param widget the widget to register | |
|
33 | */ | |
|
34 | void registerWidget(const QString &name, QWidget *widget) noexcept; | |
|
35 | ||
|
36 | private: | |
|
37 | Ui::SqpSettingsDialog *ui; | |
|
38 | }; | |
|
39 | ||
|
40 | #endif // SCIQLOP_SQPSETTINGSDIALOG_H |
@@ -0,0 +1,32 | |||
|
1 | #ifndef SCIQLOP_SQPSETTINGSGENERALWIDGET_H | |
|
2 | #define SCIQLOP_SQPSETTINGSGENERALWIDGET_H | |
|
3 | ||
|
4 | #include "Settings/ISqpSettingsBindable.h" | |
|
5 | ||
|
6 | #include <QWidget> | |
|
7 | ||
|
8 | namespace Ui { | |
|
9 | class SqpSettingsGeneralWidget; | |
|
10 | } // Ui | |
|
11 | ||
|
12 | /** | |
|
13 | * @brief The SqpSettingsGeneralWidget class represents the general settings of SciQlop | |
|
14 | */ | |
|
15 | class SqpSettingsGeneralWidget : public QWidget, public ISqpSettingsBindable { | |
|
16 | Q_OBJECT | |
|
17 | ||
|
18 | public: | |
|
19 | explicit SqpSettingsGeneralWidget(QWidget *parent = 0); | |
|
20 | virtual ~SqpSettingsGeneralWidget() noexcept; | |
|
21 | ||
|
22 | /// @sa ISqpSettingsBindable::loadSettings() | |
|
23 | void loadSettings() override final; | |
|
24 | ||
|
25 | /// @sa ISqpSettingsBindable::saveSettings() | |
|
26 | void saveSettings() const override final; | |
|
27 | ||
|
28 | private: | |
|
29 | Ui::SqpSettingsGeneralWidget *ui; | |
|
30 | }; | |
|
31 | ||
|
32 | #endif // SCIQLOP_SQPSETTINGSGENERALWIDGET_H |
@@ -0,0 +1,66 | |||
|
1 | #include "Settings/SqpSettingsDialog.h" | |
|
2 | #include "ui_SqpSettingsDialog.h" | |
|
3 | ||
|
4 | namespace { | |
|
5 | ||
|
6 | /** | |
|
7 | * Performs a bind operation on widgets that can be binded to SciQlop settings | |
|
8 | * @param widgets | |
|
9 | * @param bind the bind operation | |
|
10 | * @sa ISqpSettingsBindable | |
|
11 | */ | |
|
12 | template <typename BindMethod> | |
|
13 | void processBind(const QStackedWidget &widgets, BindMethod bind) | |
|
14 | { | |
|
15 | auto count = widgets.count(); | |
|
16 | for (auto i = 0; i < count; ++i) { | |
|
17 | // Performs operation if widget is an ISqpSettingsBindable | |
|
18 | if (auto sqpSettingsWidget = dynamic_cast<ISqpSettingsBindable *>(widgets.widget(i))) { | |
|
19 | bind(*sqpSettingsWidget); | |
|
20 | } | |
|
21 | } | |
|
22 | } | |
|
23 | ||
|
24 | } // namespace | |
|
25 | ||
|
26 | SqpSettingsDialog::SqpSettingsDialog(QWidget *parent) | |
|
27 | : QDialog{parent}, ui{new Ui::SqpSettingsDialog} | |
|
28 | { | |
|
29 | ui->setupUi(this); | |
|
30 | ||
|
31 | // Connection to change the current page to the selection of an entry in the list | |
|
32 | connect(ui->listWidget, &QListWidget::currentRowChanged, ui->stackedWidget, | |
|
33 | &QStackedWidget::setCurrentIndex); | |
|
34 | } | |
|
35 | ||
|
36 | SqpSettingsDialog::~SqpSettingsDialog() noexcept | |
|
37 | { | |
|
38 | delete ui; | |
|
39 | } | |
|
40 | ||
|
41 | void SqpSettingsDialog::loadSettings() | |
|
42 | { | |
|
43 | // Performs load on all widgets that can be binded to SciQlop settings | |
|
44 | processBind(*ui->stackedWidget, | |
|
45 | [](ISqpSettingsBindable &bindable) { bindable.loadSettings(); }); | |
|
46 | } | |
|
47 | ||
|
48 | void SqpSettingsDialog::saveSettings() const | |
|
49 | { | |
|
50 | // Performs save on all widgets that can be binded to SciQlop settings | |
|
51 | processBind(*ui->stackedWidget, | |
|
52 | [](ISqpSettingsBindable &bindable) { bindable.saveSettings(); }); | |
|
53 | } | |
|
54 | ||
|
55 | void SqpSettingsDialog::registerWidget(const QString &name, QWidget *widget) noexcept | |
|
56 | { | |
|
57 | auto newItem = new QListWidgetItem{ui->listWidget}; | |
|
58 | newItem->setText(name); | |
|
59 | ||
|
60 | ui->stackedWidget->addWidget(widget); | |
|
61 | ||
|
62 | // Selects widget if it's the first in the dialog | |
|
63 | if (ui->listWidget->count() == 1) { | |
|
64 | ui->listWidget->setCurrentItem(newItem); | |
|
65 | } | |
|
66 | } |
@@ -0,0 +1,45 | |||
|
1 | #include "Settings/SqpSettingsGeneralWidget.h" | |
|
2 | ||
|
3 | #include "Settings/SqpSettingsDefs.h" | |
|
4 | ||
|
5 | #include "ui_SqpSettingsGeneralWidget.h" | |
|
6 | ||
|
7 | SqpSettingsGeneralWidget::SqpSettingsGeneralWidget(QWidget *parent) | |
|
8 | : QWidget{parent}, ui{new Ui::SqpSettingsGeneralWidget} | |
|
9 | { | |
|
10 | ui->setupUi(this); | |
|
11 | } | |
|
12 | ||
|
13 | SqpSettingsGeneralWidget::~SqpSettingsGeneralWidget() noexcept | |
|
14 | { | |
|
15 | delete ui; | |
|
16 | } | |
|
17 | ||
|
18 | void SqpSettingsGeneralWidget::loadSettings() | |
|
19 | { | |
|
20 | QSettings settings{}; | |
|
21 | ||
|
22 | auto loadTolerance = [&settings](const QString &key, double defaultValue) { | |
|
23 | // Tolerance is converted to percent | |
|
24 | auto toleranceValue = settings.value(key, defaultValue).toDouble(); | |
|
25 | return toleranceValue * 100.; | |
|
26 | }; | |
|
27 | ||
|
28 | ui->toleranceInitSpinBox->setValue( | |
|
29 | loadTolerance(GENERAL_TOLERANCE_AT_INIT_KEY, GENERAL_TOLERANCE_AT_INIT_DEFAULT_VALUE)); | |
|
30 | ui->toleranceUpdateSpinBox->setValue( | |
|
31 | loadTolerance(GENERAL_TOLERANCE_AT_UPDATE_KEY, GENERAL_TOLERANCE_AT_UPDATE_DEFAULT_VALUE)); | |
|
32 | } | |
|
33 | ||
|
34 | void SqpSettingsGeneralWidget::saveSettings() const | |
|
35 | { | |
|
36 | QSettings settings{}; | |
|
37 | ||
|
38 | auto saveTolerance = [&settings](const QString &key, double value) { | |
|
39 | // Tolerance is converted from percent | |
|
40 | settings.setValue(key, value * 0.01); | |
|
41 | }; | |
|
42 | ||
|
43 | saveTolerance(GENERAL_TOLERANCE_AT_INIT_KEY, ui->toleranceInitSpinBox->value()); | |
|
44 | saveTolerance(GENERAL_TOLERANCE_AT_UPDATE_KEY, ui->toleranceUpdateSpinBox->value()); | |
|
45 | } |
@@ -0,0 +1,84 | |||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
|
2 | <ui version="4.0"> | |
|
3 | <class>SqpSettingsDialog</class> | |
|
4 | <widget class="QDialog" name="SqpSettingsDialog"> | |
|
5 | <property name="geometry"> | |
|
6 | <rect> | |
|
7 | <x>0</x> | |
|
8 | <y>0</y> | |
|
9 | <width>572</width> | |
|
10 | <height>394</height> | |
|
11 | </rect> | |
|
12 | </property> | |
|
13 | <property name="windowTitle"> | |
|
14 | <string>SciQlop Settings</string> | |
|
15 | </property> | |
|
16 | <layout class="QGridLayout" name="gridLayout"> | |
|
17 | <item row="0" column="0"> | |
|
18 | <widget class="QListWidget" name="listWidget"> | |
|
19 | <property name="sizePolicy"> | |
|
20 | <sizepolicy hsizetype="Minimum" vsizetype="Expanding"> | |
|
21 | <horstretch>0</horstretch> | |
|
22 | <verstretch>0</verstretch> | |
|
23 | </sizepolicy> | |
|
24 | </property> | |
|
25 | </widget> | |
|
26 | </item> | |
|
27 | <item row="0" column="1"> | |
|
28 | <widget class="QStackedWidget" name="stackedWidget"> | |
|
29 | <property name="sizePolicy"> | |
|
30 | <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> | |
|
31 | <horstretch>0</horstretch> | |
|
32 | <verstretch>0</verstretch> | |
|
33 | </sizepolicy> | |
|
34 | </property> | |
|
35 | </widget> | |
|
36 | </item> | |
|
37 | <item row="1" column="0" colspan="2"> | |
|
38 | <widget class="QDialogButtonBox" name="buttonBox"> | |
|
39 | <property name="orientation"> | |
|
40 | <enum>Qt::Horizontal</enum> | |
|
41 | </property> | |
|
42 | <property name="standardButtons"> | |
|
43 | <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> | |
|
44 | </property> | |
|
45 | </widget> | |
|
46 | </item> | |
|
47 | </layout> | |
|
48 | </widget> | |
|
49 | <resources/> | |
|
50 | <connections> | |
|
51 | <connection> | |
|
52 | <sender>buttonBox</sender> | |
|
53 | <signal>accepted()</signal> | |
|
54 | <receiver>SqpSettingsDialog</receiver> | |
|
55 | <slot>accept()</slot> | |
|
56 | <hints> | |
|
57 | <hint type="sourcelabel"> | |
|
58 | <x>248</x> | |
|
59 | <y>254</y> | |
|
60 | </hint> | |
|
61 | <hint type="destinationlabel"> | |
|
62 | <x>157</x> | |
|
63 | <y>274</y> | |
|
64 | </hint> | |
|
65 | </hints> | |
|
66 | </connection> | |
|
67 | <connection> | |
|
68 | <sender>buttonBox</sender> | |
|
69 | <signal>rejected()</signal> | |
|
70 | <receiver>SqpSettingsDialog</receiver> | |
|
71 | <slot>reject()</slot> | |
|
72 | <hints> | |
|
73 | <hint type="sourcelabel"> | |
|
74 | <x>316</x> | |
|
75 | <y>260</y> | |
|
76 | </hint> | |
|
77 | <hint type="destinationlabel"> | |
|
78 | <x>286</x> | |
|
79 | <y>274</y> | |
|
80 | </hint> | |
|
81 | </hints> | |
|
82 | </connection> | |
|
83 | </connections> | |
|
84 | </ui> |
@@ -0,0 +1,86 | |||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
|
2 | <ui version="4.0"> | |
|
3 | <class>SqpSettingsGeneralWidget</class> | |
|
4 | <widget class="QWidget" name="SqpSettingsGeneralWidget"> | |
|
5 | <property name="geometry"> | |
|
6 | <rect> | |
|
7 | <x>0</x> | |
|
8 | <y>0</y> | |
|
9 | <width>343</width> | |
|
10 | <height>300</height> | |
|
11 | </rect> | |
|
12 | </property> | |
|
13 | <property name="windowTitle"> | |
|
14 | <string>Form</string> | |
|
15 | </property> | |
|
16 | <layout class="QGridLayout" name="gridLayout"> | |
|
17 | <item row="0" column="0"> | |
|
18 | <widget class="QLabel" name="toleranceInitLabel"> | |
|
19 | <property name="text"> | |
|
20 | <string>Tolerance on first acquisition:</string> | |
|
21 | </property> | |
|
22 | </widget> | |
|
23 | </item> | |
|
24 | <item row="0" column="1"> | |
|
25 | <widget class="QDoubleSpinBox" name="toleranceInitSpinBox"> | |
|
26 | <property name="sizePolicy"> | |
|
27 | <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> | |
|
28 | <horstretch>0</horstretch> | |
|
29 | <verstretch>0</verstretch> | |
|
30 | </sizepolicy> | |
|
31 | </property> | |
|
32 | <property name="suffix"> | |
|
33 | <string> %</string> | |
|
34 | </property> | |
|
35 | <property name="minimum"> | |
|
36 | <double>0.000000000000000</double> | |
|
37 | </property> | |
|
38 | <property name="maximum"> | |
|
39 | <double>500.000000000000000</double> | |
|
40 | </property> | |
|
41 | </widget> | |
|
42 | </item> | |
|
43 | <item row="1" column="0"> | |
|
44 | <widget class="QLabel" name="toleranceUpdateLabel"> | |
|
45 | <property name="text"> | |
|
46 | <string>Tolerance when updating acquisition:</string> | |
|
47 | </property> | |
|
48 | </widget> | |
|
49 | </item> | |
|
50 | <item row="1" column="1"> | |
|
51 | <widget class="QDoubleSpinBox" name="toleranceUpdateSpinBox"> | |
|
52 | <property name="sizePolicy"> | |
|
53 | <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> | |
|
54 | <horstretch>0</horstretch> | |
|
55 | <verstretch>0</verstretch> | |
|
56 | </sizepolicy> | |
|
57 | </property> | |
|
58 | <property name="suffix"> | |
|
59 | <string> %</string> | |
|
60 | </property> | |
|
61 | <property name="minimum"> | |
|
62 | <double>0.000000000000000</double> | |
|
63 | </property> | |
|
64 | <property name="maximum"> | |
|
65 | <double>500.000000000000000</double> | |
|
66 | </property> | |
|
67 | </widget> | |
|
68 | </item> | |
|
69 | <item row="2" column="0"> | |
|
70 | <spacer name="verticalSpacer"> | |
|
71 | <property name="orientation"> | |
|
72 | <enum>Qt::Vertical</enum> | |
|
73 | </property> | |
|
74 | <property name="sizeHint" stdset="0"> | |
|
75 | <size> | |
|
76 | <width>20</width> | |
|
77 | <height>40</height> | |
|
78 | </size> | |
|
79 | </property> | |
|
80 | </spacer> | |
|
81 | </item> | |
|
82 | </layout> | |
|
83 | </widget> | |
|
84 | <resources/> | |
|
85 | <connections/> | |
|
86 | </ui> |
@@ -28,6 +28,10 | |||
|
28 | 28 | #include <Plugin/PluginManager.h> |
|
29 | 29 | #include <QDir> |
|
30 | 30 | |
|
31 | #include <QLoggingCategory> | |
|
32 | ||
|
33 | Q_LOGGING_CATEGORY(LOG_Main, "Main") | |
|
34 | ||
|
31 | 35 | namespace { |
|
32 | 36 | |
|
33 | 37 | /// Name of the directory containing the plugins |
@@ -66,8 +70,7 int main(int argc, char *argv[]) | |||
|
66 | 70 | } |
|
67 | 71 | #endif |
|
68 | 72 | #endif |
|
69 | qCDebug(LOG_PluginManager()) | |
|
70 | << QObject::tr("Plugin directory: %1").arg(pluginDir.absolutePath()); | |
|
73 | qCDebug(LOG_Main()) << QObject::tr("Plugin directory: %1").arg(pluginDir.absolutePath()); | |
|
71 | 74 | |
|
72 | 75 | PluginManager pluginManager{}; |
|
73 | 76 | pluginManager.loadPlugins(pluginDir); |
@@ -24,6 +24,8 | |||
|
24 | 24 | |
|
25 | 25 | #include <DataSource/DataSourceController.h> |
|
26 | 26 | #include <DataSource/DataSourceWidget.h> |
|
27 | #include <Settings/SqpSettingsDialog.h> | |
|
28 | #include <Settings/SqpSettingsGeneralWidget.h> | |
|
27 | 29 | #include <SidePane/SqpSidePane.h> |
|
28 | 30 | #include <SqpApplication.h> |
|
29 | 31 | #include <Time/TimeController.h> |
@@ -41,18 +43,6 | |||
|
41 | 43 | #include <QToolButton> |
|
42 | 44 | #include <memory.h> |
|
43 | 45 | |
|
44 | //#include <omp.h> | |
|
45 | //#include <network/filedownloader.h> | |
|
46 | //#include <qlopdatabase.h> | |
|
47 | //#include <qlopsettings.h> | |
|
48 | //#include <qlopgui.h> | |
|
49 | //#include <spacedata.h> | |
|
50 | //#include "qlopcore.h" | |
|
51 | //#include "qlopcodecmanager.h" | |
|
52 | //#include "cdfcodec.h" | |
|
53 | //#include "amdatxtcodec.h" | |
|
54 | //#include <qlopplotmanager.h> | |
|
55 | ||
|
56 | 46 | #include "iostream" |
|
57 | 47 | |
|
58 | 48 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") |
@@ -67,14 +57,26 const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; | |||
|
67 | 57 | |
|
68 | 58 | class MainWindow::MainWindowPrivate { |
|
69 | 59 | public: |
|
60 | explicit MainWindowPrivate(MainWindow *mainWindow) | |
|
61 | : m_LastOpenLeftInspectorSize{}, | |
|
62 | m_LastOpenRightInspectorSize{}, | |
|
63 | m_GeneralSettingsWidget{new SqpSettingsGeneralWidget{mainWindow}}, | |
|
64 | m_SettingsDialog{new SqpSettingsDialog{mainWindow}} | |
|
65 | { | |
|
66 | } | |
|
67 | ||
|
70 | 68 | QSize m_LastOpenLeftInspectorSize; |
|
71 | 69 | QSize m_LastOpenRightInspectorSize; |
|
70 | /// General settings widget. MainWindow has the ownership | |
|
71 | SqpSettingsGeneralWidget *m_GeneralSettingsWidget; | |
|
72 | /// Settings dialog. MainWindow has the ownership | |
|
73 | SqpSettingsDialog *m_SettingsDialog; | |
|
72 | 74 | }; |
|
73 | 75 | |
|
74 | 76 | MainWindow::MainWindow(QWidget *parent) |
|
75 | 77 | : QMainWindow{parent}, |
|
76 | 78 | m_Ui{new Ui::MainWindow}, |
|
77 | impl{spimpl::make_unique_impl<MainWindowPrivate>()} | |
|
79 | impl{spimpl::make_unique_impl<MainWindowPrivate>(this)} | |
|
78 | 80 | { |
|
79 | 81 | m_Ui->setupUi(this); |
|
80 | 82 | |
@@ -167,12 +169,39 MainWindow::MainWindow(QWidget *parent) | |||
|
167 | 169 | openInspector(checked, true, openRightInspectorAction); |
|
168 | 170 | }); |
|
169 | 171 | |
|
172 | // //// // | |
|
173 | // Menu // | |
|
174 | // //// // | |
|
170 | 175 | this->menuBar()->addAction(tr("File")); |
|
176 | auto toolsMenu = this->menuBar()->addMenu(tr("Tools")); | |
|
177 | toolsMenu->addAction(tr("Settings..."), [this]() { | |
|
178 | // Loads settings | |
|
179 | impl->m_SettingsDialog->loadSettings(); | |
|
180 | ||
|
181 | // Open settings dialog and save settings if the dialog is accepted | |
|
182 | if (impl->m_SettingsDialog->exec() == QDialog::Accepted) { | |
|
183 | impl->m_SettingsDialog->saveSettings(); | |
|
184 | } | |
|
185 | ||
|
186 | }); | |
|
187 | ||
|
171 | 188 | auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar")); |
|
172 | 189 | |
|
173 | 190 | auto timeWidget = new TimeWidget{}; |
|
174 | 191 | mainToolBar->addWidget(timeWidget); |
|
175 | 192 | |
|
193 | // //////// // | |
|
194 | // Settings // | |
|
195 | // //////// // | |
|
196 | ||
|
197 | // Registers "general settings" widget to the settings dialog | |
|
198 | impl->m_SettingsDialog->registerWidget(QStringLiteral("General"), | |
|
199 | impl->m_GeneralSettingsWidget); | |
|
200 | ||
|
201 | // /////////// // | |
|
202 | // Connections // | |
|
203 | // /////////// // | |
|
204 | ||
|
176 | 205 | // Controllers / controllers connections |
|
177 | 206 | connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpDateTime)), |
|
178 | 207 | &sqpApp->variableController(), SLOT(onDateTimeOnSelection(SqpDateTime))); |
@@ -207,55 +236,12 MainWindow::MainWindow(QWidget *parent) | |||
|
207 | 236 | SIGNAL(tableMenuAboutToBeDisplayed(QMenu *, const QVector<std::shared_ptr<Variable> > &)), |
|
208 | 237 | m_Ui->view, SLOT(attachVariableMenu(QMenu *, const QVector<std::shared_ptr<Variable> > &)), |
|
209 | 238 | Qt::DirectConnection); |
|
210 | ||
|
211 | /* QLopGUI::registerMenuBar(menuBar()); | |
|
212 | this->setWindowIcon(QIcon(":/sciqlopLOGO.svg")); | |
|
213 | this->m_progressWidget = new QWidget(); | |
|
214 | this->m_progressLayout = new QVBoxLayout(this->m_progressWidget); | |
|
215 | this->m_progressWidget->setLayout(this->m_progressLayout); | |
|
216 | this->m_progressWidget->setWindowModality(Qt::WindowModal); | |
|
217 | m_progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int)); | |
|
218 | for(int i=0;i<OMP_THREADS;i++) | |
|
219 | { | |
|
220 | this->m_progress.append(new QProgressBar(this->m_progressWidget)); | |
|
221 | this->m_progress.last()->setMinimum(0); | |
|
222 | this->m_progress.last()->setMaximum(100); | |
|
223 | this->m_progressLayout->addWidget(this->m_progress.last()); | |
|
224 | this->m_progressWidget->hide(); | |
|
225 | this->m_progressThreadIds[i] = -1; | |
|
226 | } | |
|
227 | this->m_progressWidget->setWindowTitle("Loading File"); | |
|
228 | const QList<QLopService*>ServicesToLoad=QList<QLopService*>() | |
|
229 | << QLopCore::self() | |
|
230 | << QLopPlotManager::self() | |
|
231 | << QLopCodecManager::self() | |
|
232 | << FileDownloader::self() | |
|
233 | << QLopDataBase::self() | |
|
234 | << SpaceData::self(); | |
|
235 | ||
|
236 | CDFCodec::registerToManager(); | |
|
237 | AMDATXTCodec::registerToManager(); | |
|
238 | ||
|
239 | ||
|
240 | for(int i=0;i<ServicesToLoad.count();i++) | |
|
241 | { | |
|
242 | qDebug()<<ServicesToLoad.at(i)->serviceName(); | |
|
243 | ServicesToLoad.at(i)->initialize(); //must be called before getGUI | |
|
244 | QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI(); | |
|
245 | if(wdgt) | |
|
246 | { | |
|
247 | wdgt->setAllowedAreas(Qt::AllDockWidgetAreas); | |
|
248 | this->addDockWidget(Qt::TopDockWidgetArea,wdgt); | |
|
249 | } | |
|
250 | PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i)); | |
|
251 | }*/ | |
|
252 | 239 | } |
|
253 | 240 | |
|
254 | 241 | MainWindow::~MainWindow() |
|
255 | 242 | { |
|
256 | 243 | } |
|
257 | 244 | |
|
258 | ||
|
259 | 245 | void MainWindow::changeEvent(QEvent *e) |
|
260 | 246 | { |
|
261 | 247 | QMainWindow::changeEvent(e); |
@@ -29,6 +29,9 SCIQLOP_FIND_QT(Core Network) | |||
|
29 | 29 | # |
|
30 | 30 | # Compile the library library |
|
31 | 31 | # |
|
32 | ||
|
33 | ADD_DEFINITIONS(-DCORE_LIB) | |
|
34 | ||
|
32 | 35 | FILE (GLOB_RECURSE MODULE_SOURCES |
|
33 | 36 | ${INCLUDES_DIR}/*.h |
|
34 | 37 | ${SOURCES_DIR}/*.c |
@@ -1,6 +1,8 | |||
|
1 | 1 | #ifndef SCIQLOP_IDATAPROVIDER_H |
|
2 | 2 | #define SCIQLOP_IDATAPROVIDER_H |
|
3 | 3 | |
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
4 | 6 | #include <memory> |
|
5 | 7 | |
|
6 | 8 | #include <QObject> |
@@ -25,7 +27,7 class QNetworkRequest; | |||
|
25 | 27 | * |
|
26 | 28 | * @sa IDataSeries |
|
27 | 29 | */ |
|
28 | class IDataProvider : public QObject { | |
|
30 | class SCIQLOP_CORE_EXPORT IDataProvider : public QObject { | |
|
29 | 31 | |
|
30 | 32 | Q_OBJECT |
|
31 | 33 | public: |
@@ -1,12 +1,14 | |||
|
1 | 1 | #ifndef SCIQLOP_SCALARSERIES_H |
|
2 | 2 | #define SCIQLOP_SCALARSERIES_H |
|
3 | 3 | |
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
4 | 6 | #include <Data/DataSeries.h> |
|
5 | 7 | |
|
6 | 8 | /** |
|
7 | 9 | * @brief The ScalarSeries class is the implementation for a data series representing a scalar. |
|
8 | 10 | */ |
|
9 | class ScalarSeries : public DataSeries<1> { | |
|
11 | class SCIQLOP_CORE_EXPORT ScalarSeries : public DataSeries<1> { | |
|
10 | 12 | public: |
|
11 | 13 | /** |
|
12 | 14 | * Ctor with two vectors. The vectors must have the same size, otherwise a ScalarSeries with no |
@@ -1,6 +1,8 | |||
|
1 | 1 | #ifndef SCIQLOP_DATASOURCECONTROLLER_H |
|
2 | 2 | #define SCIQLOP_DATASOURCECONTROLLER_H |
|
3 | 3 | |
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
4 | 6 | #include <QLoggingCategory> |
|
5 | 7 | #include <QObject> |
|
6 | 8 | #include <QUuid> |
@@ -19,7 +21,7 class IDataProvider; | |||
|
19 | 21 | * source) then others specifics method will be able to access it. You can load a data source driver |
|
20 | 22 | * plugin then create a data source. |
|
21 | 23 | */ |
|
22 | class DataSourceController : public QObject { | |
|
24 | class SCIQLOP_CORE_EXPORT DataSourceController : public QObject { | |
|
23 | 25 | Q_OBJECT |
|
24 | 26 | public: |
|
25 | 27 | explicit DataSourceController(QObject *parent = 0); |
@@ -1,6 +1,8 | |||
|
1 | 1 | #ifndef SCIQLOP_DATASOURCEITEM_H |
|
2 | 2 | #define SCIQLOP_DATASOURCEITEM_H |
|
3 | 3 | |
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
4 | 6 | #include <Common/spimpl.h> |
|
5 | 7 | |
|
6 | 8 | #include <QVariant> |
@@ -19,7 +21,7 enum class DataSourceItemType { NODE, PRODUCT, COMPONENT }; | |||
|
19 | 21 | * containing other DataSourceItem objects (children). |
|
20 | 22 | * For each DataSourceItem can be associated a set of data representing it. |
|
21 | 23 | */ |
|
22 | class DataSourceItem { | |
|
24 | class SCIQLOP_CORE_EXPORT DataSourceItem { | |
|
23 | 25 | public: |
|
24 | 26 | /// Key associated with the name of the item |
|
25 | 27 | static const QString NAME_DATA_KEY; |
@@ -1,6 +1,8 | |||
|
1 | 1 | #ifndef SCIQLOP_DATASOURCEITEMACTION_H |
|
2 | 2 | #define SCIQLOP_DATASOURCEITEMACTION_H |
|
3 | 3 | |
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
4 | 6 | #include <Common/spimpl.h> |
|
5 | 7 | |
|
6 | 8 | #include <QLoggingCategory> |
@@ -17,7 +19,7 class DataSourceItem; | |||
|
17 | 19 | * |
|
18 | 20 | * An action is a function that will be executed when the slot execute() is called. |
|
19 | 21 | */ |
|
20 | class DataSourceItemAction : public QObject { | |
|
22 | class SCIQLOP_CORE_EXPORT DataSourceItemAction : public QObject { | |
|
21 | 23 | |
|
22 | 24 | Q_OBJECT |
|
23 | 25 |
@@ -1,6 +1,8 | |||
|
1 | 1 | #ifndef SCIQLOP_NETWORKCONTROLLER_H |
|
2 | 2 | #define SCIQLOP_NETWORKCONTROLLER_H |
|
3 | 3 | |
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
4 | 6 | #include <QLoggingCategory> |
|
5 | 7 | #include <QObject> |
|
6 | 8 | #include <QUuid> |
@@ -16,7 +18,7 class QNetworkRequest; | |||
|
16 | 18 | /** |
|
17 | 19 | * @brief The NetworkController class aims to handle all network connection of SciQlop. |
|
18 | 20 | */ |
|
19 | class NetworkController : public QObject { | |
|
21 | class SCIQLOP_CORE_EXPORT NetworkController : public QObject { | |
|
20 | 22 | Q_OBJECT |
|
21 | 23 | public: |
|
22 | 24 | explicit NetworkController(QObject *parent = 0); |
@@ -1,6 +1,8 | |||
|
1 | 1 | #ifndef SCIQLOP_PLUGINMANAGER_H |
|
2 | 2 | #define SCIQLOP_PLUGINMANAGER_H |
|
3 | 3 | |
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
4 | 6 | #include <Common/spimpl.h> |
|
5 | 7 | |
|
6 | 8 | #include <QLoggingCategory> |
@@ -12,7 +14,7 Q_DECLARE_LOGGING_CATEGORY(LOG_PluginManager) | |||
|
12 | 14 | /** |
|
13 | 15 | * @brief The PluginManager class aims to handle the plugins loaded dynamically into SciQLop. |
|
14 | 16 | */ |
|
15 | class PluginManager { | |
|
17 | class SCIQLOP_CORE_EXPORT PluginManager { | |
|
16 | 18 | public: |
|
17 | 19 | explicit PluginManager(); |
|
18 | 20 |
@@ -1,6 +1,8 | |||
|
1 | 1 | #ifndef SCIQLOP_TIMECONTROLLER_H |
|
2 | 2 | #define SCIQLOP_TIMECONTROLLER_H |
|
3 | 3 | |
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
4 | 6 | #include <Data/SqpDateTime.h> |
|
5 | 7 | |
|
6 | 8 | #include <QLoggingCategory> |
@@ -14,7 +16,7 Q_DECLARE_LOGGING_CATEGORY(LOG_TimeController) | |||
|
14 | 16 | /** |
|
15 | 17 | * @brief The TimeController class aims to handle the Time parameters notification in SciQlop. |
|
16 | 18 | */ |
|
17 | class TimeController : public QObject { | |
|
19 | class SCIQLOP_CORE_EXPORT TimeController : public QObject { | |
|
18 | 20 | Q_OBJECT |
|
19 | 21 | public: |
|
20 | 22 | explicit TimeController(QObject *parent = 0); |
@@ -1,6 +1,8 | |||
|
1 | 1 | #ifndef SCIQLOP_VARIABLE_H |
|
2 | 2 | #define SCIQLOP_VARIABLE_H |
|
3 | 3 | |
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
4 | 6 | #include <Data/SqpDateTime.h> |
|
5 | 7 | |
|
6 | 8 | #include <QLoggingCategory> |
@@ -17,7 +19,7 class QString; | |||
|
17 | 19 | /** |
|
18 | 20 | * @brief The Variable class represents a variable in SciQlop. |
|
19 | 21 | */ |
|
20 | class Variable : public QObject { | |
|
22 | class SCIQLOP_CORE_EXPORT Variable : public QObject { | |
|
21 | 23 | |
|
22 | 24 | Q_OBJECT |
|
23 | 25 |
@@ -1,6 +1,8 | |||
|
1 | 1 | #ifndef SCIQLOP_VARIABLECACHECONTROLLER_H |
|
2 | 2 | #define SCIQLOP_VARIABLECACHECONTROLLER_H |
|
3 | 3 | |
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
4 | 6 | #include <QLoggingCategory> |
|
5 | 7 | #include <QObject> |
|
6 | 8 | |
@@ -14,11 +16,8 Q_DECLARE_LOGGING_CATEGORY(LOG_VariableCacheController) | |||
|
14 | 16 | |
|
15 | 17 | class Variable; |
|
16 | 18 | |
|
17 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableCacheController) | |
|
18 | ||
|
19 | ||
|
20 | 19 | /// This class aims to store in the cache all of the dateTime already requested to the variable. |
|
21 | class VariableCacheController : public QObject { | |
|
20 | class SCIQLOP_CORE_EXPORT VariableCacheController : public QObject { | |
|
22 | 21 | Q_OBJECT |
|
23 | 22 | public: |
|
24 | 23 | explicit VariableCacheController(QObject *parent = 0); |
@@ -1,6 +1,8 | |||
|
1 | 1 | #ifndef SCIQLOP_VARIABLECONTROLLER_H |
|
2 | 2 | #define SCIQLOP_VARIABLECONTROLLER_H |
|
3 | 3 | |
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
4 | 6 | #include <Data/SqpDateTime.h> |
|
5 | 7 | |
|
6 | 8 | #include <QLoggingCategory> |
@@ -19,7 +21,7 Q_DECLARE_LOGGING_CATEGORY(LOG_VariableController) | |||
|
19 | 21 | /** |
|
20 | 22 | * @brief The VariableController class aims to handle the variables in SciQlop. |
|
21 | 23 | */ |
|
22 | class VariableController : public QObject { | |
|
24 | class SCIQLOP_CORE_EXPORT VariableController : public QObject { | |
|
23 | 25 | Q_OBJECT |
|
24 | 26 | public: |
|
25 | 27 | explicit VariableController(QObject *parent = 0); |
@@ -1,6 +1,7 | |||
|
1 | 1 | #ifndef SCIQLOP_VARIABLEMODEL_H |
|
2 | 2 | #define SCIQLOP_VARIABLEMODEL_H |
|
3 | 3 | |
|
4 | #include "CoreGlobal.h" | |
|
4 | 5 | |
|
5 | 6 | #include <Data/SqpDateTime.h> |
|
6 | 7 | |
@@ -21,7 +22,7 class Variable; | |||
|
21 | 22 | /** |
|
22 | 23 | * @brief The VariableModel class aims to hold the variables that have been created in SciQlop |
|
23 | 24 | */ |
|
24 | class VariableModel : public QAbstractTableModel { | |
|
25 | class SCIQLOP_CORE_EXPORT VariableModel : public QAbstractTableModel { | |
|
25 | 26 | Q_OBJECT |
|
26 | 27 | public: |
|
27 | 28 | explicit VariableModel(QObject *parent = nullptr); |
@@ -1,6 +1,8 | |||
|
1 | 1 | #ifndef SCIQLOP_VISUALIZATIONCONTROLLER_H |
|
2 | 2 | #define SCIQLOP_VISUALIZATIONCONTROLLER_H |
|
3 | 3 | |
|
4 | #include "CoreGlobal.h" | |
|
5 | ||
|
4 | 6 | #include <Data/SqpDateTime.h> |
|
5 | 7 | |
|
6 | 8 | #include <QLoggingCategory> |
@@ -21,7 +23,7 class Variable; | |||
|
21 | 23 | * plugin source) then others specifics method will be able to access it. You can load a data source |
|
22 | 24 | * driver plugin then create a data source. |
|
23 | 25 | */ |
|
24 | class VisualizationController : public QObject { | |
|
26 | class SCIQLOP_CORE_EXPORT VisualizationController : public QObject { | |
|
25 | 27 | Q_OBJECT |
|
26 | 28 | public: |
|
27 | 29 | explicit VisualizationController(QObject *parent = 0); |
@@ -48,8 +48,8 void updateScalarData(QCPAbstractPlottable *component, ScalarSeries &scalarSerie | |||
|
48 | 48 | auto xDataBegin = xData.cbegin(); |
|
49 | 49 | auto xDataEnd = xData.cend(); |
|
50 | 50 | |
|
51 | qCInfo(LOG_VisualizationGraphHelper()) | |
|
52 | << "TORM: Current points in cache" << xData.count(); | |
|
51 | qCInfo(LOG_VisualizationGraphHelper()) << "TORM: Current points in cache" | |
|
52 | << xData.count(); | |
|
53 | 53 | |
|
54 | 54 | auto sqpDataContainer = QSharedPointer<SqpDataContainer>::create(); |
|
55 | 55 | qcpGraph->setData(sqpDataContainer); |
@@ -64,8 +64,8 void updateScalarData(QCPAbstractPlottable *component, ScalarSeries &scalarSerie | |||
|
64 | 64 | sqpDataContainer->appendGraphData(QCPGraphData(*xAxisDataIt, *valuesDataIt)); |
|
65 | 65 | } |
|
66 | 66 | |
|
67 | qCInfo(LOG_VisualizationGraphHelper()) | |
|
68 |
|
|
|
67 | qCInfo(LOG_VisualizationGraphHelper()) << "TORM: Current points displayed" | |
|
68 | << sqpDataContainer->size(); | |
|
69 | 69 | } |
|
70 | 70 | scalarSeries.unlock(); |
|
71 | 71 |
@@ -5,6 +5,7 | |||
|
5 | 5 | |
|
6 | 6 | #include <Data/ArrayData.h> |
|
7 | 7 | #include <Data/IDataSeries.h> |
|
8 | #include <Settings/SqpSettingsDefs.h> | |
|
8 | 9 | #include <SqpApplication.h> |
|
9 | 10 | #include <Variable/Variable.h> |
|
10 | 11 | #include <Variable/VariableController.h> |
@@ -21,6 +22,13 const auto HORIZONTAL_ZOOM_MODIFIER = Qt::NoModifier; | |||
|
21 | 22 | /// Key pressed to enable zoom on vertical axis |
|
22 | 23 | const auto VERTICAL_ZOOM_MODIFIER = Qt::ControlModifier; |
|
23 | 24 | |
|
25 | /// Gets a tolerance value from application settings. If the setting can't be found, the default | |
|
26 | /// value passed in parameter is returned | |
|
27 | double toleranceValue(const QString &key, double defaultValue) noexcept | |
|
28 | { | |
|
29 | return QSettings{}.value(key, defaultValue).toDouble(); | |
|
30 | } | |
|
31 | ||
|
24 | 32 | } // namespace |
|
25 | 33 | |
|
26 | 34 | struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { |
@@ -106,8 +114,10 void VisualizationGraphWidget::addVariableUsingGraph(std::shared_ptr<Variable> v | |||
|
106 | 114 | |
|
107 | 115 | auto variableDateTimeWithTolerance = dateTime; |
|
108 | 116 | |
|
109 |
// add |
|
|
110 | auto tolerance = 0.2 * (dateTime.m_TEnd - dateTime.m_TStart); | |
|
117 | // add tolerance for each side | |
|
118 | auto toleranceFactor | |
|
119 | = toleranceValue(GENERAL_TOLERANCE_AT_INIT_KEY, GENERAL_TOLERANCE_AT_INIT_DEFAULT_VALUE); | |
|
120 | auto tolerance = toleranceFactor * (dateTime.m_TEnd - dateTime.m_TStart); | |
|
111 | 121 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
|
112 | 122 | variableDateTimeWithTolerance.m_TEnd += tolerance; |
|
113 | 123 | |
@@ -232,7 +242,8 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange | |||
|
232 | 242 | auto variable = it->first; |
|
233 | 243 | auto currentDateTime = dateTimeRange; |
|
234 | 244 | |
|
235 | auto toleranceFactor = 0.2; | |
|
245 | auto toleranceFactor = toleranceValue(GENERAL_TOLERANCE_AT_UPDATE_KEY, | |
|
246 | GENERAL_TOLERANCE_AT_UPDATE_DEFAULT_VALUE); | |
|
236 | 247 | auto tolerance = toleranceFactor * (currentDateTime.m_TEnd - currentDateTime.m_TStart); |
|
237 | 248 | auto variableDateTimeWithTolerance = currentDateTime; |
|
238 | 249 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
@@ -251,7 +262,7 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange | |||
|
251 | 262 | if (variable->contains(variableDateTimeWithTolerance)) { |
|
252 | 263 | qCDebug(LOG_VisualizationGraphWidget()) |
|
253 | 264 | << tr("TORM: Detection zoom in that need request:"); |
|
254 |
// add |
|
|
265 | // add tolerance for each side | |
|
255 | 266 | tolerance |
|
256 | 267 | = toleranceFactor * (currentDateTime.m_TEnd - currentDateTime.m_TStart); |
|
257 | 268 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
@@ -286,7 +297,7 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange | |||
|
286 | 297 | } |
|
287 | 298 | else { |
|
288 | 299 | qCDebug(LOG_VisualizationGraphWidget()) << tr("TORM: Detection zoom out: "); |
|
289 |
// add |
|
|
300 | // add tolerance for each side | |
|
290 | 301 | tolerance = toleranceFactor * (currentDateTime.m_TEnd - currentDateTime.m_TStart); |
|
291 | 302 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
|
292 | 303 | variableDateTimeWithTolerance.m_TEnd += tolerance; |
@@ -39,8 +39,7 QString dateFormat(double sqpDateTime) noexcept | |||
|
39 | 39 | |
|
40 | 40 | AmdaProvider::AmdaProvider() |
|
41 | 41 | { |
|
42 |
qCDebug(LOG_ |
|
|
43 | << QThread::currentThread(); | |
|
42 | qCDebug(LOG_AmdaProvider()) << tr("AmdaProvider::AmdaProvider") << QThread::currentThread(); | |
|
44 | 43 | if (auto app = sqpApp) { |
|
45 | 44 | auto &networkController = app->networkController(); |
|
46 | 45 | connect(this, SIGNAL(requestConstructed(QNetworkRequest, QUuid, |
General Comments 0
You need to be logged in to leave comments.
Login now