##// END OF EJS Templates
Creates settings dialog and adds it to a new menu in MainWindow...
Alexandre Leroux -
r463:6a4aa86600f2
parent child
Show More
@@ -0,0 +1,27
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 {
17 Q_OBJECT
18
19 public:
20 explicit SqpSettingsDialog(QWidget *parent = 0);
21 virtual ~SqpSettingsDialog() noexcept;
22
23 private:
24 Ui::SqpSettingsDialog *ui;
25 };
26
27 #endif // SCIQLOP_SQPSETTINGSDIALOG_H
@@ -0,0 +1,17
1 #include "Settings/SqpSettingsDialog.h"
2 #include "ui_SqpSettingsDialog.h"
3
4 SqpSettingsDialog::SqpSettingsDialog(QWidget *parent)
5 : QDialog{parent}, ui{new Ui::SqpSettingsDialog}
6 {
7 ui->setupUi(this);
8
9 // Connection to change the current page to the selection of an entry in the list
10 connect(ui->listWidget, &QListWidget::currentRowChanged, ui->stackedWidget,
11 &QStackedWidget::setCurrentIndex);
12 }
13
14 SqpSettingsDialog::~SqpSettingsDialog() noexcept
15 {
16 delete ui;
17 }
@@ -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>
@@ -24,6 +24,7
24 24
25 25 #include <DataSource/DataSourceController.h>
26 26 #include <DataSource/DataSourceWidget.h>
27 #include <Settings/SqpSettingsDialog.h>
27 28 #include <SidePane/SqpSidePane.h>
28 29 #include <SqpApplication.h>
29 30 #include <Time/TimeController.h>
@@ -55,14 +56,23 const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4;
55 56
56 57 class MainWindow::MainWindowPrivate {
57 58 public:
59 explicit MainWindowPrivate(MainWindow *mainWindow)
60 : m_LastOpenLeftInspectorSize{},
61 m_LastOpenRightInspectorSize{},
62 m_SettingsDialog{new SqpSettingsDialog{mainWindow}}
63 {
64 }
65
58 66 QSize m_LastOpenLeftInspectorSize;
59 67 QSize m_LastOpenRightInspectorSize;
68 /// Settings dialog. MainWindow has the ownership
69 SqpSettingsDialog *m_SettingsDialog;
60 70 };
61 71
62 72 MainWindow::MainWindow(QWidget *parent)
63 73 : QMainWindow{parent},
64 74 m_Ui{new Ui::MainWindow},
65 impl{spimpl::make_unique_impl<MainWindowPrivate>()}
75 impl{spimpl::make_unique_impl<MainWindowPrivate>(this)}
66 76 {
67 77 m_Ui->setupUi(this);
68 78
@@ -155,12 +165,24 MainWindow::MainWindow(QWidget *parent)
155 165 openInspector(checked, true, openRightInspectorAction);
156 166 });
157 167
168 // //// //
169 // Menu //
170 // //// //
158 171 this->menuBar()->addAction(tr("File"));
172 auto toolsMenu = this->menuBar()->addMenu(tr("Tools"));
173 toolsMenu->addAction(tr("Settings..."), [this]() {
174 impl->m_SettingsDialog->exec();
175 });
176
159 177 auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar"));
160 178
161 179 auto timeWidget = new TimeWidget{};
162 180 mainToolBar->addWidget(timeWidget);
163 181
182 // /////////// //
183 // Connections //
184 // /////////// //
185
164 186 // Controllers / controllers connections
165 187 connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpDateTime)),
166 188 &sqpApp->variableController(), SLOT(onDateTimeOnSelection(SqpDateTime)));
General Comments 0
You need to be logged in to leave comments. Login now