##// END OF EJS Templates
Added catalog columns sorting but broken :(...
jeandet -
r1474:337dc641a65f
parent child
Show More
@@ -1,1 +1,1
1 Subproject commit 4e4ec6844f702c9fe7b3c758a50430e17d186fac
1 Subproject commit 521f9540ac01f61c92600a4aa6c8d3c148abc74a
@@ -1,206 +1,215
1 /*
1 /*
2 This file is part of SciQLop.
2 This file is part of SciQLop.
3
3
4 SciQLop is free software: you can redistribute it and/or modify
4 SciQLop is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
7 (at your option) any later version.
8
8
9 SciQLop is distributed in the hope that it will be useful,
9 SciQLop is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
12 GNU General Public License for more details.
13
13
14 You should have received a copy of the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with SciQLop. If not, see <https://www.gnu.org/licenses/>.
15 along with SciQLop. If not, see <https://www.gnu.org/licenses/>.
16 */
16 */
17 #ifndef EVENTSMODEL_H
17 #ifndef EVENTSMODEL_H
18 #define EVENTSMODEL_H
18 #define EVENTSMODEL_H
19 #include <Catalogue/CatalogueController.h>
19 #include <Catalogue/CatalogueController.h>
20 #include <QAbstractItemModel>
20 #include <QAbstractItemModel>
21 #include <QIcon>
21 #include <QIcon>
22 #include <array>
22 #include <array>
23
23
24 class EventsModel : public QAbstractItemModel
24 class EventsModel : public QAbstractItemModel
25 {
25 {
26 Q_OBJECT
26 Q_OBJECT
27
27
28 enum class Columns
28 enum class Columns
29 {
29 {
30 Name = 0,
30 Name = 0,
31 TStart = 1,
31 TStart = 1,
32 TEnd = 2,
32 TEnd = 2,
33 Tags = 3,
33 Tags = 3,
34 Product = 4,
34 Product = 4,
35 Validation = 5,
35 Validation = 5,
36 NbColumn = 6
36 NbColumn = 6
37 };
37 };
38
38
39 const std::array<QString, static_cast<int>(Columns::NbColumn)> ColumnsNames
39 const std::array<QString, static_cast<int>(Columns::NbColumn)> ColumnsNames
40 = { "Name", "Start time", "Stop time", "Tags", "Product(s)", "" };
40 = { "Name", "Start time", "Stop time", "Tags", "Product(s)", "" };
41
41
42
42
43 public:
43 public:
44 enum class ItemType
44 enum class ItemType
45 {
45 {
46 None,
46 None,
47 Event,
47 Event,
48 Product
48 Product
49 };
49 };
50
50
51 struct EventsModelItem
51 struct EventsModelItem
52 {
52 {
53 ItemType type;
53 ItemType type;
54 std::variant<CatalogueController::Event_ptr, CatalogueController::Product_t> item;
54 std::variant<CatalogueController::Event_ptr, CatalogueController::Product_t> item;
55 EventsModelItem() : type { ItemType::None } {}
55 // EventsModelItem() : type { ItemType::None } {}
56 EventsModelItem() = delete;
57 EventsModelItem(const EventsModelItem&) = delete;
58 EventsModelItem(EventsModelItem&&) = delete;
59 EventsModelItem& operator=(const EventsModelItem&) = delete;
60 EventsModelItem& operator=(EventsModelItem&&) = delete;
56 EventsModelItem(const CatalogueController::Event_ptr& event)
61 EventsModelItem(const CatalogueController::Event_ptr& event)
57 : type { ItemType::Event }, item { event }, parent { nullptr }, icon {}
62 : type { ItemType::Event }, item { event }, parent { nullptr }, icon {}
58 {
63 {
59 std::transform(std::cbegin(event->products), std::cend(event->products),
64 std::transform(std::cbegin(event->products), std::cend(event->products),
60 std::back_inserter(children),
65 std::back_inserter(children),
61 [this](auto& product) { return std::make_unique<EventsModelItem>(product, this); });
66 [this](auto& product) { return std::make_unique<EventsModelItem>(product, this); });
62 }
67 }
63
68
64 EventsModelItem(const CatalogueController::Product_t& product, EventsModelItem* parent)
69 EventsModelItem(const CatalogueController::Product_t& product, EventsModelItem* parent)
65 : type { ItemType::Product }, item { product }, parent { parent }, icon {}
70 : type { ItemType::Product }, item { product }, parent { parent }, icon {}
66 {
71 {
67 }
72 }
73 ~EventsModelItem() { children.clear(); }
68 CatalogueController::Event_ptr event() const
74 CatalogueController::Event_ptr event() const
69 {
75 {
70 return std::get<CatalogueController::Event_ptr>(item);
76 return std::get<CatalogueController::Event_ptr>(item);
71 }
77 }
72 CatalogueController::Product_t product() const
78 CatalogueController::Product_t product() const
73 {
79 {
74 return std::get<CatalogueController::Product_t>(item);
80 return std::get<CatalogueController::Product_t>(item);
75 }
81 }
76 QVariant data(int col, int role) const
82 QVariant data(int col, int role) const
77 {
83 {
78 if(role==Qt::DisplayRole)
84 if (role == Qt::DisplayRole)
79 {
85 {
80 switch (type)
86 switch (type)
81 {
87 {
82 case ItemType::Product :
88 case ItemType::Product:
83 return data(product(),col);
89 return data(product(), col);
84 case ItemType::Event:
90 case ItemType::Event:
85 return data(event(),col);
91 return data(event(), col);
86 default:
92 default:
87 break;
93 break;
88 }
94 }
89 }
95 }
90 return QVariant{};
96 return QVariant {};
91 }
97 }
92 QVariant data(const CatalogueController::Event_ptr& event, int col) const
98 QVariant data(const CatalogueController::Event_ptr& event, int col) const
93 {
99 {
94 switch (static_cast<Columns>(col))
100 switch (static_cast<Columns>(col))
95 {
101 {
96 case EventsModel::Columns::Name:
102 case EventsModel::Columns::Name:
97 return QString::fromStdString(event->name);
103 return QString::fromStdString(event->name);
98 case EventsModel::Columns::TStart:
104 case EventsModel::Columns::TStart:
99 if (auto start = event->startTime())
105 if (auto start = event->startTime())
100 return DateUtils::dateTime(*start).toString(DATETIME_FORMAT_ONE_LINE);
106 return DateUtils::dateTime(*start).toString(DATETIME_FORMAT_ONE_LINE);
101 else
107 else
102 return QVariant {};
108 return QVariant {};
103 case EventsModel::Columns::TEnd:
109 case EventsModel::Columns::TEnd:
104 if (auto stop = event->stopTime())
110 if (auto stop = event->stopTime())
105 return DateUtils::dateTime(*stop).toString(DATETIME_FORMAT_ONE_LINE);
111 return DateUtils::dateTime(*stop).toString(DATETIME_FORMAT_ONE_LINE);
106 else
112 else
107 return QVariant {};
113 return QVariant {};
108 case EventsModel::Columns::Product:
114 case EventsModel::Columns::Product:
109 {
115 {
110 QStringList eventProductList;
116 QStringList eventProductList;
111 for (const auto& evtProduct : event->products)
117 for (const auto& evtProduct : event->products)
112 {
118 {
113 eventProductList << QString::fromStdString(evtProduct.name);
119 eventProductList << QString::fromStdString(evtProduct.name);
114 }
120 }
115 return eventProductList.join(";");
121 return eventProductList.join(";");
116 }
122 }
117 case EventsModel::Columns::Tags:
123 case EventsModel::Columns::Tags:
118 {
124 {
119 QString tagList;
125 QString tagList;
120 for (const auto& tag : event->tags)
126 for (const auto& tag : event->tags)
121 {
127 {
122 tagList += QString::fromStdString(tag);
128 tagList += QString::fromStdString(tag);
123 tagList += ' ';
129 tagList += ' ';
124 }
130 }
125 return tagList;
131 return tagList;
126 }
132 }
127 default:
133 default:
128 break;
134 break;
129 }
135 }
130 return QVariant {};
136 return QVariant {};
131 }
137 }
132
138
133 QVariant data(const CatalogueController::Product_t& product, int col) const
139 QVariant data(const CatalogueController::Product_t& product, int col) const
134 {
140 {
135 switch (static_cast<Columns>(col))
141 switch (static_cast<Columns>(col))
136 {
142 {
137 case EventsModel::Columns::Name:
143 case EventsModel::Columns::Name:
138 return QString::fromStdString(product.name);
144 return QString::fromStdString(product.name);
139 case EventsModel::Columns::TStart:
145 case EventsModel::Columns::TStart:
140 return DateUtils::dateTime(product.startTime).toString(DATETIME_FORMAT_ONE_LINE);
146 return DateUtils::dateTime(product.startTime)
147 .toString(DATETIME_FORMAT_ONE_LINE);
141 case EventsModel::Columns::TEnd:
148 case EventsModel::Columns::TEnd:
142 return DateUtils::dateTime(product.stopTime).toString(DATETIME_FORMAT_ONE_LINE);
149 return DateUtils::dateTime(product.stopTime).toString(DATETIME_FORMAT_ONE_LINE);
143 case EventsModel::Columns::Product:
150 case EventsModel::Columns::Product:
144 return QString::fromStdString(product.name);
151 return QString::fromStdString(product.name);
145 default:
152 default:
146 break;
153 break;
147 }
154 }
148 return QVariant {};
155 return QVariant {};
149 }
156 }
150
157
151 QString text() const
158 QString text() const
152 {
159 {
153 if (type == ItemType::Event)
160 if (type == ItemType::Event)
154 return QString::fromStdString(event()->name);
161 return QString::fromStdString(event()->name);
155 if (type == ItemType::Product)
162 if (type == ItemType::Product)
156 return QString::fromStdString(product().name);
163 return QString::fromStdString(product().name);
157 return QString();
164 return QString();
158 }
165 }
159 std::vector<std::unique_ptr<EventsModelItem>> children;
166 std::vector<std::unique_ptr<EventsModelItem>> children;
160 EventsModelItem* parent = nullptr;
167 EventsModelItem* parent = nullptr;
161 QIcon icon;
168 QIcon icon;
162 };
169 };
163 EventsModel(QObject* parent = nullptr);
170 EventsModel(QObject* parent = nullptr);
164
171
165 static inline EventsModelItem* to_item(const QModelIndex& index)
172 static inline EventsModelItem* to_item(const QModelIndex& index)
166 {
173 {
167 return static_cast<EventsModelItem*>(index.internalPointer());
174 return static_cast<EventsModelItem*>(index.internalPointer());
168 }
175 }
169
176
177 ~EventsModel() { _items.clear(); }
178
170 ItemType type(const QModelIndex& index) const;
179 ItemType type(const QModelIndex& index) const;
171
180
172 Qt::ItemFlags flags(const QModelIndex& index) const override
181 Qt::ItemFlags flags(const QModelIndex& index) const override
173 {
182 {
174 return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
183 return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
175 }
184 }
176 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
185 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
177
186
178 QModelIndex index(
187 QModelIndex index(
179 int row, int column, const QModelIndex& parent = QModelIndex()) const override;
188 int row, int column, const QModelIndex& parent = QModelIndex()) const override;
180
189
181 QModelIndex parent(const QModelIndex& index) const override;
190 QModelIndex parent(const QModelIndex& index) const override;
182
191
183 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
192 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
184
193
185 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
194 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
186
195
187 QVariant headerData(
196 QVariant headerData(
188 int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
197 int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
189
198
190 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
199 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
191
200
192 public slots:
201 public slots:
193 void setEvents(std::vector<CatalogueController::Event_ptr> events)
202 void setEvents(std::vector<CatalogueController::Event_ptr> events)
194 {
203 {
195 beginResetModel();
204 beginResetModel();
196 _items.clear();
205 _items.clear();
197 std::transform(std::begin(events), std::end(events), std::back_inserter(_items),
206 std::transform(std::begin(events), std::end(events), std::back_inserter(_items),
198 [](const auto& event) { return std::make_unique<EventsModelItem>(event); });
207 [](const auto& event) { return std::make_unique<EventsModelItem>(event); });
199 endResetModel();
208 endResetModel();
200 }
209 }
201
210
202 private:
211 private:
203 std::vector<std::unique_ptr<EventsModelItem>> _items;
212 std::vector<std::unique_ptr<EventsModelItem>> _items;
204 };
213 };
205
214
206 #endif // EVENTSMODEL_H
215 #endif // EVENTSMODEL_H
@@ -1,41 +1,43
1 /*
1 /*
2 This file is part of SciQLop.
2 This file is part of SciQLop.
3
3
4 SciQLop is free software: you can redistribute it and/or modify
4 SciQLop is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
7 (at your option) any later version.
8
8
9 SciQLop is distributed in the hope that it will be useful,
9 SciQLop is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
12 GNU General Public License for more details.
13
13
14 You should have received a copy of the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with SciQLop. If not, see <https://www.gnu.org/licenses/>.
15 along with SciQLop. If not, see <https://www.gnu.org/licenses/>.
16 */
16 */
17 #ifndef EVENTSTREEVIEW_H
17 #ifndef EVENTSTREEVIEW_H
18 #define EVENTSTREEVIEW_H
18 #define EVENTSTREEVIEW_H
19
19
20 #include <Catalogue/CatalogueController.h>
20 #include <Catalogue/CatalogueController.h>
21 #include <QObject>
21 #include <QObject>
22 #include <QTreeView>
22 #include <QTreeView>
23
23
24 class EventsTreeView : public QTreeView
24 class EventsTreeView : public QTreeView
25 {
25 {
26 Q_OBJECT
26 Q_OBJECT
27 public:
27 public:
28 EventsTreeView(QWidget* parent = nullptr);
28 EventsTreeView(QWidget* parent = nullptr);
29 ~EventsTreeView();
29
30
30 signals:
31 signals:
31 void eventSelected(const CatalogueController::Event_ptr& event);
32 void eventSelected(const CatalogueController::Event_ptr& event);
32 void productSelected(const CatalogueController::Product_t& product, const CatalogueController::Event_ptr& event);
33 void productSelected(
34 const CatalogueController::Product_t& product, const CatalogueController::Event_ptr& event);
33
35
34 public slots:
36 public slots:
35 void setEvents(std::vector<CatalogueController::Event_ptr> events);
37 void setEvents(std::vector<CatalogueController::Event_ptr> events);
36
38
37 private:
39 private:
38 void _itemSelected(const QModelIndex& index);
40 void _itemSelected(const QModelIndex& index);
39 };
41 };
40
42
41 #endif // EVENTSTREEVIEW_H
43 #endif // EVENTSTREEVIEW_H
@@ -1,169 +1,174
1
1
2 gui_moc_headers = [
2 gui_moc_headers = [
3 './include/Common/VisualizationDef.h',
3 './include/Common/VisualizationDef.h',
4 './include/Common/ColorUtils.h',
4 './include/Common/ColorUtils.h',
5 './include/DragAndDrop/DragDropGuiController.h',
5 './include/DragAndDrop/DragDropGuiController.h',
6 './include/DragAndDrop/DragDropTabSwitcher.h',
6 './include/DragAndDrop/DragDropTabSwitcher.h',
7 './include/DragAndDrop/DragDropScroller.h',
7 './include/DragAndDrop/DragDropScroller.h',
8 './include/Settings/SqpSettingsDialog.h',
8 './include/Settings/SqpSettingsDialog.h',
9 './include/Settings/SqpSettingsGeneralWidget.h',
9 './include/Settings/SqpSettingsGeneralWidget.h',
10 './include/DataSource/DataSourceTreeWidgetHelper.h',
10 './include/DataSource/DataSourceTreeWidgetHelper.h',
11 './include/DataSource/DataSourceTreeWidget.h',
11 './include/DataSource/DataSourceTreeWidget.h',
12 './include/DataSource/DataSourceTreeWidgetItem.h',
12 './include/DataSource/DataSourceTreeWidgetItem.h',
13 './include/DataSource/DataSourceWidget.h',
13 './include/DataSource/DataSourceWidget.h',
14 './include/Catalogue2/repositoriestreeview.h',
14 './include/Catalogue2/repositoriestreeview.h',
15 './include/Catalogue2/browser.h',
15 './include/Catalogue2/browser.h',
16 './include/Catalogue2/eventeditor.h',
16 './include/Catalogue2/eventeditor.h',
17 './include/Catalogue2/eventsmodel.h',
17 './include/Catalogue2/eventsmodel.h',
18 './include/Catalogue2/eventstreeview.h',
18 './include/Catalogue2/eventstreeview.h',
19 './include/Catalogue2/repositoriesmodel.h',
19 './include/Catalogue2/repositoriesmodel.h',
20 './include/TimeWidget/TimeWidget.h',
20 './include/TimeWidget/TimeWidget.h',
21 './include/SqpApplication.h',
21 './include/SqpApplication.h',
22 './include/SidePane/SqpSidePane.h',
22 './include/SidePane/SqpSidePane.h',
23 './include/Variable/RenameVariableDialog.h',
23 './include/Variable/RenameVariableDialog.h',
24 './include/Variable/VariableInspectorWidget.h',
24 './include/Variable/VariableInspectorWidget.h',
25 './include/Variable/VariableInspectorTableView.h',
25 './include/Variable/VariableInspectorTableView.h',
26 './include/Variable/VariableMenuHeaderWidget.h',
26 './include/Variable/VariableMenuHeaderWidget.h',
27 './include/Visualization/VisualizationDragWidget.h',
27 './include/Visualization/VisualizationDragWidget.h',
28 './include/Visualization/VisualizationZoneWidget.h',
28 './include/Visualization/VisualizationZoneWidget.h',
29 './include/Visualization/operations/GenerateVariableMenuOperation.h',
29 './include/Visualization/operations/GenerateVariableMenuOperation.h',
30 './include/Visualization/operations/RescaleAxeOperation.h',
30 './include/Visualization/operations/RescaleAxeOperation.h',
31 './include/Visualization/operations/RemoveVariableOperation.h',
31 './include/Visualization/operations/RemoveVariableOperation.h',
32 './include/Visualization/operations/MenuBuilder.h',
32 './include/Visualization/operations/MenuBuilder.h',
33 './include/Visualization/operations/FindVariableOperation.h',
33 './include/Visualization/operations/FindVariableOperation.h',
34 './include/Visualization/VisualizationDefs.h',
34 './include/Visualization/VisualizationDefs.h',
35 './include/Visualization/IVisualizationWidgetVisitor.h',
35 './include/Visualization/IVisualizationWidgetVisitor.h',
36 './include/Visualization/SqpColorScale.h',
36 './include/Visualization/SqpColorScale.h',
37 './include/Visualization/VisualizationGraphRenderingDelegate.h',
37 './include/Visualization/VisualizationGraphRenderingDelegate.h',
38 './include/Visualization/VisualizationGraphWidget.h',
38 './include/Visualization/VisualizationGraphWidget.h',
39 './include/Visualization/MacScrollBarStyle.h',
39 './include/Visualization/MacScrollBarStyle.h',
40 './include/Visualization/IVisualizationWidget.h',
40 './include/Visualization/IVisualizationWidget.h',
41 './include/Visualization/qcustomplot.h',
41 './include/Visualization/qcustomplot.h',
42 './include/Visualization/IGraphSynchronizer.h',
42 './include/Visualization/IGraphSynchronizer.h',
43 './include/Visualization/QCPColorMapIterator.h',
43 './include/Visualization/QCPColorMapIterator.h',
44 './include/Visualization/VisualizationActionManager.h',
44 './include/Visualization/VisualizationActionManager.h',
45 './include/Visualization/VisualizationTabWidget.h',
45 './include/Visualization/VisualizationTabWidget.h',
46 './include/Visualization/IVariableContainer.h',
46 './include/Visualization/IVariableContainer.h',
47 './include/Visualization/AxisRenderingUtils.h',
47 './include/Visualization/AxisRenderingUtils.h',
48 './include/Visualization/VisualizationMultiZoneSelectionDialog.h',
48 './include/Visualization/VisualizationMultiZoneSelectionDialog.h',
49 './include/Visualization/VisualizationCursorItem.h',
49 './include/Visualization/VisualizationCursorItem.h',
50 './include/Visualization/VisualizationWidget.h',
50 './include/Visualization/VisualizationWidget.h',
51 './include/Visualization/PlottablesRenderingUtils.h',
51 './include/Visualization/PlottablesRenderingUtils.h',
52 './include/Visualization/VisualizationSelectionZoneManager.h',
52 './include/Visualization/VisualizationSelectionZoneManager.h',
53 './include/Visualization/QCustomPlotSynchronizer.h',
53 './include/Visualization/QCustomPlotSynchronizer.h',
54 './include/Visualization/VisualizationSelectionZoneItem.h',
54 './include/Visualization/VisualizationSelectionZoneItem.h',
55 './include/Visualization/VisualizationDragDropContainer.h',
55 './include/Visualization/VisualizationDragDropContainer.h',
56 './include/Visualization/ColorScaleEditor.h',
56 './include/Visualization/ColorScaleEditor.h',
57 './include/Visualization/VisualizationGraphHelper.h',
57 './include/Visualization/VisualizationGraphHelper.h',
58 './include/Actions/ActionsGuiController.h',
58 './include/Actions/ActionsGuiController.h',
59 './include/Actions/FilteringAction.h',
59 './include/Actions/FilteringAction.h',
60 './include/Actions/SelectionZoneAction.h'
60 './include/Actions/SelectionZoneAction.h'
61 ]
61 ]
62
62
63
63
64 gui_ui_files = [
64 gui_ui_files = [
65 './ui/Settings/SqpSettingsGeneralWidget.ui',
65 './ui/Settings/SqpSettingsGeneralWidget.ui',
66 './ui/Settings/SqpSettingsDialog.ui',
66 './ui/Settings/SqpSettingsDialog.ui',
67 './ui/DataSource/DataSourceWidget.ui',
67 './ui/DataSource/DataSourceWidget.ui',
68 './ui/Catalogue2/browser.ui',
68 './ui/Catalogue2/browser.ui',
69 './ui/Catalogue2/eventeditor.ui',
69 './ui/Catalogue2/eventeditor.ui',
70 './ui/TimeWidget/TimeWidget.ui',
70 './ui/TimeWidget/TimeWidget.ui',
71 './ui/SidePane/SqpSidePane.ui',
71 './ui/SidePane/SqpSidePane.ui',
72 './ui/Variable/RenameVariableDialog.ui',
72 './ui/Variable/RenameVariableDialog.ui',
73 './ui/Variable/VariableInspectorWidget.ui',
73 './ui/Variable/VariableInspectorWidget.ui',
74 './ui/Variable/VariableMenuHeaderWidget.ui',
74 './ui/Variable/VariableMenuHeaderWidget.ui',
75 './ui/Visualization/ColorScaleEditor.ui',
75 './ui/Visualization/ColorScaleEditor.ui',
76 './ui/Visualization/VisualizationZoneWidget.ui',
76 './ui/Visualization/VisualizationZoneWidget.ui',
77 './ui/Visualization/VisualizationMultiZoneSelectionDialog.ui',
77 './ui/Visualization/VisualizationMultiZoneSelectionDialog.ui',
78 './ui/Visualization/VisualizationGraphWidget.ui',
78 './ui/Visualization/VisualizationGraphWidget.ui',
79 './ui/Visualization/VisualizationWidget.ui',
79 './ui/Visualization/VisualizationWidget.ui',
80 './ui/Visualization/VisualizationTabWidget.ui'
80 './ui/Visualization/VisualizationTabWidget.ui'
81 ]
81 ]
82
82
83 gui_qresources = ['resources/sqpguiresources.qrc']
83 gui_qresources = ['resources/sqpguiresources.qrc']
84
84
85 rcc_gen = generator(rcc,
85 rcc_gen = generator(rcc,
86 output : 'qrc_@BASENAME@.cpp',
86 output : 'qrc_@BASENAME@.cpp',
87 arguments : [
87 arguments : [
88 '--output',
88 '--output',
89 '@OUTPUT@',
89 '@OUTPUT@',
90 '@INPUT@',
90 '@INPUT@',
91 '@EXTRA_ARGS@'])
91 '@EXTRA_ARGS@'])
92
92
93 rcc_files = rcc_gen.process(gui_qresources, extra_args : ['-name', 'sqpguiresources'])
93 rcc_files = rcc_gen.process(gui_qresources, extra_args : ['-name', 'sqpguiresources'])
94
94
95 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
95 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
96 ui_files : gui_ui_files)
96 ui_files : gui_ui_files)
97
97
98 gui_sources = [
98 gui_sources = [
99 './src/Common/ColorUtils.cpp',
99 './src/Common/ColorUtils.cpp',
100 './src/Common/VisualizationDef.cpp',
100 './src/Common/VisualizationDef.cpp',
101 './src/SqpApplication.cpp',
101 './src/SqpApplication.cpp',
102 './src/DragAndDrop/DragDropTabSwitcher.cpp',
102 './src/DragAndDrop/DragDropTabSwitcher.cpp',
103 './src/DragAndDrop/DragDropScroller.cpp',
103 './src/DragAndDrop/DragDropScroller.cpp',
104 './src/DragAndDrop/DragDropGuiController.cpp',
104 './src/DragAndDrop/DragDropGuiController.cpp',
105 './src/Settings/SqpSettingsGeneralWidget.cpp',
105 './src/Settings/SqpSettingsGeneralWidget.cpp',
106 './src/Settings/SqpSettingsDialog.cpp',
106 './src/Settings/SqpSettingsDialog.cpp',
107 './src/DataSource/DataSourceTreeWidgetItem.cpp',
107 './src/DataSource/DataSourceTreeWidgetItem.cpp',
108 './src/DataSource/DataSourceTreeWidgetHelper.cpp',
108 './src/DataSource/DataSourceTreeWidgetHelper.cpp',
109 './src/DataSource/DataSourceWidget.cpp',
109 './src/DataSource/DataSourceWidget.cpp',
110 './src/DataSource/DataSourceTreeWidget.cpp',
110 './src/DataSource/DataSourceTreeWidget.cpp',
111 './src/Catalogue2/eventstreeview.cpp',
111 './src/Catalogue2/eventstreeview.cpp',
112 './src/Catalogue2/eventeditor.cpp',
112 './src/Catalogue2/eventeditor.cpp',
113 './src/Catalogue2/repositoriestreeview.cpp',
113 './src/Catalogue2/repositoriestreeview.cpp',
114 './src/Catalogue2/browser.cpp',
114 './src/Catalogue2/browser.cpp',
115 './src/Catalogue2/eventsmodel.cpp',
115 './src/Catalogue2/eventsmodel.cpp',
116 './src/Catalogue2/repositoriesmodel.cpp',
116 './src/Catalogue2/repositoriesmodel.cpp',
117 './src/TimeWidget/TimeWidget.cpp',
117 './src/TimeWidget/TimeWidget.cpp',
118 './src/SidePane/SqpSidePane.cpp',
118 './src/SidePane/SqpSidePane.cpp',
119 './src/Variable/VariableInspectorTableView.cpp',
119 './src/Variable/VariableInspectorTableView.cpp',
120 './src/Variable/VariableInspectorWidget.cpp',
120 './src/Variable/VariableInspectorWidget.cpp',
121 './src/Variable/RenameVariableDialog.cpp',
121 './src/Variable/RenameVariableDialog.cpp',
122 './src/Variable/VariableMenuHeaderWidget.cpp',
122 './src/Variable/VariableMenuHeaderWidget.cpp',
123 './src/Visualization/VisualizationGraphWidget.cpp',
123 './src/Visualization/VisualizationGraphWidget.cpp',
124 './src/Visualization/PlottablesRenderingUtils.cpp',
124 './src/Visualization/PlottablesRenderingUtils.cpp',
125 './src/Visualization/AxisRenderingUtils.cpp',
125 './src/Visualization/AxisRenderingUtils.cpp',
126 './src/Visualization/VisualizationWidget.cpp',
126 './src/Visualization/VisualizationWidget.cpp',
127 './src/Visualization/qcustomplot.cpp',
127 './src/Visualization/qcustomplot.cpp',
128 './src/Visualization/VisualizationDragWidget.cpp',
128 './src/Visualization/VisualizationDragWidget.cpp',
129 './src/Visualization/VisualizationActionManager.cpp',
129 './src/Visualization/VisualizationActionManager.cpp',
130 './src/Visualization/MacScrollBarStyle.cpp',
130 './src/Visualization/MacScrollBarStyle.cpp',
131 './src/Visualization/VisualizationSelectionZoneManager.cpp',
131 './src/Visualization/VisualizationSelectionZoneManager.cpp',
132 './src/Visualization/operations/FindVariableOperation.cpp',
132 './src/Visualization/operations/FindVariableOperation.cpp',
133 './src/Visualization/operations/RescaleAxeOperation.cpp',
133 './src/Visualization/operations/RescaleAxeOperation.cpp',
134 './src/Visualization/operations/MenuBuilder.cpp',
134 './src/Visualization/operations/MenuBuilder.cpp',
135 './src/Visualization/operations/GenerateVariableMenuOperation.cpp',
135 './src/Visualization/operations/GenerateVariableMenuOperation.cpp',
136 './src/Visualization/operations/RemoveVariableOperation.cpp',
136 './src/Visualization/operations/RemoveVariableOperation.cpp',
137 './src/Visualization/VisualizationSelectionZoneItem.cpp',
137 './src/Visualization/VisualizationSelectionZoneItem.cpp',
138 './src/Visualization/VisualizationCursorItem.cpp',
138 './src/Visualization/VisualizationCursorItem.cpp',
139 './src/Visualization/QCPColorMapIterator.cpp',
139 './src/Visualization/QCPColorMapIterator.cpp',
140 './src/Visualization/QCustomPlotSynchronizer.cpp',
140 './src/Visualization/QCustomPlotSynchronizer.cpp',
141 './src/Visualization/ColorScaleEditor.cpp',
141 './src/Visualization/ColorScaleEditor.cpp',
142 './src/Visualization/VisualizationMultiZoneSelectionDialog.cpp',
142 './src/Visualization/VisualizationMultiZoneSelectionDialog.cpp',
143 './src/Visualization/VisualizationTabWidget.cpp',
143 './src/Visualization/VisualizationTabWidget.cpp',
144 './src/Visualization/VisualizationGraphHelper.cpp',
144 './src/Visualization/VisualizationGraphHelper.cpp',
145 './src/Visualization/VisualizationGraphRenderingDelegate.cpp',
145 './src/Visualization/VisualizationGraphRenderingDelegate.cpp',
146 './src/Visualization/VisualizationDragDropContainer.cpp',
146 './src/Visualization/VisualizationDragDropContainer.cpp',
147 './src/Visualization/VisualizationZoneWidget.cpp',
147 './src/Visualization/VisualizationZoneWidget.cpp',
148 './src/Visualization/SqpColorScale.cpp',
148 './src/Visualization/SqpColorScale.cpp',
149 './src/Actions/FilteringAction.cpp',
149 './src/Actions/FilteringAction.cpp',
150 './src/Actions/SelectionZoneAction.cpp',
150 './src/Actions/SelectionZoneAction.cpp',
151 './src/Actions/ActionsGuiController.cpp'
151 './src/Actions/ActionsGuiController.cpp'
152 ]
152 ]
153
153
154 gui_inc = include_directories(['include', 'include/Visualization'])
154 gui_inc = include_directories(['include', 'include/Visualization'])
155
155
156 sciqlop_gui_lib = library('sciqlopgui',
156 sciqlop_gui_lib = library('sciqlopgui',
157 gui_sources,
157 gui_sources,
158 gui_moc_files,
158 gui_moc_files,
159 rcc_files,
159 rcc_files,
160 include_directories : [gui_inc],
160 include_directories : [gui_inc],
161 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core],
161 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core],
162 install : true
162 install : true
163 )
163 )
164
164
165 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
165 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
166 include_directories : gui_inc,
166 include_directories : gui_inc,
167 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core])
167 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core])
168
168
169 gui_tests_inc = include_directories(['tests/GUITestUtils'])
169
170
171 catalogue_browser_moc_files = qt5.preprocess(moc_sources : 'tests/catalogue/browser/main.cpp')
172 catalogue_browser = executable('catalogue_browser', 'tests/catalogue/browser/main.cpp',catalogue_browser_moc_files,
173 include_directories : gui_tests_inc,
174 dependencies :[sciqlop_gui, qt5test])
@@ -1,105 +1,194
1 /*
1 /*
2 This file is part of SciQLop.
2 This file is part of SciQLop.
3
3
4 SciQLop is free software: you can redistribute it and/or modify
4 SciQLop is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
7 (at your option) any later version.
8
8
9 SciQLop is distributed in the hope that it will be useful,
9 SciQLop is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
12 GNU General Public License for more details.
13
13
14 You should have received a copy of the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with SciQLop. If not, see <https://www.gnu.org/licenses/>.
15 along with SciQLop. If not, see <https://www.gnu.org/licenses/>.
16 */
16 */
17 #include "Catalogue2/eventsmodel.h"
17 #include "Catalogue2/eventsmodel.h"
18 #include <SqpApplication.h>
19 #include <Common/containers.h>
18 #include <Common/containers.h>
19 #include <SqpApplication.h>
20
20
21 EventsModel::EventsModel(QObject* parent) : QAbstractItemModel(parent) {}
21 EventsModel::EventsModel(QObject* parent) : QAbstractItemModel(parent) {}
22
22
23 EventsModel::ItemType EventsModel::type(const QModelIndex& index) const
23 EventsModel::ItemType EventsModel::type(const QModelIndex& index) const
24 {
24 {
25 if (EventsModelItem* item = to_item(index))
25 if (EventsModelItem* item = to_item(index))
26 {
26 {
27 return item->type;
27 return item->type;
28 }
28 }
29 return ItemType::None;
29 return ItemType::None;
30 }
30 }
31
31
32 QVariant EventsModel::data(const QModelIndex& index, int role) const
32 QVariant EventsModel::data(const QModelIndex& index, int role) const
33 {
33 {
34 if (index.isValid())
34 if (index.isValid())
35 {
35 {
36 return to_item(index)->data(index.column(),role);
36 return to_item(index)->data(index.column(), role);
37 }
37 }
38 return QVariant {};
38 return QVariant {};
39 }
39 }
40
40
41 QModelIndex EventsModel::index(int row, int column, const QModelIndex& parent) const
41 QModelIndex EventsModel::index(int row, int column, const QModelIndex& parent) const
42 {
42 {
43 if (!hasIndex(row, column, parent))
43 if (!hasIndex(row, column, parent))
44 {
44 {
45 return QModelIndex();
45 return QModelIndex();
46 }
46 }
47
47
48 switch (type(parent))
48 switch (type(parent))
49 {
49 {
50 case ItemType::None: // is an event
50 case ItemType::None: // is an event
51 return createIndex(row, column, _items[row].get());
51 return createIndex(row, column, _items[row].get());
52 case ItemType::Event: // is a product
52 case ItemType::Event: // is a product
53 return createIndex(row, column, to_item(parent)->children[row].get());
53 return createIndex(row, column, to_item(parent)->children[row].get());
54 case ItemType::Product:
54 case ItemType::Product:
55 QModelIndex();
55 QModelIndex();
56 }
56 }
57
57
58 return QModelIndex();
58 return QModelIndex();
59 }
59 }
60
60
61 QModelIndex EventsModel::parent(const QModelIndex& index) const
61 QModelIndex EventsModel::parent(const QModelIndex& index) const
62 {
62 {
63 auto item = to_item(index);
63 auto item = to_item(index);
64 if (item->type == ItemType::Product)
64 if (item->type == ItemType::Product)
65 {
65 {
66 auto repoIndex = SciQLop::containers::index_of(_items, item->parent);
66 auto repoIndex = SciQLop::containers::index_of(_items, item->parent);
67 return createIndex(repoIndex, 0, item->parent);
67 return createIndex(repoIndex, 0, item->parent);
68 }
68 }
69 return QModelIndex();
69 return QModelIndex();
70 }
70 }
71
71
72 int EventsModel::rowCount(const QModelIndex& parent) const
72 int EventsModel::rowCount(const QModelIndex& parent) const
73 {
73 {
74 if (parent.column() > 0)
74 if (parent.column() > 0)
75 {
75 {
76 return 0;
76 return 0;
77 }
77 }
78 switch (type(parent))
78 switch (type(parent))
79 {
79 {
80 case ItemType::None:
80 case ItemType::None:
81 return _items.size();
81 return _items.size();
82 case ItemType::Event:
82 case ItemType::Event:
83 return to_item(parent)->children.size();
83 return to_item(parent)->children.size();
84 case ItemType::Product:
84 case ItemType::Product:
85 break;
85 break;
86 }
86 }
87 return 0;
87 return 0;
88 }
88 }
89
89
90 int EventsModel::columnCount(const QModelIndex& parent) const
90 int EventsModel::columnCount(const QModelIndex& parent) const
91 {
91 {
92 return static_cast<int>(EventsModel::Columns::NbColumn);
92 return static_cast<int>(EventsModel::Columns::NbColumn);
93 }
93 }
94
94
95 QVariant EventsModel::headerData(int section, Qt::Orientation orientation, int role) const
95 QVariant EventsModel::headerData(int section, Qt::Orientation orientation, int role) const
96 {
96 {
97 if (orientation == Qt::Horizontal && role == Qt::DisplayRole && section < ColumnsNames.size())
97 if (orientation == Qt::Horizontal && role == Qt::DisplayRole && section < ColumnsNames.size())
98 {
98 {
99 return ColumnsNames[section];
99 return ColumnsNames[section];
100 }
100 }
101
101
102 return QVariant();
102 return QVariant();
103 }
103 }
104
104
105 void EventsModel::sort(int column, Qt::SortOrder order) {}
105 void EventsModel::sort(int column, Qt::SortOrder order)
106 {
107 beginResetModel();
108 switch (static_cast<Columns>(column))
109 {
110 case EventsModel::Columns::Name:
111 std::sort(std::begin(_items), std::end(_items),
112 [inverse = order != Qt::SortOrder::AscendingOrder](
113 const std::unique_ptr<EventsModelItem>& a,
114 const std::unique_ptr<EventsModelItem>& b) {
115 static int i = 0;
116 i++;
117 if (!a->event())
118 {
119 throw;
120 }
121 if (!b->event())
122 {
123 throw;
124 }
125 return (a->event()->name < b->event()->name) xor inverse;
126 });
127 break;
128 case EventsModel::Columns::TStart:
129 std::sort(std::begin(_items), std::end(_items),
130 [inverse = order != Qt::SortOrder::AscendingOrder](
131 const std::unique_ptr<EventsModelItem>& a,
132 const std::unique_ptr<EventsModelItem>& b) {
133 static int i = 0;
134 i++;
135 if (!a)
136 {
137 throw;
138 }
139 if (!b)
140 {
141 throw;
142 }
143 if (!a->event())
144 {
145 throw;
146 }
147 if (!b->event())
148 {
149 throw;
150 }
151 return (a->event()->name < b->event()->name) xor inverse;
152 });
153 // std::sort(std::begin(_items), std::end(_items),
154 // [inverse = order != Qt::SortOrder::AscendingOrder](
155 // const std::unique_ptr<EventsModelItem>& a,
156 // const std::unique_ptr<EventsModelItem>& b) {
157 // static int i = 0;
158 // i++;
159 // if (a and b)
160 // {
161 // if (a->type == ItemType::Event and b->type == ItemType::Event)
162 // {
163 // if (auto e1 = a->event(); auto e2 = b->event())
164 // {
165 // return bool((e1->startTime() < e2->startTime()) xor
166 // inverse);
167 // }
168 // }
169 // }
170 // return false;
171 // });
172 break;
173 case EventsModel::Columns::TEnd:
174 std::sort(std::begin(_items), std::end(_items),
175 [inverse = order != Qt::SortOrder::AscendingOrder](
176 const std::unique_ptr<EventsModelItem>& a,
177 const std::unique_ptr<EventsModelItem>& b) {
178 if (auto t1 = a->event()->stopTime(); auto t2 = b->event()->stopTime())
179 {
180 if (t1 and t2)
181 return bool((t1.value() < t2.value()) xor inverse);
182 }
183 return true;
184 });
185 break;
186 case EventsModel::Columns::Product:
187 break;
188 case EventsModel::Columns::Tags:
189 break;
190 default:
191 break;
192 }
193 endResetModel();
194 }
@@ -1,45 +1,51
1 /*
1 /*
2 This file is part of SciQLop.
2 This file is part of SciQLop.
3
3
4 SciQLop is free software: you can redistribute it and/or modify
4 SciQLop is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
7 (at your option) any later version.
8
8
9 SciQLop is distributed in the hope that it will be useful,
9 SciQLop is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
12 GNU General Public License for more details.
13
13
14 You should have received a copy of the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with SciQLop. If not, see <https://www.gnu.org/licenses/>.
15 along with SciQLop. If not, see <https://www.gnu.org/licenses/>.
16 */
16 */
17 #include <Catalogue2/eventsmodel.h>
17 #include <Catalogue2/eventsmodel.h>
18 #include <Catalogue2/eventstreeview.h>
18 #include <Catalogue2/eventstreeview.h>
19
19
20 EventsTreeView::EventsTreeView(QWidget* parent) : QTreeView(parent)
20 EventsTreeView::EventsTreeView(QWidget* parent) : QTreeView(parent)
21 {
21 {
22 this->setModel(new EventsModel());
22 this->setModel(new EventsModel());
23 connect(this->selectionModel(), &QItemSelectionModel::currentChanged, [this](const QModelIndex &current, const QModelIndex &previous){
23 connect(this->selectionModel(), &QItemSelectionModel::currentChanged,
24 [this](const QModelIndex& current, const QModelIndex& previous) {
24 Q_UNUSED(previous);
25 Q_UNUSED(previous);
25 this->_itemSelected(current);
26 this->_itemSelected(current);
26 });
27 });
27 }
28 }
28
29
30 EventsTreeView::~EventsTreeView()
31 {
32 delete this->model();
33 }
34
29 void EventsTreeView::setEvents(std::vector<CatalogueController::Event_ptr> events)
35 void EventsTreeView::setEvents(std::vector<CatalogueController::Event_ptr> events)
30 {
36 {
31 static_cast<EventsModel*>(this->model())->setEvents(events);
37 static_cast<EventsModel*>(this->model())->setEvents(events);
32 }
38 }
33
39
34 void EventsTreeView::_itemSelected(const QModelIndex &index)
40 void EventsTreeView::_itemSelected(const QModelIndex& index)
35 {
41 {
36 auto item = EventsModel::to_item(index);
42 auto item = EventsModel::to_item(index);
37 if (item->type == EventsModel::ItemType::Event)
43 if (item->type == EventsModel::ItemType::Event)
38 {
44 {
39 emit eventSelected(item->event());
45 emit eventSelected(item->event());
40 }
46 }
41 else if (item->type == EventsModel::ItemType::Product)
47 else if (item->type == EventsModel::ItemType::Product)
42 {
48 {
43 emit productSelected(item->product(), item->parent->event());
49 emit productSelected(item->product(), item->parent->event());
44 }
50 }
45 }
51 }
@@ -1,70 +1,69
1 #include <QMainWindow>
1 #include <QMainWindow>
2 #include <QObject>
2 #include <QObject>
3 #include <QScreen>
3 #include <QScreen>
4 #include <QString>
4 #include <QString>
5 #include <QWheelEvent>
5 #include <QWheelEvent>
6 #include <QtTest>
6 #include <QtTest>
7
7
8
8
9 #include <Common/cpp_utils.h>
9 #include <Common/cpp_utils.h>
10 #include <SqpApplication.h>
10 #include <SqpApplication.h>
11
11
12 #include <GUITestUtils.h>
12 #include <GUITestUtils.h>
13 #include <TestProviders.h>
14
13
15 #include <Catalogue/CatalogueController.h>
14 #include <Catalogue/CatalogueController.h>
16 #include <Catalogue2/browser.h>
15 #include <Catalogue2/browser.h>
17
16
18
17
19 class A_CatalogueBrowser : public QObject
18 class A_CatalogueBrowser : public QObject
20 {
19 {
21 Q_OBJECT
20 Q_OBJECT
22 public:
21 public:
23 explicit A_CatalogueBrowser(QObject* parent = Q_NULLPTR) : QObject(parent) {}
22 explicit A_CatalogueBrowser(QObject* parent = Q_NULLPTR) : QObject(parent) {}
24
23
25 private slots:
24 private slots:
26 };
25 };
27
26
28 // QT_BEGIN_NAMESPACE
27 // QT_BEGIN_NAMESPACE
29 // QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
28 // QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
30 // QT_END_NAMESPACE
29 // QT_END_NAMESPACE
31 // int main(int argc, char* argv[])
30 // int main(int argc, char* argv[])
32 //{
31 //{
33 // SqpApplication app { argc, argv };
32 // SqpApplication app { argc, argv };
34 // app.setAttribute(Qt::AA_Use96Dpi, true);
33 // app.setAttribute(Qt::AA_Use96Dpi, true);
35 // QTEST_DISABLE_KEYPAD_NAVIGATION;
34 // QTEST_DISABLE_KEYPAD_NAVIGATION;
36 // QTEST_ADD_GPU_BLACKLIST_SUPPORT;
35 // QTEST_ADD_GPU_BLACKLIST_SUPPORT;
37 // An_EventList tc;
36 // An_EventList tc;
38 // QTEST_SET_MAIN_SOURCE_PATH;
37 // QTEST_SET_MAIN_SOURCE_PATH;
39 // return QTest::qExec(&tc, argc, argv);
38 // return QTest::qExec(&tc, argc, argv);
40 //}
39 //}
41
40
42 #include "main.moc"
41 #include "main.moc"
43
42
44
43
45 int main(int argc, char* argv[])
44 int main(int argc, char* argv[])
46 {
45 {
47 Q_INIT_RESOURCE(sqpguiresources);
46 Q_INIT_RESOURCE(sqpguiresources);
48 QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
47 QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
49
48
50 SqpApplication a { argc, argv };
49 SqpApplication a { argc, argv };
51 CataloguesBrowser w;
50 CataloguesBrowser w;
52 sqpApp->catalogueController().add("test");
51 sqpApp->catalogueController().add("test");
53 sqpApp->catalogueController().add("stuff");
52 sqpApp->catalogueController().add("stuff");
54 sqpApp->catalogueController().add("default");
53 sqpApp->catalogueController().add("default");
55 sqpApp->catalogueController().add("new catalogue", "default");
54 sqpApp->catalogueController().add("new catalogue", "default");
56 auto catalogue = sqpApp->catalogueController().add("new catalogue2", "default");
55 auto catalogue = sqpApp->catalogueController().add("new catalogue2", "default");
57 for (auto _ : std::array<char, 1000>())
56 for (auto _ : std::array<char, 1000>())
58 {
57 {
59 static int i = 0;
58 static int i = 0;
60 auto event = CatalogueController::make_event_ptr();
59 auto event = CatalogueController::make_event_ptr();
61 event->name = std::string("Event ") + std::to_string(i++);
60 event->name = std::string("Event ") + std::to_string(i++);
62 event->tags = {"tag1", "tag2"};
61 event->tags = {"tag1", "tag2"};
63 event->products = { CatalogueController::Event_t::Product_t { "Product1", 10., 11. },
62 event->products = { CatalogueController::Event_t::Product_t { "Product1", 10., 11. },
64 CatalogueController::Event_t::Product_t { "Product2", 11., 12. },
63 CatalogueController::Event_t::Product_t { "Product2", 11., 12. },
65 CatalogueController::Event_t::Product_t { "Product3", 10.2, 11. } };
64 CatalogueController::Event_t::Product_t { "Product3", 10.2, 11. } };
66 catalogue->add(event);
65 catalogue->add(event);
67 }
66 }
68 w.show();
67 w.show();
69 return a.exec();
68 return a.exec();
70 }
69 }
@@ -1,224 +1,230
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>Browser</class>
3 <class>Browser</class>
4 <widget class="QWidget" name="Browser">
4 <widget class="QWidget" name="Browser">
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>708</width>
9 <width>708</width>
10 <height>461</height>
10 <height>461</height>
11 </rect>
11 </rect>
12 </property>
12 </property>
13 <property name="windowTitle">
13 <property name="windowTitle">
14 <string>Catalogues Browser</string>
14 <string>Catalogues Browser</string>
15 </property>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout_4">
16 <layout class="QVBoxLayout" name="verticalLayout_4">
17 <item>
17 <item>
18 <widget class="QSplitter" name="splitter">
18 <widget class="QSplitter" name="splitter">
19 <property name="orientation">
19 <property name="orientation">
20 <enum>Qt::Horizontal</enum>
20 <enum>Qt::Horizontal</enum>
21 </property>
21 </property>
22 <widget class="RepositoriesTreeView" name="repositories">
22 <widget class="RepositoriesTreeView" name="repositories">
23 <property name="sizePolicy">
23 <property name="sizePolicy">
24 <sizepolicy hsizetype="Maximum" vsizetype="Expanding">
24 <sizepolicy hsizetype="Maximum" vsizetype="Expanding">
25 <horstretch>1</horstretch>
25 <horstretch>1</horstretch>
26 <verstretch>0</verstretch>
26 <verstretch>0</verstretch>
27 </sizepolicy>
27 </sizepolicy>
28 </property>
28 </property>
29 <property name="tabKeyNavigation">
29 <property name="tabKeyNavigation">
30 <bool>true</bool>
30 <bool>true</bool>
31 </property>
31 </property>
32 <property name="rootIsDecorated">
32 <property name="rootIsDecorated">
33 <bool>true</bool>
33 <bool>true</bool>
34 </property>
34 </property>
35 <property name="animated">
35 <property name="animated">
36 <bool>true</bool>
36 <bool>true</bool>
37 </property>
37 </property>
38 <property name="headerHidden">
38 <property name="headerHidden">
39 <bool>true</bool>
39 <bool>true</bool>
40 </property>
40 </property>
41 <attribute name="headerCascadingSectionResizes">
41 <attribute name="headerCascadingSectionResizes">
42 <bool>true</bool>
42 <bool>true</bool>
43 </attribute>
43 </attribute>
44 <attribute name="headerStretchLastSection">
44 <attribute name="headerStretchLastSection">
45 <bool>true</bool>
45 <bool>true</bool>
46 </attribute>
46 </attribute>
47 </widget>
47 </widget>
48 <widget class="QWidget" name="rightPane" native="true">
48 <widget class="QWidget" name="rightPane" native="true">
49 <property name="sizePolicy">
49 <property name="sizePolicy">
50 <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
50 <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
51 <horstretch>3</horstretch>
51 <horstretch>3</horstretch>
52 <verstretch>0</verstretch>
52 <verstretch>0</verstretch>
53 </sizepolicy>
53 </sizepolicy>
54 </property>
54 </property>
55 <layout class="QVBoxLayout" name="verticalLayout">
55 <layout class="QVBoxLayout" name="verticalLayout">
56 <item>
56 <item>
57 <widget class="EventsTreeView" name="events">
57 <widget class="EventsTreeView" name="events">
58 <property name="sizePolicy">
58 <property name="sizePolicy">
59 <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
59 <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
60 <horstretch>0</horstretch>
60 <horstretch>0</horstretch>
61 <verstretch>0</verstretch>
61 <verstretch>0</verstretch>
62 </sizepolicy>
62 </sizepolicy>
63 </property>
63 </property>
64 <property name="sortingEnabled">
65 <bool>true</bool>
66 </property>
67 <attribute name="headerShowSortIndicator" stdset="0">
68 <bool>true</bool>
69 </attribute>
64 </widget>
70 </widget>
65 </item>
71 </item>
66 <item>
72 <item>
67 <widget class="QStackedWidget" name="Infos">
73 <widget class="QStackedWidget" name="Infos">
68 <property name="sizePolicy">
74 <property name="sizePolicy">
69 <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
75 <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
70 <horstretch>0</horstretch>
76 <horstretch>0</horstretch>
71 <verstretch>0</verstretch>
77 <verstretch>0</verstretch>
72 </sizepolicy>
78 </sizepolicy>
73 </property>
79 </property>
74 <property name="currentIndex">
80 <property name="currentIndex">
75 <number>2</number>
81 <number>2</number>
76 </property>
82 </property>
77 <widget class="QWidget" name="Repository">
83 <widget class="QWidget" name="Repository">
78 <property name="sizePolicy">
84 <property name="sizePolicy">
79 <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
85 <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
80 <horstretch>0</horstretch>
86 <horstretch>0</horstretch>
81 <verstretch>0</verstretch>
87 <verstretch>0</verstretch>
82 </sizepolicy>
88 </sizepolicy>
83 </property>
89 </property>
84 <layout class="QVBoxLayout" name="verticalLayout_2">
90 <layout class="QVBoxLayout" name="verticalLayout_2">
85 <item>
91 <item>
86 <widget class="QGroupBox" name="groupBox">
92 <widget class="QGroupBox" name="groupBox">
87 <property name="sizePolicy">
93 <property name="sizePolicy">
88 <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
94 <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
89 <horstretch>0</horstretch>
95 <horstretch>0</horstretch>
90 <verstretch>0</verstretch>
96 <verstretch>0</verstretch>
91 </sizepolicy>
97 </sizepolicy>
92 </property>
98 </property>
93 <property name="title">
99 <property name="title">
94 <string>Repository information</string>
100 <string>Repository information</string>
95 </property>
101 </property>
96 <layout class="QGridLayout" name="gridLayout">
102 <layout class="QGridLayout" name="gridLayout">
97 <item row="0" column="1">
103 <item row="0" column="1">
98 <layout class="QFormLayout" name="formLayout">
104 <layout class="QFormLayout" name="formLayout">
99 <item row="0" column="0">
105 <item row="0" column="0">
100 <widget class="QLabel" name="label">
106 <widget class="QLabel" name="label">
101 <property name="text">
107 <property name="text">
102 <string>Catalogues</string>
108 <string>Catalogues</string>
103 </property>
109 </property>
104 </widget>
110 </widget>
105 </item>
111 </item>
106 <item row="0" column="1">
112 <item row="0" column="1">
107 <widget class="QLabel" name="catalogues_count">
113 <widget class="QLabel" name="catalogues_count">
108 <property name="text">
114 <property name="text">
109 <string/>
115 <string/>
110 </property>
116 </property>
111 </widget>
117 </widget>
112 </item>
118 </item>
113 <item row="1" column="0">
119 <item row="1" column="0">
114 <widget class="QLabel" name="label_3">
120 <widget class="QLabel" name="label_3">
115 <property name="text">
121 <property name="text">
116 <string>Events</string>
122 <string>Events</string>
117 </property>
123 </property>
118 </widget>
124 </widget>
119 </item>
125 </item>
120 <item row="1" column="1">
126 <item row="1" column="1">
121 <widget class="QLabel" name="rep_events_count">
127 <widget class="QLabel" name="rep_events_count">
122 <property name="text">
128 <property name="text">
123 <string/>
129 <string/>
124 </property>
130 </property>
125 </widget>
131 </widget>
126 </item>
132 </item>
127 </layout>
133 </layout>
128 </item>
134 </item>
129 </layout>
135 </layout>
130 </widget>
136 </widget>
131 </item>
137 </item>
132 </layout>
138 </layout>
133 </widget>
139 </widget>
134 <widget class="QWidget" name="Catalogue">
140 <widget class="QWidget" name="Catalogue">
135 <property name="sizePolicy">
141 <property name="sizePolicy">
136 <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
142 <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
137 <horstretch>0</horstretch>
143 <horstretch>0</horstretch>
138 <verstretch>0</verstretch>
144 <verstretch>0</verstretch>
139 </sizepolicy>
145 </sizepolicy>
140 </property>
146 </property>
141 <layout class="QGridLayout" name="gridLayout_2">
147 <layout class="QGridLayout" name="gridLayout_2">
142 <item row="0" column="0">
148 <item row="0" column="0">
143 <widget class="QGroupBox" name="groupBox_2">
149 <widget class="QGroupBox" name="groupBox_2">
144 <property name="sizePolicy">
150 <property name="sizePolicy">
145 <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
151 <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
146 <horstretch>0</horstretch>
152 <horstretch>0</horstretch>
147 <verstretch>0</verstretch>
153 <verstretch>0</verstretch>
148 </sizepolicy>
154 </sizepolicy>
149 </property>
155 </property>
150 <property name="title">
156 <property name="title">
151 <string>Catalogue</string>
157 <string>Catalogue</string>
152 </property>
158 </property>
153 <layout class="QGridLayout" name="gridLayout_3">
159 <layout class="QGridLayout" name="gridLayout_3">
154 <item row="0" column="0">
160 <item row="0" column="0">
155 <layout class="QFormLayout" name="formLayout_2">
161 <layout class="QFormLayout" name="formLayout_2">
156 <item row="0" column="0">
162 <item row="0" column="0">
157 <widget class="QLabel" name="label_2">
163 <widget class="QLabel" name="label_2">
158 <property name="text">
164 <property name="text">
159 <string>Name</string>
165 <string>Name</string>
160 </property>
166 </property>
161 </widget>
167 </widget>
162 </item>
168 </item>
163 <item row="0" column="1">
169 <item row="0" column="1">
164 <widget class="QLineEdit" name="lineEdit"/>
170 <widget class="QLineEdit" name="lineEdit"/>
165 </item>
171 </item>
166 <item row="1" column="0">
172 <item row="1" column="0">
167 <widget class="QLabel" name="label_4">
173 <widget class="QLabel" name="label_4">
168 <property name="text">
174 <property name="text">
169 <string>Events</string>
175 <string>Events</string>
170 </property>
176 </property>
171 </widget>
177 </widget>
172 </item>
178 </item>
173 <item row="1" column="1">
179 <item row="1" column="1">
174 <widget class="QLabel" name="cat_events_count">
180 <widget class="QLabel" name="cat_events_count">
175 <property name="text">
181 <property name="text">
176 <string/>
182 <string/>
177 </property>
183 </property>
178 </widget>
184 </widget>
179 </item>
185 </item>
180 </layout>
186 </layout>
181 </item>
187 </item>
182 </layout>
188 </layout>
183 </widget>
189 </widget>
184 </item>
190 </item>
185 </layout>
191 </layout>
186 </widget>
192 </widget>
187 <widget class="EventEditor" name="Event">
193 <widget class="EventEditor" name="Event">
188 <property name="sizePolicy">
194 <property name="sizePolicy">
189 <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
195 <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
190 <horstretch>0</horstretch>
196 <horstretch>0</horstretch>
191 <verstretch>0</verstretch>
197 <verstretch>0</verstretch>
192 </sizepolicy>
198 </sizepolicy>
193 </property>
199 </property>
194 <layout class="QGridLayout" name="gridLayout_4"/>
200 <layout class="QGridLayout" name="gridLayout_4"/>
195 </widget>
201 </widget>
196 </widget>
202 </widget>
197 </item>
203 </item>
198 </layout>
204 </layout>
199 </widget>
205 </widget>
200 </widget>
206 </widget>
201 </item>
207 </item>
202 </layout>
208 </layout>
203 </widget>
209 </widget>
204 <customwidgets>
210 <customwidgets>
205 <customwidget>
211 <customwidget>
206 <class>RepositoriesTreeView</class>
212 <class>RepositoriesTreeView</class>
207 <extends>QTreeView</extends>
213 <extends>QTreeView</extends>
208 <header location="global">Catalogue2/repositoriestreeview.h</header>
214 <header location="global">Catalogue2/repositoriestreeview.h</header>
209 </customwidget>
215 </customwidget>
210 <customwidget>
216 <customwidget>
211 <class>EventsTreeView</class>
217 <class>EventsTreeView</class>
212 <extends>QTreeView</extends>
218 <extends>QTreeView</extends>
213 <header location="global">Catalogue2/eventstreeview.h</header>
219 <header location="global">Catalogue2/eventstreeview.h</header>
214 </customwidget>
220 </customwidget>
215 <customwidget>
221 <customwidget>
216 <class>EventEditor</class>
222 <class>EventEditor</class>
217 <extends>QWidget</extends>
223 <extends>QWidget</extends>
218 <header location="global">Catalogue2/eventeditor.h</header>
224 <header location="global">Catalogue2/eventeditor.h</header>
219 <container>1</container>
225 <container>1</container>
220 </customwidget>
226 </customwidget>
221 </customwidgets>
227 </customwidgets>
222 <resources/>
228 <resources/>
223 <connections/>
229 <connections/>
224 </ui>
230 </ui>
General Comments 0
You need to be logged in to leave comments. Login now