##// END OF EJS Templates
Change the event model to a treeview model + update the last version of CatalogueAPI
trabillard -
r1149:c352dc0e2afa
parent child
Show More
@@ -1,40 +1,42
1 #ifndef SCIQLOP_CATALOGUEEVENTSTABLEMODEL_H
1 #ifndef SCIQLOP_CATALOGUEEVENTSMODEL_H
2 #define SCIQLOP_CATALOGUEEVENTSTABLEMODEL_H
2 #define SCIQLOP_CATALOGUEEVENTSMODEL_H
3
3
4 #include <Common/spimpl.h>
4 #include <Common/spimpl.h>
5 #include <QAbstractTableModel>
5 #include <QAbstractItemModel>
6
6
7 class DBEvent;
7 class DBEvent;
8
8
9 class CatalogueEventsTableModel : public QAbstractTableModel {
9 class CatalogueEventsModel : public QAbstractItemModel {
10 public:
10 public:
11 CatalogueEventsTableModel(QObject *parent = nullptr);
11 CatalogueEventsModel(QObject *parent = nullptr);
12
12
13 void setEvents(const QVector<std::shared_ptr<DBEvent> > &events);
13 void setEvents(const QVector<std::shared_ptr<DBEvent> > &events);
14 std::shared_ptr<DBEvent> getEvent(int row) const;
14 std::shared_ptr<DBEvent> getEvent(int row) const;
15
15
16
16 void addEvent(const std::shared_ptr<DBEvent> &event);
17 void addEvent(const std::shared_ptr<DBEvent> &event);
17 void removeEvent(const std::shared_ptr<DBEvent> &event);
18 void removeEvent(const std::shared_ptr<DBEvent> &event);
18
19
19 void refreshEvent(const std::shared_ptr<DBEvent> &event);
20 void refreshEvent(const std::shared_ptr<DBEvent> &event);
20
21
21 // Model
22 // Model
23 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
24 QModelIndex parent(const QModelIndex &index) const;
22 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
25 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
23 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
26 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
24 Qt::ItemFlags flags(const QModelIndex &index) const override;
27 Qt::ItemFlags flags(const QModelIndex &index) const override;
25 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
28 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
26 QVariant headerData(int section, Qt::Orientation orientation,
29 QVariant headerData(int section, Qt::Orientation orientation,
27 int role = Qt::DisplayRole) const override;
30 int role = Qt::DisplayRole) const override;
28 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
31 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
29
32
30 Qt::DropActions supportedDragActions() const override;
33 Qt::DropActions supportedDragActions() const override;
31 QStringList mimeTypes() const override;
34 QStringList mimeTypes() const override;
32 QMimeData *mimeData(const QModelIndexList &indexes) const override;
35 QMimeData *mimeData(const QModelIndexList &indexes) const override;
33
36
34
35 private:
37 private:
36 class CatalogueEventsTableModelPrivate;
38 class CatalogueEventsTableModelPrivate;
37 spimpl::unique_impl_ptr<CatalogueEventsTableModelPrivate> impl;
39 spimpl::unique_impl_ptr<CatalogueEventsTableModelPrivate> impl;
38 };
40 };
39
41
40 #endif // SCIQLOP_CATALOGUEEVENTSTABLEMODEL_H
42 #endif // SCIQLOP_CATALOGUEEVENTSMODEL_H
@@ -1,127 +1,127
1
1
2 qxorm_dep = dependency('QxOrm', required : true, fallback:['QxOrm','qxorm_dep'])
2 qxorm_dep = dependency('QxOrm', required : true, fallback:['QxOrm','qxorm_dep'])
3 catalogueapi_dep = dependency('CatalogueAPI', required : true, fallback:['CatalogueAPI','CatalogueAPI_dep'])
3 catalogueapi_dep = dependency('CatalogueAPI', required : true, fallback:['CatalogueAPI','CatalogueAPI_dep'])
4
4
5 gui_moc_headers = [
5 gui_moc_headers = [
6 'include/DataSource/DataSourceWidget.h',
6 'include/DataSource/DataSourceWidget.h',
7 'include/Settings/SqpSettingsDialog.h',
7 'include/Settings/SqpSettingsDialog.h',
8 'include/Settings/SqpSettingsGeneralWidget.h',
8 'include/Settings/SqpSettingsGeneralWidget.h',
9 'include/SidePane/SqpSidePane.h',
9 'include/SidePane/SqpSidePane.h',
10 'include/SqpApplication.h',
10 'include/SqpApplication.h',
11 'include/DragAndDrop/DragDropScroller.h',
11 'include/DragAndDrop/DragDropScroller.h',
12 'include/DragAndDrop/DragDropTabSwitcher.h',
12 'include/DragAndDrop/DragDropTabSwitcher.h',
13 'include/TimeWidget/TimeWidget.h',
13 'include/TimeWidget/TimeWidget.h',
14 'include/Variable/VariableInspectorWidget.h',
14 'include/Variable/VariableInspectorWidget.h',
15 'include/Variable/RenameVariableDialog.h',
15 'include/Variable/RenameVariableDialog.h',
16 'include/Visualization/qcustomplot.h',
16 'include/Visualization/qcustomplot.h',
17 'include/Visualization/VisualizationGraphWidget.h',
17 'include/Visualization/VisualizationGraphWidget.h',
18 'include/Visualization/VisualizationTabWidget.h',
18 'include/Visualization/VisualizationTabWidget.h',
19 'include/Visualization/VisualizationWidget.h',
19 'include/Visualization/VisualizationWidget.h',
20 'include/Visualization/VisualizationZoneWidget.h',
20 'include/Visualization/VisualizationZoneWidget.h',
21 'include/Visualization/VisualizationDragDropContainer.h',
21 'include/Visualization/VisualizationDragDropContainer.h',
22 'include/Visualization/VisualizationDragWidget.h',
22 'include/Visualization/VisualizationDragWidget.h',
23 'include/Visualization/ColorScaleEditor.h',
23 'include/Visualization/ColorScaleEditor.h',
24 'include/Actions/SelectionZoneAction.h',
24 'include/Actions/SelectionZoneAction.h',
25 'include/Visualization/VisualizationMultiZoneSelectionDialog.h',
25 'include/Visualization/VisualizationMultiZoneSelectionDialog.h',
26 'include/Catalogue/CatalogueExplorer.h',
26 'include/Catalogue/CatalogueExplorer.h',
27 'include/Catalogue/CatalogueEventsWidget.h',
27 'include/Catalogue/CatalogueEventsWidget.h',
28 'include/Catalogue/CatalogueSideBarWidget.h',
28 'include/Catalogue/CatalogueSideBarWidget.h',
29 'include/Catalogue/CatalogueInspectorWidget.h'
29 'include/Catalogue/CatalogueInspectorWidget.h'
30 ]
30 ]
31
31
32 gui_ui_files = [
32 gui_ui_files = [
33 'ui/DataSource/DataSourceWidget.ui',
33 'ui/DataSource/DataSourceWidget.ui',
34 'ui/Settings/SqpSettingsDialog.ui',
34 'ui/Settings/SqpSettingsDialog.ui',
35 'ui/Settings/SqpSettingsGeneralWidget.ui',
35 'ui/Settings/SqpSettingsGeneralWidget.ui',
36 'ui/SidePane/SqpSidePane.ui',
36 'ui/SidePane/SqpSidePane.ui',
37 'ui/TimeWidget/TimeWidget.ui',
37 'ui/TimeWidget/TimeWidget.ui',
38 'ui/Variable/VariableInspectorWidget.ui',
38 'ui/Variable/VariableInspectorWidget.ui',
39 'ui/Variable/RenameVariableDialog.ui',
39 'ui/Variable/RenameVariableDialog.ui',
40 'ui/Variable/VariableMenuHeaderWidget.ui',
40 'ui/Variable/VariableMenuHeaderWidget.ui',
41 'ui/Visualization/VisualizationGraphWidget.ui',
41 'ui/Visualization/VisualizationGraphWidget.ui',
42 'ui/Visualization/VisualizationTabWidget.ui',
42 'ui/Visualization/VisualizationTabWidget.ui',
43 'ui/Visualization/VisualizationWidget.ui',
43 'ui/Visualization/VisualizationWidget.ui',
44 'ui/Visualization/VisualizationZoneWidget.ui',
44 'ui/Visualization/VisualizationZoneWidget.ui',
45 'ui/Visualization/ColorScaleEditor.ui',
45 'ui/Visualization/ColorScaleEditor.ui',
46 'ui/Visualization/VisualizationMultiZoneSelectionDialog.ui',
46 'ui/Visualization/VisualizationMultiZoneSelectionDialog.ui',
47 'ui/Catalogue/CatalogueExplorer.ui',
47 'ui/Catalogue/CatalogueExplorer.ui',
48 'ui/Catalogue/CatalogueEventsWidget.ui',
48 'ui/Catalogue/CatalogueEventsWidget.ui',
49 'ui/Catalogue/CatalogueSideBarWidget.ui',
49 'ui/Catalogue/CatalogueSideBarWidget.ui',
50 'ui/Catalogue/CatalogueInspectorWidget.ui'
50 'ui/Catalogue/CatalogueInspectorWidget.ui'
51 ]
51 ]
52
52
53 gui_qresources = ['resources/sqpguiresources.qrc']
53 gui_qresources = ['resources/sqpguiresources.qrc']
54
54
55 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
55 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
56 ui_files : gui_ui_files,
56 ui_files : gui_ui_files,
57 qresources : gui_qresources)
57 qresources : gui_qresources)
58
58
59 gui_sources = [
59 gui_sources = [
60 'src/SqpApplication.cpp',
60 'src/SqpApplication.cpp',
61 'src/DragAndDrop/DragDropGuiController.cpp',
61 'src/DragAndDrop/DragDropGuiController.cpp',
62 'src/DragAndDrop/DragDropScroller.cpp',
62 'src/DragAndDrop/DragDropScroller.cpp',
63 'src/DragAndDrop/DragDropTabSwitcher.cpp',
63 'src/DragAndDrop/DragDropTabSwitcher.cpp',
64 'src/Common/ColorUtils.cpp',
64 'src/Common/ColorUtils.cpp',
65 'src/Common/VisualizationDef.cpp',
65 'src/Common/VisualizationDef.cpp',
66 'src/DataSource/DataSourceTreeWidgetItem.cpp',
66 'src/DataSource/DataSourceTreeWidgetItem.cpp',
67 'src/DataSource/DataSourceTreeWidgetHelper.cpp',
67 'src/DataSource/DataSourceTreeWidgetHelper.cpp',
68 'src/DataSource/DataSourceWidget.cpp',
68 'src/DataSource/DataSourceWidget.cpp',
69 'src/DataSource/DataSourceTreeWidget.cpp',
69 'src/DataSource/DataSourceTreeWidget.cpp',
70 'src/Settings/SqpSettingsDialog.cpp',
70 'src/Settings/SqpSettingsDialog.cpp',
71 'src/Settings/SqpSettingsGeneralWidget.cpp',
71 'src/Settings/SqpSettingsGeneralWidget.cpp',
72 'src/SidePane/SqpSidePane.cpp',
72 'src/SidePane/SqpSidePane.cpp',
73 'src/TimeWidget/TimeWidget.cpp',
73 'src/TimeWidget/TimeWidget.cpp',
74 'src/Variable/VariableInspectorWidget.cpp',
74 'src/Variable/VariableInspectorWidget.cpp',
75 'src/Variable/VariableInspectorTableView.cpp',
75 'src/Variable/VariableInspectorTableView.cpp',
76 'src/Variable/VariableMenuHeaderWidget.cpp',
76 'src/Variable/VariableMenuHeaderWidget.cpp',
77 'src/Variable/RenameVariableDialog.cpp',
77 'src/Variable/RenameVariableDialog.cpp',
78 'src/Visualization/VisualizationGraphHelper.cpp',
78 'src/Visualization/VisualizationGraphHelper.cpp',
79 'src/Visualization/VisualizationGraphRenderingDelegate.cpp',
79 'src/Visualization/VisualizationGraphRenderingDelegate.cpp',
80 'src/Visualization/VisualizationGraphWidget.cpp',
80 'src/Visualization/VisualizationGraphWidget.cpp',
81 'src/Visualization/VisualizationTabWidget.cpp',
81 'src/Visualization/VisualizationTabWidget.cpp',
82 'src/Visualization/VisualizationWidget.cpp',
82 'src/Visualization/VisualizationWidget.cpp',
83 'src/Visualization/VisualizationZoneWidget.cpp',
83 'src/Visualization/VisualizationZoneWidget.cpp',
84 'src/Visualization/qcustomplot.cpp',
84 'src/Visualization/qcustomplot.cpp',
85 'src/Visualization/QCustomPlotSynchronizer.cpp',
85 'src/Visualization/QCustomPlotSynchronizer.cpp',
86 'src/Visualization/operations/FindVariableOperation.cpp',
86 'src/Visualization/operations/FindVariableOperation.cpp',
87 'src/Visualization/operations/GenerateVariableMenuOperation.cpp',
87 'src/Visualization/operations/GenerateVariableMenuOperation.cpp',
88 'src/Visualization/operations/MenuBuilder.cpp',
88 'src/Visualization/operations/MenuBuilder.cpp',
89 'src/Visualization/operations/RemoveVariableOperation.cpp',
89 'src/Visualization/operations/RemoveVariableOperation.cpp',
90 'src/Visualization/operations/RescaleAxeOperation.cpp',
90 'src/Visualization/operations/RescaleAxeOperation.cpp',
91 'src/Visualization/VisualizationDragDropContainer.cpp',
91 'src/Visualization/VisualizationDragDropContainer.cpp',
92 'src/Visualization/VisualizationDragWidget.cpp',
92 'src/Visualization/VisualizationDragWidget.cpp',
93 'src/Visualization/AxisRenderingUtils.cpp',
93 'src/Visualization/AxisRenderingUtils.cpp',
94 'src/Visualization/PlottablesRenderingUtils.cpp',
94 'src/Visualization/PlottablesRenderingUtils.cpp',
95 'src/Visualization/MacScrollBarStyle.cpp',
95 'src/Visualization/MacScrollBarStyle.cpp',
96 'src/Visualization/VisualizationCursorItem.cpp',
96 'src/Visualization/VisualizationCursorItem.cpp',
97 'src/Visualization/ColorScaleEditor.cpp',
97 'src/Visualization/ColorScaleEditor.cpp',
98 'src/Visualization/SqpColorScale.cpp',
98 'src/Visualization/SqpColorScale.cpp',
99 'src/Visualization/QCPColorMapIterator.cpp',
99 'src/Visualization/QCPColorMapIterator.cpp',
100 'src/Visualization/VisualizationSelectionZoneItem.cpp',
100 'src/Visualization/VisualizationSelectionZoneItem.cpp',
101 'src/Visualization/VisualizationSelectionZoneManager.cpp',
101 'src/Visualization/VisualizationSelectionZoneManager.cpp',
102 'src/Actions/SelectionZoneAction.cpp',
102 'src/Actions/SelectionZoneAction.cpp',
103 'src/Actions/ActionsGuiController.cpp',
103 'src/Actions/ActionsGuiController.cpp',
104 'src/Visualization/VisualizationActionManager.cpp',
104 'src/Visualization/VisualizationActionManager.cpp',
105 'src/Visualization/VisualizationMultiZoneSelectionDialog.cpp',
105 'src/Visualization/VisualizationMultiZoneSelectionDialog.cpp',
106 'src/Catalogue/CatalogueExplorer.cpp',
106 'src/Catalogue/CatalogueExplorer.cpp',
107 'src/Catalogue/CatalogueEventsWidget.cpp',
107 'src/Catalogue/CatalogueEventsWidget.cpp',
108 'src/Catalogue/CatalogueSideBarWidget.cpp',
108 'src/Catalogue/CatalogueSideBarWidget.cpp',
109 'src/Catalogue/CatalogueInspectorWidget.cpp',
109 'src/Catalogue/CatalogueInspectorWidget.cpp',
110 'src/Catalogue/CatalogueTreeWidgetItem.cpp',
110 'src/Catalogue/CatalogueTreeWidgetItem.cpp',
111 'src/Catalogue/CatalogueEventsTableModel.cpp'
111 'src/Catalogue/CatalogueEventsModel.cpp'
112 ]
112 ]
113
113
114 gui_inc = include_directories(['include'])
114 gui_inc = include_directories(['include'])
115
115
116 sciqlop_gui_lib = library('sciqlopgui',
116 sciqlop_gui_lib = library('sciqlopgui',
117 gui_sources,
117 gui_sources,
118 gui_moc_files,
118 gui_moc_files,
119 include_directories : [gui_inc],
119 include_directories : [gui_inc],
120 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core, catalogueapi_dep],
120 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core, catalogueapi_dep],
121 install : true
121 install : true
122 )
122 )
123
123
124 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
124 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
125 include_directories : gui_inc,
125 include_directories : gui_inc,
126 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core, catalogueapi_dep])
126 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core, catalogueapi_dep])
127
127
@@ -1,191 +1,340
1 #include "Catalogue/CatalogueEventsTableModel.h"
1 #include "Catalogue/CatalogueEventsModel.h"
2
2
3 #include <Common/DateUtils.h>
3 #include <Common/DateUtils.h>
4 #include <Common/MimeTypesDef.h>
4 #include <Common/MimeTypesDef.h>
5 #include <DBEvent.h>
5 #include <DBEvent.h>
6 #include <DBEventProduct.h>
6 #include <DBTag.h>
7 #include <DBTag.h>
7 #include <Data/SqpRange.h>
8 #include <Data/SqpRange.h>
8 #include <QMimeData>
9 #include <SqpApplication.h>
9 #include <SqpApplication.h>
10 #include <Time/TimeController.h>
10 #include <Time/TimeController.h>
11
11
12 struct CatalogueEventsTableModel::CatalogueEventsTableModelPrivate {
12 #include <list>
13 #include <unordered_map>
14
15 #include <QHash>
16 #include <QMimeData>
17
18 const auto EVENT_ITEM_TYPE = 1;
19 const auto EVENT_PRODUCT_ITEM_TYPE = 2;
20
21 struct CatalogueEventsModel::CatalogueEventsTableModelPrivate {
13 QVector<std::shared_ptr<DBEvent> > m_Events;
22 QVector<std::shared_ptr<DBEvent> > m_Events;
23 std::unordered_map<DBEvent *, QVector<std::shared_ptr<DBEventProduct> > > m_EventProducts;
14
24
15 enum class Column { Event, TStart, TEnd, Tags, Product, NbColumn };
25 enum class Column { Name, TStart, TEnd, Tags, Product, NbColumn };
16 QStringList columnNames()
26 QStringList columnNames()
17 {
27 {
18 return QStringList{tr("Event"), tr("TStart"), tr("TEnd"), tr("Tags"), tr("Product")};
28 return QStringList{tr("Event"), tr("TStart"), tr("TEnd"), tr("Tags"), tr("Product")};
19 }
29 }
20
30
21 QVariant eventData(int col, const std::shared_ptr<DBEvent> &event) const
31 QVariant eventData(int col, const std::shared_ptr<DBEvent> &event) const
22 {
32 {
23 switch (static_cast<Column>(col)) {
33 switch (static_cast<Column>(col)) {
24 case Column::Event:
34 case Column::Name:
25 return event->getName();
35 return event->getName();
26 case Column::TStart:
36 case Column::TStart:
27 return DateUtils::dateTime(event->getTStart());
37 return "Oo"; // DateUtils::dateTime(event->getTStart());
28 case Column::TEnd:
38 case Column::TEnd:
29 return DateUtils::dateTime(event->getTEnd());
39 return "oO"; // DateUtils::dateTime(event->getTEnd());
30 case Column::Product:
40 case Column::Product: {
31 return event->getProduct();
41 auto eventProductsIt = m_EventProducts.find(event.get());
42 if (eventProductsIt != m_EventProducts.cend()) {
43 return QString::number(m_EventProducts.at(event.get()).count()) + " product(s)";
44 }
45 else {
46 return "0 product";
47 }
48 }
32 case Column::Tags: {
49 case Column::Tags: {
33 QString tagList;
50 QString tagList;
34 auto tags = event->getTags();
51 auto tags = event->getTags();
35 for (auto tag : tags) {
52 for (auto tag : tags) {
36 tagList += tag.getName();
53 tagList += tag.getName();
37 tagList += ' ';
54 tagList += ' ';
38 }
55 }
39
56
40 return tagList;
57 return tagList;
41 }
58 }
42 default:
59 default:
43 break;
60 break;
44 }
61 }
45
62
46 Q_ASSERT(false);
63 Q_ASSERT(false);
47 return QStringLiteral("Unknown Data");
64 return QStringLiteral("Unknown Data");
48 }
65 }
66
67 void parseEventProduct(const std::shared_ptr<DBEvent> &event)
68 {
69 for (auto product : event->getEventProducts()) {
70 m_EventProducts[event.get()].append(std::make_shared<DBEventProduct>(product));
71 }
72 }
73
74 QVariant eventProductData(int col, const std::shared_ptr<DBEventProduct> &eventProduct) const
75 {
76 switch (static_cast<Column>(col)) {
77 case Column::Name:
78 return eventProduct->getProductId();
79 case Column::TStart:
80 return DateUtils::dateTime(eventProduct->getTStart());
81 case Column::TEnd:
82 return DateUtils::dateTime(eventProduct->getTEnd());
83 case Column::Product:
84 return eventProduct->getProductId();
85 case Column::Tags: {
86 return QString();
87 }
88 default:
89 break;
90 }
91
92 Q_ASSERT(false);
93 return QStringLiteral("Unknown Data");
94 }
95
96 enum class ItemType { Root, Event, EventProduct };
97 ItemType indexItemType(const QModelIndex &index) const
98 {
99
100 if (!index.isValid()) {
101 return ItemType::Root;
102 }
103 else if (index.internalPointer() == nullptr) {
104 return ItemType::Event;
105 }
106 else {
107 return ItemType::EventProduct;
108 }
109 }
110
111 std::shared_ptr<DBEventProduct> getEventProduct(const QModelIndex &index)
112 {
113 auto event = static_cast<DBEvent *>(index.internalPointer());
114 return m_EventProducts.at(event).value(index.row());
115 }
49 };
116 };
50
117
51 CatalogueEventsTableModel::CatalogueEventsTableModel(QObject *parent)
118 CatalogueEventsModel::CatalogueEventsModel(QObject *parent)
52 : QAbstractTableModel(parent),
119 : QAbstractItemModel(parent),
53 impl{spimpl::make_unique_impl<CatalogueEventsTableModelPrivate>()}
120 impl{spimpl::make_unique_impl<CatalogueEventsTableModelPrivate>()}
54 {
121 {
55 }
122 }
56
123
57 void CatalogueEventsTableModel::setEvents(const QVector<std::shared_ptr<DBEvent> > &events)
124 void CatalogueEventsModel::setEvents(const QVector<std::shared_ptr<DBEvent> > &events)
58 {
125 {
59 beginResetModel();
126 beginResetModel();
127
60 impl->m_Events = events;
128 impl->m_Events = events;
129 for (auto event : events) {
130 impl->parseEventProduct(event);
131 }
132
61 endResetModel();
133 endResetModel();
62 }
134 }
63
135
64 std::shared_ptr<DBEvent> CatalogueEventsTableModel::getEvent(int row) const
136 std::shared_ptr<DBEvent> CatalogueEventsModel::getEvent(int row) const
65 {
137 {
66 return impl->m_Events.value(row);
138 return impl->m_Events.value(row);
67 }
139 }
68
140
69 void CatalogueEventsTableModel::addEvent(const std::shared_ptr<DBEvent> &event)
141 void CatalogueEventsModel::addEvent(const std::shared_ptr<DBEvent> &event)
70 {
142 {
71 beginInsertRows(QModelIndex(), impl->m_Events.count() - 1, impl->m_Events.count() - 1);
143 beginInsertRows(QModelIndex(), impl->m_Events.count() - 1, impl->m_Events.count() - 1);
72 impl->m_Events.append(event);
144 impl->m_Events.append(event);
145 impl->parseEventProduct(event);
73 endInsertRows();
146 endInsertRows();
74 }
147 }
75
148
76 void CatalogueEventsTableModel::removeEvent(const std::shared_ptr<DBEvent> &event)
149 void CatalogueEventsModel::removeEvent(const std::shared_ptr<DBEvent> &event)
77 {
150 {
78 auto index = impl->m_Events.indexOf(event);
151 auto index = impl->m_Events.indexOf(event);
79 if (index >= 0) {
152 if (index >= 0) {
80 beginRemoveRows(QModelIndex(), index, index);
153 beginRemoveRows(QModelIndex(), index, index);
81 impl->m_Events.removeAt(index);
154 impl->m_Events.removeAt(index);
155 impl->m_EventProducts.erase(event.get());
82 endRemoveRows();
156 endRemoveRows();
83 }
157 }
84 }
158 }
85
159
86 void CatalogueEventsTableModel::refreshEvent(const std::shared_ptr<DBEvent> &event)
160 void CatalogueEventsModel::refreshEvent(const std::shared_ptr<DBEvent> &event)
87 {
161 {
88 auto eventIndex = impl->m_Events.indexOf(event);
162 auto eventIndex = impl->m_Events.indexOf(event);
89 if (eventIndex >= 0) {
163 if (eventIndex >= 0) {
90 emit dataChanged(index(eventIndex, 0), index(eventIndex, columnCount()));
164 emit dataChanged(index(eventIndex, 0), index(eventIndex, columnCount()));
91 }
165 }
92 }
166 }
93
167
94 int CatalogueEventsTableModel::rowCount(const QModelIndex &parent) const
168 QModelIndex CatalogueEventsModel::index(int row, int column, const QModelIndex &parent) const
95 {
169 {
96 int r = impl->m_Events.count();
170 if (!hasIndex(row, column, parent)) {
97 return r;
171 return QModelIndex();
172 }
173
174 switch (impl->indexItemType(parent)) {
175 case CatalogueEventsTableModelPrivate::ItemType::Root:
176 return createIndex(row, column);
177 case CatalogueEventsTableModelPrivate::ItemType::Event: {
178 auto event = getEvent(parent.row());
179 return createIndex(row, column, event.get());
180 }
181 case CatalogueEventsTableModelPrivate::ItemType::EventProduct:
182 break;
183 default:
184 break;
185 }
186
187 return QModelIndex();
98 }
188 }
99
189
100 int CatalogueEventsTableModel::columnCount(const QModelIndex &parent) const
190 QModelIndex CatalogueEventsModel::parent(const QModelIndex &index) const
191 {
192 switch (impl->indexItemType(index)) {
193 case CatalogueEventsTableModelPrivate::ItemType::EventProduct: {
194 auto parentEvent = static_cast<DBEvent *>(index.internalPointer());
195 auto it
196 = std::find_if(impl->m_Events.cbegin(), impl->m_Events.cend(),
197 [parentEvent](auto event) { return event.get() == parentEvent; });
198
199 if (it != impl->m_Events.cend()) {
200 return createIndex(it - impl->m_Events.cbegin(), 0);
201 }
202 else {
203 return QModelIndex();
204 }
205 }
206 case CatalogueEventsTableModelPrivate::ItemType::Root:
207 break;
208 case CatalogueEventsTableModelPrivate::ItemType::Event:
209 break;
210 default:
211 break;
212 }
213
214 return QModelIndex();
215 }
216
217 int CatalogueEventsModel::rowCount(const QModelIndex &parent) const
218 {
219 if (parent.column() > 0) {
220 return 0;
221 }
222
223 switch (impl->indexItemType(parent)) {
224 case CatalogueEventsTableModelPrivate::ItemType::Root:
225 return impl->m_Events.count();
226 case CatalogueEventsTableModelPrivate::ItemType::Event: {
227 auto event = getEvent(parent.row());
228 return impl->m_EventProducts[event.get()].count();
229 }
230 case CatalogueEventsTableModelPrivate::ItemType::EventProduct:
231 break;
232 default:
233 break;
234 }
235
236 return 0;
237 }
238
239 int CatalogueEventsModel::columnCount(const QModelIndex &parent) const
101 {
240 {
102 return static_cast<int>(CatalogueEventsTableModelPrivate::Column::NbColumn);
241 return static_cast<int>(CatalogueEventsTableModelPrivate::Column::NbColumn);
103 }
242 }
104
243
105 Qt::ItemFlags CatalogueEventsTableModel::flags(const QModelIndex &index) const
244 Qt::ItemFlags CatalogueEventsModel::flags(const QModelIndex &index) const
106 {
245 {
107 return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
246 return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
108 }
247 }
109
248
110 QVariant CatalogueEventsTableModel::data(const QModelIndex &index, int role) const
249 QVariant CatalogueEventsModel::data(const QModelIndex &index, int role) const
111 {
250 {
112 if (index.isValid()) {
251 if (index.isValid()) {
113 auto event = getEvent(index.row());
114
252
115 switch (role) {
253 auto type = impl->indexItemType(index);
116 case Qt::DisplayRole:
254 if (type == CatalogueEventsTableModelPrivate::ItemType::Event) {
117 return impl->eventData(index.column(), event);
255 auto event = getEvent(index.row());
118 break;
256 switch (role) {
257 case Qt::DisplayRole:
258 return impl->eventData(index.column(), event);
259 break;
260 }
261 }
262 else if (type == CatalogueEventsTableModelPrivate::ItemType::EventProduct) {
263 auto product = impl->getEventProduct(index);
264 switch (role) {
265 case Qt::DisplayRole:
266 return impl->eventProductData(index.column(), product);
267 break;
268 }
119 }
269 }
120 }
270 }
121
271
122 return QVariant{};
272 return QVariant{};
123 }
273 }
124
274
125 QVariant CatalogueEventsTableModel::headerData(int section, Qt::Orientation orientation,
275 QVariant CatalogueEventsModel::headerData(int section, Qt::Orientation orientation, int role) const
126 int role) const
127 {
276 {
128 if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
277 if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
129 return impl->columnNames().value(section);
278 return impl->columnNames().value(section);
130 }
279 }
131
280
132 return QVariant();
281 return QVariant();
133 }
282 }
134
283
135 void CatalogueEventsTableModel::sort(int column, Qt::SortOrder order)
284 void CatalogueEventsModel::sort(int column, Qt::SortOrder order)
136 {
285 {
137 std::sort(impl->m_Events.begin(), impl->m_Events.end(),
286 std::sort(impl->m_Events.begin(), impl->m_Events.end(),
138 [this, column, order](auto e1, auto e2) {
287 [this, column, order](auto e1, auto e2) {
139 auto data1 = impl->eventData(column, e1);
288 auto data1 = impl->eventData(column, e1);
140 auto data2 = impl->eventData(column, e2);
289 auto data2 = impl->eventData(column, e2);
141
290
142 auto result = data1.toString() < data2.toString();
291 auto result = data1.toString() < data2.toString();
143
292
144 return order == Qt::AscendingOrder ? result : !result;
293 return order == Qt::AscendingOrder ? result : !result;
145 });
294 });
146
295
147 emit dataChanged(QModelIndex(), QModelIndex());
296 emit dataChanged(QModelIndex(), QModelIndex());
148 }
297 }
149
298
150 Qt::DropActions CatalogueEventsTableModel::supportedDragActions() const
299 Qt::DropActions CatalogueEventsModel::supportedDragActions() const
151 {
300 {
152 return Qt::CopyAction | Qt::MoveAction;
301 return Qt::CopyAction | Qt::MoveAction;
153 }
302 }
154
303
155 QStringList CatalogueEventsTableModel::mimeTypes() const
304 QStringList CatalogueEventsModel::mimeTypes() const
156 {
305 {
157 return {MIME_TYPE_EVENT_LIST, MIME_TYPE_TIME_RANGE};
306 return {MIME_TYPE_EVENT_LIST, MIME_TYPE_TIME_RANGE};
158 }
307 }
159
308
160 QMimeData *CatalogueEventsTableModel::mimeData(const QModelIndexList &indexes) const
309 QMimeData *CatalogueEventsModel::mimeData(const QModelIndexList &indexes) const
161 {
310 {
162 auto mimeData = new QMimeData;
311 auto mimeData = new QMimeData;
163
312
164 QVector<std::shared_ptr<DBEvent> > eventList;
313 QVector<std::shared_ptr<DBEvent> > eventList;
165
314
166 SqpRange firstTimeRange;
315 SqpRange firstTimeRange;
167 for (const auto &index : indexes) {
316 for (const auto &index : indexes) {
168 if (index.column() == 0) { // only the first column
317 if (index.column() == 0) { // only the first column
169 auto event = getEvent(index.row());
318 auto event = getEvent(index.row());
170 if (eventList.isEmpty()) {
319 if (eventList.isEmpty()) {
171 // Gets the range of the first variable
320 // Gets the range of the first variable
172 firstTimeRange.m_TStart = event->getTStart();
321 // firstTimeRange.m_TStart = event->getTStart();
173 firstTimeRange.m_TEnd = event->getTEnd();
322 // firstTimeRange.m_TEnd = event->getTEnd();
174 }
323 }
175
324
176 eventList << event;
325 eventList << event;
177 }
326 }
178 }
327 }
179
328
180 auto eventsEncodedData
329 auto eventsEncodedData
181 = QByteArray{}; // sqpApp->catalogueController().->mimeDataForEvents(eventList); //TODO
330 = QByteArray{}; // sqpApp->catalogueController().->mimeDataForEvents(eventList); //TODO
182 mimeData->setData(MIME_TYPE_EVENT_LIST, eventsEncodedData);
331 mimeData->setData(MIME_TYPE_EVENT_LIST, eventsEncodedData);
183
332
184 if (eventList.count() == 1) {
333 if (eventList.count() == 1) {
185 // No time range MIME data if multiple events are dragged
334 // No time range MIME data if multiple events are dragged
186 auto timeEncodedData = TimeController::mimeDataForTimeRange(firstTimeRange);
335 auto timeEncodedData = TimeController::mimeDataForTimeRange(firstTimeRange);
187 mimeData->setData(MIME_TYPE_TIME_RANGE, timeEncodedData);
336 mimeData->setData(MIME_TYPE_TIME_RANGE, timeEncodedData);
188 }
337 }
189
338
190 return mimeData;
339 return mimeData;
191 }
340 }
@@ -1,296 +1,296
1 #include "Catalogue/CatalogueEventsWidget.h"
1 #include "Catalogue/CatalogueEventsWidget.h"
2 #include "ui_CatalogueEventsWidget.h"
2 #include "ui_CatalogueEventsWidget.h"
3
3
4 #include <Catalogue/CatalogueController.h>
4 #include <Catalogue/CatalogueController.h>
5 #include <Catalogue/CatalogueEventsTableModel.h>
5 #include <Catalogue/CatalogueEventsModel.h>
6 #include <CatalogueDao.h>
6 #include <CatalogueDao.h>
7 #include <DBCatalogue.h>
7 #include <DBCatalogue.h>
8 #include <SqpApplication.h>
8 #include <SqpApplication.h>
9 #include <Visualization/VisualizationTabWidget.h>
9 #include <Visualization/VisualizationTabWidget.h>
10 #include <Visualization/VisualizationWidget.h>
10 #include <Visualization/VisualizationWidget.h>
11 #include <Visualization/VisualizationZoneWidget.h>
11 #include <Visualization/VisualizationZoneWidget.h>
12
12
13 #include <QDialog>
13 #include <QDialog>
14 #include <QDialogButtonBox>
14 #include <QDialogButtonBox>
15 #include <QListWidget>
15 #include <QListWidget>
16
16
17 Q_LOGGING_CATEGORY(LOG_CatalogueEventsWidget, "CatalogueEventsWidget")
17 Q_LOGGING_CATEGORY(LOG_CatalogueEventsWidget, "CatalogueEventsWidget")
18
18
19 /// Format of the dates appearing in the label of a cursor
19 /// Format of the dates appearing in the label of a cursor
20 const auto DATETIME_FORMAT = QStringLiteral("yyyy/MM/dd hh:mm:ss");
20 const auto DATETIME_FORMAT = QStringLiteral("yyyy/MM/dd hh:mm:ss");
21
21
22 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate {
22 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate {
23
23
24 CatalogueEventsTableModel *m_Model = nullptr;
24 CatalogueEventsModel *m_Model = nullptr;
25 QStringList m_ZonesForTimeMode;
25 QStringList m_ZonesForTimeMode;
26 QString m_ZoneForGraphMode;
26 QString m_ZoneForGraphMode;
27
27
28 VisualizationWidget *m_VisualizationWidget = nullptr;
28 VisualizationWidget *m_VisualizationWidget = nullptr;
29
29
30 void setEvents(const QVector<std::shared_ptr<DBEvent> > &events, QTableView *tableView)
30 void setEvents(const QVector<std::shared_ptr<DBEvent> > &events, QTreeView *treeView)
31 {
31 {
32 tableView->setSortingEnabled(false);
32 treeView->setSortingEnabled(false);
33 m_Model->setEvents(events);
33 m_Model->setEvents(events);
34 tableView->setSortingEnabled(true);
34 treeView->setSortingEnabled(true);
35 }
35 }
36
36
37 void addEvent(const std::shared_ptr<DBEvent> &event, QTableView *tableView)
37 void addEvent(const std::shared_ptr<DBEvent> &event, QTreeView *treeView)
38 {
38 {
39 tableView->setSortingEnabled(false);
39 treeView->setSortingEnabled(false);
40 m_Model->addEvent(event);
40 m_Model->addEvent(event);
41 tableView->setSortingEnabled(true);
41 treeView->setSortingEnabled(true);
42 }
42 }
43
43
44 void removeEvent(const std::shared_ptr<DBEvent> &event, QTableView *tableView)
44 void removeEvent(const std::shared_ptr<DBEvent> &event, QTreeView *treeView)
45 {
45 {
46 tableView->setSortingEnabled(false);
46 treeView->setSortingEnabled(false);
47 m_Model->removeEvent(event);
47 m_Model->removeEvent(event);
48 tableView->setSortingEnabled(true);
48 treeView->setSortingEnabled(true);
49 }
49 }
50
50
51 QStringList getAvailableVisualizationZoneList() const
51 QStringList getAvailableVisualizationZoneList() const
52 {
52 {
53 if (m_VisualizationWidget) {
53 if (m_VisualizationWidget) {
54 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
54 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
55 return tab->availableZoneWidgets();
55 return tab->availableZoneWidgets();
56 }
56 }
57 }
57 }
58
58
59 return QStringList{};
59 return QStringList{};
60 }
60 }
61
61
62 QStringList selectZone(QWidget *parent, const QStringList &selectedZones,
62 QStringList selectZone(QWidget *parent, const QStringList &selectedZones,
63 bool allowMultiSelection, const QPoint &location)
63 bool allowMultiSelection, const QPoint &location)
64 {
64 {
65 auto availableZones = getAvailableVisualizationZoneList();
65 auto availableZones = getAvailableVisualizationZoneList();
66 if (availableZones.isEmpty()) {
66 if (availableZones.isEmpty()) {
67 return QStringList{};
67 return QStringList{};
68 }
68 }
69
69
70 QDialog d(parent, Qt::Tool);
70 QDialog d(parent, Qt::Tool);
71 d.setWindowTitle("Choose a zone");
71 d.setWindowTitle("Choose a zone");
72 auto layout = new QVBoxLayout{&d};
72 auto layout = new QVBoxLayout{&d};
73 layout->setContentsMargins(0, 0, 0, 0);
73 layout->setContentsMargins(0, 0, 0, 0);
74 auto listWidget = new QListWidget{&d};
74 auto listWidget = new QListWidget{&d};
75 layout->addWidget(listWidget);
75 layout->addWidget(listWidget);
76
76
77 QSet<QListWidgetItem *> checkedItems;
77 QSet<QListWidgetItem *> checkedItems;
78 for (auto zone : availableZones) {
78 for (auto zone : availableZones) {
79 auto item = new QListWidgetItem{zone};
79 auto item = new QListWidgetItem{zone};
80 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
80 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
81 if (selectedZones.contains(zone)) {
81 if (selectedZones.contains(zone)) {
82 item->setCheckState(Qt::Checked);
82 item->setCheckState(Qt::Checked);
83 checkedItems << item;
83 checkedItems << item;
84 }
84 }
85 else {
85 else {
86 item->setCheckState(Qt::Unchecked);
86 item->setCheckState(Qt::Unchecked);
87 }
87 }
88
88
89 listWidget->addItem(item);
89 listWidget->addItem(item);
90 }
90 }
91
91
92 auto buttonBox = new QDialogButtonBox{QDialogButtonBox::Ok, &d};
92 auto buttonBox = new QDialogButtonBox{QDialogButtonBox::Ok, &d};
93 layout->addWidget(buttonBox);
93 layout->addWidget(buttonBox);
94
94
95 QObject::connect(buttonBox, &QDialogButtonBox::accepted, &d, &QDialog::accept);
95 QObject::connect(buttonBox, &QDialogButtonBox::accepted, &d, &QDialog::accept);
96 QObject::connect(buttonBox, &QDialogButtonBox::rejected, &d, &QDialog::reject);
96 QObject::connect(buttonBox, &QDialogButtonBox::rejected, &d, &QDialog::reject);
97
97
98 QObject::connect(listWidget, &QListWidget::itemChanged,
98 QObject::connect(listWidget, &QListWidget::itemChanged,
99 [&checkedItems, allowMultiSelection, listWidget](auto item) {
99 [&checkedItems, allowMultiSelection, listWidget](auto item) {
100 if (item->checkState() == Qt::Checked) {
100 if (item->checkState() == Qt::Checked) {
101 if (!allowMultiSelection) {
101 if (!allowMultiSelection) {
102 for (auto checkedItem : checkedItems) {
102 for (auto checkedItem : checkedItems) {
103 listWidget->blockSignals(true);
103 listWidget->blockSignals(true);
104 checkedItem->setCheckState(Qt::Unchecked);
104 checkedItem->setCheckState(Qt::Unchecked);
105 listWidget->blockSignals(false);
105 listWidget->blockSignals(false);
106 }
106 }
107
107
108 checkedItems.clear();
108 checkedItems.clear();
109 }
109 }
110 checkedItems << item;
110 checkedItems << item;
111 }
111 }
112 else {
112 else {
113 checkedItems.remove(item);
113 checkedItems.remove(item);
114 }
114 }
115 });
115 });
116
116
117 QStringList result;
117 QStringList result;
118
118
119 d.setMinimumWidth(120);
119 d.setMinimumWidth(120);
120 d.resize(d.minimumSizeHint());
120 d.resize(d.minimumSizeHint());
121 d.move(location);
121 d.move(location);
122 if (d.exec() == QDialog::Accepted) {
122 if (d.exec() == QDialog::Accepted) {
123 for (auto item : checkedItems) {
123 for (auto item : checkedItems) {
124 result += item->text();
124 result += item->text();
125 }
125 }
126 }
126 }
127 else {
127 else {
128 result = selectedZones;
128 result = selectedZones;
129 }
129 }
130
130
131 return result;
131 return result;
132 }
132 }
133
133
134 void updateForTimeMode(QTableView *tableView)
134 void updateForTimeMode(QTreeView *treeView)
135 {
135 {
136 auto selectedRows = tableView->selectionModel()->selectedRows();
136 auto selectedRows = treeView->selectionModel()->selectedRows();
137
137
138 if (selectedRows.count() == 1) {
138 if (selectedRows.count() == 1) {
139 auto event = m_Model->getEvent(selectedRows.first().row());
139 auto event = m_Model->getEvent(selectedRows.first().row());
140 if (m_VisualizationWidget) {
140 if (m_VisualizationWidget) {
141 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
141 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
142
142
143 for (auto zoneName : m_ZonesForTimeMode) {
143 for (auto zoneName : m_ZonesForTimeMode) {
144 if (auto zone = tab->getZoneWithName(zoneName)) {
144 if (auto zone = tab->getZoneWithName(zoneName)) {
145 SqpRange eventRange;
145 SqpRange eventRange;
146 eventRange.m_TStart = event->getTStart();
146 // eventRange.m_TStart = event->getTStart();
147 eventRange.m_TEnd = event->getTEnd();
147 // eventRange.m_TEnd = event->getTEnd();
148 zone->setZoneRange(eventRange);
148 zone->setZoneRange(eventRange);
149 }
149 }
150 }
150 }
151 }
151 }
152 else {
152 else {
153 qCWarning(LOG_CatalogueEventsWidget())
153 qCWarning(LOG_CatalogueEventsWidget())
154 << "updateTimeZone: no tab found in the visualization";
154 << "updateTimeZone: no tab found in the visualization";
155 }
155 }
156 }
156 }
157 else {
157 else {
158 qCWarning(LOG_CatalogueEventsWidget())
158 qCWarning(LOG_CatalogueEventsWidget())
159 << "updateTimeZone: visualization widget not found";
159 << "updateTimeZone: visualization widget not found";
160 }
160 }
161 }
161 }
162 else {
162 else {
163 qCWarning(LOG_CatalogueEventsWidget())
163 qCWarning(LOG_CatalogueEventsWidget())
164 << "updateTimeZone: not compatible with multiple events selected";
164 << "updateTimeZone: not compatible with multiple events selected";
165 }
165 }
166 }
166 }
167
167
168 void updateForGraphMode(QTableView *tableView)
168 void updateForGraphMode(QTreeView *treeView)
169 {
169 {
170 auto selectedRows = tableView->selectionModel()->selectedRows();
170 auto selectedRows = treeView->selectionModel()->selectedRows();
171
171
172 if (selectedRows.count() == 1) {
172 if (selectedRows.count() == 1) {
173 auto event = m_Model->getEvent(selectedRows.first().row());
173 auto event = m_Model->getEvent(selectedRows.first().row());
174 if (m_VisualizationWidget) {
174 if (m_VisualizationWidget) {
175 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
175 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
176 if (auto zone = tab->getZoneWithName(m_ZoneForGraphMode)) {
176 if (auto zone = tab->getZoneWithName(m_ZoneForGraphMode)) {
177 // TODO
177 // TODO
178 }
178 }
179 }
179 }
180 else {
180 else {
181 qCWarning(LOG_CatalogueEventsWidget())
181 qCWarning(LOG_CatalogueEventsWidget())
182 << "updateGraphMode: no tab found in the visualization";
182 << "updateGraphMode: no tab found in the visualization";
183 }
183 }
184 }
184 }
185 else {
185 else {
186 qCWarning(LOG_CatalogueEventsWidget())
186 qCWarning(LOG_CatalogueEventsWidget())
187 << "updateGraphMode: visualization widget not found";
187 << "updateGraphMode: visualization widget not found";
188 }
188 }
189 }
189 }
190 else {
190 else {
191 qCWarning(LOG_CatalogueEventsWidget())
191 qCWarning(LOG_CatalogueEventsWidget())
192 << "updateGraphMode: not compatible with multiple events selected";
192 << "updateGraphMode: not compatible with multiple events selected";
193 }
193 }
194 }
194 }
195 };
195 };
196
196
197 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
197 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
198 : QWidget(parent),
198 : QWidget(parent),
199 ui(new Ui::CatalogueEventsWidget),
199 ui(new Ui::CatalogueEventsWidget),
200 impl{spimpl::make_unique_impl<CatalogueEventsWidgetPrivate>()}
200 impl{spimpl::make_unique_impl<CatalogueEventsWidgetPrivate>()}
201 {
201 {
202 ui->setupUi(this);
202 ui->setupUi(this);
203
203
204 impl->m_Model = new CatalogueEventsTableModel{this};
204 impl->m_Model = new CatalogueEventsModel{this};
205 ui->tableView->setModel(impl->m_Model);
205 ui->treeView->setModel(impl->m_Model);
206
206
207 ui->tableView->setSortingEnabled(true);
207 ui->treeView->setSortingEnabled(true);
208 ui->tableView->setDragDropMode(QAbstractItemView::DragDrop);
208 ui->treeView->setDragDropMode(QAbstractItemView::DragDrop);
209 ui->tableView->setDragEnabled(true);
209 ui->treeView->setDragEnabled(true);
210
210
211 connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) {
211 connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) {
212 if (checked) {
212 if (checked) {
213 ui->btnChart->setChecked(false);
213 ui->btnChart->setChecked(false);
214 impl->m_ZonesForTimeMode
214 impl->m_ZonesForTimeMode
215 = impl->selectZone(this, impl->m_ZonesForTimeMode, true,
215 = impl->selectZone(this, impl->m_ZonesForTimeMode, true,
216 this->mapToGlobal(ui->btnTime->frameGeometry().center()));
216 this->mapToGlobal(ui->btnTime->frameGeometry().center()));
217
217
218 impl->updateForTimeMode(ui->tableView);
218 impl->updateForTimeMode(ui->treeView);
219 }
219 }
220 });
220 });
221
221
222 connect(ui->btnChart, &QToolButton::clicked, [this](auto checked) {
222 connect(ui->btnChart, &QToolButton::clicked, [this](auto checked) {
223 if (checked) {
223 if (checked) {
224 ui->btnTime->setChecked(false);
224 ui->btnTime->setChecked(false);
225 impl->m_ZoneForGraphMode
225 impl->m_ZoneForGraphMode
226 = impl->selectZone(this, {impl->m_ZoneForGraphMode}, false,
226 = impl->selectZone(this, {impl->m_ZoneForGraphMode}, false,
227 this->mapToGlobal(ui->btnChart->frameGeometry().center()))
227 this->mapToGlobal(ui->btnChart->frameGeometry().center()))
228 .value(0);
228 .value(0);
229
229
230 impl->updateForGraphMode(ui->tableView);
230 impl->updateForGraphMode(ui->treeView);
231 }
231 }
232 });
232 });
233
233
234 auto emitSelection = [this]() {
234 auto emitSelection = [this]() {
235 QVector<std::shared_ptr<DBEvent> > events;
235 QVector<std::shared_ptr<DBEvent> > events;
236 for (auto rowIndex : ui->tableView->selectionModel()->selectedRows()) {
236 for (auto rowIndex : ui->treeView->selectionModel()->selectedRows()) {
237 events << impl->m_Model->getEvent(rowIndex.row());
237 events << impl->m_Model->getEvent(rowIndex.row());
238 }
238 }
239
239
240 emit this->eventsSelected(events);
240 emit this->eventsSelected(events);
241 };
241 };
242
242
243 connect(ui->tableView, &QTableView::clicked, emitSelection);
243 connect(ui->treeView, &QTreeView::clicked, emitSelection);
244 connect(ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged, emitSelection);
244 connect(ui->treeView->selectionModel(), &QItemSelectionModel::selectionChanged, emitSelection);
245
245
246 connect(ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged, [this]() {
246 connect(ui->treeView->selectionModel(), &QItemSelectionModel::selectionChanged, [this]() {
247 auto isNotMultiSelection = ui->tableView->selectionModel()->selectedRows().count() <= 1;
247 auto isNotMultiSelection = ui->treeView->selectionModel()->selectedRows().count() <= 1;
248 ui->btnChart->setEnabled(isNotMultiSelection);
248 ui->btnChart->setEnabled(isNotMultiSelection);
249 ui->btnTime->setEnabled(isNotMultiSelection);
249 ui->btnTime->setEnabled(isNotMultiSelection);
250
250
251 if (isNotMultiSelection && ui->btnTime->isChecked()) {
251 if (isNotMultiSelection && ui->btnTime->isChecked()) {
252 impl->updateForTimeMode(ui->tableView);
252 impl->updateForTimeMode(ui->treeView);
253 }
253 }
254 else if (isNotMultiSelection && ui->btnChart->isChecked()) {
254 else if (isNotMultiSelection && ui->btnChart->isChecked()) {
255 impl->updateForGraphMode(ui->tableView);
255 impl->updateForGraphMode(ui->treeView);
256 }
256 }
257 });
257 });
258
258
259 ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
259 ui->treeView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
260 ui->tableView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
260 ui->treeView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
261 ui->tableView->horizontalHeader()->setSortIndicatorShown(true);
261 ui->treeView->header()->setSortIndicatorShown(true);
262 }
262 }
263
263
264 CatalogueEventsWidget::~CatalogueEventsWidget()
264 CatalogueEventsWidget::~CatalogueEventsWidget()
265 {
265 {
266 delete ui;
266 delete ui;
267 }
267 }
268
268
269 void CatalogueEventsWidget::setVisualizationWidget(VisualizationWidget *visualization)
269 void CatalogueEventsWidget::setVisualizationWidget(VisualizationWidget *visualization)
270 {
270 {
271 impl->m_VisualizationWidget = visualization;
271 impl->m_VisualizationWidget = visualization;
272 }
272 }
273
273
274 void CatalogueEventsWidget::setEventChanges(const std::shared_ptr<DBEvent> &event, bool hasChanges)
274 void CatalogueEventsWidget::setEventChanges(const std::shared_ptr<DBEvent> &event, bool hasChanges)
275 {
275 {
276 impl->m_Model->refreshEvent(event);
276 impl->m_Model->refreshEvent(event);
277 }
277 }
278
278
279 void CatalogueEventsWidget::populateWithCatalogues(
279 void CatalogueEventsWidget::populateWithCatalogues(
280 const QVector<std::shared_ptr<DBCatalogue> > &catalogues)
280 const QVector<std::shared_ptr<DBCatalogue> > &catalogues)
281 {
281 {
282 QSet<QUuid> eventIds;
282 QSet<QUuid> eventIds;
283 QVector<std::shared_ptr<DBEvent> > events;
283 QVector<std::shared_ptr<DBEvent> > events;
284
284
285 for (auto catalogue : catalogues) {
285 for (auto catalogue : catalogues) {
286 auto catalogueEvents = sqpApp->catalogueController().retrieveEventsFromCatalogue(catalogue);
286 auto catalogueEvents = sqpApp->catalogueController().retrieveEventsFromCatalogue(catalogue);
287 for (auto event : catalogueEvents) {
287 for (auto event : catalogueEvents) {
288 if (!eventIds.contains(event->getUniqId())) {
288 if (!eventIds.contains(event->getUniqId())) {
289 events << event;
289 events << event;
290 eventIds.insert(event->getUniqId());
290 eventIds.insert(event->getUniqId());
291 }
291 }
292 }
292 }
293 }
293 }
294
294
295 impl->setEvents(events, ui->tableView);
295 impl->setEvents(events, ui->treeView);
296 }
296 }
@@ -1,146 +1,146
1 #include "Catalogue/CatalogueInspectorWidget.h"
1 #include "Catalogue/CatalogueInspectorWidget.h"
2 #include "ui_CatalogueInspectorWidget.h"
2 #include "ui_CatalogueInspectorWidget.h"
3
3
4 #include <Common/DateUtils.h>
4 #include <Common/DateUtils.h>
5 #include <DBCatalogue.h>
5 #include <DBCatalogue.h>
6 #include <DBEvent.h>
6 #include <DBEvent.h>
7 #include <DBTag.h>
7 #include <DBTag.h>
8
8
9 struct CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate {
9 struct CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate {
10 std::shared_ptr<DBCatalogue> m_DisplayedCatalogue = nullptr;
10 std::shared_ptr<DBCatalogue> m_DisplayedCatalogue = nullptr;
11 std::shared_ptr<DBEvent> m_DisplayedEvent = nullptr;
11 std::shared_ptr<DBEvent> m_DisplayedEvent = nullptr;
12
12
13 void connectCatalogueUpdateSignals(CatalogueInspectorWidget *inspector,
13 void connectCatalogueUpdateSignals(CatalogueInspectorWidget *inspector,
14 Ui::CatalogueInspectorWidget *ui);
14 Ui::CatalogueInspectorWidget *ui);
15 void connectEventUpdateSignals(CatalogueInspectorWidget *inspector,
15 void connectEventUpdateSignals(CatalogueInspectorWidget *inspector,
16 Ui::CatalogueInspectorWidget *ui);
16 Ui::CatalogueInspectorWidget *ui);
17 };
17 };
18
18
19 CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent)
19 CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent)
20 : QWidget(parent),
20 : QWidget(parent),
21 ui(new Ui::CatalogueInspectorWidget),
21 ui(new Ui::CatalogueInspectorWidget),
22 impl{spimpl::make_unique_impl<CatalogueInspectorWidgetPrivate>()}
22 impl{spimpl::make_unique_impl<CatalogueInspectorWidgetPrivate>()}
23 {
23 {
24 ui->setupUi(this);
24 ui->setupUi(this);
25 showPage(Page::Empty);
25 showPage(Page::Empty);
26
26
27 impl->connectCatalogueUpdateSignals(this, ui);
27 impl->connectCatalogueUpdateSignals(this, ui);
28 impl->connectEventUpdateSignals(this, ui);
28 impl->connectEventUpdateSignals(this, ui);
29 }
29 }
30
30
31 CatalogueInspectorWidget::~CatalogueInspectorWidget()
31 CatalogueInspectorWidget::~CatalogueInspectorWidget()
32 {
32 {
33 delete ui;
33 delete ui;
34 }
34 }
35
35
36 void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectCatalogueUpdateSignals(
36 void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectCatalogueUpdateSignals(
37 CatalogueInspectorWidget *inspector, Ui::CatalogueInspectorWidget *ui)
37 CatalogueInspectorWidget *inspector, Ui::CatalogueInspectorWidget *ui)
38 {
38 {
39 connect(ui->leCatalogueName, &QLineEdit::editingFinished, [ui, inspector, this]() {
39 connect(ui->leCatalogueName, &QLineEdit::editingFinished, [ui, inspector, this]() {
40 if (ui->leCatalogueName->text() != m_DisplayedCatalogue->getName()) {
40 if (ui->leCatalogueName->text() != m_DisplayedCatalogue->getName()) {
41 m_DisplayedCatalogue->setName(ui->leCatalogueName->text());
41 m_DisplayedCatalogue->setName(ui->leCatalogueName->text());
42 emit inspector->catalogueUpdated(m_DisplayedCatalogue);
42 emit inspector->catalogueUpdated(m_DisplayedCatalogue);
43 }
43 }
44 });
44 });
45
45
46 connect(ui->leCatalogueAuthor, &QLineEdit::editingFinished, [ui, inspector, this]() {
46 connect(ui->leCatalogueAuthor, &QLineEdit::editingFinished, [ui, inspector, this]() {
47 if (ui->leCatalogueAuthor->text() != m_DisplayedCatalogue->getAuthor()) {
47 if (ui->leCatalogueAuthor->text() != m_DisplayedCatalogue->getAuthor()) {
48 m_DisplayedCatalogue->setAuthor(ui->leCatalogueAuthor->text());
48 m_DisplayedCatalogue->setAuthor(ui->leCatalogueAuthor->text());
49 emit inspector->catalogueUpdated(m_DisplayedCatalogue);
49 emit inspector->catalogueUpdated(m_DisplayedCatalogue);
50 }
50 }
51 });
51 });
52 }
52 }
53
53
54 void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectEventUpdateSignals(
54 void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectEventUpdateSignals(
55 CatalogueInspectorWidget *inspector, Ui::CatalogueInspectorWidget *ui)
55 CatalogueInspectorWidget *inspector, Ui::CatalogueInspectorWidget *ui)
56 {
56 {
57 connect(ui->leEventName, &QLineEdit::editingFinished, [ui, inspector, this]() {
57 connect(ui->leEventName, &QLineEdit::editingFinished, [ui, inspector, this]() {
58 if (ui->leEventName->text() != m_DisplayedEvent->getName()) {
58 if (ui->leEventName->text() != m_DisplayedEvent->getName()) {
59 m_DisplayedEvent->setName(ui->leEventName->text());
59 m_DisplayedEvent->setName(ui->leEventName->text());
60 emit inspector->eventUpdated(m_DisplayedEvent);
60 emit inspector->eventUpdated(m_DisplayedEvent);
61 }
61 }
62 });
62 });
63
63
64 connect(ui->leEventMission, &QLineEdit::editingFinished, [ui, inspector, this]() {
64 connect(ui->leEventMission, &QLineEdit::editingFinished, [ui, inspector, this]() {
65 if (ui->leEventMission->text() != m_DisplayedEvent->getMission()) {
65 // if (ui->leEventMission->text() != m_DisplayedEvent->getMission()) {
66 m_DisplayedEvent->setMission(ui->leEventMission->text());
66 // m_DisplayedEvent->setMission(ui->leEventMission->text());
67 emit inspector->eventUpdated(m_DisplayedEvent);
67 // emit inspector->eventUpdated(m_DisplayedEvent);
68 }
68 // }
69 });
69 });
70
70
71 connect(ui->leEventProduct, &QLineEdit::editingFinished, [ui, inspector, this]() {
71 connect(ui->leEventProduct, &QLineEdit::editingFinished, [ui, inspector, this]() {
72 if (ui->leEventProduct->text() != m_DisplayedEvent->getProduct()) {
72 // if (ui->leEventProduct->text() != m_DisplayedEvent->getProduct()) {
73 m_DisplayedEvent->setProduct(ui->leEventProduct->text());
73 // m_DisplayedEvent->setProduct(ui->leEventProduct->text());
74 emit inspector->eventUpdated(m_DisplayedEvent);
74 // emit inspector->eventUpdated(m_DisplayedEvent);
75 }
75 // }
76 });
76 });
77
77
78 connect(ui->leEventTags, &QLineEdit::editingFinished, [ui, inspector, this]() {
78 connect(ui->leEventTags, &QLineEdit::editingFinished, [ui, inspector, this]() {
79 // TODO
79 // TODO
80 });
80 });
81
81
82 connect(ui->dateTimeEventTStart, &QDateTimeEdit::editingFinished, [ui, inspector, this]() {
82 connect(ui->dateTimeEventTStart, &QDateTimeEdit::editingFinished, [ui, inspector, this]() {
83 auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTStart->dateTime());
83 // auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTStart->dateTime());
84 if (time != m_DisplayedEvent->getTStart()) {
84 // if (time != m_DisplayedEvent->getTStart()) {
85 m_DisplayedEvent->setTStart(time);
85 // m_DisplayedEvent->setTStart(time);
86 emit inspector->eventUpdated(m_DisplayedEvent);
86 // emit inspector->eventUpdated(m_DisplayedEvent);
87 }
87 // }
88 });
88 });
89
89
90 connect(ui->dateTimeEventTEnd, &QDateTimeEdit::editingFinished, [ui, inspector, this]() {
90 connect(ui->dateTimeEventTEnd, &QDateTimeEdit::editingFinished, [ui, inspector, this]() {
91 auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTEnd->dateTime());
91 // auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTEnd->dateTime());
92 if (time != m_DisplayedEvent->getTEnd()) {
92 // if (time != m_DisplayedEvent->getTEnd()) {
93 m_DisplayedEvent->setTEnd(time);
93 // m_DisplayedEvent->setTEnd(time);
94 emit inspector->eventUpdated(m_DisplayedEvent);
94 // emit inspector->eventUpdated(m_DisplayedEvent);
95 }
95 // }
96 });
96 });
97 }
97 }
98
98
99 void CatalogueInspectorWidget::showPage(CatalogueInspectorWidget::Page page)
99 void CatalogueInspectorWidget::showPage(CatalogueInspectorWidget::Page page)
100 {
100 {
101 ui->stackedWidget->setCurrentIndex(static_cast<int>(page));
101 ui->stackedWidget->setCurrentIndex(static_cast<int>(page));
102 }
102 }
103
103
104 CatalogueInspectorWidget::Page CatalogueInspectorWidget::currentPage() const
104 CatalogueInspectorWidget::Page CatalogueInspectorWidget::currentPage() const
105 {
105 {
106 return static_cast<Page>(ui->stackedWidget->currentIndex());
106 return static_cast<Page>(ui->stackedWidget->currentIndex());
107 }
107 }
108
108
109 void CatalogueInspectorWidget::setEvent(const std::shared_ptr<DBEvent> &event)
109 void CatalogueInspectorWidget::setEvent(const std::shared_ptr<DBEvent> &event)
110 {
110 {
111 impl->m_DisplayedEvent = event;
111 impl->m_DisplayedEvent = event;
112
112
113 blockSignals(true);
113 blockSignals(true);
114
114
115 showPage(Page::EventProperties);
115 showPage(Page::EventProperties);
116 ui->leEventName->setText(event->getName());
116 ui->leEventName->setText(event->getName());
117 ui->leEventMission->setText(event->getMission());
117 // ui->leEventMission->setText(event->getMission());
118 ui->leEventProduct->setText(event->getProduct());
118 // ui->leEventProduct->setText(event->getProduct());
119
119
120 QString tagList;
120 QString tagList;
121 auto tags = event->getTags();
121 auto tags = event->getTags();
122 for (auto tag : tags) {
122 for (auto tag : tags) {
123 tagList += tag.getName();
123 tagList += tag.getName();
124 tagList += ' ';
124 tagList += ' ';
125 }
125 }
126
126
127 ui->leEventTags->setText(tagList);
127 ui->leEventTags->setText(tagList);
128
128
129 ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(event->getTStart()));
129 // ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(event->getTStart()));
130 ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(event->getTEnd()));
130 // ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(event->getTEnd()));
131
131
132 blockSignals(false);
132 blockSignals(false);
133 }
133 }
134
134
135 void CatalogueInspectorWidget::setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue)
135 void CatalogueInspectorWidget::setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue)
136 {
136 {
137 impl->m_DisplayedCatalogue = catalogue;
137 impl->m_DisplayedCatalogue = catalogue;
138
138
139 blockSignals(true);
139 blockSignals(true);
140
140
141 showPage(Page::CatalogueProperties);
141 showPage(Page::CatalogueProperties);
142 ui->leCatalogueName->setText(catalogue->getName());
142 ui->leCatalogueName->setText(catalogue->getName());
143 ui->leCatalogueAuthor->setText(catalogue->getAuthor());
143 ui->leCatalogueAuthor->setText(catalogue->getAuthor());
144
144
145 blockSignals(false);
145 blockSignals(false);
146 }
146 }
@@ -1,154 +1,139
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>CatalogueEventsWidget</class>
3 <class>CatalogueEventsWidget</class>
4 <widget class="QWidget" name="CatalogueEventsWidget">
4 <widget class="QWidget" name="CatalogueEventsWidget">
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>566</width>
9 <width>566</width>
10 <height>258</height>
10 <height>258</height>
11 </rect>
11 </rect>
12 </property>
12 </property>
13 <property name="windowTitle">
13 <property name="windowTitle">
14 <string>Form</string>
14 <string>Form</string>
15 </property>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout">
16 <layout class="QVBoxLayout" name="verticalLayout">
17 <property name="leftMargin">
17 <property name="leftMargin">
18 <number>0</number>
18 <number>0</number>
19 </property>
19 </property>
20 <property name="topMargin">
20 <property name="topMargin">
21 <number>0</number>
21 <number>0</number>
22 </property>
22 </property>
23 <property name="rightMargin">
23 <property name="rightMargin">
24 <number>0</number>
24 <number>0</number>
25 </property>
25 </property>
26 <property name="bottomMargin">
26 <property name="bottomMargin">
27 <number>0</number>
27 <number>0</number>
28 </property>
28 </property>
29 <item>
29 <item>
30 <layout class="QHBoxLayout" name="horizontalLayout">
30 <layout class="QHBoxLayout" name="horizontalLayout">
31 <item>
31 <item>
32 <widget class="QToolButton" name="btnAdd">
32 <widget class="QToolButton" name="btnAdd">
33 <property name="text">
33 <property name="text">
34 <string>+</string>
34 <string>+</string>
35 </property>
35 </property>
36 <property name="icon">
36 <property name="icon">
37 <iconset resource="../../resources/sqpguiresources.qrc">
37 <iconset resource="../../resources/sqpguiresources.qrc">
38 <normaloff>:/icones/add.png</normaloff>:/icones/add.png</iconset>
38 <normaloff>:/icones/add.png</normaloff>:/icones/add.png</iconset>
39 </property>
39 </property>
40 <property name="autoRaise">
40 <property name="autoRaise">
41 <bool>true</bool>
41 <bool>true</bool>
42 </property>
42 </property>
43 </widget>
43 </widget>
44 </item>
44 </item>
45 <item>
45 <item>
46 <widget class="QToolButton" name="btnRemove">
46 <widget class="QToolButton" name="btnRemove">
47 <property name="text">
47 <property name="text">
48 <string> - </string>
48 <string> - </string>
49 </property>
49 </property>
50 <property name="icon">
50 <property name="icon">
51 <iconset resource="../../resources/sqpguiresources.qrc">
51 <iconset resource="../../resources/sqpguiresources.qrc">
52 <normaloff>:/icones/remove.png</normaloff>:/icones/remove.png</iconset>
52 <normaloff>:/icones/remove.png</normaloff>:/icones/remove.png</iconset>
53 </property>
53 </property>
54 <property name="autoRaise">
54 <property name="autoRaise">
55 <bool>true</bool>
55 <bool>true</bool>
56 </property>
56 </property>
57 </widget>
57 </widget>
58 </item>
58 </item>
59 <item>
59 <item>
60 <widget class="Line" name="line">
60 <widget class="Line" name="line">
61 <property name="orientation">
61 <property name="orientation">
62 <enum>Qt::Vertical</enum>
62 <enum>Qt::Vertical</enum>
63 </property>
63 </property>
64 </widget>
64 </widget>
65 </item>
65 </item>
66 <item>
66 <item>
67 <widget class="QToolButton" name="btnTime">
67 <widget class="QToolButton" name="btnTime">
68 <property name="text">
68 <property name="text">
69 <string>T</string>
69 <string>T</string>
70 </property>
70 </property>
71 <property name="icon">
71 <property name="icon">
72 <iconset resource="../../resources/sqpguiresources.qrc">
72 <iconset resource="../../resources/sqpguiresources.qrc">
73 <normaloff>:/icones/time.png</normaloff>:/icones/time.png</iconset>
73 <normaloff>:/icones/time.png</normaloff>:/icones/time.png</iconset>
74 </property>
74 </property>
75 <property name="checkable">
75 <property name="checkable">
76 <bool>true</bool>
76 <bool>true</bool>
77 </property>
77 </property>
78 <property name="autoRaise">
78 <property name="autoRaise">
79 <bool>true</bool>
79 <bool>true</bool>
80 </property>
80 </property>
81 </widget>
81 </widget>
82 </item>
82 </item>
83 <item>
83 <item>
84 <widget class="QToolButton" name="btnChart">
84 <widget class="QToolButton" name="btnChart">
85 <property name="text">
85 <property name="text">
86 <string>G</string>
86 <string>G</string>
87 </property>
87 </property>
88 <property name="icon">
88 <property name="icon">
89 <iconset resource="../../resources/sqpguiresources.qrc">
89 <iconset resource="../../resources/sqpguiresources.qrc">
90 <normaloff>:/icones/chart.png</normaloff>:/icones/chart.png</iconset>
90 <normaloff>:/icones/chart.png</normaloff>:/icones/chart.png</iconset>
91 </property>
91 </property>
92 <property name="checkable">
92 <property name="checkable">
93 <bool>true</bool>
93 <bool>true</bool>
94 </property>
94 </property>
95 <property name="autoRaise">
95 <property name="autoRaise">
96 <bool>true</bool>
96 <bool>true</bool>
97 </property>
97 </property>
98 </widget>
98 </widget>
99 </item>
99 </item>
100 <item>
100 <item>
101 <widget class="Line" name="line_2">
101 <widget class="Line" name="line_2">
102 <property name="orientation">
102 <property name="orientation">
103 <enum>Qt::Vertical</enum>
103 <enum>Qt::Vertical</enum>
104 </property>
104 </property>
105 </widget>
105 </widget>
106 </item>
106 </item>
107 <item>
107 <item>
108 <widget class="QLineEdit" name="lineEdit">
108 <widget class="QLineEdit" name="lineEdit">
109 <property name="enabled">
109 <property name="enabled">
110 <bool>false</bool>
110 <bool>false</bool>
111 </property>
111 </property>
112 </widget>
112 </widget>
113 </item>
113 </item>
114 </layout>
114 </layout>
115 </item>
115 </item>
116 <item>
116 <item>
117 <widget class="QTableView" name="tableView">
117 <widget class="QTreeView" name="treeView">
118 <property name="dragEnabled">
118 <property name="dragEnabled">
119 <bool>true</bool>
119 <bool>true</bool>
120 </property>
120 </property>
121 <property name="dragDropMode">
121 <property name="dragDropMode">
122 <enum>QAbstractItemView::DragDrop</enum>
122 <enum>QAbstractItemView::DragDrop</enum>
123 </property>
123 </property>
124 <property name="selectionBehavior">
124 <property name="selectionBehavior">
125 <enum>QAbstractItemView::SelectRows</enum>
125 <enum>QAbstractItemView::SelectRows</enum>
126 </property>
126 </property>
127 <attribute name="horizontalHeaderVisible">
127 <attribute name="headerStretchLastSection">
128 <bool>true</bool>
129 </attribute>
130 <attribute name="horizontalHeaderHighlightSections">
131 <bool>false</bool>
132 </attribute>
133 <attribute name="horizontalHeaderShowSortIndicator" stdset="0">
134 <bool>true</bool>
135 </attribute>
136 <attribute name="verticalHeaderVisible">
137 <bool>false</bool>
138 </attribute>
139 <attribute name="verticalHeaderDefaultSectionSize">
140 <number>25</number>
141 </attribute>
142 <attribute name="verticalHeaderHighlightSections">
143 <bool>false</bool>
128 <bool>false</bool>
144 </attribute>
129 </attribute>
145 </widget>
130 </widget>
146 </item>
131 </item>
147 </layout>
132 </layout>
148 </widget>
133 </widget>
149 <resources>
134 <resources>
150 <include location="../../resources/sqpguiresources.qrc"/>
135 <include location="../../resources/sqpguiresources.qrc"/>
151 <include location="../../resources/sqpguiresources.qrc"/>
136 <include location="../../resources/sqpguiresources.qrc"/>
152 </resources>
137 </resources>
153 <connections/>
138 <connections/>
154 </ui>
139 </ui>
General Comments 0
You need to be logged in to leave comments. Login now