##// END OF EJS Templates
Merge branch 'feature/CataloguesBasicGui' into develop
trabillard -
r1107:bc8467a5b117 merge
parent child
Show More
@@ -0,0 +1,31
1 #ifndef SCIQLOP_CATALOGUEEVENTSWIDGET_H
2 #define SCIQLOP_CATALOGUEEVENTSWIDGET_H
3
4 #include <Common/spimpl.h>
5 #include <QWidget>
6
7 namespace Ui {
8 class CatalogueEventsWidget;
9 }
10
11 class CatalogueEventsWidget : public QWidget {
12 Q_OBJECT
13
14 signals:
15 void eventSelected(const QString &event);
16
17 public:
18 explicit CatalogueEventsWidget(QWidget *parent = 0);
19 virtual ~CatalogueEventsWidget();
20
21 public slots:
22 void populateWithCatalogue(const QString &catalogue);
23
24 private:
25 Ui::CatalogueEventsWidget *ui;
26
27 class CatalogueEventsWidgetPrivate;
28 spimpl::unique_impl_ptr<CatalogueEventsWidgetPrivate> impl;
29 };
30
31 #endif // SCIQLOP_CATALOGUEEVENTSWIDGET_H
@@ -0,0 +1,21
1 #ifndef SCIQLOP_CATALOGUEEXPLORER_H
2 #define SCIQLOP_CATALOGUEEXPLORER_H
3
4 #include <QDialog>
5
6 namespace Ui {
7 class CatalogueExplorer;
8 }
9
10 class CatalogueExplorer : public QDialog {
11 Q_OBJECT
12
13 public:
14 explicit CatalogueExplorer(QWidget *parent = 0);
15 virtual ~CatalogueExplorer();
16
17 private:
18 Ui::CatalogueExplorer *ui;
19 };
20
21 #endif // SCIQLOP_CATALOGUEEXPLORER_H
@@ -0,0 +1,32
1 #ifndef SCIQLOP_CATALOGUEINSPECTORWIDGET_H
2 #define SCIQLOP_CATALOGUEINSPECTORWIDGET_H
3
4 #include <QWidget>
5
6 namespace Ui {
7 class CatalogueInspectorWidget;
8 }
9
10 class CatalogueInspectorWidget : public QWidget {
11 Q_OBJECT
12
13 public:
14 explicit CatalogueInspectorWidget(QWidget *parent = 0);
15 virtual ~CatalogueInspectorWidget();
16
17 /// Enum matching the pages inside the stacked widget
18 enum class Page { Empty, CatalogueProperties, EventProperties };
19
20 Page currentPage() const;
21
22 void setEvent(const QString &event);
23 void setCatalogue(const QString &catalogue);
24
25 public slots:
26 void showPage(Page page);
27
28 private:
29 Ui::CatalogueInspectorWidget *ui;
30 };
31
32 #endif // SCIQLOP_CATALOGUEINSPECTORWIDGET_H
@@ -0,0 +1,31
1 #ifndef SCIQLOP_CATALOGUESIDEBARWIDGET_H
2 #define SCIQLOP_CATALOGUESIDEBARWIDGET_H
3
4 #include <Common/spimpl.h>
5 #include <QTreeWidgetItem>
6 #include <QWidget>
7
8 namespace Ui {
9 class CatalogueSideBarWidget;
10 }
11
12 class CatalogueSideBarWidget : public QWidget {
13 Q_OBJECT
14
15 signals:
16 void catalogueSelected(const QString &catalogue);
17 void allEventsSelected();
18 void trashSelected();
19
20 public:
21 explicit CatalogueSideBarWidget(QWidget *parent = 0);
22 virtual ~CatalogueSideBarWidget();
23
24 private:
25 Ui::CatalogueSideBarWidget *ui;
26
27 class CatalogueSideBarWidgetPrivate;
28 spimpl::unique_impl_ptr<CatalogueSideBarWidgetPrivate> impl;
29 };
30
31 #endif // SCIQLOP_CATALOGUESIDEBARWIDGET_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
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
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
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,100
1 #include "Catalogue/CatalogueEventsWidget.h"
2 #include "ui_CatalogueEventsWidget.h"
3
4 #include <QtDebug>
5
6 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate {
7 void addEventItem(const QStringList &data, QTableWidget *tableWidget);
8
9 enum class Column { Event, TStart, TEnd, Tags, Product, NbColumn };
10 QStringList columnNames() { return QStringList{"Event", "TStart", "TEnd", "Tags", "Product"}; }
11 };
12
13
14 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
15 : QWidget(parent),
16 ui(new Ui::CatalogueEventsWidget),
17 impl{spimpl::make_unique_impl<CatalogueEventsWidgetPrivate>()}
18 {
19 ui->setupUi(this);
20
21 connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) {
22 if (checked) {
23 ui->btnChart->setChecked(false);
24 }
25 });
26
27 connect(ui->btnChart, &QToolButton::clicked, [this](auto checked) {
28 if (checked) {
29 ui->btnTime->setChecked(false);
30 }
31 });
32
33 connect(ui->tableWidget, &QTableWidget::cellClicked, [this](auto row, auto column) {
34 auto event = ui->tableWidget->item(row, 0)->text();
35 emit this->eventSelected(event);
36 });
37
38 connect(ui->tableWidget, &QTableWidget::currentItemChanged,
39 [this](auto current, auto previous) {
40 if (current && current->row() >= 0) {
41 auto event = ui->tableWidget->item(current->row(), 0)->text();
42 emit this->eventSelected(event);
43 }
44 });
45
46 connect(ui->tableWidget, &QTableWidget::itemSelectionChanged, [this]() {
47 auto selection = ui->tableWidget->selectedRanges();
48 auto isNotMultiSelection
49 = selection.isEmpty() || (selection.count() == 1 && selection.first().rowCount() == 1);
50 ui->btnChart->setEnabled(isNotMultiSelection);
51 ui->btnTime->setEnabled(isNotMultiSelection);
52 });
53
54 Q_ASSERT(impl->columnNames().count() == (int)CatalogueEventsWidgetPrivate::Column::NbColumn);
55 ui->tableWidget->setColumnCount((int)CatalogueEventsWidgetPrivate::Column::NbColumn);
56 ui->tableWidget->setHorizontalHeaderLabels(impl->columnNames());
57 ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
58 ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
59 ui->tableWidget->horizontalHeader()->setSortIndicatorShown(true);
60 }
61
62 CatalogueEventsWidget::~CatalogueEventsWidget()
63 {
64 delete ui;
65 }
66
67 void CatalogueEventsWidget::populateWithCatalogue(const QString &catalogue)
68 {
69 ui->tableWidget->clearContents();
70 ui->tableWidget->setRowCount(0);
71
72 // TODO
73 impl->addEventItem(
74 {catalogue + " - Event 1", "12/12/2012 12:12", "12/12/2042 12:52", "cloud", "mfi/b_gse42"},
75 ui->tableWidget);
76 impl->addEventItem(
77 {catalogue + " - Event 2", "12/12/2012 12:10", "12/12/2042 12:42", "Acloud", "mfi/b_gse1"},
78 ui->tableWidget);
79 impl->addEventItem(
80 {catalogue + " - Event 3", "12/12/2012 12:22", "12/12/2042 12:12", "Gcloud", "mfi/b_gse2"},
81 ui->tableWidget);
82 impl->addEventItem(
83 {catalogue + " - Event 4", "12/12/2012 12:00", "12/12/2042 12:62", "Bcloud", "mfi/b_gse3"},
84 ui->tableWidget);
85 }
86
87 void CatalogueEventsWidget::CatalogueEventsWidgetPrivate::addEventItem(const QStringList &data,
88 QTableWidget *tableWidget)
89 {
90 tableWidget->setSortingEnabled(false);
91 auto row = tableWidget->rowCount();
92 tableWidget->setRowCount(row + 1);
93
94 for (auto i = 0; i < (int)Column::NbColumn; ++i) {
95 auto item = new QTableWidgetItem(data.value(i));
96 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
97 tableWidget->setItem(row, i, item);
98 }
99 tableWidget->setSortingEnabled(true);
100 }
@@ -0,0 +1,22
1 #include "Catalogue/CatalogueExplorer.h"
2 #include "ui_CatalogueExplorer.h"
3
4 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
5 : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
6 ui(new Ui::CatalogueExplorer)
7 {
8 ui->setupUi(this);
9
10 connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto name) {
11 ui->inspector->setCatalogue(name);
12 ui->events->populateWithCatalogue(name);
13 });
14
15 connect(ui->events, &CatalogueEventsWidget::eventSelected,
16 [this](auto name) { ui->inspector->setEvent(name); });
17 }
18
19 CatalogueExplorer::~CatalogueExplorer()
20 {
21 delete ui;
22 }
@@ -0,0 +1,36
1 #include "Catalogue/CatalogueInspectorWidget.h"
2 #include "ui_CatalogueInspectorWidget.h"
3
4 CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent)
5 : QWidget(parent), ui(new Ui::CatalogueInspectorWidget)
6 {
7 ui->setupUi(this);
8 showPage(Page::Empty);
9 }
10
11 CatalogueInspectorWidget::~CatalogueInspectorWidget()
12 {
13 delete ui;
14 }
15
16 void CatalogueInspectorWidget::showPage(CatalogueInspectorWidget::Page page)
17 {
18 ui->stackedWidget->setCurrentIndex(static_cast<int>(page));
19 }
20
21 CatalogueInspectorWidget::Page CatalogueInspectorWidget::currentPage() const
22 {
23 return static_cast<Page>(ui->stackedWidget->currentIndex());
24 }
25
26 void CatalogueInspectorWidget::setEvent(const QString &event)
27 {
28 showPage(Page::EventProperties);
29 ui->leEventName->setText(event);
30 }
31
32 void CatalogueInspectorWidget::setCatalogue(const QString &catalogue)
33 {
34 showPage(Page::CatalogueProperties);
35 ui->leCatalogueName->setText(catalogue);
36 }
@@ -0,0 +1,101
1 #include "Catalogue/CatalogueSideBarWidget.h"
2 #include "ui_CatalogueSideBarWidget.h"
3
4 constexpr auto ALL_EVENT_ITEM_TYPE = QTreeWidgetItem::UserType;
5 constexpr auto TRASH_ITEM_TYPE = QTreeWidgetItem::UserType + 1;
6 constexpr auto CATALOGUE_ITEM_TYPE = QTreeWidgetItem::UserType + 2;
7 constexpr auto DATABASE_ITEM_TYPE = QTreeWidgetItem::UserType + 3;
8
9
10 struct CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate {
11 void configureTreeWidget(QTreeWidget *treeWidget);
12 QTreeWidgetItem *addDatabaseItem(const QString &name, QTreeWidget *treeWidget);
13 void addCatalogueItem(const QString &name, QTreeWidgetItem *parentDatabaseItem);
14 };
15
16 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent)
17 : QWidget(parent),
18 ui(new Ui::CatalogueSideBarWidget),
19 impl{spimpl::make_unique_impl<CatalogueSideBarWidgetPrivate>()}
20 {
21 ui->setupUi(this);
22 impl->configureTreeWidget(ui->treeWidget);
23
24 auto emitSelection = [this](auto item) {
25 switch (item->type()) {
26 case CATALOGUE_ITEM_TYPE:
27 emit this->catalogueSelected(item->text(0));
28 break;
29 case ALL_EVENT_ITEM_TYPE:
30 emit this->allEventsSelected();
31 break;
32 case TRASH_ITEM_TYPE:
33 emit this->trashSelected();
34 break;
35 case DATABASE_ITEM_TYPE:
36 default:
37 break;
38 }
39 };
40
41 connect(ui->treeWidget, &QTreeWidget::itemClicked, emitSelection);
42 connect(ui->treeWidget, &QTreeWidget::currentItemChanged, emitSelection);
43 }
44
45 CatalogueSideBarWidget::~CatalogueSideBarWidget()
46 {
47 delete ui;
48 }
49
50 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::configureTreeWidget(
51 QTreeWidget *treeWidget)
52 {
53 auto allEventsItem = new QTreeWidgetItem({"All Events"}, ALL_EVENT_ITEM_TYPE);
54 allEventsItem->setIcon(0, QIcon(":/icones/allEvents.png"));
55 treeWidget->addTopLevelItem(allEventsItem);
56
57 auto trashItem = new QTreeWidgetItem({"Trash"}, TRASH_ITEM_TYPE);
58 trashItem->setIcon(0, QIcon(":/icones/trash.png"));
59 treeWidget->addTopLevelItem(trashItem);
60
61 auto separator = new QFrame(treeWidget);
62 separator->setFrameShape(QFrame::HLine);
63
64 auto separatorItem = new QTreeWidgetItem();
65 separatorItem->setFlags(Qt::NoItemFlags);
66 treeWidget->addTopLevelItem(separatorItem);
67 treeWidget->setItemWidget(separatorItem, 0, separator);
68
69 // Test
70 auto db = addDatabaseItem("Database 1", treeWidget);
71 addCatalogueItem("Catalogue 1", db);
72 addCatalogueItem("Catalogue 2", db);
73 addCatalogueItem("Catalogue 3", db);
74 addCatalogueItem("Catalogue 4", db);
75
76 auto db2 = addDatabaseItem("Database 2", treeWidget);
77 addCatalogueItem("Catalogue A", db2);
78 addCatalogueItem("Catalogue B", db2);
79 addCatalogueItem("Catalogue C", db2);
80
81 treeWidget->expandAll();
82 }
83
84 QTreeWidgetItem *
85 CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::addDatabaseItem(const QString &name,
86 QTreeWidget *treeWidget)
87 {
88 auto databaseItem = new QTreeWidgetItem({name}, DATABASE_ITEM_TYPE);
89 databaseItem->setIcon(0, QIcon(":/icones/database.png"));
90 treeWidget->addTopLevelItem(databaseItem);
91
92 return databaseItem;
93 }
94
95 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::addCatalogueItem(
96 const QString &name, QTreeWidgetItem *parentDatabaseItem)
97 {
98 auto catalogueItem = new QTreeWidgetItem({name}, CATALOGUE_ITEM_TYPE);
99 catalogueItem->setIcon(0, QIcon(":/icones/catalogue.png"));
100 parentDatabaseItem->addChild(catalogueItem);
101 }
@@ -0,0 +1,139
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
3 <class>CatalogueEventsWidget</class>
4 <widget class="QWidget" name="CatalogueEventsWidget">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>566</width>
10 <height>258</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Form</string>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout">
17 <property name="leftMargin">
18 <number>0</number>
19 </property>
20 <property name="topMargin">
21 <number>0</number>
22 </property>
23 <property name="rightMargin">
24 <number>0</number>
25 </property>
26 <property name="bottomMargin">
27 <number>0</number>
28 </property>
29 <item>
30 <layout class="QHBoxLayout" name="horizontalLayout">
31 <item>
32 <widget class="QToolButton" name="btnAdd">
33 <property name="text">
34 <string>+</string>
35 </property>
36 <property name="icon">
37 <iconset>
38 <normaloff>:/icones/add.png</normaloff>:/icones/add.png</iconset>
39 </property>
40 <property name="autoRaise">
41 <bool>true</bool>
42 </property>
43 </widget>
44 </item>
45 <item>
46 <widget class="QToolButton" name="btnRemove">
47 <property name="text">
48 <string> - </string>
49 </property>
50 <property name="icon">
51 <iconset>
52 <normaloff>:/icones/remove.png</normaloff>:/icones/remove.png</iconset>
53 </property>
54 <property name="autoRaise">
55 <bool>true</bool>
56 </property>
57 </widget>
58 </item>
59 <item>
60 <widget class="Line" name="line">
61 <property name="orientation">
62 <enum>Qt::Vertical</enum>
63 </property>
64 </widget>
65 </item>
66 <item>
67 <widget class="QToolButton" name="btnTime">
68 <property name="text">
69 <string>T</string>
70 </property>
71 <property name="icon">
72 <iconset>
73 <normaloff>:/icones/time.png</normaloff>:/icones/time.png</iconset>
74 </property>
75 <property name="checkable">
76 <bool>true</bool>
77 </property>
78 <property name="autoRaise">
79 <bool>true</bool>
80 </property>
81 </widget>
82 </item>
83 <item>
84 <widget class="QToolButton" name="btnChart">
85 <property name="text">
86 <string>G</string>
87 </property>
88 <property name="icon">
89 <iconset>
90 <normaloff>:/icones/chart.png</normaloff>:/icones/chart.png</iconset>
91 </property>
92 <property name="checkable">
93 <bool>true</bool>
94 </property>
95 <property name="autoRaise">
96 <bool>true</bool>
97 </property>
98 </widget>
99 </item>
100 <item>
101 <widget class="Line" name="line_2">
102 <property name="orientation">
103 <enum>Qt::Vertical</enum>
104 </property>
105 </widget>
106 </item>
107 <item>
108 <widget class="QLineEdit" name="lineEdit">
109 <property name="enabled">
110 <bool>false</bool>
111 </property>
112 </widget>
113 </item>
114 </layout>
115 </item>
116 <item>
117 <widget class="QTableWidget" name="tableWidget">
118 <property name="alternatingRowColors">
119 <bool>true</bool>
120 </property>
121 <property name="selectionBehavior">
122 <enum>QAbstractItemView::SelectRows</enum>
123 </property>
124 <attribute name="horizontalHeaderHighlightSections">
125 <bool>false</bool>
126 </attribute>
127 <attribute name="verticalHeaderVisible">
128 <bool>false</bool>
129 </attribute>
130 <attribute name="verticalHeaderDefaultSectionSize">
131 <number>25</number>
132 </attribute>
133 </widget>
134 </item>
135 </layout>
136 </widget>
137 <resources/>
138 <connections/>
139 </ui>
@@ -0,0 +1,83
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
3 <class>CatalogueExplorer</class>
4 <widget class="QDialog" name="CatalogueExplorer">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>755</width>
10 <height>481</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Catalogue Explorer</string>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout">
17 <item>
18 <widget class="QSplitter" name="horizontalSplitter">
19 <property name="orientation">
20 <enum>Qt::Horizontal</enum>
21 </property>
22 <widget class="CatalogueSideBarWidget" name="catalogues" native="true">
23 <property name="sizePolicy">
24 <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
25 <horstretch>1</horstretch>
26 <verstretch>0</verstretch>
27 </sizepolicy>
28 </property>
29 </widget>
30 <widget class="QSplitter" name="verticalSplitter">
31 <property name="sizePolicy">
32 <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
33 <horstretch>3</horstretch>
34 <verstretch>0</verstretch>
35 </sizepolicy>
36 </property>
37 <property name="orientation">
38 <enum>Qt::Vertical</enum>
39 </property>
40 <widget class="CatalogueEventsWidget" name="events" native="true">
41 <property name="sizePolicy">
42 <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
43 <horstretch>0</horstretch>
44 <verstretch>5</verstretch>
45 </sizepolicy>
46 </property>
47 </widget>
48 <widget class="CatalogueInspectorWidget" name="inspector" native="true">
49 <property name="sizePolicy">
50 <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
51 <horstretch>0</horstretch>
52 <verstretch>2</verstretch>
53 </sizepolicy>
54 </property>
55 </widget>
56 </widget>
57 </widget>
58 </item>
59 </layout>
60 </widget>
61 <customwidgets>
62 <customwidget>
63 <class>CatalogueSideBarWidget</class>
64 <extends>QWidget</extends>
65 <header>Catalogue/CatalogueSideBarWidget.h</header>
66 <container>1</container>
67 </customwidget>
68 <customwidget>
69 <class>CatalogueEventsWidget</class>
70 <extends>QWidget</extends>
71 <header>Catalogue/CatalogueEventsWidget.h</header>
72 <container>1</container>
73 </customwidget>
74 <customwidget>
75 <class>CatalogueInspectorWidget</class>
76 <extends>QWidget</extends>
77 <header>Catalogue/CatalogueInspectorWidget.h</header>
78 <container>1</container>
79 </customwidget>
80 </customwidgets>
81 <resources/>
82 <connections/>
83 </ui>
@@ -0,0 +1,214
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
3 <class>CatalogueInspectorWidget</class>
4 <widget class="QWidget" name="CatalogueInspectorWidget">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>400</width>
10 <height>300</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Form</string>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout_2">
17 <property name="leftMargin">
18 <number>0</number>
19 </property>
20 <property name="topMargin">
21 <number>0</number>
22 </property>
23 <property name="rightMargin">
24 <number>0</number>
25 </property>
26 <property name="bottomMargin">
27 <number>0</number>
28 </property>
29 <item>
30 <widget class="QFrame" name="frame">
31 <property name="frameShape">
32 <enum>QFrame::Box</enum>
33 </property>
34 <property name="frameShadow">
35 <enum>QFrame::Sunken</enum>
36 </property>
37 <property name="lineWidth">
38 <number>1</number>
39 </property>
40 <layout class="QVBoxLayout" name="verticalLayout">
41 <property name="leftMargin">
42 <number>0</number>
43 </property>
44 <property name="topMargin">
45 <number>0</number>
46 </property>
47 <property name="rightMargin">
48 <number>0</number>
49 </property>
50 <property name="bottomMargin">
51 <number>0</number>
52 </property>
53 <item>
54 <widget class="QStackedWidget" name="stackedWidget">
55 <property name="currentIndex">
56 <number>1</number>
57 </property>
58 <widget class="QWidget" name="emptyPage"/>
59 <widget class="QWidget" name="catalogueInspectorPage">
60 <layout class="QGridLayout" name="gridLayout_2">
61 <item row="1" column="0">
62 <widget class="QLabel" name="label_7">
63 <property name="text">
64 <string>Name</string>
65 </property>
66 </widget>
67 </item>
68 <item row="1" column="1">
69 <widget class="QLineEdit" name="leCatalogueName"/>
70 </item>
71 <item row="2" column="0">
72 <widget class="QLabel" name="label_8">
73 <property name="text">
74 <string>Author</string>
75 </property>
76 </widget>
77 </item>
78 <item row="2" column="1">
79 <widget class="QLineEdit" name="leCatalogueAuthor">
80 <property name="text">
81 <string/>
82 </property>
83 </widget>
84 </item>
85 <item row="3" column="1">
86 <spacer name="verticalSpacer_2">
87 <property name="orientation">
88 <enum>Qt::Vertical</enum>
89 </property>
90 <property name="sizeHint" stdset="0">
91 <size>
92 <width>20</width>
93 <height>40</height>
94 </size>
95 </property>
96 </spacer>
97 </item>
98 <item row="0" column="0" colspan="2">
99 <widget class="QLabel" name="label_9">
100 <property name="font">
101 <font>
102 <pointsize>10</pointsize>
103 <weight>75</weight>
104 <bold>true</bold>
105 </font>
106 </property>
107 <property name="text">
108 <string>Catalogue Properties</string>
109 </property>
110 </widget>
111 </item>
112 </layout>
113 </widget>
114 <widget class="QWidget" name="eventInspectorPage">
115 <layout class="QGridLayout" name="gridLayout">
116 <item row="5" column="1">
117 <widget class="QDateTimeEdit" name="dateTimeEventTEnd"/>
118 </item>
119 <item row="4" column="0">
120 <widget class="QLabel" name="label_4">
121 <property name="text">
122 <string>TStart</string>
123 </property>
124 </widget>
125 </item>
126 <item row="6" column="0">
127 <widget class="QLabel" name="label_6">
128 <property name="text">
129 <string>Tags</string>
130 </property>
131 </widget>
132 </item>
133 <item row="3" column="0">
134 <widget class="QLabel" name="label_3">
135 <property name="text">
136 <string>Product</string>
137 </property>
138 </widget>
139 </item>
140 <item row="3" column="1">
141 <widget class="QLineEdit" name="leEventProduct"/>
142 </item>
143 <item row="5" column="0">
144 <widget class="QLabel" name="label_5">
145 <property name="text">
146 <string>Tend</string>
147 </property>
148 </widget>
149 </item>
150 <item row="4" column="1">
151 <widget class="QDateTimeEdit" name="dateTimeEventTStart"/>
152 </item>
153 <item row="2" column="0">
154 <widget class="QLabel" name="label_2">
155 <property name="text">
156 <string>Mission</string>
157 </property>
158 </widget>
159 </item>
160 <item row="1" column="1">
161 <widget class="QLineEdit" name="leEventName"/>
162 </item>
163 <item row="1" column="0">
164 <widget class="QLabel" name="label">
165 <property name="text">
166 <string>Name</string>
167 </property>
168 </widget>
169 </item>
170 <item row="2" column="1">
171 <widget class="QLineEdit" name="leEventMission"/>
172 </item>
173 <item row="6" column="1">
174 <widget class="QLineEdit" name="leEventTags"/>
175 </item>
176 <item row="7" column="1">
177 <spacer name="verticalSpacer">
178 <property name="orientation">
179 <enum>Qt::Vertical</enum>
180 </property>
181 <property name="sizeHint" stdset="0">
182 <size>
183 <width>20</width>
184 <height>40</height>
185 </size>
186 </property>
187 </spacer>
188 </item>
189 <item row="0" column="0" colspan="2">
190 <widget class="QLabel" name="label_10">
191 <property name="font">
192 <font>
193 <pointsize>10</pointsize>
194 <weight>75</weight>
195 <bold>true</bold>
196 </font>
197 </property>
198 <property name="text">
199 <string>Event Properties</string>
200 </property>
201 </widget>
202 </item>
203 </layout>
204 </widget>
205 </widget>
206 </item>
207 </layout>
208 </widget>
209 </item>
210 </layout>
211 </widget>
212 <resources/>
213 <connections/>
214 </ui>
@@ -0,0 +1,90
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
3 <class>CatalogueSideBarWidget</class>
4 <widget class="QWidget" name="CatalogueSideBarWidget">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>330</width>
10 <height>523</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Form</string>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout">
17 <property name="leftMargin">
18 <number>0</number>
19 </property>
20 <property name="topMargin">
21 <number>0</number>
22 </property>
23 <property name="rightMargin">
24 <number>0</number>
25 </property>
26 <property name="bottomMargin">
27 <number>0</number>
28 </property>
29 <item>
30 <layout class="QHBoxLayout" name="horizontalLayout">
31 <item>
32 <widget class="QToolButton" name="btnAdd">
33 <property name="text">
34 <string>+</string>
35 </property>
36 <property name="icon">
37 <iconset>
38 <normaloff>:/icones/add.png</normaloff>:/icones/add.png</iconset>
39 </property>
40 <property name="autoRaise">
41 <bool>true</bool>
42 </property>
43 </widget>
44 </item>
45 <item>
46 <widget class="QToolButton" name="btnRemove">
47 <property name="text">
48 <string> - </string>
49 </property>
50 <property name="icon">
51 <iconset>
52 <normaloff>:/icones/remove.png</normaloff>:/icones/remove.png</iconset>
53 </property>
54 <property name="autoRaise">
55 <bool>true</bool>
56 </property>
57 </widget>
58 </item>
59 <item>
60 <spacer name="horizontalSpacer">
61 <property name="orientation">
62 <enum>Qt::Horizontal</enum>
63 </property>
64 <property name="sizeHint" stdset="0">
65 <size>
66 <width>40</width>
67 <height>20</height>
68 </size>
69 </property>
70 </spacer>
71 </item>
72 </layout>
73 </item>
74 <item>
75 <widget class="QTreeWidget" name="treeWidget">
76 <attribute name="headerVisible">
77 <bool>false</bool>
78 </attribute>
79 <column>
80 <property name="text">
81 <string notr="true">1</string>
82 </property>
83 </column>
84 </widget>
85 </item>
86 </layout>
87 </widget>
88 <resources/>
89 <connections/>
90 </ui>
@@ -1,353 +1,364
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 <Catalogue/CatalogueExplorer.h>
25 #include <DataSource/DataSourceController.h>
26 #include <DataSource/DataSourceController.h>
26 #include <DataSource/DataSourceWidget.h>
27 #include <DataSource/DataSourceWidget.h>
27 #include <Settings/SqpSettingsDialog.h>
28 #include <Settings/SqpSettingsDialog.h>
28 #include <Settings/SqpSettingsGeneralWidget.h>
29 #include <Settings/SqpSettingsGeneralWidget.h>
29 #include <SidePane/SqpSidePane.h>
30 #include <SidePane/SqpSidePane.h>
30 #include <SqpApplication.h>
31 #include <SqpApplication.h>
31 #include <Time/TimeController.h>
32 #include <Time/TimeController.h>
32 #include <TimeWidget/TimeWidget.h>
33 #include <TimeWidget/TimeWidget.h>
33 #include <Variable/Variable.h>
34 #include <Variable/Variable.h>
34 #include <Variable/VariableController.h>
35 #include <Variable/VariableController.h>
35 #include <Visualization/VisualizationController.h>
36 #include <Visualization/VisualizationController.h>
36
37
37 #include <QAction>
38 #include <QAction>
38 #include <QDate>
39 #include <QDate>
39 #include <QDir>
40 #include <QDir>
40 #include <QFileDialog>
41 #include <QFileDialog>
41 #include <QToolBar>
42 #include <QToolBar>
42 #include <QToolButton>
43 #include <QToolButton>
43 #include <memory.h>
44 #include <memory.h>
44
45
45 #include "iostream"
46 #include "iostream"
46
47
47 Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow")
48 Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow")
48
49
49 namespace {
50 namespace {
50 const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0;
51 const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0;
51 const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1;
52 const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1;
52 const auto VIEWPLITTERINDEX = 2;
53 const auto VIEWPLITTERINDEX = 2;
53 const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3;
54 const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3;
54 const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4;
55 const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4;
55 }
56 }
56
57
57 class MainWindow::MainWindowPrivate {
58 class MainWindow::MainWindowPrivate {
58 public:
59 public:
59 explicit MainWindowPrivate(MainWindow *mainWindow)
60 explicit MainWindowPrivate(MainWindow *mainWindow)
60 : m_LastOpenLeftInspectorSize{},
61 : m_LastOpenLeftInspectorSize{},
61 m_LastOpenRightInspectorSize{},
62 m_LastOpenRightInspectorSize{},
62 m_GeneralSettingsWidget{new SqpSettingsGeneralWidget{mainWindow}},
63 m_GeneralSettingsWidget{new SqpSettingsGeneralWidget{mainWindow}},
63 m_SettingsDialog{new SqpSettingsDialog{mainWindow}}
64 m_SettingsDialog{new SqpSettingsDialog{mainWindow}},
65 m_CatalogExplorer{new CatalogueExplorer{mainWindow}}
64 {
66 {
65 }
67 }
66
68
67 QSize m_LastOpenLeftInspectorSize;
69 QSize m_LastOpenLeftInspectorSize;
68 QSize m_LastOpenRightInspectorSize;
70 QSize m_LastOpenRightInspectorSize;
69 /// General settings widget. MainWindow has the ownership
71 /// General settings widget. MainWindow has the ownership
70 SqpSettingsGeneralWidget *m_GeneralSettingsWidget;
72 SqpSettingsGeneralWidget *m_GeneralSettingsWidget;
71 /// Settings dialog. MainWindow has the ownership
73 /// Settings dialog. MainWindow has the ownership
72 SqpSettingsDialog *m_SettingsDialog;
74 SqpSettingsDialog *m_SettingsDialog;
75 /// Catalogue dialog. MainWindow has the ownership
76 CatalogueExplorer *m_CatalogExplorer;
73 };
77 };
74
78
75 MainWindow::MainWindow(QWidget *parent)
79 MainWindow::MainWindow(QWidget *parent)
76 : QMainWindow{parent},
80 : QMainWindow{parent},
77 m_Ui{new Ui::MainWindow},
81 m_Ui{new Ui::MainWindow},
78 impl{spimpl::make_unique_impl<MainWindowPrivate>(this)}
82 impl{spimpl::make_unique_impl<MainWindowPrivate>(this)}
79 {
83 {
80 m_Ui->setupUi(this);
84 m_Ui->setupUi(this);
81
85
82 m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false);
86 m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false);
83 m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false);
87 m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false);
84
88
85
89
86 auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane();
90 auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane();
87 auto openLeftInspectorAction = new QAction{QIcon{
91 auto openLeftInspectorAction = new QAction{QIcon{
88 ":/icones/previous.png",
92 ":/icones/previous.png",
89 },
93 },
90 tr("Show/hide the left inspector"), this};
94 tr("Show/hide the left inspector"), this};
91
95
92
96
93 auto spacerLeftTop = new QWidget{};
97 auto spacerLeftTop = new QWidget{};
94 spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
98 spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
95
99
96 auto spacerLeftBottom = new QWidget{};
100 auto spacerLeftBottom = new QWidget{};
97 spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
101 spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
98
102
99 leftSidePane->addWidget(spacerLeftTop);
103 leftSidePane->addWidget(spacerLeftTop);
100 leftSidePane->addAction(openLeftInspectorAction);
104 leftSidePane->addAction(openLeftInspectorAction);
101 leftSidePane->addWidget(spacerLeftBottom);
105 leftSidePane->addWidget(spacerLeftBottom);
102
106
103
107
104 auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane();
108 auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane();
105 auto openRightInspectorAction = new QAction{QIcon{
109 auto openRightInspectorAction = new QAction{QIcon{
106 ":/icones/next.png",
110 ":/icones/next.png",
107 },
111 },
108 tr("Show/hide the right inspector"), this};
112 tr("Show/hide the right inspector"), this};
109
113
110 auto spacerRightTop = new QWidget{};
114 auto spacerRightTop = new QWidget{};
111 spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
115 spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
112
116
113 auto spacerRightBottom = new QWidget{};
117 auto spacerRightBottom = new QWidget{};
114 spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
118 spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
115
119
116 rightSidePane->addWidget(spacerRightTop);
120 rightSidePane->addWidget(spacerRightTop);
117 rightSidePane->addAction(openRightInspectorAction);
121 rightSidePane->addAction(openRightInspectorAction);
118 rightSidePane->addWidget(spacerRightBottom);
122 rightSidePane->addWidget(spacerRightBottom);
119
123
120 openLeftInspectorAction->setCheckable(true);
124 openLeftInspectorAction->setCheckable(true);
121 openRightInspectorAction->setCheckable(true);
125 openRightInspectorAction->setCheckable(true);
122
126
123 auto openInspector = [this](bool checked, bool right, auto action) {
127 auto openInspector = [this](bool checked, bool right, auto action) {
124
128
125 action->setIcon(QIcon{(checked xor right) ? ":/icones/next.png" : ":/icones/previous.png"});
129 action->setIcon(QIcon{(checked xor right) ? ":/icones/next.png" : ":/icones/previous.png"});
126
130
127 auto &lastInspectorSize
131 auto &lastInspectorSize
128 = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize;
132 = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize;
129
133
130 auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size()
134 auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size()
131 : m_Ui->leftMainInspectorWidget->size();
135 : m_Ui->leftMainInspectorWidget->size();
132
136
133 // Update of the last opened geometry
137 // Update of the last opened geometry
134 if (checked) {
138 if (checked) {
135 lastInspectorSize = nextInspectorSize;
139 lastInspectorSize = nextInspectorSize;
136 }
140 }
137
141
138 auto startSize = lastInspectorSize;
142 auto startSize = lastInspectorSize;
139 auto endSize = startSize;
143 auto endSize = startSize;
140 endSize.setWidth(0);
144 endSize.setWidth(0);
141
145
142 auto splitterInspectorIndex
146 auto splitterInspectorIndex
143 = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX;
147 = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX;
144
148
145 auto currentSizes = m_Ui->splitter->sizes();
149 auto currentSizes = m_Ui->splitter->sizes();
146 if (checked) {
150 if (checked) {
147 // adjust sizes individually here, e.g.
151 // adjust sizes individually here, e.g.
148 currentSizes[splitterInspectorIndex] -= lastInspectorSize.width();
152 currentSizes[splitterInspectorIndex] -= lastInspectorSize.width();
149 currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width();
153 currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width();
150 m_Ui->splitter->setSizes(currentSizes);
154 m_Ui->splitter->setSizes(currentSizes);
151 }
155 }
152 else {
156 else {
153 // adjust sizes individually here, e.g.
157 // adjust sizes individually here, e.g.
154 currentSizes[splitterInspectorIndex] += lastInspectorSize.width();
158 currentSizes[splitterInspectorIndex] += lastInspectorSize.width();
155 currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width();
159 currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width();
156 m_Ui->splitter->setSizes(currentSizes);
160 m_Ui->splitter->setSizes(currentSizes);
157 }
161 }
158
162
159 };
163 };
160
164
161
165
162 connect(openLeftInspectorAction, &QAction::triggered,
166 connect(openLeftInspectorAction, &QAction::triggered,
163 [openInspector, openLeftInspectorAction](bool checked) {
167 [openInspector, openLeftInspectorAction](bool checked) {
164 openInspector(checked, false, openLeftInspectorAction);
168 openInspector(checked, false, openLeftInspectorAction);
165 });
169 });
166 connect(openRightInspectorAction, &QAction::triggered,
170 connect(openRightInspectorAction, &QAction::triggered,
167 [openInspector, openRightInspectorAction](bool checked) {
171 [openInspector, openRightInspectorAction](bool checked) {
168 openInspector(checked, true, openRightInspectorAction);
172 openInspector(checked, true, openRightInspectorAction);
169 });
173 });
170
174
171 // //////////////// //
175 // //////////////// //
172 // Menu and Toolbar //
176 // Menu and Toolbar //
173 // //////////////// //
177 // //////////////// //
174 this->menuBar()->addAction(tr("File"));
178 this->menuBar()->addAction(tr("File"));
175 auto toolsMenu = this->menuBar()->addMenu(tr("Tools"));
179 auto toolsMenu = this->menuBar()->addMenu(tr("Tools"));
176 toolsMenu->addAction(tr("Settings..."), [this]() {
180 toolsMenu->addAction(tr("Settings..."), [this]() {
177 // Loads settings
181 // Loads settings
178 impl->m_SettingsDialog->loadSettings();
182 impl->m_SettingsDialog->loadSettings();
179
183
180 // Open settings dialog and save settings if the dialog is accepted
184 // Open settings dialog and save settings if the dialog is accepted
181 if (impl->m_SettingsDialog->exec() == QDialog::Accepted) {
185 if (impl->m_SettingsDialog->exec() == QDialog::Accepted) {
182 impl->m_SettingsDialog->saveSettings();
186 impl->m_SettingsDialog->saveSettings();
183 }
187 }
184
188
185 });
189 });
186
190
187 auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar"));
191 auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar"));
188
192
189 auto timeWidget = new TimeWidget{};
193 auto timeWidget = new TimeWidget{};
190 mainToolBar->addWidget(timeWidget);
194 mainToolBar->addWidget(timeWidget);
191
195
196 // Interaction modes
192 auto actionPointerMode = new QAction{QIcon(":/icones/pointer.png"), "Move", this};
197 auto actionPointerMode = new QAction{QIcon(":/icones/pointer.png"), "Move", this};
193 actionPointerMode->setCheckable(true);
198 actionPointerMode->setCheckable(true);
194 actionPointerMode->setChecked(sqpApp->plotsInteractionMode()
199 actionPointerMode->setChecked(sqpApp->plotsInteractionMode()
195 == SqpApplication::PlotsInteractionMode::None);
200 == SqpApplication::PlotsInteractionMode::None);
196 connect(actionPointerMode, &QAction::triggered,
201 connect(actionPointerMode, &QAction::triggered,
197 []() { sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::None); });
202 []() { sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::None); });
198
203
199 auto actionZoomMode = new QAction{QIcon(":/icones/zoom.png"), "Zoom", this};
204 auto actionZoomMode = new QAction{QIcon(":/icones/zoom.png"), "Zoom", this};
200 actionZoomMode->setCheckable(true);
205 actionZoomMode->setCheckable(true);
201 actionZoomMode->setChecked(sqpApp->plotsInteractionMode()
206 actionZoomMode->setChecked(sqpApp->plotsInteractionMode()
202 == SqpApplication::PlotsInteractionMode::ZoomBox);
207 == SqpApplication::PlotsInteractionMode::ZoomBox);
203 connect(actionZoomMode, &QAction::triggered, []() {
208 connect(actionZoomMode, &QAction::triggered, []() {
204 sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::ZoomBox);
209 sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::ZoomBox);
205 });
210 });
206
211
207 auto actionOrganisationMode = new QAction{QIcon(":/icones/drag.png"), "Organize", this};
212 auto actionOrganisationMode = new QAction{QIcon(":/icones/drag.png"), "Organize", this};
208 actionOrganisationMode->setCheckable(true);
213 actionOrganisationMode->setCheckable(true);
209 actionOrganisationMode->setChecked(sqpApp->plotsInteractionMode()
214 actionOrganisationMode->setChecked(sqpApp->plotsInteractionMode()
210 == SqpApplication::PlotsInteractionMode::DragAndDrop);
215 == SqpApplication::PlotsInteractionMode::DragAndDrop);
211 connect(actionOrganisationMode, &QAction::triggered, []() {
216 connect(actionOrganisationMode, &QAction::triggered, []() {
212 sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::DragAndDrop);
217 sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::DragAndDrop);
213 });
218 });
214
219
215 auto actionZonesMode = new QAction{QIcon(":/icones/rectangle.png"), "Zones", this};
220 auto actionZonesMode = new QAction{QIcon(":/icones/rectangle.png"), "Zones", this};
216 actionZonesMode->setCheckable(true);
221 actionZonesMode->setCheckable(true);
217 actionZonesMode->setChecked(sqpApp->plotsInteractionMode()
222 actionZonesMode->setChecked(sqpApp->plotsInteractionMode()
218 == SqpApplication::PlotsInteractionMode::SelectionZones);
223 == SqpApplication::PlotsInteractionMode::SelectionZones);
219 connect(actionZonesMode, &QAction::triggered, []() {
224 connect(actionZonesMode, &QAction::triggered, []() {
220 sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::SelectionZones);
225 sqpApp->setPlotsInteractionMode(SqpApplication::PlotsInteractionMode::SelectionZones);
221 });
226 });
222
227
223 auto modeActionGroup = new QActionGroup{this};
228 auto modeActionGroup = new QActionGroup{this};
224 modeActionGroup->addAction(actionZoomMode);
229 modeActionGroup->addAction(actionZoomMode);
225 modeActionGroup->addAction(actionZonesMode);
230 modeActionGroup->addAction(actionZonesMode);
226 modeActionGroup->addAction(actionOrganisationMode);
231 modeActionGroup->addAction(actionOrganisationMode);
227 modeActionGroup->addAction(actionPointerMode);
232 modeActionGroup->addAction(actionPointerMode);
228 modeActionGroup->setExclusive(true);
233 modeActionGroup->setExclusive(true);
229
234
230 mainToolBar->addSeparator();
235 mainToolBar->addSeparator();
231 mainToolBar->addAction(actionPointerMode);
236 mainToolBar->addAction(actionPointerMode);
232 mainToolBar->addAction(actionZoomMode);
237 mainToolBar->addAction(actionZoomMode);
233 mainToolBar->addAction(actionOrganisationMode);
238 mainToolBar->addAction(actionOrganisationMode);
234 mainToolBar->addAction(actionZonesMode);
239 mainToolBar->addAction(actionZonesMode);
235 mainToolBar->addSeparator();
240 mainToolBar->addSeparator();
236
241
242 // Cursors
237 auto btnCursor = new QToolButton{this};
243 auto btnCursor = new QToolButton{this};
238 btnCursor->setIcon(QIcon(":/icones/cursor.png"));
244 btnCursor->setIcon(QIcon(":/icones/cursor.png"));
239 btnCursor->setText("Cursor");
245 btnCursor->setText("Cursor");
240 btnCursor->setToolTip("Cursor");
246 btnCursor->setToolTip("Cursor");
241 btnCursor->setPopupMode(QToolButton::InstantPopup);
247 btnCursor->setPopupMode(QToolButton::InstantPopup);
242 auto cursorMenu = new QMenu("CursorMenu", this);
248 auto cursorMenu = new QMenu("CursorMenu", this);
243 btnCursor->setMenu(cursorMenu);
249 btnCursor->setMenu(cursorMenu);
244
250
245 auto noCursorAction = cursorMenu->addAction("No Cursor");
251 auto noCursorAction = cursorMenu->addAction("No Cursor");
246 noCursorAction->setCheckable(true);
252 noCursorAction->setCheckable(true);
247 noCursorAction->setChecked(sqpApp->plotsCursorMode()
253 noCursorAction->setChecked(sqpApp->plotsCursorMode()
248 == SqpApplication::PlotsCursorMode::NoCursor);
254 == SqpApplication::PlotsCursorMode::NoCursor);
249 connect(noCursorAction, &QAction::triggered,
255 connect(noCursorAction, &QAction::triggered,
250 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::NoCursor); });
256 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::NoCursor); });
251
257
252 cursorMenu->addSeparator();
258 cursorMenu->addSeparator();
253 auto verticalCursorAction = cursorMenu->addAction("Vertical Cursor");
259 auto verticalCursorAction = cursorMenu->addAction("Vertical Cursor");
254 verticalCursorAction->setCheckable(true);
260 verticalCursorAction->setCheckable(true);
255 verticalCursorAction->setChecked(sqpApp->plotsCursorMode()
261 verticalCursorAction->setChecked(sqpApp->plotsCursorMode()
256 == SqpApplication::PlotsCursorMode::Vertical);
262 == SqpApplication::PlotsCursorMode::Vertical);
257 connect(verticalCursorAction, &QAction::triggered,
263 connect(verticalCursorAction, &QAction::triggered,
258 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Vertical); });
264 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Vertical); });
259
265
260 auto temporalCursorAction = cursorMenu->addAction("Temporal Cursor");
266 auto temporalCursorAction = cursorMenu->addAction("Temporal Cursor");
261 temporalCursorAction->setCheckable(true);
267 temporalCursorAction->setCheckable(true);
262 temporalCursorAction->setChecked(sqpApp->plotsCursorMode()
268 temporalCursorAction->setChecked(sqpApp->plotsCursorMode()
263 == SqpApplication::PlotsCursorMode::Temporal);
269 == SqpApplication::PlotsCursorMode::Temporal);
264 connect(temporalCursorAction, &QAction::triggered,
270 connect(temporalCursorAction, &QAction::triggered,
265 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Temporal); });
271 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Temporal); });
266
272
267 auto horizontalCursorAction = cursorMenu->addAction("Horizontal Cursor");
273 auto horizontalCursorAction = cursorMenu->addAction("Horizontal Cursor");
268 horizontalCursorAction->setCheckable(true);
274 horizontalCursorAction->setCheckable(true);
269 horizontalCursorAction->setChecked(sqpApp->plotsCursorMode()
275 horizontalCursorAction->setChecked(sqpApp->plotsCursorMode()
270 == SqpApplication::PlotsCursorMode::Horizontal);
276 == SqpApplication::PlotsCursorMode::Horizontal);
271 connect(horizontalCursorAction, &QAction::triggered,
277 connect(horizontalCursorAction, &QAction::triggered,
272 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Horizontal); });
278 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Horizontal); });
273
279
274 auto crossCursorAction = cursorMenu->addAction("Cross Cursor");
280 auto crossCursorAction = cursorMenu->addAction("Cross Cursor");
275 crossCursorAction->setCheckable(true);
281 crossCursorAction->setCheckable(true);
276 crossCursorAction->setChecked(sqpApp->plotsCursorMode()
282 crossCursorAction->setChecked(sqpApp->plotsCursorMode()
277 == SqpApplication::PlotsCursorMode::Cross);
283 == SqpApplication::PlotsCursorMode::Cross);
278 connect(crossCursorAction, &QAction::triggered,
284 connect(crossCursorAction, &QAction::triggered,
279 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Cross); });
285 []() { sqpApp->setPlotsCursorMode(SqpApplication::PlotsCursorMode::Cross); });
280
286
281 mainToolBar->addWidget(btnCursor);
287 mainToolBar->addWidget(btnCursor);
282
288
283 auto cursorModeActionGroup = new QActionGroup{this};
289 auto cursorModeActionGroup = new QActionGroup{this};
284 cursorModeActionGroup->setExclusive(true);
290 cursorModeActionGroup->setExclusive(true);
285 cursorModeActionGroup->addAction(noCursorAction);
291 cursorModeActionGroup->addAction(noCursorAction);
286 cursorModeActionGroup->addAction(verticalCursorAction);
292 cursorModeActionGroup->addAction(verticalCursorAction);
287 cursorModeActionGroup->addAction(temporalCursorAction);
293 cursorModeActionGroup->addAction(temporalCursorAction);
288 cursorModeActionGroup->addAction(horizontalCursorAction);
294 cursorModeActionGroup->addAction(horizontalCursorAction);
289 cursorModeActionGroup->addAction(crossCursorAction);
295 cursorModeActionGroup->addAction(crossCursorAction);
290
296
297 // Catalog
298 mainToolBar->addSeparator();
299 mainToolBar->addAction(QIcon(":/icones/catalogue.png"), "Catalogues",
300 [this]() { impl->m_CatalogExplorer->show(); });
301
291 // //////// //
302 // //////// //
292 // Settings //
303 // Settings //
293 // //////// //
304 // //////// //
294
305
295 // Registers "general settings" widget to the settings dialog
306 // Registers "general settings" widget to the settings dialog
296 impl->m_SettingsDialog->registerWidget(QStringLiteral("General"),
307 impl->m_SettingsDialog->registerWidget(QStringLiteral("General"),
297 impl->m_GeneralSettingsWidget);
308 impl->m_GeneralSettingsWidget);
298
309
299 // /////////// //
310 // /////////// //
300 // Connections //
311 // Connections //
301 // /////////// //
312 // /////////// //
302
313
303 // Controllers / controllers connections
314 // Controllers / controllers connections
304 connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpRange)), &sqpApp->variableController(),
315 connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpRange)), &sqpApp->variableController(),
305 SLOT(onDateTimeOnSelection(SqpRange)));
316 SLOT(onDateTimeOnSelection(SqpRange)));
306
317
307 // Widgets / controllers connections
318 // Widgets / controllers connections
308
319
309 // DataSource
320 // DataSource
310 connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)),
321 connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)),
311 m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *)));
322 m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *)));
312
323
313 // Time
324 // Time
314 connect(timeWidget, SIGNAL(timeUpdated(SqpRange)), &sqpApp->timeController(),
325 connect(timeWidget, SIGNAL(timeUpdated(SqpRange)), &sqpApp->timeController(),
315 SLOT(onTimeToUpdate(SqpRange)));
326 SLOT(onTimeToUpdate(SqpRange)));
316
327
317 // Visualization
328 // Visualization
318 connect(&sqpApp->visualizationController(),
329 connect(&sqpApp->visualizationController(),
319 SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), m_Ui->view,
330 SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), m_Ui->view,
320 SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable>)));
331 SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable>)));
321
332
322 connect(&sqpApp->visualizationController(),
333 connect(&sqpApp->visualizationController(),
323 SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)), m_Ui->view,
334 SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)), m_Ui->view,
324 SLOT(onRangeChanged(std::shared_ptr<Variable>, const SqpRange &)));
335 SLOT(onRangeChanged(std::shared_ptr<Variable>, const SqpRange &)));
325
336
326 // Widgets / widgets connections
337 // Widgets / widgets connections
327
338
328 // For the following connections, we use DirectConnection to allow each widget that can
339 // For the following connections, we use DirectConnection to allow each widget that can
329 // potentially attach a menu to the variable's menu to do so before this menu is displayed.
340 // potentially attach a menu to the variable's menu to do so before this menu is displayed.
330 // The order of connections is also important, since it determines the order in which each
341 // The order of connections is also important, since it determines the order in which each
331 // widget will attach its menu
342 // widget will attach its menu
332 connect(
343 connect(
333 m_Ui->variableInspectorWidget,
344 m_Ui->variableInspectorWidget,
334 SIGNAL(tableMenuAboutToBeDisplayed(QMenu *, const QVector<std::shared_ptr<Variable> > &)),
345 SIGNAL(tableMenuAboutToBeDisplayed(QMenu *, const QVector<std::shared_ptr<Variable> > &)),
335 m_Ui->view, SLOT(attachVariableMenu(QMenu *, const QVector<std::shared_ptr<Variable> > &)),
346 m_Ui->view, SLOT(attachVariableMenu(QMenu *, const QVector<std::shared_ptr<Variable> > &)),
336 Qt::DirectConnection);
347 Qt::DirectConnection);
337 }
348 }
338
349
339 MainWindow::~MainWindow()
350 MainWindow::~MainWindow()
340 {
351 {
341 }
352 }
342
353
343 void MainWindow::changeEvent(QEvent *e)
354 void MainWindow::changeEvent(QEvent *e)
344 {
355 {
345 QMainWindow::changeEvent(e);
356 QMainWindow::changeEvent(e);
346 switch (e->type()) {
357 switch (e->type()) {
347 case QEvent::LanguageChange:
358 case QEvent::LanguageChange:
348 m_Ui->retranslateUi(this);
359 m_Ui->retranslateUi(this);
349 break;
360 break;
350 default:
361 default:
351 break;
362 break;
352 }
363 }
353 }
364 }
@@ -1,170 +1,170
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
2 <ui version="4.0">
3 <class>MainWindow</class>
3 <class>MainWindow</class>
4 <widget class="QMainWindow" name="MainWindow">
4 <widget class="QMainWindow" name="MainWindow">
5 <property name="geometry">
5 <property name="geometry">
6 <rect>
6 <rect>
7 <x>0</x>
7 <x>0</x>
8 <y>0</y>
8 <y>0</y>
9 <width>800</width>
9 <width>800</width>
10 <height>600</height>
10 <height>600</height>
11 </rect>
11 </rect>
12 </property>
12 </property>
13 <property name="windowTitle">
13 <property name="windowTitle">
14 <string>SciQlop v0.0.1</string>
14 <string>SciQlop v0.0.1</string>
15 </property>
15 </property>
16 <property name="dockNestingEnabled">
16 <property name="dockNestingEnabled">
17 <bool>true</bool>
17 <bool>true</bool>
18 </property>
18 </property>
19 <widget class="QWidget" name="centralWidget">
19 <widget class="QWidget" name="centralWidget">
20 <property name="enabled">
20 <property name="enabled">
21 <bool>true</bool>
21 <bool>true</bool>
22 </property>
22 </property>
23 <property name="sizePolicy">
23 <property name="sizePolicy">
24 <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
24 <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
25 <horstretch>0</horstretch>
25 <horstretch>0</horstretch>
26 <verstretch>0</verstretch>
26 <verstretch>0</verstretch>
27 </sizepolicy>
27 </sizepolicy>
28 </property>
28 </property>
29 <property name="maximumSize">
29 <property name="maximumSize">
30 <size>
30 <size>
31 <width>16777215</width>
31 <width>16777215</width>
32 <height>16777215</height>
32 <height>16777215</height>
33 </size>
33 </size>
34 </property>
34 </property>
35 <layout class="QHBoxLayout" name="horizontalLayout">
35 <layout class="QHBoxLayout" name="horizontalLayout">
36 <property name="spacing">
36 <property name="spacing">
37 <number>0</number>
37 <number>0</number>
38 </property>
38 </property>
39 <property name="leftMargin">
39 <property name="leftMargin">
40 <number>0</number>
40 <number>0</number>
41 </property>
41 </property>
42 <property name="topMargin">
42 <property name="topMargin">
43 <number>0</number>
43 <number>0</number>
44 </property>
44 </property>
45 <property name="rightMargin">
45 <property name="rightMargin">
46 <number>0</number>
46 <number>0</number>
47 </property>
47 </property>
48 <property name="bottomMargin">
48 <property name="bottomMargin">
49 <number>0</number>
49 <number>0</number>
50 </property>
50 </property>
51 <item>
51 <item>
52 <widget class="QSplitter" name="splitter">
52 <widget class="QSplitter" name="splitter">
53 <property name="orientation">
53 <property name="orientation">
54 <enum>Qt::Horizontal</enum>
54 <enum>Qt::Horizontal</enum>
55 </property>
55 </property>
56 <widget class="QWidget" name="leftMainInspectorWidget" native="true">
56 <widget class="QWidget" name="leftMainInspectorWidget" native="true">
57 <layout class="QVBoxLayout" name="verticalLayout">
57 <layout class="QVBoxLayout" name="verticalLayout">
58 <property name="spacing">
58 <property name="spacing">
59 <number>0</number>
59 <number>0</number>
60 </property>
60 </property>
61 <property name="leftMargin">
61 <property name="leftMargin">
62 <number>0</number>
62 <number>0</number>
63 </property>
63 </property>
64 <property name="topMargin">
64 <property name="topMargin">
65 <number>0</number>
65 <number>0</number>
66 </property>
66 </property>
67 <property name="rightMargin">
67 <property name="rightMargin">
68 <number>0</number>
68 <number>0</number>
69 </property>
69 </property>
70 <property name="bottomMargin">
70 <property name="bottomMargin">
71 <number>0</number>
71 <number>0</number>
72 </property>
72 </property>
73 <item>
73 <item>
74 <widget class="DataSourceWidget" name="dataSourceWidget" native="true"/>
74 <widget class="DataSourceWidget" name="dataSourceWidget" native="true"/>
75 </item>
75 </item>
76 <item>
76 <item>
77 <widget class="QWidget" name="dateTimeWidget" native="true"/>
77 <widget class="QWidget" name="dateTimeWidget" native="true"/>
78 </item>
78 </item>
79 <item>
79 <item>
80 <widget class="VariableInspectorWidget" name="variableInspectorWidget" native="true"/>
80 <widget class="VariableInspectorWidget" name="variableInspectorWidget" native="true"/>
81 </item>
81 </item>
82 </layout>
82 </layout>
83 </widget>
83 </widget>
84 <widget class="SqpSidePane" name="leftInspectorSidePane" native="true"/>
84 <widget class="SqpSidePane" name="leftInspectorSidePane" native="true"/>
85 <widget class="VisualizationWidget" name="view" native="true">
85 <widget class="VisualizationWidget" name="view" native="true">
86 <property name="sizePolicy">
86 <property name="sizePolicy">
87 <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
87 <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
88 <horstretch>0</horstretch>
88 <horstretch>0</horstretch>
89 <verstretch>0</verstretch>
89 <verstretch>0</verstretch>
90 </sizepolicy>
90 </sizepolicy>
91 </property>
91 </property>
92 </widget>
92 </widget>
93 <widget class="SqpSidePane" name="rightInspectorSidePane" native="true"/>
93 <widget class="SqpSidePane" name="rightInspectorSidePane" native="true"/>
94 <widget class="QWidget" name="rightMainInspectorWidget" native="true">
94 <widget class="QWidget" name="rightMainInspectorWidget" native="true">
95 <layout class="QVBoxLayout" name="verticalLayout_3">
95 <layout class="QVBoxLayout" name="verticalLayout_3">
96 <property name="spacing">
96 <property name="spacing">
97 <number>0</number>
97 <number>0</number>
98 </property>
98 </property>
99 <property name="leftMargin">
99 <property name="leftMargin">
100 <number>0</number>
100 <number>0</number>
101 </property>
101 </property>
102 <property name="topMargin">
102 <property name="topMargin">
103 <number>0</number>
103 <number>0</number>
104 </property>
104 </property>
105 <property name="rightMargin">
105 <property name="rightMargin">
106 <number>0</number>
106 <number>0</number>
107 </property>
107 </property>
108 <property name="bottomMargin">
108 <property name="bottomMargin">
109 <number>0</number>
109 <number>0</number>
110 </property>
110 </property>
111 <item>
111 <item>
112 <widget class="QWidget" name="commonPropertyInspectorWidget" native="true"/>
112 <widget class="QWidget" name="commonPropertyInspectorWidget" native="true"/>
113 </item>
113 </item>
114 <item>
114 <item>
115 <widget class="QTreeWidget" name="catalogWidget">
115 <widget class="QTreeWidget" name="catalogWidget">
116 <column>
116 <column>
117 <property name="text">
117 <property name="text">
118 <string notr="true">Name</string>
118 <string notr="true">Name</string>
119 </property>
119 </property>
120 </column>
120 </column>
121 </widget>
121 </widget>
122 </item>
122 </item>
123 </layout>
123 </layout>
124 </widget>
124 </widget>
125 </widget>
125 </widget>
126 </item>
126 </item>
127 </layout>
127 </layout>
128 </widget>
128 </widget>
129 <widget class="QMenuBar" name="menuBar">
129 <widget class="QMenuBar" name="menuBar">
130 <property name="geometry">
130 <property name="geometry">
131 <rect>
131 <rect>
132 <x>0</x>
132 <x>0</x>
133 <y>0</y>
133 <y>0</y>
134 <width>800</width>
134 <width>800</width>
135 <height>28</height>
135 <height>21</height>
136 </rect>
136 </rect>
137 </property>
137 </property>
138 </widget>
138 </widget>
139 <widget class="QStatusBar" name="statusBar"/>
139 <widget class="QStatusBar" name="statusBar"/>
140 </widget>
140 </widget>
141 <layoutdefault spacing="6" margin="11"/>
141 <layoutdefault spacing="6" margin="11"/>
142 <customwidgets>
142 <customwidgets>
143 <customwidget>
143 <customwidget>
144 <class>VisualizationWidget</class>
144 <class>VisualizationWidget</class>
145 <extends>QWidget</extends>
145 <extends>QWidget</extends>
146 <header location="global">Visualization/VisualizationWidget.h</header>
146 <header location="global">Visualization/VisualizationWidget.h</header>
147 <container>1</container>
147 <container>1</container>
148 </customwidget>
148 </customwidget>
149 <customwidget>
149 <customwidget>
150 <class>SqpSidePane</class>
150 <class>SqpSidePane</class>
151 <extends>QWidget</extends>
151 <extends>QWidget</extends>
152 <header location="global">SidePane/SqpSidePane.h</header>
152 <header location="global">SidePane/SqpSidePane.h</header>
153 <container>1</container>
153 <container>1</container>
154 </customwidget>
154 </customwidget>
155 <customwidget>
155 <customwidget>
156 <class>DataSourceWidget</class>
156 <class>DataSourceWidget</class>
157 <extends>QWidget</extends>
157 <extends>QWidget</extends>
158 <header location="global">DataSource/DataSourceWidget.h</header>
158 <header location="global">DataSource/DataSourceWidget.h</header>
159 <container>1</container>
159 <container>1</container>
160 </customwidget>
160 </customwidget>
161 <customwidget>
161 <customwidget>
162 <class>VariableInspectorWidget</class>
162 <class>VariableInspectorWidget</class>
163 <extends>QWidget</extends>
163 <extends>QWidget</extends>
164 <header location="global">Variable/VariableInspectorWidget.h</header>
164 <header location="global">Variable/VariableInspectorWidget.h</header>
165 <container>1</container>
165 <container>1</container>
166 </customwidget>
166 </customwidget>
167 </customwidgets>
167 </customwidgets>
168 <resources/>
168 <resources/>
169 <connections/>
169 <connections/>
170 </ui>
170 </ui>
@@ -1,110 +1,122
1
1
2 gui_moc_headers = [
2 gui_moc_headers = [
3 'include/DataSource/DataSourceWidget.h',
3 'include/DataSource/DataSourceWidget.h',
4 'include/Settings/SqpSettingsDialog.h',
4 'include/Settings/SqpSettingsDialog.h',
5 'include/Settings/SqpSettingsGeneralWidget.h',
5 'include/Settings/SqpSettingsGeneralWidget.h',
6 'include/SidePane/SqpSidePane.h',
6 'include/SidePane/SqpSidePane.h',
7 'include/SqpApplication.h',
7 'include/SqpApplication.h',
8 'include/DragAndDrop/DragDropScroller.h',
8 'include/DragAndDrop/DragDropScroller.h',
9 'include/DragAndDrop/DragDropTabSwitcher.h',
9 'include/DragAndDrop/DragDropTabSwitcher.h',
10 'include/TimeWidget/TimeWidget.h',
10 'include/TimeWidget/TimeWidget.h',
11 'include/Variable/VariableInspectorWidget.h',
11 'include/Variable/VariableInspectorWidget.h',
12 'include/Variable/RenameVariableDialog.h',
12 'include/Variable/RenameVariableDialog.h',
13 'include/Visualization/qcustomplot.h',
13 'include/Visualization/qcustomplot.h',
14 'include/Visualization/VisualizationGraphWidget.h',
14 'include/Visualization/VisualizationGraphWidget.h',
15 'include/Visualization/VisualizationTabWidget.h',
15 'include/Visualization/VisualizationTabWidget.h',
16 'include/Visualization/VisualizationWidget.h',
16 'include/Visualization/VisualizationWidget.h',
17 'include/Visualization/VisualizationZoneWidget.h',
17 'include/Visualization/VisualizationZoneWidget.h',
18 'include/Visualization/VisualizationDragDropContainer.h',
18 'include/Visualization/VisualizationDragDropContainer.h',
19 'include/Visualization/VisualizationDragWidget.h',
19 'include/Visualization/VisualizationDragWidget.h',
20 'include/Visualization/ColorScaleEditor.h',
20 'include/Visualization/ColorScaleEditor.h',
21 'include/Actions/SelectionZoneAction.h',
21 'include/Actions/SelectionZoneAction.h',
22 'include/Visualization/VisualizationMultiZoneSelectionDialog.h'
22 'include/Visualization/VisualizationMultiZoneSelectionDialog.h',
23 'include/Catalogue/CatalogueExplorer.h',
24 'include/Catalogue/CatalogueEventsWidget.h',
25 'include/Catalogue/CatalogueSideBarWidget.h',
26 'include/Catalogue/CatalogueInspectorWidget.h'
23 ]
27 ]
24
28
25 gui_ui_files = [
29 gui_ui_files = [
26 'ui/DataSource/DataSourceWidget.ui',
30 'ui/DataSource/DataSourceWidget.ui',
27 'ui/Settings/SqpSettingsDialog.ui',
31 'ui/Settings/SqpSettingsDialog.ui',
28 'ui/Settings/SqpSettingsGeneralWidget.ui',
32 'ui/Settings/SqpSettingsGeneralWidget.ui',
29 'ui/SidePane/SqpSidePane.ui',
33 'ui/SidePane/SqpSidePane.ui',
30 'ui/TimeWidget/TimeWidget.ui',
34 'ui/TimeWidget/TimeWidget.ui',
31 'ui/Variable/VariableInspectorWidget.ui',
35 'ui/Variable/VariableInspectorWidget.ui',
32 'ui/Variable/RenameVariableDialog.ui',
36 'ui/Variable/RenameVariableDialog.ui',
33 'ui/Variable/VariableMenuHeaderWidget.ui',
37 'ui/Variable/VariableMenuHeaderWidget.ui',
34 'ui/Visualization/VisualizationGraphWidget.ui',
38 'ui/Visualization/VisualizationGraphWidget.ui',
35 'ui/Visualization/VisualizationTabWidget.ui',
39 'ui/Visualization/VisualizationTabWidget.ui',
36 'ui/Visualization/VisualizationWidget.ui',
40 'ui/Visualization/VisualizationWidget.ui',
37 'ui/Visualization/VisualizationZoneWidget.ui',
41 'ui/Visualization/VisualizationZoneWidget.ui',
38 'ui/Visualization/ColorScaleEditor.ui',
42 'ui/Visualization/ColorScaleEditor.ui',
39 'ui/Visualization/VisualizationMultiZoneSelectionDialog.ui'
43 'ui/Visualization/VisualizationMultiZoneSelectionDialog.ui',
44 'ui/Catalogue/CatalogueExplorer.ui',
45 'ui/Catalogue/CatalogueEventsWidget.ui',
46 'ui/Catalogue/CatalogueSideBarWidget.ui',
47 'ui/Catalogue/CatalogueInspectorWidget.ui'
40 ]
48 ]
41
49
42 gui_qresources = ['resources/sqpguiresources.qrc']
50 gui_qresources = ['resources/sqpguiresources.qrc']
43
51
44 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
52 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
45 ui_files : gui_ui_files,
53 ui_files : gui_ui_files,
46 qresources : gui_qresources)
54 qresources : gui_qresources)
47
55
48 gui_sources = [
56 gui_sources = [
49 'src/SqpApplication.cpp',
57 'src/SqpApplication.cpp',
50 'src/DragAndDrop/DragDropGuiController.cpp',
58 'src/DragAndDrop/DragDropGuiController.cpp',
51 'src/DragAndDrop/DragDropScroller.cpp',
59 'src/DragAndDrop/DragDropScroller.cpp',
52 'src/DragAndDrop/DragDropTabSwitcher.cpp',
60 'src/DragAndDrop/DragDropTabSwitcher.cpp',
53 'src/Common/ColorUtils.cpp',
61 'src/Common/ColorUtils.cpp',
54 'src/Common/VisualizationDef.cpp',
62 'src/Common/VisualizationDef.cpp',
55 'src/DataSource/DataSourceTreeWidgetItem.cpp',
63 'src/DataSource/DataSourceTreeWidgetItem.cpp',
56 'src/DataSource/DataSourceTreeWidgetHelper.cpp',
64 'src/DataSource/DataSourceTreeWidgetHelper.cpp',
57 'src/DataSource/DataSourceWidget.cpp',
65 'src/DataSource/DataSourceWidget.cpp',
58 'src/DataSource/DataSourceTreeWidget.cpp',
66 'src/DataSource/DataSourceTreeWidget.cpp',
59 'src/Settings/SqpSettingsDialog.cpp',
67 'src/Settings/SqpSettingsDialog.cpp',
60 'src/Settings/SqpSettingsGeneralWidget.cpp',
68 'src/Settings/SqpSettingsGeneralWidget.cpp',
61 'src/SidePane/SqpSidePane.cpp',
69 'src/SidePane/SqpSidePane.cpp',
62 'src/TimeWidget/TimeWidget.cpp',
70 'src/TimeWidget/TimeWidget.cpp',
63 'src/Variable/VariableInspectorWidget.cpp',
71 'src/Variable/VariableInspectorWidget.cpp',
64 'src/Variable/VariableInspectorTableView.cpp',
72 'src/Variable/VariableInspectorTableView.cpp',
65 'src/Variable/VariableMenuHeaderWidget.cpp',
73 'src/Variable/VariableMenuHeaderWidget.cpp',
66 'src/Variable/RenameVariableDialog.cpp',
74 'src/Variable/RenameVariableDialog.cpp',
67 'src/Visualization/VisualizationGraphHelper.cpp',
75 'src/Visualization/VisualizationGraphHelper.cpp',
68 'src/Visualization/VisualizationGraphRenderingDelegate.cpp',
76 'src/Visualization/VisualizationGraphRenderingDelegate.cpp',
69 'src/Visualization/VisualizationGraphWidget.cpp',
77 'src/Visualization/VisualizationGraphWidget.cpp',
70 'src/Visualization/VisualizationTabWidget.cpp',
78 'src/Visualization/VisualizationTabWidget.cpp',
71 'src/Visualization/VisualizationWidget.cpp',
79 'src/Visualization/VisualizationWidget.cpp',
72 'src/Visualization/VisualizationZoneWidget.cpp',
80 'src/Visualization/VisualizationZoneWidget.cpp',
73 'src/Visualization/qcustomplot.cpp',
81 'src/Visualization/qcustomplot.cpp',
74 'src/Visualization/QCustomPlotSynchronizer.cpp',
82 'src/Visualization/QCustomPlotSynchronizer.cpp',
75 'src/Visualization/operations/FindVariableOperation.cpp',
83 'src/Visualization/operations/FindVariableOperation.cpp',
76 'src/Visualization/operations/GenerateVariableMenuOperation.cpp',
84 'src/Visualization/operations/GenerateVariableMenuOperation.cpp',
77 'src/Visualization/operations/MenuBuilder.cpp',
85 'src/Visualization/operations/MenuBuilder.cpp',
78 'src/Visualization/operations/RemoveVariableOperation.cpp',
86 'src/Visualization/operations/RemoveVariableOperation.cpp',
79 'src/Visualization/operations/RescaleAxeOperation.cpp',
87 'src/Visualization/operations/RescaleAxeOperation.cpp',
80 'src/Visualization/VisualizationDragDropContainer.cpp',
88 'src/Visualization/VisualizationDragDropContainer.cpp',
81 'src/Visualization/VisualizationDragWidget.cpp',
89 'src/Visualization/VisualizationDragWidget.cpp',
82 'src/Visualization/AxisRenderingUtils.cpp',
90 'src/Visualization/AxisRenderingUtils.cpp',
83 'src/Visualization/PlottablesRenderingUtils.cpp',
91 'src/Visualization/PlottablesRenderingUtils.cpp',
84 'src/Visualization/MacScrollBarStyle.cpp',
92 'src/Visualization/MacScrollBarStyle.cpp',
85 'src/Visualization/VisualizationCursorItem.cpp',
93 'src/Visualization/VisualizationCursorItem.cpp',
86 'src/Visualization/ColorScaleEditor.cpp',
94 'src/Visualization/ColorScaleEditor.cpp',
87 'src/Visualization/SqpColorScale.cpp',
95 'src/Visualization/SqpColorScale.cpp',
88 'src/Visualization/QCPColorMapIterator.cpp',
96 'src/Visualization/QCPColorMapIterator.cpp',
89 'src/Visualization/VisualizationSelectionZoneItem.cpp',
97 'src/Visualization/VisualizationSelectionZoneItem.cpp',
90 'src/Visualization/VisualizationSelectionZoneManager.cpp',
98 'src/Visualization/VisualizationSelectionZoneManager.cpp',
91 'src/Actions/SelectionZoneAction.cpp',
99 'src/Actions/SelectionZoneAction.cpp',
92 'src/Actions/ActionsGuiController.cpp',
100 'src/Actions/ActionsGuiController.cpp',
93 'src/Visualization/VisualizationActionManager.cpp',
101 'src/Visualization/VisualizationActionManager.cpp',
94 'src/Visualization/VisualizationMultiZoneSelectionDialog.cpp'
102 'src/Visualization/VisualizationMultiZoneSelectionDialog.cpp',
103 'src/Catalogue/CatalogueExplorer.cpp',
104 'src/Catalogue/CatalogueEventsWidget.cpp',
105 'src/Catalogue/CatalogueSideBarWidget.cpp',
106 'src/Catalogue/CatalogueInspectorWidget.cpp'
95 ]
107 ]
96
108
97 gui_inc = include_directories(['include'])
109 gui_inc = include_directories(['include'])
98
110
99 sciqlop_gui_lib = library('sciqlopgui',
111 sciqlop_gui_lib = library('sciqlopgui',
100 gui_sources,
112 gui_sources,
101 gui_moc_files,
113 gui_moc_files,
102 include_directories : [gui_inc],
114 include_directories : [gui_inc],
103 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core],
115 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core],
104 install : true
116 install : true
105 )
117 )
106
118
107 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
119 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
108 include_directories : gui_inc,
120 include_directories : gui_inc,
109 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core])
121 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core])
110
122
@@ -1,22 +1,29
1 <RCC>
1 <RCC>
2 <qresource prefix="/">
2 <qresource prefix="/">
3 <file>icones/dataSourceComponent.png</file>
3 <file>icones/dataSourceComponent.png</file>
4 <file>icones/dataSourceNode.png</file>
4 <file>icones/dataSourceNode.png</file>
5 <file>icones/dataSourceProduct.png</file>
5 <file>icones/dataSourceProduct.png</file>
6 <file>icones/dataSourceRoot.png</file>
6 <file>icones/dataSourceRoot.png</file>
7 <file>icones/delete.png</file>
7 <file>icones/delete.png</file>
8 <file>icones/down.png</file>
8 <file>icones/down.png</file>
9 <file>icones/openInspector.png</file>
9 <file>icones/openInspector.png</file>
10 <file>icones/next.png</file>
10 <file>icones/next.png</file>
11 <file>icones/plot.png</file>
11 <file>icones/plot.png</file>
12 <file>icones/previous.png</file>
12 <file>icones/previous.png</file>
13 <file>icones/unplot.png</file>
13 <file>icones/unplot.png</file>
14 <file>icones/up.png</file>
14 <file>icones/up.png</file>
15 <file>icones/time.png</file>
15 <file>icones/time.png</file>
16 <file>icones/zoom.png</file>
16 <file>icones/zoom.png</file>
17 <file>icones/rectangle.png</file>
17 <file>icones/rectangle.png</file>
18 <file>icones/drag.png</file>
18 <file>icones/drag.png</file>
19 <file>icones/cursor.png</file>
19 <file>icones/cursor.png</file>
20 <file>icones/pointer.png</file>
20 <file>icones/pointer.png</file>
21 <file>icones/catalogue.png</file>
22 <file>icones/add.png</file>
23 <file>icones/remove.png</file>
24 <file>icones/chart.png</file>
25 <file>icones/allEvents.png</file>
26 <file>icones/trash.png</file>
27 <file>icones/database.png</file>
21 </qresource>
28 </qresource>
22 </RCC>
29 </RCC>
@@ -1,440 +1,438
1 #include "Visualization/VisualizationSelectionZoneItem.h"
1 #include "Visualization/VisualizationSelectionZoneItem.h"
2 #include "Visualization/VisualizationGraphWidget.h"
2 #include "Visualization/VisualizationGraphWidget.h"
3 #include "Visualization/VisualizationSelectionZoneManager.h"
3 #include "Visualization/VisualizationSelectionZoneManager.h"
4 #include "Visualization/VisualizationWidget.h"
4 #include "Visualization/VisualizationWidget.h"
5
5
6 const QString &DEFAULT_COLOR = QStringLiteral("#E79D41");
6 const QString &DEFAULT_COLOR = QStringLiteral("#E79D41");
7
7
8 struct VisualizationSelectionZoneItem::VisualizationSelectionZoneItemPrivate {
8 struct VisualizationSelectionZoneItem::VisualizationSelectionZoneItemPrivate {
9
9
10 QCustomPlot *m_Plot;
10 QCustomPlot *m_Plot;
11 double m_T1 = 0;
11 double m_T1 = 0;
12 double m_T2 = 0;
12 double m_T2 = 0;
13 QColor m_Color;
13 QColor m_Color;
14
14
15 bool m_IsEditionEnabled = true;
15 bool m_IsEditionEnabled = true;
16 double m_MovedOrinalT1 = 0;
16 double m_MovedOrinalT1 = 0;
17 double m_MovedOrinalT2 = 0;
17 double m_MovedOrinalT2 = 0;
18
18
19 QCPItemStraightLine *m_LeftLine;
19 QCPItemStraightLine *m_LeftLine;
20 QCPItemStraightLine *m_RightLine;
20 QCPItemStraightLine *m_RightLine;
21 QCPItemText *m_NameLabelItem = nullptr;
21 QCPItemText *m_NameLabelItem = nullptr;
22
22
23 enum class EditionMode { NoEdition, ResizeLeft, ResizeRight, Move };
23 enum class EditionMode { NoEdition, ResizeLeft, ResizeRight, Move };
24 EditionMode m_CurrentEditionMode;
24 EditionMode m_CurrentEditionMode;
25
25
26 QVector<VisualizationSelectionZoneItem *> m_AssociatedEditedZones;
26 QVector<VisualizationSelectionZoneItem *> m_AssociatedEditedZones;
27
27
28 VisualizationSelectionZoneItemPrivate(QCustomPlot *plot)
28 VisualizationSelectionZoneItemPrivate(QCustomPlot *plot)
29 : m_Plot(plot), m_Color(Qt::blue), m_CurrentEditionMode(EditionMode::NoEdition)
29 : m_Plot(plot), m_Color(Qt::blue), m_CurrentEditionMode(EditionMode::NoEdition)
30 {
30 {
31 }
31 }
32
32
33 void updatePosition(VisualizationSelectionZoneItem *item)
33 void updatePosition(VisualizationSelectionZoneItem *item)
34 {
34 {
35 item->topLeft->setCoords(m_T1, 0);
35 item->topLeft->setCoords(m_T1, 0);
36 item->bottomRight->setCoords(m_T2, 1);
36 item->bottomRight->setCoords(m_T2, 1);
37 }
37 }
38
38
39 EditionMode getEditionMode(const QPoint &pos, const VisualizationSelectionZoneItem *zoneItem)
39 EditionMode getEditionMode(const QPoint &pos, const VisualizationSelectionZoneItem *zoneItem)
40 {
40 {
41 auto distanceLeft = m_LeftLine->selectTest(pos, false);
41 auto distanceLeft = m_LeftLine->selectTest(pos, false);
42 auto distanceRight = m_RightLine->selectTest(pos, false);
42 auto distanceRight = m_RightLine->selectTest(pos, false);
43 auto distance = zoneItem->selectTest(pos, false);
43 auto distance = zoneItem->selectTest(pos, false);
44
44
45 if (distanceRight <= distance) {
45 if (distanceRight <= distance) {
46 return VisualizationSelectionZoneItemPrivate::EditionMode::ResizeRight;
46 return VisualizationSelectionZoneItemPrivate::EditionMode::ResizeRight;
47 }
47 }
48 else if (distanceLeft <= distance) {
48 else if (distanceLeft <= distance) {
49 return VisualizationSelectionZoneItemPrivate::EditionMode::ResizeLeft;
49 return VisualizationSelectionZoneItemPrivate::EditionMode::ResizeLeft;
50 }
50 }
51
51
52 return VisualizationSelectionZoneItemPrivate::EditionMode::Move;
52 return VisualizationSelectionZoneItemPrivate::EditionMode::Move;
53 }
53 }
54
54
55 double pixelSizeToAxisXSize(double pixels)
55 double pixelSizeToAxisXSize(double pixels)
56 {
56 {
57 auto axis = m_Plot->axisRect()->axis(QCPAxis::atBottom);
57 auto axis = m_Plot->axisRect()->axis(QCPAxis::atBottom);
58 return axis->pixelToCoord(pixels) - axis->pixelToCoord(0);
58 return axis->pixelToCoord(pixels) - axis->pixelToCoord(0);
59 }
59 }
60
60
61 bool alignZones(VisualizationSelectionZoneItem *referenceZone,
61 bool alignZones(VisualizationSelectionZoneItem *referenceZone,
62 const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, bool alignOnLeft,
62 const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, bool alignOnLeft,
63 bool allowResize, bool vertically)
63 bool allowResize, bool vertically)
64 {
64 {
65 auto result = false;
65 auto result = false;
66
66
67 auto referenceTime
67 auto referenceTime
68 = alignOnLeft ? referenceZone->range().m_TStart : referenceZone->range().m_TEnd;
68 = alignOnLeft ? referenceZone->range().m_TStart : referenceZone->range().m_TEnd;
69
69
70 auto referenceBottomAxis = m_Plot->axisRect()->axis(QCPAxis::atBottom);
70 auto referenceBottomAxis = m_Plot->axisRect()->axis(QCPAxis::atBottom);
71 auto referenceVerticalPosition = referenceBottomAxis->coordToPixel(referenceTime);
71 auto referenceVerticalPosition = referenceBottomAxis->coordToPixel(referenceTime);
72
72
73 for (auto otherZone : zonesToAlign) {
73 for (auto otherZone : zonesToAlign) {
74
74
75 auto otherZoneRange = otherZone->range();
75 auto otherZoneRange = otherZone->range();
76 auto newZoneStart = otherZoneRange.m_TStart;
76 auto newZoneStart = otherZoneRange.m_TStart;
77 auto newZoneEnd = otherZoneRange.m_TEnd;
77 auto newZoneEnd = otherZoneRange.m_TEnd;
78
78
79 auto alignedTime = referenceTime;
79 auto alignedTime = referenceTime;
80 if (vertically) {
80 if (vertically) {
81 auto otherZoneAxis = otherZone->parentPlot()->axisRect()->axis(QCPAxis::atBottom);
81 auto otherZoneAxis = otherZone->parentPlot()->axisRect()->axis(QCPAxis::atBottom);
82 alignedTime = otherZoneAxis->pixelToCoord(referenceVerticalPosition);
82 alignedTime = otherZoneAxis->pixelToCoord(referenceVerticalPosition);
83 }
83 }
84
84
85 if (alignOnLeft) {
85 if (alignOnLeft) {
86 newZoneStart = alignedTime;
86 newZoneStart = alignedTime;
87 if (!allowResize) {
87 if (!allowResize) {
88 newZoneEnd = alignedTime + (otherZoneRange.m_TEnd - otherZoneRange.m_TStart);
88 newZoneEnd = alignedTime + (otherZoneRange.m_TEnd - otherZoneRange.m_TStart);
89 }
89 }
90 }
90 }
91 else { // align on right
91 else { // align on right
92 newZoneEnd = alignedTime;
92 newZoneEnd = alignedTime;
93 if (!allowResize) {
93 if (!allowResize) {
94 newZoneStart = alignedTime - (otherZoneRange.m_TEnd - otherZoneRange.m_TStart);
94 newZoneStart = alignedTime - (otherZoneRange.m_TEnd - otherZoneRange.m_TStart);
95 }
95 }
96 }
96 }
97
97
98 if (newZoneStart < newZoneEnd) {
98 if (newZoneStart < newZoneEnd) {
99 result = true;
99 result = true;
100 otherZone->setRange(newZoneStart, newZoneEnd);
100 otherZone->setRange(newZoneStart, newZoneEnd);
101 otherZone->parentPlot()->replot();
101 otherZone->parentPlot()->replot();
102 }
102 }
103 }
103 }
104
104
105 return result;
105 return result;
106 }
106 }
107 };
107 };
108
108
109 VisualizationSelectionZoneItem::VisualizationSelectionZoneItem(QCustomPlot *plot)
109 VisualizationSelectionZoneItem::VisualizationSelectionZoneItem(QCustomPlot *plot)
110 : QCPItemRect(plot),
110 : QCPItemRect(plot),
111 impl{spimpl::make_unique_impl<VisualizationSelectionZoneItemPrivate>(plot)}
111 impl{spimpl::make_unique_impl<VisualizationSelectionZoneItemPrivate>(plot)}
112 {
112 {
113 topLeft->setTypeX(QCPItemPosition::ptPlotCoords);
113 topLeft->setTypeX(QCPItemPosition::ptPlotCoords);
114 topLeft->setTypeY(QCPItemPosition::ptAxisRectRatio);
114 topLeft->setTypeY(QCPItemPosition::ptAxisRectRatio);
115 bottomRight->setTypeX(QCPItemPosition::ptPlotCoords);
115 bottomRight->setTypeX(QCPItemPosition::ptPlotCoords);
116 bottomRight->setTypeY(QCPItemPosition::ptAxisRectRatio);
116 bottomRight->setTypeY(QCPItemPosition::ptAxisRectRatio);
117 setSelectable(false);
117 setSelectable(false);
118
118
119 impl->m_RightLine = new QCPItemStraightLine(plot);
119 impl->m_RightLine = new QCPItemStraightLine(plot);
120 impl->m_RightLine->point1->setParentAnchor(topRight);
120 impl->m_RightLine->point1->setParentAnchor(topRight);
121 impl->m_RightLine->point2->setParentAnchor(bottomRight);
121 impl->m_RightLine->point2->setParentAnchor(bottomRight);
122 impl->m_RightLine->point1->setTypeX(QCPItemPosition::ptAbsolute);
122 impl->m_RightLine->point1->setTypeX(QCPItemPosition::ptAbsolute);
123 impl->m_RightLine->point1->setTypeY(QCPItemPosition::ptAbsolute);
123 impl->m_RightLine->point1->setTypeY(QCPItemPosition::ptAbsolute);
124 impl->m_RightLine->point2->setTypeX(QCPItemPosition::ptAbsolute);
124 impl->m_RightLine->point2->setTypeX(QCPItemPosition::ptAbsolute);
125 impl->m_RightLine->point2->setTypeY(QCPItemPosition::ptAbsolute);
125 impl->m_RightLine->point2->setTypeY(QCPItemPosition::ptAbsolute);
126 impl->m_RightLine->setSelectable(false);
126 impl->m_RightLine->setSelectable(false);
127
127
128 impl->m_LeftLine = new QCPItemStraightLine(plot);
128 impl->m_LeftLine = new QCPItemStraightLine(plot);
129 impl->m_LeftLine->point1->setParentAnchor(topLeft);
129 impl->m_LeftLine->point1->setParentAnchor(topLeft);
130 impl->m_LeftLine->point2->setParentAnchor(bottomLeft);
130 impl->m_LeftLine->point2->setParentAnchor(bottomLeft);
131 impl->m_LeftLine->point1->setTypeX(QCPItemPosition::ptAbsolute);
131 impl->m_LeftLine->point1->setTypeX(QCPItemPosition::ptAbsolute);
132 impl->m_LeftLine->point1->setTypeY(QCPItemPosition::ptAbsolute);
132 impl->m_LeftLine->point1->setTypeY(QCPItemPosition::ptAbsolute);
133 impl->m_LeftLine->point2->setTypeX(QCPItemPosition::ptAbsolute);
133 impl->m_LeftLine->point2->setTypeX(QCPItemPosition::ptAbsolute);
134 impl->m_LeftLine->point2->setTypeY(QCPItemPosition::ptAbsolute);
134 impl->m_LeftLine->point2->setTypeY(QCPItemPosition::ptAbsolute);
135 impl->m_LeftLine->setSelectable(false);
135 impl->m_LeftLine->setSelectable(false);
136
136
137 connect(this, &VisualizationSelectionZoneItem::selectionChanged, impl->m_RightLine,
137 connect(this, &VisualizationSelectionZoneItem::selectionChanged, impl->m_RightLine,
138 &QCPItemStraightLine::setSelected);
138 &QCPItemStraightLine::setSelected);
139 connect(this, &VisualizationSelectionZoneItem::selectionChanged, impl->m_LeftLine,
139 connect(this, &VisualizationSelectionZoneItem::selectionChanged, impl->m_LeftLine,
140 &QCPItemStraightLine::setSelected);
140 &QCPItemStraightLine::setSelected);
141
141
142 setColor(QColor(DEFAULT_COLOR));
142 setColor(QColor(DEFAULT_COLOR));
143 }
143 }
144
144
145 VisualizationSelectionZoneItem::~VisualizationSelectionZoneItem()
145 VisualizationSelectionZoneItem::~VisualizationSelectionZoneItem() {}
146 {
147 }
148
146
149 VisualizationGraphWidget *VisualizationSelectionZoneItem::parentGraphWidget() const noexcept
147 VisualizationGraphWidget *VisualizationSelectionZoneItem::parentGraphWidget() const noexcept
150 {
148 {
151 auto parent = impl->m_Plot->parentWidget();
149 auto parent = impl->m_Plot->parentWidget();
152 while (parent != nullptr && !qobject_cast<VisualizationGraphWidget *>(parent)) {
150 while (parent != nullptr && !qobject_cast<VisualizationGraphWidget *>(parent)) {
153 parent = parent->parentWidget();
151 parent = parent->parentWidget();
154 }
152 }
155
153
156 return qobject_cast<VisualizationGraphWidget *>(parent);
154 return qobject_cast<VisualizationGraphWidget *>(parent);
157 }
155 }
158
156
159 void VisualizationSelectionZoneItem::setName(const QString &name)
157 void VisualizationSelectionZoneItem::setName(const QString &name)
160 {
158 {
161 if (name.isEmpty() && impl->m_NameLabelItem) {
159 if (name.isEmpty() && impl->m_NameLabelItem) {
162 impl->m_Plot->removeItem(impl->m_NameLabelItem);
160 impl->m_Plot->removeItem(impl->m_NameLabelItem);
163 impl->m_NameLabelItem = nullptr;
161 impl->m_NameLabelItem = nullptr;
164 }
162 }
165 else if (!impl->m_NameLabelItem) {
163 else if (!impl->m_NameLabelItem) {
166 impl->m_NameLabelItem = new QCPItemText(impl->m_Plot);
164 impl->m_NameLabelItem = new QCPItemText(impl->m_Plot);
167 impl->m_NameLabelItem->setText(name);
165 impl->m_NameLabelItem->setText(name);
168 impl->m_NameLabelItem->setPositionAlignment(Qt::AlignHCenter | Qt::AlignTop);
166 impl->m_NameLabelItem->setPositionAlignment(Qt::AlignHCenter | Qt::AlignTop);
169 impl->m_NameLabelItem->setColor(impl->m_Color);
167 impl->m_NameLabelItem->setColor(impl->m_Color);
170 impl->m_NameLabelItem->position->setParentAnchor(top);
168 impl->m_NameLabelItem->position->setParentAnchor(top);
171 }
169 }
172 }
170 }
173
171
174 QString VisualizationSelectionZoneItem::name() const
172 QString VisualizationSelectionZoneItem::name() const
175 {
173 {
176 if (!impl->m_NameLabelItem) {
174 if (!impl->m_NameLabelItem) {
177 return QString();
175 return QString();
178 }
176 }
179
177
180 return impl->m_NameLabelItem->text();
178 return impl->m_NameLabelItem->text();
181 }
179 }
182
180
183 SqpRange VisualizationSelectionZoneItem::range() const
181 SqpRange VisualizationSelectionZoneItem::range() const
184 {
182 {
185 SqpRange range;
183 SqpRange range;
186 range.m_TStart = impl->m_T1 <= impl->m_T2 ? impl->m_T1 : impl->m_T2;
184 range.m_TStart = impl->m_T1 <= impl->m_T2 ? impl->m_T1 : impl->m_T2;
187 range.m_TEnd = impl->m_T1 > impl->m_T2 ? impl->m_T1 : impl->m_T2;
185 range.m_TEnd = impl->m_T1 > impl->m_T2 ? impl->m_T1 : impl->m_T2;
188 return range;
186 return range;
189 }
187 }
190
188
191 void VisualizationSelectionZoneItem::setRange(double tstart, double tend)
189 void VisualizationSelectionZoneItem::setRange(double tstart, double tend)
192 {
190 {
193 impl->m_T1 = tstart;
191 impl->m_T1 = tstart;
194 impl->m_T2 = tend;
192 impl->m_T2 = tend;
195 impl->updatePosition(this);
193 impl->updatePosition(this);
196 }
194 }
197
195
198 void VisualizationSelectionZoneItem::setStart(double tstart)
196 void VisualizationSelectionZoneItem::setStart(double tstart)
199 {
197 {
200 impl->m_T1 = tstart;
198 impl->m_T1 = tstart;
201 impl->updatePosition(this);
199 impl->updatePosition(this);
202 }
200 }
203
201
204 void VisualizationSelectionZoneItem::setEnd(double tend)
202 void VisualizationSelectionZoneItem::setEnd(double tend)
205 {
203 {
206 impl->m_T2 = tend;
204 impl->m_T2 = tend;
207 impl->updatePosition(this);
205 impl->updatePosition(this);
208 }
206 }
209
207
210 void VisualizationSelectionZoneItem::setColor(const QColor &color)
208 void VisualizationSelectionZoneItem::setColor(const QColor &color)
211 {
209 {
212 impl->m_Color = color;
210 impl->m_Color = color;
213
211
214 auto brushColor = color;
212 auto brushColor = color;
215 brushColor.setAlpha(80);
213 brushColor.setAlpha(80);
216 setBrush(QBrush(brushColor));
214 setBrush(QBrush(brushColor));
217 setPen(QPen(Qt::NoPen));
215 setPen(QPen(Qt::NoPen));
218
216
219 auto selectedBrushColor = brushColor;
217 auto selectedBrushColor = brushColor;
220 selectedBrushColor.setAlpha(150);
218 selectedBrushColor.setAlpha(150);
221 setSelectedBrush(QBrush(selectedBrushColor));
219 setSelectedBrush(QBrush(selectedBrushColor));
222 setSelectedPen(QPen(Qt::NoPen));
220 setSelectedPen(QPen(Qt::NoPen));
223
221
224 auto linePen = QPen(color);
222 auto linePen = QPen(color);
225 linePen.setStyle(Qt::SolidLine);
223 linePen.setStyle(Qt::SolidLine);
226 linePen.setWidth(4);
224 linePen.setWidth(4);
227
225
228 auto selectedLinePen = linePen;
226 auto selectedLinePen = linePen;
229 selectedLinePen.setColor(color.darker(120));
227 selectedLinePen.setColor(color.darker(120));
230 selectedLinePen.setWidth(4);
228 selectedLinePen.setWidth(4);
231
229
232 impl->m_LeftLine->setPen(linePen);
230 impl->m_LeftLine->setPen(linePen);
233 impl->m_RightLine->setPen(linePen);
231 impl->m_RightLine->setPen(linePen);
234
232
235 impl->m_LeftLine->setSelectedPen(selectedLinePen);
233 impl->m_LeftLine->setSelectedPen(selectedLinePen);
236 impl->m_RightLine->setSelectedPen(selectedLinePen);
234 impl->m_RightLine->setSelectedPen(selectedLinePen);
237 }
235 }
238
236
239 void VisualizationSelectionZoneItem::setEditionEnabled(bool value)
237 void VisualizationSelectionZoneItem::setEditionEnabled(bool value)
240 {
238 {
241 impl->m_IsEditionEnabled = value;
239 impl->m_IsEditionEnabled = value;
242 setSelectable(value);
240 setSelectable(value);
243 if (!value) {
241 if (!value) {
244 setSelected(false);
242 setSelected(false);
245 impl->m_CurrentEditionMode = VisualizationSelectionZoneItemPrivate::EditionMode::NoEdition;
243 impl->m_CurrentEditionMode = VisualizationSelectionZoneItemPrivate::EditionMode::NoEdition;
246 }
244 }
247 }
245 }
248
246
249 bool VisualizationSelectionZoneItem::isEditionEnabled() const
247 bool VisualizationSelectionZoneItem::isEditionEnabled() const
250 {
248 {
251 return impl->m_IsEditionEnabled;
249 return impl->m_IsEditionEnabled;
252 }
250 }
253
251
254 void VisualizationSelectionZoneItem::moveToTop()
252 void VisualizationSelectionZoneItem::moveToTop()
255 {
253 {
256 moveToLayer(layer(), false);
254 moveToLayer(layer(), false);
257 }
255 }
258
256
259 Qt::CursorShape
257 Qt::CursorShape
260 VisualizationSelectionZoneItem::curshorShapeForPosition(const QPoint &position) const
258 VisualizationSelectionZoneItem::curshorShapeForPosition(const QPoint &position) const
261 {
259 {
262 auto mode = impl->m_CurrentEditionMode
260 auto mode = impl->m_CurrentEditionMode
263 == VisualizationSelectionZoneItemPrivate::EditionMode::NoEdition
261 == VisualizationSelectionZoneItemPrivate::EditionMode::NoEdition
264 ? impl->getEditionMode(position, this)
262 ? impl->getEditionMode(position, this)
265 : impl->m_CurrentEditionMode;
263 : impl->m_CurrentEditionMode;
266 switch (mode) {
264 switch (mode) {
267 case VisualizationSelectionZoneItemPrivate::EditionMode::Move:
265 case VisualizationSelectionZoneItemPrivate::EditionMode::Move:
268 return Qt::SizeAllCursor;
266 return Qt::SizeAllCursor;
269 case VisualizationSelectionZoneItemPrivate::EditionMode::ResizeLeft:
267 case VisualizationSelectionZoneItemPrivate::EditionMode::ResizeLeft:
270 case VisualizationSelectionZoneItemPrivate::EditionMode::ResizeRight: // fallthrough
268 case VisualizationSelectionZoneItemPrivate::EditionMode::ResizeRight: // fallthrough
271 return Qt::SizeHorCursor;
269 return Qt::SizeHorCursor;
272 default:
270 default:
273 return Qt::ArrowCursor;
271 return Qt::ArrowCursor;
274 }
272 }
275 }
273 }
276
274
277 void VisualizationSelectionZoneItem::setHovered(bool value)
275 void VisualizationSelectionZoneItem::setHovered(bool value)
278 {
276 {
279 if (value) {
277 if (value) {
280 auto linePen = impl->m_LeftLine->pen();
278 auto linePen = impl->m_LeftLine->pen();
281 linePen.setStyle(Qt::DotLine);
279 linePen.setStyle(Qt::DotLine);
282 linePen.setWidth(3);
280 linePen.setWidth(3);
283
281
284 auto selectedLinePen = impl->m_LeftLine->selectedPen();
282 auto selectedLinePen = impl->m_LeftLine->selectedPen();
285 ;
283 ;
286 selectedLinePen.setStyle(Qt::DotLine);
284 selectedLinePen.setStyle(Qt::DotLine);
287 selectedLinePen.setWidth(3);
285 selectedLinePen.setWidth(3);
288
286
289 impl->m_LeftLine->setPen(linePen);
287 impl->m_LeftLine->setPen(linePen);
290 impl->m_RightLine->setPen(linePen);
288 impl->m_RightLine->setPen(linePen);
291
289
292 impl->m_LeftLine->setSelectedPen(selectedLinePen);
290 impl->m_LeftLine->setSelectedPen(selectedLinePen);
293 impl->m_RightLine->setSelectedPen(selectedLinePen);
291 impl->m_RightLine->setSelectedPen(selectedLinePen);
294 }
292 }
295 else {
293 else {
296 setColor(impl->m_Color);
294 setColor(impl->m_Color);
297 }
295 }
298 }
296 }
299
297
300 void VisualizationSelectionZoneItem::setAssociatedEditedZones(
298 void VisualizationSelectionZoneItem::setAssociatedEditedZones(
301 const QVector<VisualizationSelectionZoneItem *> &associatedZones)
299 const QVector<VisualizationSelectionZoneItem *> &associatedZones)
302 {
300 {
303 impl->m_AssociatedEditedZones = associatedZones;
301 impl->m_AssociatedEditedZones = associatedZones;
304 impl->m_AssociatedEditedZones.removeAll(this);
302 impl->m_AssociatedEditedZones.removeAll(this);
305 }
303 }
306
304
307 bool VisualizationSelectionZoneItem::alignZonesVerticallyOnLeft(
305 bool VisualizationSelectionZoneItem::alignZonesVerticallyOnLeft(
308 const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, bool allowResize)
306 const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, bool allowResize)
309 {
307 {
310 return impl->alignZones(this, zonesToAlign, true, allowResize, true);
308 return impl->alignZones(this, zonesToAlign, true, allowResize, true);
311 }
309 }
312
310
313 bool VisualizationSelectionZoneItem::alignZonesVerticallyOnRight(
311 bool VisualizationSelectionZoneItem::alignZonesVerticallyOnRight(
314 const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, bool allowResize)
312 const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, bool allowResize)
315 {
313 {
316 return impl->alignZones(this, zonesToAlign, false, allowResize, true);
314 return impl->alignZones(this, zonesToAlign, false, allowResize, true);
317 }
315 }
318
316
319 bool VisualizationSelectionZoneItem::alignZonesTemporallyOnLeft(
317 bool VisualizationSelectionZoneItem::alignZonesTemporallyOnLeft(
320 const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, bool allowResize)
318 const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, bool allowResize)
321 {
319 {
322 return impl->alignZones(this, zonesToAlign, true, allowResize, false);
320 return impl->alignZones(this, zonesToAlign, true, allowResize, false);
323 }
321 }
324
322
325 bool VisualizationSelectionZoneItem::alignZonesTemporallyOnRight(
323 bool VisualizationSelectionZoneItem::alignZonesTemporallyOnRight(
326 const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, bool allowResize)
324 const QVector<VisualizationSelectionZoneItem *> &zonesToAlign, bool allowResize)
327 {
325 {
328 return impl->alignZones(this, zonesToAlign, false, allowResize, false);
326 return impl->alignZones(this, zonesToAlign, false, allowResize, false);
329 }
327 }
330
328
331 void VisualizationSelectionZoneItem::mousePressEvent(QMouseEvent *event, const QVariant &details)
329 void VisualizationSelectionZoneItem::mousePressEvent(QMouseEvent *event, const QVariant &details)
332 {
330 {
333 Q_UNUSED(details);
331 Q_UNUSED(details);
334
332
335 if (isEditionEnabled() && event->button() == Qt::LeftButton) {
333 if (isEditionEnabled() && event->button() == Qt::LeftButton) {
336 impl->m_CurrentEditionMode = impl->getEditionMode(event->pos(), this);
334 impl->m_CurrentEditionMode = impl->getEditionMode(event->pos(), this);
337
335
338 impl->m_MovedOrinalT1 = impl->m_T1;
336 impl->m_MovedOrinalT1 = impl->m_T1;
339 impl->m_MovedOrinalT2 = impl->m_T2;
337 impl->m_MovedOrinalT2 = impl->m_T2;
340 for (auto associatedZone : impl->m_AssociatedEditedZones) {
338 for (auto associatedZone : impl->m_AssociatedEditedZones) {
341 associatedZone->impl->m_MovedOrinalT1 = associatedZone->impl->m_T1;
339 associatedZone->impl->m_MovedOrinalT1 = associatedZone->impl->m_T1;
342 associatedZone->impl->m_MovedOrinalT2 = associatedZone->impl->m_T2;
340 associatedZone->impl->m_MovedOrinalT2 = associatedZone->impl->m_T2;
343 }
341 }
344 }
342 }
345 else {
343 else {
346 impl->m_CurrentEditionMode = VisualizationSelectionZoneItemPrivate::EditionMode::NoEdition;
344 impl->m_CurrentEditionMode = VisualizationSelectionZoneItemPrivate::EditionMode::NoEdition;
347 event->ignore();
345 event->ignore();
348 }
346 }
349 }
347 }
350
348
351 void VisualizationSelectionZoneItem::mouseMoveEvent(QMouseEvent *event, const QPointF &startPos)
349 void VisualizationSelectionZoneItem::mouseMoveEvent(QMouseEvent *event, const QPointF &startPos)
352 {
350 {
353 if (isEditionEnabled()) {
351 if (isEditionEnabled()) {
354 if (!selected()) {
352 if (!selected()) {
355 // Force the item to be selected during the edition
353 // Force the item to be selected during the edition
356 parentGraphWidget()->parentVisualizationWidget()->selectionZoneManager().setSelected(
354 parentGraphWidget()->parentVisualizationWidget()->selectionZoneManager().setSelected(
357 this, true);
355 this, true);
358 }
356 }
359
357
360 auto axis = impl->m_Plot->axisRect()->axis(QCPAxis::atBottom);
358 auto axis = impl->m_Plot->axisRect()->axis(QCPAxis::atBottom);
361 auto pixelDiff = event->pos().x() - startPos.x();
359 auto pixelDiff = event->pos().x() - startPos.x();
362 auto diff = impl->pixelSizeToAxisXSize(pixelDiff);
360 auto diff = impl->pixelSizeToAxisXSize(pixelDiff);
363
361
364 switch (impl->m_CurrentEditionMode) {
362 switch (impl->m_CurrentEditionMode) {
365 case VisualizationSelectionZoneItemPrivate::EditionMode::Move:
363 case VisualizationSelectionZoneItemPrivate::EditionMode::Move:
366 setRange(impl->m_MovedOrinalT1 + diff, impl->m_MovedOrinalT2 + diff);
364 setRange(impl->m_MovedOrinalT1 + diff, impl->m_MovedOrinalT2 + diff);
367 for (auto associatedZone : impl->m_AssociatedEditedZones) {
365 for (auto associatedZone : impl->m_AssociatedEditedZones) {
368 associatedZone->move(pixelDiff);
366 associatedZone->move(pixelDiff);
369 }
367 }
370 break;
368 break;
371 case VisualizationSelectionZoneItemPrivate::EditionMode::ResizeLeft:
369 case VisualizationSelectionZoneItemPrivate::EditionMode::ResizeLeft:
372 setStart(impl->m_MovedOrinalT1 + diff);
370 setStart(impl->m_MovedOrinalT1 + diff);
373 for (auto associatedZone : impl->m_AssociatedEditedZones) {
371 for (auto associatedZone : impl->m_AssociatedEditedZones) {
374 impl->m_MovedOrinalT1 < impl->m_MovedOrinalT2
372 impl->m_MovedOrinalT1 < impl->m_MovedOrinalT2
375 ? associatedZone->resizeLeft(pixelDiff)
373 ? associatedZone->resizeLeft(pixelDiff)
376 : associatedZone->resizeRight(pixelDiff);
374 : associatedZone->resizeRight(pixelDiff);
377 }
375 }
378 break;
376 break;
379 case VisualizationSelectionZoneItemPrivate::EditionMode::ResizeRight:
377 case VisualizationSelectionZoneItemPrivate::EditionMode::ResizeRight:
380 setEnd(impl->m_MovedOrinalT2 + diff);
378 setEnd(impl->m_MovedOrinalT2 + diff);
381 for (auto associatedZone : impl->m_AssociatedEditedZones) {
379 for (auto associatedZone : impl->m_AssociatedEditedZones) {
382 impl->m_MovedOrinalT1 < impl->m_MovedOrinalT2
380 impl->m_MovedOrinalT1 < impl->m_MovedOrinalT2
383 ? associatedZone->resizeRight(pixelDiff)
381 ? associatedZone->resizeRight(pixelDiff)
384 : associatedZone->resizeLeft(pixelDiff);
382 : associatedZone->resizeLeft(pixelDiff);
385 }
383 }
386 break;
384 break;
387 default:
385 default:
388 break;
386 break;
389 }
387 }
390
388
391 for (auto associatedZone : impl->m_AssociatedEditedZones) {
389 for (auto associatedZone : impl->m_AssociatedEditedZones) {
392 associatedZone->parentPlot()->replot();
390 associatedZone->parentPlot()->replot();
393 }
391 }
394 }
392 }
395 else {
393 else {
396 event->ignore();
394 event->ignore();
397 }
395 }
398 }
396 }
399
397
400 void VisualizationSelectionZoneItem::mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos)
398 void VisualizationSelectionZoneItem::mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos)
401 {
399 {
402 Q_UNUSED(startPos);
400 Q_UNUSED(startPos);
403
401
404 if (isEditionEnabled()) {
402 if (isEditionEnabled()) {
405 impl->m_CurrentEditionMode = VisualizationSelectionZoneItemPrivate::EditionMode::NoEdition;
403 impl->m_CurrentEditionMode = VisualizationSelectionZoneItemPrivate::EditionMode::NoEdition;
406 }
404 }
407 else {
405 else {
408 event->ignore();
406 event->ignore();
409 }
407 }
410
408
411 impl->m_AssociatedEditedZones.clear();
409 impl->m_AssociatedEditedZones.clear();
412 }
410 }
413
411
414 void VisualizationSelectionZoneItem::resizeLeft(double pixelDiff)
412 void VisualizationSelectionZoneItem::resizeLeft(double pixelDiff)
415 {
413 {
416 auto diff = impl->pixelSizeToAxisXSize(pixelDiff);
414 auto diff = impl->pixelSizeToAxisXSize(pixelDiff);
417 if (impl->m_MovedOrinalT1 <= impl->m_MovedOrinalT2) {
415 if (impl->m_MovedOrinalT1 <= impl->m_MovedOrinalT2) {
418 setStart(impl->m_MovedOrinalT1 + diff);
416 setStart(impl->m_MovedOrinalT1 + diff);
419 }
417 }
420 else {
418 else {
421 setEnd(impl->m_MovedOrinalT2 + diff);
419 setEnd(impl->m_MovedOrinalT2 + diff);
422 }
420 }
423 }
421 }
424
422
425 void VisualizationSelectionZoneItem::resizeRight(double pixelDiff)
423 void VisualizationSelectionZoneItem::resizeRight(double pixelDiff)
426 {
424 {
427 auto diff = impl->pixelSizeToAxisXSize(pixelDiff);
425 auto diff = impl->pixelSizeToAxisXSize(pixelDiff);
428 if (impl->m_MovedOrinalT1 > impl->m_MovedOrinalT2) {
426 if (impl->m_MovedOrinalT1 > impl->m_MovedOrinalT2) {
429 setStart(impl->m_MovedOrinalT1 + diff);
427 setStart(impl->m_MovedOrinalT1 + diff);
430 }
428 }
431 else {
429 else {
432 setEnd(impl->m_MovedOrinalT2 + diff);
430 setEnd(impl->m_MovedOrinalT2 + diff);
433 }
431 }
434 }
432 }
435
433
436 void VisualizationSelectionZoneItem::move(double pixelDiff)
434 void VisualizationSelectionZoneItem::move(double pixelDiff)
437 {
435 {
438 auto diff = impl->pixelSizeToAxisXSize(pixelDiff);
436 auto diff = impl->pixelSizeToAxisXSize(pixelDiff);
439 setRange(impl->m_MovedOrinalT1 + diff, impl->m_MovedOrinalT2 + diff);
437 setRange(impl->m_MovedOrinalT1 + diff, impl->m_MovedOrinalT2 + diff);
440 }
438 }
General Comments 0
You need to be logged in to leave comments. Login now