##// END OF EJS Templates
Merge branch 'feature/CatalogueGuiPart2' into develop
trabillard -
r1188:17cb73ee00c8 merge
parent child
Show More
@@ -0,0 +1,381
1 #include "Catalogue/CatalogueEventsModel.h"
2
3 #include <Common/DateUtils.h>
4 #include <Common/MimeTypesDef.h>
5 #include <DBEvent.h>
6 #include <DBEventProduct.h>
7 #include <DBTag.h>
8 #include <Data/SqpRange.h>
9 #include <SqpApplication.h>
10 #include <Time/TimeController.h>
11
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::CatalogueEventsModelPrivate {
22 QVector<std::shared_ptr<DBEvent> > m_Events;
23 std::unordered_map<DBEvent *, QVector<std::shared_ptr<DBEventProduct> > > m_EventProducts;
24
25 enum class Column { Name, TStart, TEnd, Tags, Product, NbColumn };
26 QStringList columnNames()
27 {
28 return QStringList{tr("Event"), tr("TStart"), tr("TEnd"), tr("Tags"), tr("Product")};
29 }
30
31 QVariant eventData(int col, const std::shared_ptr<DBEvent> &event) const
32 {
33 switch (static_cast<Column>(col)) {
34 case Column::Name:
35 return event->getName();
36 case Column::TStart:
37 return DateUtils::dateTime(event->getTStart());
38 case Column::TEnd:
39 return DateUtils::dateTime(event->getTEnd());
40 case Column::Product: {
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 }
49 case Column::Tags: {
50 QString tagList;
51 auto tags = event->getTags();
52 for (auto tag : tags) {
53 tagList += tag.getName();
54 tagList += ' ';
55 }
56
57 return tagList;
58 }
59 default:
60 break;
61 }
62
63 Q_ASSERT(false);
64 return QStringLiteral("Unknown Data");
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
97 CatalogueEventsModel::CatalogueEventsModel(QObject *parent)
98 : QAbstractItemModel(parent), impl{spimpl::make_unique_impl<CatalogueEventsModelPrivate>()}
99 {
100 }
101
102 void CatalogueEventsModel::setEvents(const QVector<std::shared_ptr<DBEvent> > &events)
103 {
104 beginResetModel();
105
106 impl->m_Events = events;
107 impl->m_EventProducts.clear();
108 for (auto event : events) {
109 impl->parseEventProduct(event);
110 }
111
112 endResetModel();
113 }
114
115 std::shared_ptr<DBEvent> CatalogueEventsModel::getEvent(const QModelIndex &index) const
116 {
117 if (itemTypeOf(index) == CatalogueEventsModel::ItemType::Event) {
118 return impl->m_Events.value(index.row());
119 }
120 else {
121 return nullptr;
122 }
123 }
124
125 std::shared_ptr<DBEvent> CatalogueEventsModel::getParentEvent(const QModelIndex &index) const
126 {
127 if (itemTypeOf(index) == CatalogueEventsModel::ItemType::EventProduct) {
128 return getEvent(index.parent());
129 }
130 else {
131 return nullptr;
132 }
133 }
134
135 std::shared_ptr<DBEventProduct>
136 CatalogueEventsModel::getEventProduct(const QModelIndex &index) const
137 {
138 if (itemTypeOf(index) == CatalogueEventsModel::ItemType::EventProduct) {
139 auto event = static_cast<DBEvent *>(index.internalPointer());
140 return impl->m_EventProducts.at(event).value(index.row());
141 }
142 else {
143 return nullptr;
144 }
145 }
146
147 void CatalogueEventsModel::addEvent(const std::shared_ptr<DBEvent> &event)
148 {
149 beginInsertRows(QModelIndex(), impl->m_Events.count() - 1, impl->m_Events.count() - 1);
150 impl->m_Events.append(event);
151 impl->parseEventProduct(event);
152 endInsertRows();
153 }
154
155 void CatalogueEventsModel::removeEvent(const std::shared_ptr<DBEvent> &event)
156 {
157 auto index = impl->m_Events.indexOf(event);
158 if (index >= 0) {
159 beginRemoveRows(QModelIndex(), index, index);
160 impl->m_Events.removeAt(index);
161 impl->m_EventProducts.erase(event.get());
162 endRemoveRows();
163 }
164 }
165
166 void CatalogueEventsModel::refreshEvent(const std::shared_ptr<DBEvent> &event)
167 {
168 auto i = impl->m_Events.indexOf(event);
169 if (i >= 0) {
170 auto eventIndex = index(i, 0);
171 auto colCount = columnCount();
172 emit dataChanged(eventIndex, index(i, colCount));
173
174 auto childCount = rowCount(eventIndex);
175 emit dataChanged(index(0, 0, eventIndex), index(childCount, colCount, eventIndex));
176 }
177 }
178
179 QModelIndex CatalogueEventsModel::index(int row, int column, const QModelIndex &parent) const
180 {
181 if (!hasIndex(row, column, parent)) {
182 return QModelIndex();
183 }
184
185 switch (itemTypeOf(parent)) {
186 case CatalogueEventsModel::ItemType::Root:
187 return createIndex(row, column);
188 case CatalogueEventsModel::ItemType::Event: {
189 auto event = getEvent(parent);
190 return createIndex(row, column, event.get());
191 }
192 case CatalogueEventsModel::ItemType::EventProduct:
193 break;
194 default:
195 break;
196 }
197
198 return QModelIndex();
199 }
200
201 QModelIndex CatalogueEventsModel::parent(const QModelIndex &index) const
202 {
203 switch (itemTypeOf(index)) {
204 case CatalogueEventsModel::ItemType::EventProduct: {
205 auto parentEvent = static_cast<DBEvent *>(index.internalPointer());
206 auto it
207 = std::find_if(impl->m_Events.cbegin(), impl->m_Events.cend(),
208 [parentEvent](auto event) { return event.get() == parentEvent; });
209
210 if (it != impl->m_Events.cend()) {
211 return createIndex(it - impl->m_Events.cbegin(), 0);
212 }
213 else {
214 return QModelIndex();
215 }
216 }
217 case CatalogueEventsModel::ItemType::Root:
218 break;
219 case CatalogueEventsModel::ItemType::Event:
220 break;
221 default:
222 break;
223 }
224
225 return QModelIndex();
226 }
227
228 int CatalogueEventsModel::rowCount(const QModelIndex &parent) const
229 {
230 if (parent.column() > 0) {
231 return 0;
232 }
233
234 switch (itemTypeOf(parent)) {
235 case CatalogueEventsModel::ItemType::Root:
236 return impl->m_Events.count();
237 case CatalogueEventsModel::ItemType::Event: {
238 auto event = getEvent(parent);
239 return impl->m_EventProducts[event.get()].count();
240 }
241 case CatalogueEventsModel::ItemType::EventProduct:
242 break;
243 default:
244 break;
245 }
246
247 return 0;
248 }
249
250 int CatalogueEventsModel::columnCount(const QModelIndex &parent) const
251 {
252 return static_cast<int>(CatalogueEventsModelPrivate::Column::NbColumn);
253 }
254
255 Qt::ItemFlags CatalogueEventsModel::flags(const QModelIndex &index) const
256 {
257 return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
258 }
259
260 QVariant CatalogueEventsModel::data(const QModelIndex &index, int role) const
261 {
262 if (index.isValid()) {
263
264 auto type = itemTypeOf(index);
265 if (type == CatalogueEventsModel::ItemType::Event) {
266 auto event = getEvent(index);
267 switch (role) {
268 case Qt::DisplayRole:
269 return impl->eventData(index.column(), event);
270 break;
271 }
272 }
273 else if (type == CatalogueEventsModel::ItemType::EventProduct) {
274 auto product = getEventProduct(index);
275 switch (role) {
276 case Qt::DisplayRole:
277 return impl->eventProductData(index.column(), product);
278 break;
279 }
280 }
281 }
282
283 return QVariant{};
284 }
285
286 QVariant CatalogueEventsModel::headerData(int section, Qt::Orientation orientation, int role) const
287 {
288 if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
289 return impl->columnNames().value(section);
290 }
291
292 return QVariant();
293 }
294
295 void CatalogueEventsModel::sort(int column, Qt::SortOrder order)
296 {
297 std::sort(impl->m_Events.begin(), impl->m_Events.end(),
298 [this, column, order](auto e1, auto e2) {
299 auto data1 = impl->eventData(column, e1);
300 auto data2 = impl->eventData(column, e2);
301
302 auto result = data1.toString() < data2.toString();
303
304 return order == Qt::AscendingOrder ? result : !result;
305 });
306
307 emit dataChanged(QModelIndex(), QModelIndex());
308 }
309
310 Qt::DropActions CatalogueEventsModel::supportedDragActions() const
311 {
312 return Qt::CopyAction | Qt::MoveAction;
313 }
314
315 QStringList CatalogueEventsModel::mimeTypes() const
316 {
317 return {MIME_TYPE_EVENT_LIST, MIME_TYPE_TIME_RANGE};
318 }
319
320 QMimeData *CatalogueEventsModel::mimeData(const QModelIndexList &indexes) const
321 {
322 auto mimeData = new QMimeData;
323
324 bool isFirst = true;
325
326 QVector<std::shared_ptr<DBEvent> > eventList;
327 QVector<std::shared_ptr<DBEventProduct> > eventProductList;
328
329 SqpRange firstTimeRange;
330 for (const auto &index : indexes) {
331 if (index.column() == 0) { // only the first column
332
333 auto type = itemTypeOf(index);
334 if (type == ItemType::Event) {
335 auto event = getEvent(index);
336 eventList << event;
337
338 if (isFirst) {
339 isFirst = false;
340 firstTimeRange.m_TStart = event->getTStart();
341 firstTimeRange.m_TEnd = event->getTEnd();
342 }
343 }
344 else if (type == ItemType::EventProduct) {
345 auto product = getEventProduct(index);
346 eventProductList << product;
347
348 if (isFirst) {
349 isFirst = false;
350 firstTimeRange.m_TStart = product->getTStart();
351 firstTimeRange.m_TEnd = product->getTEnd();
352 }
353 }
354 }
355 }
356
357 auto eventsEncodedData
358 = QByteArray{}; // sqpApp->catalogueController().->mimeDataForEvents(eventList); //TODO
359 mimeData->setData(MIME_TYPE_EVENT_LIST, eventsEncodedData);
360
361 if (eventList.count() + eventProductList.count() == 1) {
362 // No time range MIME data if multiple events are dragged
363 auto timeEncodedData = TimeController::mimeDataForTimeRange(firstTimeRange);
364 mimeData->setData(MIME_TYPE_TIME_RANGE, timeEncodedData);
365 }
366
367 return mimeData;
368 }
369
370 CatalogueEventsModel::ItemType CatalogueEventsModel::itemTypeOf(const QModelIndex &index) const
371 {
372 if (!index.isValid()) {
373 return ItemType::Root;
374 }
375 else if (index.internalPointer() == nullptr) {
376 return ItemType::Event;
377 }
378 else {
379 return ItemType::EventProduct;
380 }
381 }
@@ -1,38 +1,46
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 class DBEventProduct;
8
9
9 class CatalogueEventsTableModel : public QAbstractTableModel {
10 class CatalogueEventsModel : public QAbstractItemModel {
10 public:
11 public:
11 CatalogueEventsTableModel(QObject *parent = nullptr);
12 CatalogueEventsModel(QObject *parent = nullptr);
12
13
13 void setEvents(const QVector<std::shared_ptr<DBEvent> > &events);
14 void setEvents(const QVector<std::shared_ptr<DBEvent> > &events);
14 std::shared_ptr<DBEvent> getEvent(int row) const;
15 void addEvent(const std::shared_ptr<DBEvent> &event);
16 void removeEvent(const std::shared_ptr<DBEvent> &event);
15
17
16 void addEvent(const std::shared_ptr<DBEvent> &events);
18 enum class ItemType { Root, Event, EventProduct };
17 void removeEvent(const std::shared_ptr<DBEvent> &events);
19 ItemType itemTypeOf(const QModelIndex &index) const;
20 std::shared_ptr<DBEvent> getEvent(const QModelIndex &index) const;
21 std::shared_ptr<DBEvent> getParentEvent(const QModelIndex &index) const;
22 std::shared_ptr<DBEventProduct> getEventProduct(const QModelIndex &index) const;
23
24 void refreshEvent(const std::shared_ptr<DBEvent> &event);
18
25
19 // Model
26 // Model
27 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
28 QModelIndex parent(const QModelIndex &index) const;
20 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
29 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
21 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
30 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
22 Qt::ItemFlags flags(const QModelIndex &index) const override;
31 Qt::ItemFlags flags(const QModelIndex &index) const override;
23 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
32 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
24 QVariant headerData(int section, Qt::Orientation orientation,
33 QVariant headerData(int section, Qt::Orientation orientation,
25 int role = Qt::DisplayRole) const override;
34 int role = Qt::DisplayRole) const override;
26 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
35 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
27
36
28 Qt::DropActions supportedDragActions() const override;
37 Qt::DropActions supportedDragActions() const override;
29 QStringList mimeTypes() const override;
38 QStringList mimeTypes() const override;
30 QMimeData *mimeData(const QModelIndexList &indexes) const override;
39 QMimeData *mimeData(const QModelIndexList &indexes) const override;
31
40
32
33 private:
41 private:
34 class CatalogueEventsTableModelPrivate;
42 class CatalogueEventsModelPrivate;
35 spimpl::unique_impl_ptr<CatalogueEventsTableModelPrivate> impl;
43 spimpl::unique_impl_ptr<CatalogueEventsModelPrivate> impl;
36 };
44 };
37
45
38 #endif // SCIQLOP_CATALOGUEEVENTSTABLEMODEL_H
46 #endif // SCIQLOP_CATALOGUEEVENTSMODEL_H
@@ -1,40 +1,47
1 #ifndef SCIQLOP_CATALOGUEEVENTSWIDGET_H
1 #ifndef SCIQLOP_CATALOGUEEVENTSWIDGET_H
2 #define SCIQLOP_CATALOGUEEVENTSWIDGET_H
2 #define SCIQLOP_CATALOGUEEVENTSWIDGET_H
3
3
4 #include <Common/spimpl.h>
4 #include <Common/spimpl.h>
5 #include <QLoggingCategory>
5 #include <QLoggingCategory>
6 #include <QWidget>
6 #include <QWidget>
7
7
8 class DBCatalogue;
8 class DBCatalogue;
9 class DBEvent;
9 class DBEvent;
10 class DBEventProduct;
10 class VisualizationWidget;
11 class VisualizationWidget;
11
12
12 namespace Ui {
13 namespace Ui {
13 class CatalogueEventsWidget;
14 class CatalogueEventsWidget;
14 }
15 }
15
16
16 Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueEventsWidget)
17 Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueEventsWidget)
17
18
18 class CatalogueEventsWidget : public QWidget {
19 class CatalogueEventsWidget : public QWidget {
19 Q_OBJECT
20 Q_OBJECT
20
21
21 signals:
22 signals:
22 void eventsSelected(const QVector<std::shared_ptr<DBEvent> > &event);
23 void eventsSelected(const QVector<std::shared_ptr<DBEvent> > &event);
24 void eventProductsSelected(
25 const QVector<QPair<std::shared_ptr<DBEvent>, std::shared_ptr<DBEventProduct> > >
26 &eventproducts);
27 void selectionCleared();
23
28
24 public:
29 public:
25 explicit CatalogueEventsWidget(QWidget *parent = 0);
30 explicit CatalogueEventsWidget(QWidget *parent = 0);
26 virtual ~CatalogueEventsWidget();
31 virtual ~CatalogueEventsWidget();
27
32
28 void setVisualizationWidget(VisualizationWidget *visualization);
33 void setVisualizationWidget(VisualizationWidget *visualization);
29
34
35 void setEventChanges(const std::shared_ptr<DBEvent> &event, bool hasChanges);
36
30 public slots:
37 public slots:
31 void populateWithCatalogues(const QVector<std::shared_ptr<DBCatalogue> > &catalogues);
38 void populateWithCatalogues(const QVector<std::shared_ptr<DBCatalogue> > &catalogues);
32
39
33 private:
40 private:
34 Ui::CatalogueEventsWidget *ui;
41 Ui::CatalogueEventsWidget *ui;
35
42
36 class CatalogueEventsWidgetPrivate;
43 class CatalogueEventsWidgetPrivate;
37 spimpl::unique_impl_ptr<CatalogueEventsWidgetPrivate> impl;
44 spimpl::unique_impl_ptr<CatalogueEventsWidgetPrivate> impl;
38 };
45 };
39
46
40 #endif // SCIQLOP_CATALOGUEEVENTSWIDGET_H
47 #endif // SCIQLOP_CATALOGUEEVENTSWIDGET_H
@@ -1,36 +1,49
1 #ifndef SCIQLOP_CATALOGUEINSPECTORWIDGET_H
1 #ifndef SCIQLOP_CATALOGUEINSPECTORWIDGET_H
2 #define SCIQLOP_CATALOGUEINSPECTORWIDGET_H
2 #define SCIQLOP_CATALOGUEINSPECTORWIDGET_H
3
3
4 #include <Common/spimpl.h>
4 #include <QWidget>
5 #include <QWidget>
5 #include <memory>
6 #include <memory>
6
7
7 namespace Ui {
8 namespace Ui {
8 class CatalogueInspectorWidget;
9 class CatalogueInspectorWidget;
9 }
10 }
10
11
11 class DBCatalogue;
12 class DBCatalogue;
12 class DBEvent;
13 class DBEvent;
14 class DBEventProduct;
13
15
14 class CatalogueInspectorWidget : public QWidget {
16 class CatalogueInspectorWidget : public QWidget {
15 Q_OBJECT
17 Q_OBJECT
16
18
19 signals:
20 void catalogueUpdated(const std::shared_ptr<DBCatalogue> &catalogue);
21 void eventUpdated(const std::shared_ptr<DBEvent> &event);
22 void eventProductUpdated(const std::shared_ptr<DBEvent> &event,
23 const std::shared_ptr<DBEventProduct> &eventProduct);
24
17 public:
25 public:
18 explicit CatalogueInspectorWidget(QWidget *parent = 0);
26 explicit CatalogueInspectorWidget(QWidget *parent = 0);
19 virtual ~CatalogueInspectorWidget();
27 virtual ~CatalogueInspectorWidget();
20
28
21 /// Enum matching the pages inside the stacked widget
29 /// Enum matching the pages inside the stacked widget
22 enum class Page { Empty, CatalogueProperties, EventProperties };
30 enum class Page { Empty, CatalogueProperties, EventProperties };
23
31
24 Page currentPage() const;
32 Page currentPage() const;
25
33
26 void setEvent(const std::shared_ptr<DBEvent> &event);
34 void setEvent(const std::shared_ptr<DBEvent> &event);
35 void setEventProduct(const std::shared_ptr<DBEvent> &event,
36 const std::shared_ptr<DBEventProduct> &eventProduct);
27 void setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue);
37 void setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue);
28
38
29 public slots:
39 public slots:
30 void showPage(Page page);
40 void showPage(Page page);
31
41
32 private:
42 private:
33 Ui::CatalogueInspectorWidget *ui;
43 Ui::CatalogueInspectorWidget *ui;
44
45 class CatalogueInspectorWidgetPrivate;
46 spimpl::unique_impl_ptr<CatalogueInspectorWidgetPrivate> impl;
34 };
47 };
35
48
36 #endif // SCIQLOP_CATALOGUEINSPECTORWIDGET_H
49 #endif // SCIQLOP_CATALOGUEINSPECTORWIDGET_H
@@ -1,38 +1,43
1 #ifndef SCIQLOP_CATALOGUESIDEBARWIDGET_H
1 #ifndef SCIQLOP_CATALOGUESIDEBARWIDGET_H
2 #define SCIQLOP_CATALOGUESIDEBARWIDGET_H
2 #define SCIQLOP_CATALOGUESIDEBARWIDGET_H
3
3
4 #include <Common/spimpl.h>
4 #include <Common/spimpl.h>
5 #include <QLoggingCategory>
5 #include <QTreeWidgetItem>
6 #include <QTreeWidgetItem>
6 #include <QWidget>
7 #include <QWidget>
7
8
8 class DBCatalogue;
9 class DBCatalogue;
9
10
10 namespace Ui {
11 namespace Ui {
11 class CatalogueSideBarWidget;
12 class CatalogueSideBarWidget;
12 }
13 }
13
14
15 Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueSideBarWidget)
16
14 class CatalogueSideBarWidget : public QWidget {
17 class CatalogueSideBarWidget : public QWidget {
15 Q_OBJECT
18 Q_OBJECT
16
19
17 signals:
20 signals:
18 void catalogueSelected(const QVector<std::shared_ptr<DBCatalogue> > &catalogues);
21 void catalogueSelected(const QVector<std::shared_ptr<DBCatalogue> > &catalogues);
19 void databaseSelected(const QStringList &databases);
22 void databaseSelected(const QStringList &databases);
20 void allEventsSelected();
23 void allEventsSelected();
21 void trashSelected();
24 void trashSelected();
22 void selectionCleared();
25 void selectionCleared();
23
26
24 public:
27 public:
25 explicit CatalogueSideBarWidget(QWidget *parent = 0);
28 explicit CatalogueSideBarWidget(QWidget *parent = 0);
26 virtual ~CatalogueSideBarWidget();
29 virtual ~CatalogueSideBarWidget();
27
30
31 void setCatalogueChanges(const std::shared_ptr<DBCatalogue> &catalogue, bool hasChanges);
32
28 private:
33 private:
29 Ui::CatalogueSideBarWidget *ui;
34 Ui::CatalogueSideBarWidget *ui;
30
35
31 class CatalogueSideBarWidgetPrivate;
36 class CatalogueSideBarWidgetPrivate;
32 spimpl::unique_impl_ptr<CatalogueSideBarWidgetPrivate> impl;
37 spimpl::unique_impl_ptr<CatalogueSideBarWidgetPrivate> impl;
33
38
34 private slots:
39 private slots:
35 void onContextMenuRequested(const QPoint &pos);
40 void onContextMenuRequested(const QPoint &pos);
36 };
41 };
37
42
38 #endif // SCIQLOP_CATALOGUESIDEBARWIDGET_H
43 #endif // SCIQLOP_CATALOGUESIDEBARWIDGET_H
@@ -1,28 +1,33
1 #ifndef SCIQLOP_CATALOGUETREEWIDGETITEM_H
1 #ifndef SCIQLOP_CATALOGUETREEWIDGETITEM_H
2 #define SCIQLOP_CATALOGUETREEWIDGETITEM_H
2 #define SCIQLOP_CATALOGUETREEWIDGETITEM_H
3
3
4 #include <Common/spimpl.h>
4 #include <Common/spimpl.h>
5 #include <QTreeWidgetItem>
5 #include <QTreeWidgetItem>
6
6
7 class DBCatalogue;
7 class DBCatalogue;
8
8
9
9
10 class CatalogueTreeWidgetItem : public QTreeWidgetItem {
10 class CatalogueTreeWidgetItem : public QTreeWidgetItem {
11 public:
11 public:
12 CatalogueTreeWidgetItem(std::shared_ptr<DBCatalogue> catalogue,
12 CatalogueTreeWidgetItem(std::shared_ptr<DBCatalogue> catalogue,
13 int type = QTreeWidgetItem::Type);
13 int type = QTreeWidgetItem::Type);
14
14
15 QVariant data(int column, int role) const override;
15 QVariant data(int column, int role) const override;
16 void setData(int column, int role, const QVariant &value) override;
16 void setData(int column, int role, const QVariant &value) override;
17
17
18 /// Returns the catalogue represented by the item
18 /// Returns the catalogue represented by the item
19 std::shared_ptr<DBCatalogue> catalogue() const;
19 std::shared_ptr<DBCatalogue> catalogue() const;
20
20
21 /// Displays or hides the save and cancel buttons indicating that the catalogue has unsaved
22 /// changes
21 void setHasChanges(bool value);
23 void setHasChanges(bool value);
22
24
25 /// Refreshes the data displayed by the item from the catalogue
26 void refresh();
27
23 private:
28 private:
24 class CatalogueTreeWidgetItemPrivate;
29 class CatalogueTreeWidgetItemPrivate;
25 spimpl::unique_impl_ptr<CatalogueTreeWidgetItemPrivate> impl;
30 spimpl::unique_impl_ptr<CatalogueTreeWidgetItemPrivate> impl;
26 };
31 };
27
32
28 #endif // SCIQLOP_CATALOGUETREEWIDGETITEM_H
33 #endif // SCIQLOP_CATALOGUETREEWIDGETITEM_H
@@ -1,30 +1,30
1 #ifndef SCIQLOP_VISUALIZATIONMULTIZONESELECTIONDIALOG_H
1 #ifndef SCIQLOP_VISUALIZATIONMULTIZONESELECTIONDIALOG_H
2 #define SCIQLOP_VISUALIZATIONMULTIZONESELECTIONDIALOG_H
2 #define SCIQLOP_VISUALIZATIONMULTIZONESELECTIONDIALOG_H
3
3
4 #include <Common/spimpl.h>
4 #include <Common/spimpl.h>
5 #include <QDialog>
5 #include <QDialog>
6
6
7 namespace Ui {
7 namespace Ui {
8 class VisualizationMultiZoneSelectionDialog;
8 class VisualizationMultiZoneSelectionDialog;
9 }
9 }
10
10
11 class VisualizationSelectionZoneItem;
11 class VisualizationSelectionZoneItem;
12
12
13 class VisualizationMultiZoneSelectionDialog : public QDialog {
13 class VisualizationMultiZoneSelectionDialog : public QDialog {
14 Q_OBJECT
14 Q_OBJECT
15
15
16 public:
16 public:
17 explicit VisualizationMultiZoneSelectionDialog(QWidget *parent = 0);
17 explicit VisualizationMultiZoneSelectionDialog(QWidget *parent = 0);
18 ~VisualizationMultiZoneSelectionDialog();
18 virtual ~VisualizationMultiZoneSelectionDialog();
19
19
20 void setZones(const QVector<VisualizationSelectionZoneItem *> &zones);
20 void setZones(const QVector<VisualizationSelectionZoneItem *> &zones);
21 QMap<VisualizationSelectionZoneItem *, bool> selectedZones() const;
21 QMap<VisualizationSelectionZoneItem *, bool> selectedZones() const;
22
22
23 private:
23 private:
24 Ui::VisualizationMultiZoneSelectionDialog *ui;
24 Ui::VisualizationMultiZoneSelectionDialog *ui;
25
25
26 class VisualizationMultiZoneSelectionDialogPrivate;
26 class VisualizationMultiZoneSelectionDialogPrivate;
27 spimpl::unique_impl_ptr<VisualizationMultiZoneSelectionDialogPrivate> impl;
27 spimpl::unique_impl_ptr<VisualizationMultiZoneSelectionDialogPrivate> impl;
28 };
28 };
29
29
30 #endif // SCIQLOP_VISUALIZATIONMULTIZONESELECTIONDIALOG_H
30 #endif // SCIQLOP_VISUALIZATIONMULTIZONESELECTIONDIALOG_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,291 +1,316
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());
140 if (m_VisualizationWidget) {
140 if (event) {
141 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
141 if (m_VisualizationWidget) {
142
142 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
143 for (auto zoneName : m_ZonesForTimeMode) {
143
144 if (auto zone = tab->getZoneWithName(zoneName)) {
144 for (auto zoneName : m_ZonesForTimeMode) {
145 SqpRange eventRange;
145 if (auto zone = tab->getZoneWithName(zoneName)) {
146 eventRange.m_TStart = event->getTStart();
146 SqpRange eventRange;
147 eventRange.m_TEnd = event->getTEnd();
147 eventRange.m_TStart = event->getTStart();
148 zone->setZoneRange(eventRange);
148 eventRange.m_TEnd = event->getTEnd();
149 zone->setZoneRange(eventRange);
150 }
149 }
151 }
150 }
152 }
153 else {
154 qCWarning(LOG_CatalogueEventsWidget())
155 << "updateTimeZone: no tab found in the visualization";
156 }
151 }
157 }
152 else {
158 else {
153 qCWarning(LOG_CatalogueEventsWidget())
159 qCWarning(LOG_CatalogueEventsWidget())
154 << "updateTimeZone: no tab found in the visualization";
160 << "updateTimeZone: visualization widget not found";
155 }
161 }
156 }
162 }
157 else {
158 qCWarning(LOG_CatalogueEventsWidget())
159 << "updateTimeZone: visualization widget not found";
160 }
161 }
163 }
162 else {
164 else {
163 qCWarning(LOG_CatalogueEventsWidget())
165 qCWarning(LOG_CatalogueEventsWidget())
164 << "updateTimeZone: not compatible with multiple events selected";
166 << "updateTimeZone: not compatible with multiple events selected";
165 }
167 }
166 }
168 }
167
169
168 void updateForGraphMode(QTableView *tableView)
170 void updateForGraphMode(QTreeView *treeView)
169 {
171 {
170 auto selectedRows = tableView->selectionModel()->selectedRows();
172 auto selectedRows = treeView->selectionModel()->selectedRows();
171
173
172 if (selectedRows.count() == 1) {
174 if (selectedRows.count() == 1) {
173 auto event = m_Model->getEvent(selectedRows.first().row());
175 auto event = m_Model->getEvent(selectedRows.first());
174 if (m_VisualizationWidget) {
176 if (m_VisualizationWidget) {
175 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
177 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
176 if (auto zone = tab->getZoneWithName(m_ZoneForGraphMode)) {
178 if (auto zone = tab->getZoneWithName(m_ZoneForGraphMode)) {
177 // TODO
179 // TODO
178 }
180 }
179 }
181 }
180 else {
182 else {
181 qCWarning(LOG_CatalogueEventsWidget())
183 qCWarning(LOG_CatalogueEventsWidget())
182 << "updateGraphMode: no tab found in the visualization";
184 << "updateGraphMode: no tab found in the visualization";
183 }
185 }
184 }
186 }
185 else {
187 else {
186 qCWarning(LOG_CatalogueEventsWidget())
188 qCWarning(LOG_CatalogueEventsWidget())
187 << "updateGraphMode: visualization widget not found";
189 << "updateGraphMode: visualization widget not found";
188 }
190 }
189 }
191 }
190 else {
192 else {
191 qCWarning(LOG_CatalogueEventsWidget())
193 qCWarning(LOG_CatalogueEventsWidget())
192 << "updateGraphMode: not compatible with multiple events selected";
194 << "updateGraphMode: not compatible with multiple events selected";
193 }
195 }
194 }
196 }
195 };
197 };
196
198
197 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
199 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
198 : QWidget(parent),
200 : QWidget(parent),
199 ui(new Ui::CatalogueEventsWidget),
201 ui(new Ui::CatalogueEventsWidget),
200 impl{spimpl::make_unique_impl<CatalogueEventsWidgetPrivate>()}
202 impl{spimpl::make_unique_impl<CatalogueEventsWidgetPrivate>()}
201 {
203 {
202 ui->setupUi(this);
204 ui->setupUi(this);
203
205
204 impl->m_Model = new CatalogueEventsTableModel{this};
206 impl->m_Model = new CatalogueEventsModel{this};
205 ui->tableView->setModel(impl->m_Model);
207 ui->treeView->setModel(impl->m_Model);
206
208
207 ui->tableView->setSortingEnabled(true);
209 ui->treeView->setSortingEnabled(true);
208 ui->tableView->setDragDropMode(QAbstractItemView::DragDrop);
210 ui->treeView->setDragDropMode(QAbstractItemView::DragDrop);
209 ui->tableView->setDragEnabled(true);
211 ui->treeView->setDragEnabled(true);
210
212
211 connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) {
213 connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) {
212 if (checked) {
214 if (checked) {
213 ui->btnChart->setChecked(false);
215 ui->btnChart->setChecked(false);
214 impl->m_ZonesForTimeMode
216 impl->m_ZonesForTimeMode
215 = impl->selectZone(this, impl->m_ZonesForTimeMode, true,
217 = impl->selectZone(this, impl->m_ZonesForTimeMode, true,
216 this->mapToGlobal(ui->btnTime->frameGeometry().center()));
218 this->mapToGlobal(ui->btnTime->frameGeometry().center()));
217
219
218 impl->updateForTimeMode(ui->tableView);
220 impl->updateForTimeMode(ui->treeView);
219 }
221 }
220 });
222 });
221
223
222 connect(ui->btnChart, &QToolButton::clicked, [this](auto checked) {
224 connect(ui->btnChart, &QToolButton::clicked, [this](auto checked) {
223 if (checked) {
225 if (checked) {
224 ui->btnTime->setChecked(false);
226 ui->btnTime->setChecked(false);
225 impl->m_ZoneForGraphMode
227 impl->m_ZoneForGraphMode
226 = impl->selectZone(this, {impl->m_ZoneForGraphMode}, false,
228 = impl->selectZone(this, {impl->m_ZoneForGraphMode}, false,
227 this->mapToGlobal(ui->btnChart->frameGeometry().center()))
229 this->mapToGlobal(ui->btnChart->frameGeometry().center()))
228 .value(0);
230 .value(0);
229
231
230 impl->updateForGraphMode(ui->tableView);
232 impl->updateForGraphMode(ui->treeView);
231 }
233 }
232 });
234 });
233
235
234 auto emitSelection = [this]() {
236 auto emitSelection = [this]() {
235 QVector<std::shared_ptr<DBEvent> > events;
237 QVector<std::shared_ptr<DBEvent> > events;
236 for (auto rowIndex : ui->tableView->selectionModel()->selectedRows()) {
238 QVector<QPair<std::shared_ptr<DBEvent>, std::shared_ptr<DBEventProduct> > > eventProducts;
237 events << impl->m_Model->getEvent(rowIndex.row());
239
240 for (auto rowIndex : ui->treeView->selectionModel()->selectedRows()) {
241
242 auto itemType = impl->m_Model->itemTypeOf(rowIndex);
243 if (itemType == CatalogueEventsModel::ItemType::Event) {
244 events << impl->m_Model->getEvent(rowIndex);
245 }
246 else if (itemType == CatalogueEventsModel::ItemType::EventProduct) {
247 eventProducts << qMakePair(impl->m_Model->getParentEvent(rowIndex),
248 impl->m_Model->getEventProduct(rowIndex));
249 }
238 }
250 }
239
251
240 emit this->eventsSelected(events);
252 if (!events.isEmpty() && eventProducts.isEmpty()) {
253 emit this->eventsSelected(events);
254 }
255 else if (events.isEmpty() && !eventProducts.isEmpty()) {
256 emit this->eventProductsSelected(eventProducts);
257 }
258 else {
259 emit this->selectionCleared();
260 }
241 };
261 };
242
262
243 connect(ui->tableView, &QTableView::clicked, emitSelection);
263 connect(ui->treeView, &QTreeView::clicked, emitSelection);
244 connect(ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged, emitSelection);
264 connect(ui->treeView->selectionModel(), &QItemSelectionModel::selectionChanged, emitSelection);
245
265
246 connect(ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged, [this]() {
266 connect(ui->treeView->selectionModel(), &QItemSelectionModel::selectionChanged, [this]() {
247 auto isNotMultiSelection = ui->tableView->selectionModel()->selectedRows().count() <= 1;
267 auto isNotMultiSelection = ui->treeView->selectionModel()->selectedRows().count() <= 1;
248 ui->btnChart->setEnabled(isNotMultiSelection);
268 ui->btnChart->setEnabled(isNotMultiSelection);
249 ui->btnTime->setEnabled(isNotMultiSelection);
269 ui->btnTime->setEnabled(isNotMultiSelection);
250
270
251 if (isNotMultiSelection && ui->btnTime->isChecked()) {
271 if (isNotMultiSelection && ui->btnTime->isChecked()) {
252 impl->updateForTimeMode(ui->tableView);
272 impl->updateForTimeMode(ui->treeView);
253 }
273 }
254 else if (isNotMultiSelection && ui->btnChart->isChecked()) {
274 else if (isNotMultiSelection && ui->btnChart->isChecked()) {
255 impl->updateForGraphMode(ui->tableView);
275 impl->updateForGraphMode(ui->treeView);
256 }
276 }
257 });
277 });
258
278
259 ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
279 ui->treeView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
260 ui->tableView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
280 ui->treeView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
261 ui->tableView->horizontalHeader()->setSortIndicatorShown(true);
281 ui->treeView->header()->setSortIndicatorShown(true);
262 }
282 }
263
283
264 CatalogueEventsWidget::~CatalogueEventsWidget()
284 CatalogueEventsWidget::~CatalogueEventsWidget()
265 {
285 {
266 delete ui;
286 delete ui;
267 }
287 }
268
288
269 void CatalogueEventsWidget::setVisualizationWidget(VisualizationWidget *visualization)
289 void CatalogueEventsWidget::setVisualizationWidget(VisualizationWidget *visualization)
270 {
290 {
271 impl->m_VisualizationWidget = visualization;
291 impl->m_VisualizationWidget = visualization;
272 }
292 }
273
293
294 void CatalogueEventsWidget::setEventChanges(const std::shared_ptr<DBEvent> &event, bool hasChanges)
295 {
296 impl->m_Model->refreshEvent(event);
297 }
298
274 void CatalogueEventsWidget::populateWithCatalogues(
299 void CatalogueEventsWidget::populateWithCatalogues(
275 const QVector<std::shared_ptr<DBCatalogue> > &catalogues)
300 const QVector<std::shared_ptr<DBCatalogue> > &catalogues)
276 {
301 {
277 QSet<QUuid> eventIds;
302 QSet<QUuid> eventIds;
278 QVector<std::shared_ptr<DBEvent> > events;
303 QVector<std::shared_ptr<DBEvent> > events;
279
304
280 for (auto catalogue : catalogues) {
305 for (auto catalogue : catalogues) {
281 auto catalogueEvents = sqpApp->catalogueController().retrieveEventsFromCatalogue(catalogue);
306 auto catalogueEvents = sqpApp->catalogueController().retrieveEventsFromCatalogue(catalogue);
282 for (auto event : catalogueEvents) {
307 for (auto event : catalogueEvents) {
283 if (!eventIds.contains(event->getUniqId())) {
308 if (!eventIds.contains(event->getUniqId())) {
284 events << event;
309 events << event;
285 eventIds.insert(event->getUniqId());
310 eventIds.insert(event->getUniqId());
286 }
311 }
287 }
312 }
288 }
313 }
289
314
290 impl->setEvents(events, ui->tableView);
315 impl->setEvents(events, ui->treeView);
291 }
316 }
@@ -1,61 +1,83
1 #include "Catalogue/CatalogueExplorer.h"
1 #include "Catalogue/CatalogueExplorer.h"
2 #include "ui_CatalogueExplorer.h"
2 #include "ui_CatalogueExplorer.h"
3
3
4 #include <Visualization/VisualizationWidget.h>
4 #include <Visualization/VisualizationWidget.h>
5
5
6 #include <DBCatalogue.h>
6 #include <DBCatalogue.h>
7 #include <DBEvent.h>
7 #include <DBEvent.h>
8
8
9 struct CatalogueExplorer::CatalogueExplorerPrivate {
9 struct CatalogueExplorer::CatalogueExplorerPrivate {
10 };
10 };
11
11
12 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
12 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
13 : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
13 : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
14 ui(new Ui::CatalogueExplorer),
14 ui(new Ui::CatalogueExplorer),
15 impl{spimpl::make_unique_impl<CatalogueExplorerPrivate>()}
15 impl{spimpl::make_unique_impl<CatalogueExplorerPrivate>()}
16 {
16 {
17 ui->setupUi(this);
17 ui->setupUi(this);
18
18
19 connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto catalogues) {
19 connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto catalogues) {
20 if (catalogues.count() == 1) {
20 if (catalogues.count() == 1) {
21 ui->inspector->setCatalogue(catalogues.first());
21 ui->inspector->setCatalogue(catalogues.first());
22 }
22 }
23 else {
23 else {
24 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
24 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
25 }
25 }
26
26
27 ui->events->populateWithCatalogues(catalogues);
27 ui->events->populateWithCatalogues(catalogues);
28 });
28 });
29
29
30 connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databases) {
30 connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databases) {
31 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
31 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
32 });
32 });
33
33
34 connect(ui->catalogues, &CatalogueSideBarWidget::trashSelected,
34 connect(ui->catalogues, &CatalogueSideBarWidget::trashSelected,
35 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
35 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
36
36
37 connect(ui->catalogues, &CatalogueSideBarWidget::allEventsSelected,
37 connect(ui->catalogues, &CatalogueSideBarWidget::allEventsSelected,
38 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
38 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
39
39
40 connect(ui->catalogues, &CatalogueSideBarWidget::selectionCleared,
40 connect(ui->catalogues, &CatalogueSideBarWidget::selectionCleared,
41 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
41 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
42
42
43 connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) {
43 connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) {
44 if (events.count() == 1) {
44 if (events.count() == 1) {
45 ui->inspector->setEvent(events.first());
45 ui->inspector->setEvent(events.first());
46 }
46 }
47 else {
47 else {
48 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
48 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
49 }
49 }
50 });
50 });
51
52 connect(ui->events, &CatalogueEventsWidget::eventProductsSelected, [this](auto eventProducts) {
53 if (eventProducts.count() == 1) {
54 ui->inspector->setEventProduct(eventProducts.first().first,
55 eventProducts.first().second);
56 }
57 else {
58 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
59 }
60 });
61
62 connect(ui->events, &CatalogueEventsWidget::selectionCleared,
63 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
64
65 connect(ui->inspector, &CatalogueInspectorWidget::catalogueUpdated,
66 [this](auto catalogue) { ui->catalogues->setCatalogueChanges(catalogue, true); });
67
68 connect(ui->inspector, &CatalogueInspectorWidget::eventUpdated,
69 [this](auto event) { ui->events->setEventChanges(event, true); });
70
71 connect(ui->inspector, &CatalogueInspectorWidget::eventProductUpdated,
72 [this](auto event, auto eventProduct) { ui->events->setEventChanges(event, true); });
51 }
73 }
52
74
53 CatalogueExplorer::~CatalogueExplorer()
75 CatalogueExplorer::~CatalogueExplorer()
54 {
76 {
55 delete ui;
77 delete ui;
56 }
78 }
57
79
58 void CatalogueExplorer::setVisualizationWidget(VisualizationWidget *visualization)
80 void CatalogueExplorer::setVisualizationWidget(VisualizationWidget *visualization)
59 {
81 {
60 ui->events->setVisualizationWidget(visualization);
82 ui->events->setVisualizationWidget(visualization);
61 }
83 }
@@ -1,56 +1,181
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 <DBEventProduct.h>
7 #include <DBTag.h>
8 #include <DBTag.h>
8
9
10 struct CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate {
11 std::shared_ptr<DBCatalogue> m_DisplayedCatalogue = nullptr;
12 std::shared_ptr<DBEvent> m_DisplayedEvent = nullptr;
13 std::shared_ptr<DBEventProduct> m_DisplayedEventProduct = nullptr;
14
15 void connectCatalogueUpdateSignals(CatalogueInspectorWidget *inspector,
16 Ui::CatalogueInspectorWidget *ui);
17 void connectEventUpdateSignals(CatalogueInspectorWidget *inspector,
18 Ui::CatalogueInspectorWidget *ui);
19 };
20
9 CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent)
21 CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent)
10 : QWidget(parent), ui(new Ui::CatalogueInspectorWidget)
22 : QWidget(parent),
23 ui(new Ui::CatalogueInspectorWidget),
24 impl{spimpl::make_unique_impl<CatalogueInspectorWidgetPrivate>()}
11 {
25 {
12 ui->setupUi(this);
26 ui->setupUi(this);
13 showPage(Page::Empty);
27 showPage(Page::Empty);
28
29 impl->connectCatalogueUpdateSignals(this, ui);
30 impl->connectEventUpdateSignals(this, ui);
14 }
31 }
15
32
16 CatalogueInspectorWidget::~CatalogueInspectorWidget()
33 CatalogueInspectorWidget::~CatalogueInspectorWidget()
17 {
34 {
18 delete ui;
35 delete ui;
19 }
36 }
20
37
38 void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectCatalogueUpdateSignals(
39 CatalogueInspectorWidget *inspector, Ui::CatalogueInspectorWidget *ui)
40 {
41 connect(ui->leCatalogueName, &QLineEdit::editingFinished, [ui, inspector, this]() {
42 if (ui->leCatalogueName->text() != m_DisplayedCatalogue->getName()) {
43 m_DisplayedCatalogue->setName(ui->leCatalogueName->text());
44 emit inspector->catalogueUpdated(m_DisplayedCatalogue);
45 }
46 });
47
48 connect(ui->leCatalogueAuthor, &QLineEdit::editingFinished, [ui, inspector, this]() {
49 if (ui->leCatalogueAuthor->text() != m_DisplayedCatalogue->getAuthor()) {
50 m_DisplayedCatalogue->setAuthor(ui->leCatalogueAuthor->text());
51 emit inspector->catalogueUpdated(m_DisplayedCatalogue);
52 }
53 });
54 }
55
56 void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectEventUpdateSignals(
57 CatalogueInspectorWidget *inspector, Ui::CatalogueInspectorWidget *ui)
58 {
59 connect(ui->leEventName, &QLineEdit::editingFinished, [ui, inspector, this]() {
60 if (ui->leEventName->text() != m_DisplayedEvent->getName()) {
61 m_DisplayedEvent->setName(ui->leEventName->text());
62 emit inspector->eventUpdated(m_DisplayedEvent);
63 }
64 });
65
66 connect(ui->leEventTags, &QLineEdit::editingFinished, [ui, inspector, this]() {
67 auto tags = ui->leEventTags->text().split(QRegExp("\\s+"));
68 std::list<QString> tagNames;
69 for (auto tag : tags) {
70 tagNames.push_back(tag);
71 }
72
73 if (m_DisplayedEvent->getTagsNames() != tagNames) {
74 m_DisplayedEvent->setTagsNames(tagNames);
75 emit inspector->eventUpdated(m_DisplayedEvent);
76 }
77 });
78
79 connect(ui->leEventProduct, &QLineEdit::editingFinished, [ui, inspector, this]() {
80 if (ui->leEventProduct->text() != m_DisplayedEventProduct->getProductId()) {
81 m_DisplayedEventProduct->setProductId(ui->leEventProduct->text());
82 emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct);
83 }
84 });
85
86 connect(ui->dateTimeEventTStart, &QDateTimeEdit::editingFinished, [ui, inspector, this]() {
87 auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTStart->dateTime());
88 if (time != m_DisplayedEventProduct->getTStart()) {
89 m_DisplayedEventProduct->setTStart(time);
90 emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct);
91 }
92 });
93
94 connect(ui->dateTimeEventTEnd, &QDateTimeEdit::editingFinished, [ui, inspector, this]() {
95 auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTEnd->dateTime());
96 if (time != m_DisplayedEventProduct->getTEnd()) {
97 m_DisplayedEventProduct->setTEnd(time);
98 emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct);
99 }
100 });
101 }
102
21 void CatalogueInspectorWidget::showPage(CatalogueInspectorWidget::Page page)
103 void CatalogueInspectorWidget::showPage(CatalogueInspectorWidget::Page page)
22 {
104 {
23 ui->stackedWidget->setCurrentIndex(static_cast<int>(page));
105 ui->stackedWidget->setCurrentIndex(static_cast<int>(page));
24 }
106 }
25
107
26 CatalogueInspectorWidget::Page CatalogueInspectorWidget::currentPage() const
108 CatalogueInspectorWidget::Page CatalogueInspectorWidget::currentPage() const
27 {
109 {
28 return static_cast<Page>(ui->stackedWidget->currentIndex());
110 return static_cast<Page>(ui->stackedWidget->currentIndex());
29 }
111 }
30
112
31 void CatalogueInspectorWidget::setEvent(const std::shared_ptr<DBEvent> &event)
113 void CatalogueInspectorWidget::setEvent(const std::shared_ptr<DBEvent> &event)
32 {
114 {
115 impl->m_DisplayedEvent = event;
116
117 blockSignals(true);
118
33 showPage(Page::EventProperties);
119 showPage(Page::EventProperties);
120 ui->leEventName->setEnabled(true);
34 ui->leEventName->setText(event->getName());
121 ui->leEventName->setText(event->getName());
35 ui->leEventMission->setText(event->getMission());
122 ui->leEventProduct->setEnabled(false);
36 ui->leEventProduct->setText(event->getProduct());
123 ui->leEventProduct->setText(
124 QString::number(event->getEventProducts().size()).append(" product(s)"));
37
125
38 QString tagList;
126 QString tagList;
39 auto tags = event->getTags();
127 auto tags = event->getTagsNames();
40 for (auto tag : tags) {
128 for (auto tag : tags) {
41 tagList += tag.getName();
129 tagList += tag;
42 tagList += ' ';
130 tagList += ' ';
43 }
131 }
44
132
133 ui->leEventTags->setEnabled(true);
45 ui->leEventTags->setText(tagList);
134 ui->leEventTags->setText(tagList);
46
135
136 ui->dateTimeEventTStart->setEnabled(false);
137 ui->dateTimeEventTEnd->setEnabled(false);
138
47 ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(event->getTStart()));
139 ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(event->getTStart()));
48 ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(event->getTEnd()));
140 ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(event->getTEnd()));
141
142 blockSignals(false);
143 }
144
145 void CatalogueInspectorWidget::setEventProduct(const std::shared_ptr<DBEvent> &event,
146 const std::shared_ptr<DBEventProduct> &eventProduct)
147 {
148 impl->m_DisplayedEventProduct = eventProduct;
149
150 blockSignals(true);
151
152 showPage(Page::EventProperties);
153 ui->leEventName->setEnabled(false);
154 ui->leEventName->setText(event->getName());
155 ui->leEventProduct->setEnabled(true);
156 ui->leEventProduct->setText(eventProduct->getProductId());
157
158 ui->leEventTags->setEnabled(false);
159 ui->leEventTags->clear();
160
161 ui->dateTimeEventTStart->setEnabled(true);
162 ui->dateTimeEventTEnd->setEnabled(true);
163
164 ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(eventProduct->getTStart()));
165 ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(eventProduct->getTEnd()));
166
167 blockSignals(false);
49 }
168 }
50
169
51 void CatalogueInspectorWidget::setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue)
170 void CatalogueInspectorWidget::setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue)
52 {
171 {
172 impl->m_DisplayedCatalogue = catalogue;
173
174 blockSignals(true);
175
53 showPage(Page::CatalogueProperties);
176 showPage(Page::CatalogueProperties);
54 ui->leCatalogueName->setText(catalogue->getName());
177 ui->leCatalogueName->setText(catalogue->getName());
55 ui->leCatalogueAuthor->setText(catalogue->getAuthor());
178 ui->leCatalogueAuthor->setText(catalogue->getAuthor());
179
180 blockSignals(false);
56 }
181 }
@@ -1,198 +1,247
1 #include "Catalogue/CatalogueSideBarWidget.h"
1 #include "Catalogue/CatalogueSideBarWidget.h"
2 #include "ui_CatalogueSideBarWidget.h"
2 #include "ui_CatalogueSideBarWidget.h"
3 #include <SqpApplication.h>
3 #include <SqpApplication.h>
4
4
5 #include <Catalogue/CatalogueController.h>
5 #include <Catalogue/CatalogueController.h>
6 #include <Catalogue/CatalogueTreeWidgetItem.h>
6 #include <Catalogue/CatalogueTreeWidgetItem.h>
7 #include <CatalogueDao.h>
7 #include <CatalogueDao.h>
8 #include <ComparaisonPredicate.h>
8 #include <ComparaisonPredicate.h>
9 #include <DBCatalogue.h>
9 #include <DBCatalogue.h>
10
10
11 #include <QMenu>
11 #include <QMenu>
12
12
13 Q_LOGGING_CATEGORY(LOG_CatalogueSideBarWidget, "CatalogueSideBarWidget")
14
13
15
14 constexpr auto ALL_EVENT_ITEM_TYPE = QTreeWidgetItem::UserType;
16 constexpr auto ALL_EVENT_ITEM_TYPE = QTreeWidgetItem::UserType;
15 constexpr auto TRASH_ITEM_TYPE = QTreeWidgetItem::UserType + 1;
17 constexpr auto TRASH_ITEM_TYPE = QTreeWidgetItem::UserType + 1;
16 constexpr auto CATALOGUE_ITEM_TYPE = QTreeWidgetItem::UserType + 2;
18 constexpr auto CATALOGUE_ITEM_TYPE = QTreeWidgetItem::UserType + 2;
17 constexpr auto DATABASE_ITEM_TYPE = QTreeWidgetItem::UserType + 3;
19 constexpr auto DATABASE_ITEM_TYPE = QTreeWidgetItem::UserType + 3;
18
20
19
21
20 struct CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate {
22 struct CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate {
21
23
22 void configureTreeWidget(QTreeWidget *treeWidget);
24 void configureTreeWidget(QTreeWidget *treeWidget);
23 QTreeWidgetItem *addDatabaseItem(const QString &name, QTreeWidget *treeWidget);
25 QTreeWidgetItem *addDatabaseItem(const QString &name, QTreeWidget *treeWidget);
24 QTreeWidgetItem *getDatabaseItem(const QString &name, QTreeWidget *treeWidget);
26 QTreeWidgetItem *getDatabaseItem(const QString &name, QTreeWidget *treeWidget);
25 void addCatalogueItem(const std::shared_ptr<DBCatalogue> &catalogue,
27 void addCatalogueItem(const std::shared_ptr<DBCatalogue> &catalogue,
26 QTreeWidgetItem *parentDatabaseItem);
28 QTreeWidgetItem *parentDatabaseItem);
29
30 CatalogueTreeWidgetItem *getCatalogueItem(const std::shared_ptr<DBCatalogue> &catalogue,
31 QTreeWidget *treeWidget) const;
27 };
32 };
28
33
29 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent)
34 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent)
30 : QWidget(parent),
35 : QWidget(parent),
31 ui(new Ui::CatalogueSideBarWidget),
36 ui(new Ui::CatalogueSideBarWidget),
32 impl{spimpl::make_unique_impl<CatalogueSideBarWidgetPrivate>()}
37 impl{spimpl::make_unique_impl<CatalogueSideBarWidgetPrivate>()}
33 {
38 {
34 ui->setupUi(this);
39 ui->setupUi(this);
35 impl->configureTreeWidget(ui->treeWidget);
40 impl->configureTreeWidget(ui->treeWidget);
36
41
37 ui->treeWidget->setColumnCount(2);
42 ui->treeWidget->setColumnCount(2);
38 ui->treeWidget->header()->setStretchLastSection(false);
43 ui->treeWidget->header()->setStretchLastSection(false);
39 ui->treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
44 ui->treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
40 ui->treeWidget->header()->setSectionResizeMode(0, QHeaderView::Stretch);
45 ui->treeWidget->header()->setSectionResizeMode(0, QHeaderView::Stretch);
41
46
42 auto emitSelection = [this]() {
47 auto emitSelection = [this]() {
43
48
44 auto selectedItems = ui->treeWidget->selectedItems();
49 auto selectedItems = ui->treeWidget->selectedItems();
45 if (selectedItems.isEmpty()) {
50 if (selectedItems.isEmpty()) {
46 emit this->selectionCleared();
51 emit this->selectionCleared();
47 }
52 }
48 else {
53 else {
49 QVector<std::shared_ptr<DBCatalogue> > catalogues;
54 QVector<std::shared_ptr<DBCatalogue> > catalogues;
50 QStringList databases;
55 QStringList databases;
51 int selectionType = selectedItems.first()->type();
56 int selectionType = selectedItems.first()->type();
52
57
53 for (auto item : ui->treeWidget->selectedItems()) {
58 for (auto item : ui->treeWidget->selectedItems()) {
54 if (item->type() == selectionType) {
59 if (item->type() == selectionType) {
55 switch (selectionType) {
60 switch (selectionType) {
56 case CATALOGUE_ITEM_TYPE:
61 case CATALOGUE_ITEM_TYPE:
57 catalogues.append(
62 catalogues.append(
58 static_cast<CatalogueTreeWidgetItem *>(item)->catalogue());
63 static_cast<CatalogueTreeWidgetItem *>(item)->catalogue());
59 break;
64 break;
60 case DATABASE_ITEM_TYPE:
65 case DATABASE_ITEM_TYPE:
61 selectionType = DATABASE_ITEM_TYPE;
66 selectionType = DATABASE_ITEM_TYPE;
62 databases.append(item->text(0));
67 databases.append(item->text(0));
63 case ALL_EVENT_ITEM_TYPE: // fallthrough
68 case ALL_EVENT_ITEM_TYPE: // fallthrough
64 case TRASH_ITEM_TYPE: // fallthrough
69 case TRASH_ITEM_TYPE: // fallthrough
65 default:
70 default:
66 break;
71 break;
67 }
72 }
68 }
73 }
69 else {
74 else {
70 // Incoherent multi selection
75 // Incoherent multi selection
71 selectionType = -1;
76 selectionType = -1;
72 break;
77 break;
73 }
78 }
74 }
79 }
75
80
76 switch (selectionType) {
81 switch (selectionType) {
77 case CATALOGUE_ITEM_TYPE:
82 case CATALOGUE_ITEM_TYPE:
78 emit this->catalogueSelected(catalogues);
83 emit this->catalogueSelected(catalogues);
79 break;
84 break;
80 case DATABASE_ITEM_TYPE:
85 case DATABASE_ITEM_TYPE:
81 emit this->databaseSelected(databases);
86 emit this->databaseSelected(databases);
82 break;
87 break;
83 case ALL_EVENT_ITEM_TYPE:
88 case ALL_EVENT_ITEM_TYPE:
84 emit this->allEventsSelected();
89 emit this->allEventsSelected();
85 break;
90 break;
86 case TRASH_ITEM_TYPE:
91 case TRASH_ITEM_TYPE:
87 emit this->trashSelected();
92 emit this->trashSelected();
88 break;
93 break;
89 default:
94 default:
90 emit this->selectionCleared();
95 emit this->selectionCleared();
91 break;
96 break;
92 }
97 }
93 }
98 }
94
99
95
100
96 };
101 };
97
102
98 connect(ui->treeWidget, &QTreeWidget::itemClicked, emitSelection);
103 connect(ui->treeWidget, &QTreeWidget::itemClicked, emitSelection);
99 connect(ui->treeWidget, &QTreeWidget::currentItemChanged, emitSelection);
104 connect(ui->treeWidget, &QTreeWidget::currentItemChanged, emitSelection);
105 connect(ui->treeWidget, &QTreeWidget::itemChanged,
106 [emitSelection, this](auto item, auto column) {
107 auto selectedItems = ui->treeWidget->selectedItems();
108 qDebug() << "ITEM CHANGED" << column;
109 if (selectedItems.contains(item) && column == 0) {
110 emitSelection();
111 }
112 });
100
113
101 ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
114 ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
102 connect(ui->treeWidget, &QTreeWidget::customContextMenuRequested, this,
115 connect(ui->treeWidget, &QTreeWidget::customContextMenuRequested, this,
103 &CatalogueSideBarWidget::onContextMenuRequested);
116 &CatalogueSideBarWidget::onContextMenuRequested);
104 }
117 }
105
118
106 CatalogueSideBarWidget::~CatalogueSideBarWidget()
119 CatalogueSideBarWidget::~CatalogueSideBarWidget()
107 {
120 {
108 delete ui;
121 delete ui;
109 }
122 }
110
123
124 void CatalogueSideBarWidget::setCatalogueChanges(const std::shared_ptr<DBCatalogue> &catalogue,
125 bool hasChanges)
126 {
127 if (auto catalogueItem = impl->getCatalogueItem(catalogue, ui->treeWidget)) {
128 catalogueItem->setHasChanges(hasChanges);
129 catalogueItem->refresh();
130 }
131 }
132
111 void CatalogueSideBarWidget::onContextMenuRequested(const QPoint &pos)
133 void CatalogueSideBarWidget::onContextMenuRequested(const QPoint &pos)
112 {
134 {
113 QMenu menu{this};
135 QMenu menu{this};
114
136
115 auto currentItem = ui->treeWidget->currentItem();
137 auto currentItem = ui->treeWidget->currentItem();
116 switch (currentItem->type()) {
138 switch (currentItem->type()) {
117 case CATALOGUE_ITEM_TYPE:
139 case CATALOGUE_ITEM_TYPE:
118 menu.addAction("Rename",
140 menu.addAction("Rename",
119 [this, currentItem]() { ui->treeWidget->editItem(currentItem); });
141 [this, currentItem]() { ui->treeWidget->editItem(currentItem); });
120 break;
142 break;
121 case DATABASE_ITEM_TYPE:
143 case DATABASE_ITEM_TYPE:
122 break;
144 break;
123 case ALL_EVENT_ITEM_TYPE:
145 case ALL_EVENT_ITEM_TYPE:
124 break;
146 break;
125 case TRASH_ITEM_TYPE:
147 case TRASH_ITEM_TYPE:
126 menu.addAction("Empty Trash", []() {
148 menu.addAction("Empty Trash", []() {
127 // TODO
149 // TODO
128 });
150 });
129 break;
151 break;
130 default:
152 default:
131 break;
153 break;
132 }
154 }
133
155
134 if (!menu.isEmpty()) {
156 if (!menu.isEmpty()) {
135 menu.exec(ui->treeWidget->mapToGlobal(pos));
157 menu.exec(ui->treeWidget->mapToGlobal(pos));
136 }
158 }
137 }
159 }
138
160
139 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::configureTreeWidget(
161 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::configureTreeWidget(
140 QTreeWidget *treeWidget)
162 QTreeWidget *treeWidget)
141 {
163 {
142 auto allEventsItem = new QTreeWidgetItem{{"All Events"}, ALL_EVENT_ITEM_TYPE};
164 auto allEventsItem = new QTreeWidgetItem{{"All Events"}, ALL_EVENT_ITEM_TYPE};
143 allEventsItem->setIcon(0, QIcon(":/icones/allEvents.png"));
165 allEventsItem->setIcon(0, QIcon(":/icones/allEvents.png"));
144 treeWidget->addTopLevelItem(allEventsItem);
166 treeWidget->addTopLevelItem(allEventsItem);
145
167
146 auto trashItem = new QTreeWidgetItem{{"Trash"}, TRASH_ITEM_TYPE};
168 auto trashItem = new QTreeWidgetItem{{"Trash"}, TRASH_ITEM_TYPE};
147 trashItem->setIcon(0, QIcon(":/icones/trash.png"));
169 trashItem->setIcon(0, QIcon(":/icones/trash.png"));
148 treeWidget->addTopLevelItem(trashItem);
170 treeWidget->addTopLevelItem(trashItem);
149
171
150 auto separator = new QFrame{treeWidget};
172 auto separator = new QFrame{treeWidget};
151 separator->setFrameShape(QFrame::HLine);
173 separator->setFrameShape(QFrame::HLine);
152 auto separatorItem = new QTreeWidgetItem{};
174 auto separatorItem = new QTreeWidgetItem{};
153 separatorItem->setFlags(Qt::NoItemFlags);
175 separatorItem->setFlags(Qt::NoItemFlags);
154 treeWidget->addTopLevelItem(separatorItem);
176 treeWidget->addTopLevelItem(separatorItem);
155 treeWidget->setItemWidget(separatorItem, 0, separator);
177 treeWidget->setItemWidget(separatorItem, 0, separator);
156
178
157 auto db = addDatabaseItem("Default", treeWidget);
179 auto db = addDatabaseItem("Default", treeWidget);
158
180
159 auto catalogues = sqpApp->catalogueController().getCatalogues("Default");
181 auto catalogues = sqpApp->catalogueController().getCatalogues("Default");
160 for (auto catalogue : catalogues) {
182 for (auto catalogue : catalogues) {
161 addCatalogueItem(catalogue, db);
183 addCatalogueItem(catalogue, db);
162 }
184 }
163
185
164 treeWidget->expandAll();
186 treeWidget->expandAll();
165 }
187 }
166
188
167 QTreeWidgetItem *
189 QTreeWidgetItem *
168 CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::addDatabaseItem(const QString &name,
190 CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::addDatabaseItem(const QString &name,
169 QTreeWidget *treeWidget)
191 QTreeWidget *treeWidget)
170 {
192 {
171 auto databaseItem = new QTreeWidgetItem{{name}, DATABASE_ITEM_TYPE};
193 auto databaseItem = new QTreeWidgetItem{{name}, DATABASE_ITEM_TYPE};
172 databaseItem->setIcon(0, QIcon{":/icones/database.png"});
194 databaseItem->setIcon(0, QIcon{":/icones/database.png"});
173 treeWidget->addTopLevelItem(databaseItem);
195 treeWidget->addTopLevelItem(databaseItem);
174
196
175 return databaseItem;
197 return databaseItem;
176 }
198 }
177
199
178 QTreeWidgetItem *
200 QTreeWidgetItem *
179 CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::getDatabaseItem(const QString &name,
201 CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::getDatabaseItem(const QString &name,
180 QTreeWidget *treeWidget)
202 QTreeWidget *treeWidget)
181 {
203 {
182 for (auto i = 0; i < treeWidget->topLevelItemCount(); ++i) {
204 for (auto i = 0; i < treeWidget->topLevelItemCount(); ++i) {
183 auto item = treeWidget->topLevelItem(i);
205 auto item = treeWidget->topLevelItem(i);
184 if (item->type() == DATABASE_ITEM_TYPE && item->text(0) == name) {
206 if (item->type() == DATABASE_ITEM_TYPE && item->text(0) == name) {
185 return item;
207 return item;
186 }
208 }
187 }
209 }
188
210
189 return nullptr;
211 return nullptr;
190 }
212 }
191
213
192 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::addCatalogueItem(
214 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::addCatalogueItem(
193 const std::shared_ptr<DBCatalogue> &catalogue, QTreeWidgetItem *parentDatabaseItem)
215 const std::shared_ptr<DBCatalogue> &catalogue, QTreeWidgetItem *parentDatabaseItem)
194 {
216 {
195 auto catalogueItem = new CatalogueTreeWidgetItem{catalogue, CATALOGUE_ITEM_TYPE};
217 auto catalogueItem = new CatalogueTreeWidgetItem{catalogue, CATALOGUE_ITEM_TYPE};
196 catalogueItem->setIcon(0, QIcon{":/icones/catalogue.png"});
218 catalogueItem->setIcon(0, QIcon{":/icones/catalogue.png"});
197 parentDatabaseItem->addChild(catalogueItem);
219 parentDatabaseItem->addChild(catalogueItem);
198 }
220 }
221
222 CatalogueTreeWidgetItem *CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::getCatalogueItem(
223 const std::shared_ptr<DBCatalogue> &catalogue, QTreeWidget *treeWidget) const
224 {
225 for (auto i = 0; i < treeWidget->topLevelItemCount(); ++i) {
226 auto item = treeWidget->topLevelItem(i);
227 if (item->type() == DATABASE_ITEM_TYPE) {
228 for (auto j = 0; j < item->childCount(); ++j) {
229 auto childItem = item->child(j);
230 if (childItem->type() == CATALOGUE_ITEM_TYPE) {
231 auto catalogueItem = static_cast<CatalogueTreeWidgetItem *>(childItem);
232 if (catalogueItem->catalogue() == catalogue) {
233 return catalogueItem;
234 }
235 }
236 else {
237 qCWarning(LOG_CatalogueSideBarWidget()) << "getCatalogueItem: Invalid tree "
238 "structure. A database item should "
239 "only contain catalogues.";
240 Q_ASSERT(false);
241 }
242 }
243 }
244 }
245
246 return nullptr;
247 }
@@ -1,93 +1,103
1 #include "Catalogue/CatalogueTreeWidgetItem.h"
1 #include "Catalogue/CatalogueTreeWidgetItem.h"
2
2
3 #include <memory>
3 #include <memory>
4
4
5 #include <DBCatalogue.h>
5 #include <DBCatalogue.h>
6 #include <QBoxLayout>
6 #include <QBoxLayout>
7 #include <QToolButton>
7 #include <QToolButton>
8
8
9 const auto VALIDATION_BUTTON_ICON_SIZE = 12;
9 const auto VALIDATION_BUTTON_ICON_SIZE = 12;
10
10
11 /// Column in the tree widget where the apply and cancel buttons must appear
12 const auto APPLY_CANCEL_BUTTONS_COLUMN = 1;
13
11 struct CatalogueTreeWidgetItem::CatalogueTreeWidgetItemPrivate {
14 struct CatalogueTreeWidgetItem::CatalogueTreeWidgetItemPrivate {
12
15
13 std::shared_ptr<DBCatalogue> m_Catalogue;
16 std::shared_ptr<DBCatalogue> m_Catalogue;
14
17
15 CatalogueTreeWidgetItemPrivate(std::shared_ptr<DBCatalogue> catalogue) : m_Catalogue(catalogue)
18 CatalogueTreeWidgetItemPrivate(std::shared_ptr<DBCatalogue> catalogue) : m_Catalogue(catalogue)
16 {
19 {
17 }
20 }
18 };
21 };
19
22
20
23
21 CatalogueTreeWidgetItem::CatalogueTreeWidgetItem(std::shared_ptr<DBCatalogue> catalogue, int type)
24 CatalogueTreeWidgetItem::CatalogueTreeWidgetItem(std::shared_ptr<DBCatalogue> catalogue, int type)
22 : QTreeWidgetItem(type),
25 : QTreeWidgetItem(type),
23 impl{spimpl::make_unique_impl<CatalogueTreeWidgetItemPrivate>(catalogue)}
26 impl{spimpl::make_unique_impl<CatalogueTreeWidgetItemPrivate>(catalogue)}
24 {
27 {
25 setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable);
28 setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable);
26 }
29 }
27
30
28 QVariant CatalogueTreeWidgetItem::data(int column, int role) const
31 QVariant CatalogueTreeWidgetItem::data(int column, int role) const
29 {
32 {
30 if (column == 0) {
33 if (column == 0) {
31 switch (role) {
34 switch (role) {
32 case Qt::EditRole: // fallthrough
35 case Qt::EditRole: // fallthrough
33 case Qt::DisplayRole:
36 case Qt::DisplayRole:
34 return impl->m_Catalogue->getName();
37 return impl->m_Catalogue->getName();
35 default:
38 default:
36 break;
39 break;
37 }
40 }
38 }
41 }
39
42
40 return QTreeWidgetItem::data(column, role);
43 return QTreeWidgetItem::data(column, role);
41 }
44 }
42
45
43 void CatalogueTreeWidgetItem::setData(int column, int role, const QVariant &value)
46 void CatalogueTreeWidgetItem::setData(int column, int role, const QVariant &value)
44 {
47 {
45 if (role == Qt::EditRole && column == 0) {
48 if (role == Qt::EditRole && column == 0) {
46 auto newName = value.toString();
49 auto newName = value.toString();
47 if (newName != impl->m_Catalogue->getName()) {
50 if (newName != impl->m_Catalogue->getName()) {
48 setText(0, newName);
51 setText(0, newName);
49 impl->m_Catalogue->setName(newName);
52 impl->m_Catalogue->setName(newName);
50 setHasChanges(true);
53 setHasChanges(true);
51 }
54 }
52 }
55 }
53 else {
56 else {
54 QTreeWidgetItem::setData(column, role, value);
57 QTreeWidgetItem::setData(column, role, value);
55 }
58 }
56 }
59 }
57
60
58 std::shared_ptr<DBCatalogue> CatalogueTreeWidgetItem::catalogue() const
61 std::shared_ptr<DBCatalogue> CatalogueTreeWidgetItem::catalogue() const
59 {
62 {
60 return impl->m_Catalogue;
63 return impl->m_Catalogue;
61 }
64 }
62
65
63 void CatalogueTreeWidgetItem::setHasChanges(bool value)
66 void CatalogueTreeWidgetItem::setHasChanges(bool value)
64 {
67 {
65 if (value) {
68 if (value) {
66 auto widet = new QWidget{treeWidget()};
69 if (treeWidget()->itemWidget(this, APPLY_CANCEL_BUTTONS_COLUMN) == nullptr) {
67
70 auto widet = new QWidget{treeWidget()};
68 auto layout = new QHBoxLayout{widet};
71
69 layout->setContentsMargins(0, 0, 0, 0);
72 auto layout = new QHBoxLayout{widet};
70 layout->setSpacing(0);
73 layout->setContentsMargins(0, 0, 0, 0);
71
74 layout->setSpacing(0);
72 auto btnValid = new QToolButton{widet};
75
73 btnValid->setIcon(QIcon{":/icones/save"});
76 auto btnValid = new QToolButton{widet};
74 btnValid->setIconSize(QSize{VALIDATION_BUTTON_ICON_SIZE, VALIDATION_BUTTON_ICON_SIZE});
77 btnValid->setIcon(QIcon{":/icones/save"});
75 btnValid->setAutoRaise(true);
78 btnValid->setIconSize(QSize{VALIDATION_BUTTON_ICON_SIZE, VALIDATION_BUTTON_ICON_SIZE});
76 QObject::connect(btnValid, &QToolButton::clicked, [this]() { setHasChanges(false); });
79 btnValid->setAutoRaise(true);
77 layout->addWidget(btnValid);
80 QObject::connect(btnValid, &QToolButton::clicked, [this]() { setHasChanges(false); });
78
81 layout->addWidget(btnValid);
79 auto btnDiscard = new QToolButton{widet};
82
80 btnDiscard->setIcon(QIcon{":/icones/discard"});
83 auto btnDiscard = new QToolButton{widet};
81 btnDiscard->setIconSize(QSize{VALIDATION_BUTTON_ICON_SIZE, VALIDATION_BUTTON_ICON_SIZE});
84 btnDiscard->setIcon(QIcon{":/icones/discard"});
82 btnDiscard->setAutoRaise(true);
85 btnDiscard->setIconSize(
83 QObject::connect(btnDiscard, &QToolButton::clicked, [this]() { setHasChanges(false); });
86 QSize{VALIDATION_BUTTON_ICON_SIZE, VALIDATION_BUTTON_ICON_SIZE});
84 layout->addWidget(btnDiscard);
87 btnDiscard->setAutoRaise(true);
85
88 QObject::connect(btnDiscard, &QToolButton::clicked, [this]() { setHasChanges(false); });
86 treeWidget()->setItemWidget(this, 1, {widet});
89 layout->addWidget(btnDiscard);
87 treeWidget()->resizeColumnToContents(1);
90
91 treeWidget()->setItemWidget(this, APPLY_CANCEL_BUTTONS_COLUMN, {widet});
92 }
88 }
93 }
89 else {
94 else {
90 // Note: the widget is destroyed
95 // Note: the widget is destroyed
91 treeWidget()->setItemWidget(this, 1, nullptr);
96 treeWidget()->setItemWidget(this, APPLY_CANCEL_BUTTONS_COLUMN, nullptr);
92 }
97 }
93 }
98 }
99
100 void CatalogueTreeWidgetItem::refresh()
101 {
102 emitDataChanged();
103 }
@@ -1,154 +1,142
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="selectionMode">
125 <enum>QAbstractItemView::ExtendedSelection</enum>
126 </property>
124 <property name="selectionBehavior">
127 <property name="selectionBehavior">
125 <enum>QAbstractItemView::SelectRows</enum>
128 <enum>QAbstractItemView::SelectRows</enum>
126 </property>
129 </property>
127 <attribute name="horizontalHeaderVisible">
130 <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>
131 <bool>false</bool>
144 </attribute>
132 </attribute>
145 </widget>
133 </widget>
146 </item>
134 </item>
147 </layout>
135 </layout>
148 </widget>
136 </widget>
149 <resources>
137 <resources>
150 <include location="../../resources/sqpguiresources.qrc"/>
138 <include location="../../resources/sqpguiresources.qrc"/>
151 <include location="../../resources/sqpguiresources.qrc"/>
139 <include location="../../resources/sqpguiresources.qrc"/>
152 </resources>
140 </resources>
153 <connections/>
141 <connections/>
154 </ui>
142 </ui>
@@ -1,214 +1,219
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>CatalogueInspectorWidget</class>
3 <class>CatalogueInspectorWidget</class>
4 <widget class="QWidget" name="CatalogueInspectorWidget">
4 <widget class="QWidget" name="CatalogueInspectorWidget">
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>400</width>
9 <width>400</width>
10 <height>300</height>
10 <height>300</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_2">
16 <layout class="QVBoxLayout" name="verticalLayout_2">
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 <widget class="QFrame" name="frame">
30 <widget class="QFrame" name="frame">
31 <property name="frameShape">
31 <property name="frameShape">
32 <enum>QFrame::Box</enum>
32 <enum>QFrame::Box</enum>
33 </property>
33 </property>
34 <property name="frameShadow">
34 <property name="frameShadow">
35 <enum>QFrame::Sunken</enum>
35 <enum>QFrame::Sunken</enum>
36 </property>
36 </property>
37 <property name="lineWidth">
37 <property name="lineWidth">
38 <number>1</number>
38 <number>1</number>
39 </property>
39 </property>
40 <layout class="QVBoxLayout" name="verticalLayout">
40 <layout class="QVBoxLayout" name="verticalLayout">
41 <property name="leftMargin">
41 <property name="leftMargin">
42 <number>0</number>
42 <number>0</number>
43 </property>
43 </property>
44 <property name="topMargin">
44 <property name="topMargin">
45 <number>0</number>
45 <number>0</number>
46 </property>
46 </property>
47 <property name="rightMargin">
47 <property name="rightMargin">
48 <number>0</number>
48 <number>0</number>
49 </property>
49 </property>
50 <property name="bottomMargin">
50 <property name="bottomMargin">
51 <number>0</number>
51 <number>0</number>
52 </property>
52 </property>
53 <item>
53 <item>
54 <widget class="QStackedWidget" name="stackedWidget">
54 <widget class="QStackedWidget" name="stackedWidget">
55 <property name="currentIndex">
55 <property name="currentIndex">
56 <number>1</number>
56 <number>2</number>
57 </property>
57 </property>
58 <widget class="QWidget" name="emptyPage"/>
58 <widget class="QWidget" name="emptyPage"/>
59 <widget class="QWidget" name="catalogueInspectorPage">
59 <widget class="QWidget" name="catalogueInspectorPage">
60 <layout class="QGridLayout" name="gridLayout_2">
60 <layout class="QGridLayout" name="gridLayout_2">
61 <item row="1" column="0">
61 <item row="1" column="0">
62 <widget class="QLabel" name="label_7">
62 <widget class="QLabel" name="label_7">
63 <property name="text">
63 <property name="text">
64 <string>Name</string>
64 <string>Name</string>
65 </property>
65 </property>
66 </widget>
66 </widget>
67 </item>
67 </item>
68 <item row="1" column="1">
68 <item row="1" column="1">
69 <widget class="QLineEdit" name="leCatalogueName"/>
69 <widget class="QLineEdit" name="leCatalogueName"/>
70 </item>
70 </item>
71 <item row="2" column="0">
71 <item row="2" column="0">
72 <widget class="QLabel" name="label_8">
72 <widget class="QLabel" name="label_8">
73 <property name="text">
73 <property name="text">
74 <string>Author</string>
74 <string>Author</string>
75 </property>
75 </property>
76 </widget>
76 </widget>
77 </item>
77 </item>
78 <item row="2" column="1">
78 <item row="2" column="1">
79 <widget class="QLineEdit" name="leCatalogueAuthor">
79 <widget class="QLineEdit" name="leCatalogueAuthor">
80 <property name="text">
80 <property name="text">
81 <string/>
81 <string/>
82 </property>
82 </property>
83 </widget>
83 </widget>
84 </item>
84 </item>
85 <item row="3" column="1">
85 <item row="3" column="1">
86 <spacer name="verticalSpacer_2">
86 <spacer name="verticalSpacer_2">
87 <property name="orientation">
87 <property name="orientation">
88 <enum>Qt::Vertical</enum>
88 <enum>Qt::Vertical</enum>
89 </property>
89 </property>
90 <property name="sizeHint" stdset="0">
90 <property name="sizeHint" stdset="0">
91 <size>
91 <size>
92 <width>20</width>
92 <width>20</width>
93 <height>40</height>
93 <height>40</height>
94 </size>
94 </size>
95 </property>
95 </property>
96 </spacer>
96 </spacer>
97 </item>
97 </item>
98 <item row="0" column="0" colspan="2">
98 <item row="0" column="0" colspan="2">
99 <widget class="QLabel" name="label_9">
99 <widget class="QLabel" name="label_9">
100 <property name="font">
100 <property name="font">
101 <font>
101 <font>
102 <pointsize>10</pointsize>
102 <pointsize>10</pointsize>
103 <weight>75</weight>
103 <weight>75</weight>
104 <bold>true</bold>
104 <bold>true</bold>
105 </font>
105 </font>
106 </property>
106 </property>
107 <property name="text">
107 <property name="text">
108 <string>Catalogue Properties</string>
108 <string>Catalogue Properties</string>
109 </property>
109 </property>
110 </widget>
110 </widget>
111 </item>
111 </item>
112 </layout>
112 </layout>
113 </widget>
113 </widget>
114 <widget class="QWidget" name="eventInspectorPage">
114 <widget class="QWidget" name="eventInspectorPage">
115 <layout class="QGridLayout" name="gridLayout">
115 <layout class="QGridLayout" name="gridLayout">
116 <item row="5" column="1">
117 <widget class="QDateTimeEdit" name="dateTimeEventTEnd"/>
118 </item>
119 <item row="4" column="0">
116 <item row="4" column="0">
120 <widget class="QLabel" name="label_4">
121 <property name="text">
122 <string>TStart</string>
123 </property>
124 </widget>
125 </item>
126 <item row="6" column="0">
127 <widget class="QLabel" name="label_6">
128 <property name="text">
129 <string>Tags</string>
130 </property>
131 </widget>
132 </item>
133 <item row="3" column="0">
134 <widget class="QLabel" name="label_3">
117 <widget class="QLabel" name="label_3">
135 <property name="text">
118 <property name="text">
136 <string>Product</string>
119 <string>Product</string>
137 </property>
120 </property>
138 </widget>
121 </widget>
139 </item>
122 </item>
140 <item row="3" column="1">
141 <widget class="QLineEdit" name="leEventProduct"/>
142 </item>
143 <item row="5" column="0">
123 <item row="5" column="0">
144 <widget class="QLabel" name="label_5">
124 <widget class="QLabel" name="label_4">
145 <property name="text">
146 <string>Tend</string>
147 </property>
148 </widget>
149 </item>
150 <item row="4" column="1">
151 <widget class="QDateTimeEdit" name="dateTimeEventTStart"/>
152 </item>
153 <item row="2" column="0">
154 <widget class="QLabel" name="label_2">
155 <property name="text">
125 <property name="text">
156 <string>Mission</string>
126 <string>TStart</string>
157 </property>
127 </property>
158 </widget>
128 </widget>
159 </item>
129 </item>
160 <item row="1" column="1">
161 <widget class="QLineEdit" name="leEventName"/>
162 </item>
163 <item row="1" column="0">
130 <item row="1" column="0">
164 <widget class="QLabel" name="label">
131 <widget class="QLabel" name="label">
165 <property name="text">
132 <property name="text">
166 <string>Name</string>
133 <string>Name</string>
167 </property>
134 </property>
168 </widget>
135 </widget>
169 </item>
136 </item>
170 <item row="2" column="1">
137 <item row="0" column="0" colspan="2">
171 <widget class="QLineEdit" name="leEventMission"/>
138 <widget class="QLabel" name="label_10">
172 </item>
139 <property name="font">
173 <item row="6" column="1">
140 <font>
174 <widget class="QLineEdit" name="leEventTags"/>
141 <pointsize>10</pointsize>
142 <weight>75</weight>
143 <bold>true</bold>
144 </font>
145 </property>
146 <property name="text">
147 <string>Event Properties</string>
148 </property>
149 </widget>
175 </item>
150 </item>
176 <item row="7" column="1">
151 <item row="8" column="1">
177 <spacer name="verticalSpacer">
152 <spacer name="verticalSpacer">
178 <property name="orientation">
153 <property name="orientation">
179 <enum>Qt::Vertical</enum>
154 <enum>Qt::Vertical</enum>
180 </property>
155 </property>
181 <property name="sizeHint" stdset="0">
156 <property name="sizeHint" stdset="0">
182 <size>
157 <size>
183 <width>20</width>
158 <width>20</width>
184 <height>40</height>
159 <height>40</height>
185 </size>
160 </size>
186 </property>
161 </property>
187 </spacer>
162 </spacer>
188 </item>
163 </item>
189 <item row="0" column="0" colspan="2">
164 <item row="1" column="1">
190 <widget class="QLabel" name="label_10">
165 <widget class="QLineEdit" name="leEventName"/>
191 <property name="font">
166 </item>
192 <font>
167 <item row="5" column="1">
193 <pointsize>10</pointsize>
168 <widget class="QDateTimeEdit" name="dateTimeEventTStart">
194 <weight>75</weight>
169 <property name="timeSpec">
195 <bold>true</bold>
170 <enum>Qt::UTC</enum>
196 </font>
171 </property>
172 </widget>
173 </item>
174 <item row="4" column="1">
175 <widget class="QLineEdit" name="leEventProduct"/>
176 </item>
177 <item row="6" column="0">
178 <widget class="QLabel" name="label_5">
179 <property name="text">
180 <string>Tend</string>
197 </property>
181 </property>
182 </widget>
183 </item>
184 <item row="6" column="1">
185 <widget class="QDateTimeEdit" name="dateTimeEventTEnd">
186 <property name="timeSpec">
187 <enum>Qt::UTC</enum>
188 </property>
189 </widget>
190 </item>
191 <item row="2" column="1">
192 <widget class="QLineEdit" name="leEventTags"/>
193 </item>
194 <item row="2" column="0">
195 <widget class="QLabel" name="label_6">
198 <property name="text">
196 <property name="text">
199 <string>Event Properties</string>
197 <string>Tags</string>
198 </property>
199 </widget>
200 </item>
201 <item row="3" column="0" colspan="2">
202 <widget class="Line" name="line">
203 <property name="orientation">
204 <enum>Qt::Horizontal</enum>
200 </property>
205 </property>
201 </widget>
206 </widget>
202 </item>
207 </item>
203 </layout>
208 </layout>
204 </widget>
209 </widget>
205 </widget>
210 </widget>
206 </item>
211 </item>
207 </layout>
212 </layout>
208 </widget>
213 </widget>
209 </item>
214 </item>
210 </layout>
215 </layout>
211 </widget>
216 </widget>
212 <resources/>
217 <resources/>
213 <connections/>
218 <connections/>
214 </ui>
219 </ui>
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved

Status change > Approved

You need to be logged in to leave comments. Login now