##// END OF EJS Templates
Edition of event products via the inspector
trabillard -
r1150:ecfb65cac0fa
parent child
Show More
@@ -1,42 +1,46
1 1 #ifndef SCIQLOP_CATALOGUEEVENTSMODEL_H
2 2 #define SCIQLOP_CATALOGUEEVENTSMODEL_H
3 3
4 4 #include <Common/spimpl.h>
5 5 #include <QAbstractItemModel>
6 6
7 7 class DBEvent;
8 class DBEventProduct;
8 9
9 10 class CatalogueEventsModel : public QAbstractItemModel {
10 11 public:
11 12 CatalogueEventsModel(QObject *parent = nullptr);
12 13
13 14 void setEvents(const QVector<std::shared_ptr<DBEvent> > &events);
14 std::shared_ptr<DBEvent> getEvent(int row) const;
15
16
17 15 void addEvent(const std::shared_ptr<DBEvent> &event);
18 16 void removeEvent(const std::shared_ptr<DBEvent> &event);
19 17
18 enum class ItemType { Root, Event, EventProduct };
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
20 24 void refreshEvent(const std::shared_ptr<DBEvent> &event);
21 25
22 26 // Model
23 27 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
24 28 QModelIndex parent(const QModelIndex &index) const;
25 29 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
26 30 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
27 31 Qt::ItemFlags flags(const QModelIndex &index) const override;
28 32 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
29 33 QVariant headerData(int section, Qt::Orientation orientation,
30 34 int role = Qt::DisplayRole) const override;
31 35 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
32 36
33 37 Qt::DropActions supportedDragActions() const override;
34 38 QStringList mimeTypes() const override;
35 39 QMimeData *mimeData(const QModelIndexList &indexes) const override;
36 40
37 41 private:
38 class CatalogueEventsTableModelPrivate;
39 spimpl::unique_impl_ptr<CatalogueEventsTableModelPrivate> impl;
42 class CatalogueEventsModelPrivate;
43 spimpl::unique_impl_ptr<CatalogueEventsModelPrivate> impl;
40 44 };
41 45
42 46 #endif // SCIQLOP_CATALOGUEEVENTSMODEL_H
@@ -1,42 +1,47
1 1 #ifndef SCIQLOP_CATALOGUEEVENTSWIDGET_H
2 2 #define SCIQLOP_CATALOGUEEVENTSWIDGET_H
3 3
4 4 #include <Common/spimpl.h>
5 5 #include <QLoggingCategory>
6 6 #include <QWidget>
7 7
8 8 class DBCatalogue;
9 9 class DBEvent;
10 class DBEventProduct;
10 11 class VisualizationWidget;
11 12
12 13 namespace Ui {
13 14 class CatalogueEventsWidget;
14 15 }
15 16
16 17 Q_DECLARE_LOGGING_CATEGORY(LOG_CatalogueEventsWidget)
17 18
18 19 class CatalogueEventsWidget : public QWidget {
19 20 Q_OBJECT
20 21
21 22 signals:
22 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 29 public:
25 30 explicit CatalogueEventsWidget(QWidget *parent = 0);
26 31 virtual ~CatalogueEventsWidget();
27 32
28 33 void setVisualizationWidget(VisualizationWidget *visualization);
29 34
30 35 void setEventChanges(const std::shared_ptr<DBEvent> &event, bool hasChanges);
31 36
32 37 public slots:
33 38 void populateWithCatalogues(const QVector<std::shared_ptr<DBCatalogue> > &catalogues);
34 39
35 40 private:
36 41 Ui::CatalogueEventsWidget *ui;
37 42
38 43 class CatalogueEventsWidgetPrivate;
39 44 spimpl::unique_impl_ptr<CatalogueEventsWidgetPrivate> impl;
40 45 };
41 46
42 47 #endif // SCIQLOP_CATALOGUEEVENTSWIDGET_H
@@ -1,44 +1,49
1 1 #ifndef SCIQLOP_CATALOGUEINSPECTORWIDGET_H
2 2 #define SCIQLOP_CATALOGUEINSPECTORWIDGET_H
3 3
4 4 #include <Common/spimpl.h>
5 5 #include <QWidget>
6 6 #include <memory>
7 7
8 8 namespace Ui {
9 9 class CatalogueInspectorWidget;
10 10 }
11 11
12 12 class DBCatalogue;
13 13 class DBEvent;
14 class DBEventProduct;
14 15
15 16 class CatalogueInspectorWidget : public QWidget {
16 17 Q_OBJECT
17 18
18 19 signals:
19 20 void catalogueUpdated(const std::shared_ptr<DBCatalogue> &catalogue);
20 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);
21 24
22 25 public:
23 26 explicit CatalogueInspectorWidget(QWidget *parent = 0);
24 27 virtual ~CatalogueInspectorWidget();
25 28
26 29 /// Enum matching the pages inside the stacked widget
27 30 enum class Page { Empty, CatalogueProperties, EventProperties };
28 31
29 32 Page currentPage() const;
30 33
31 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);
32 37 void setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue);
33 38
34 39 public slots:
35 40 void showPage(Page page);
36 41
37 42 private:
38 43 Ui::CatalogueInspectorWidget *ui;
39 44
40 45 class CatalogueInspectorWidgetPrivate;
41 46 spimpl::unique_impl_ptr<CatalogueInspectorWidgetPrivate> impl;
42 47 };
43 48
44 49 #endif // SCIQLOP_CATALOGUEINSPECTORWIDGET_H
@@ -1,340 +1,364
1 1 #include "Catalogue/CatalogueEventsModel.h"
2 2
3 3 #include <Common/DateUtils.h>
4 4 #include <Common/MimeTypesDef.h>
5 5 #include <DBEvent.h>
6 6 #include <DBEventProduct.h>
7 7 #include <DBTag.h>
8 8 #include <Data/SqpRange.h>
9 9 #include <SqpApplication.h>
10 10 #include <Time/TimeController.h>
11 11
12 12 #include <list>
13 13 #include <unordered_map>
14 14
15 15 #include <QHash>
16 16 #include <QMimeData>
17 17
18 18 const auto EVENT_ITEM_TYPE = 1;
19 19 const auto EVENT_PRODUCT_ITEM_TYPE = 2;
20 20
21 struct CatalogueEventsModel::CatalogueEventsTableModelPrivate {
21 struct CatalogueEventsModel::CatalogueEventsModelPrivate {
22 22 QVector<std::shared_ptr<DBEvent> > m_Events;
23 23 std::unordered_map<DBEvent *, QVector<std::shared_ptr<DBEventProduct> > > m_EventProducts;
24 24
25 25 enum class Column { Name, TStart, TEnd, Tags, Product, NbColumn };
26 26 QStringList columnNames()
27 27 {
28 28 return QStringList{tr("Event"), tr("TStart"), tr("TEnd"), tr("Tags"), tr("Product")};
29 29 }
30 30
31 31 QVariant eventData(int col, const std::shared_ptr<DBEvent> &event) const
32 32 {
33 33 switch (static_cast<Column>(col)) {
34 34 case Column::Name:
35 35 return event->getName();
36 36 case Column::TStart:
37 37 return "Oo"; // DateUtils::dateTime(event->getTStart());
38 38 case Column::TEnd:
39 39 return "oO"; // DateUtils::dateTime(event->getTEnd());
40 40 case Column::Product: {
41 41 auto eventProductsIt = m_EventProducts.find(event.get());
42 42 if (eventProductsIt != m_EventProducts.cend()) {
43 43 return QString::number(m_EventProducts.at(event.get()).count()) + " product(s)";
44 44 }
45 45 else {
46 46 return "0 product";
47 47 }
48 48 }
49 49 case Column::Tags: {
50 50 QString tagList;
51 51 auto tags = event->getTags();
52 52 for (auto tag : tags) {
53 53 tagList += tag.getName();
54 54 tagList += ' ';
55 55 }
56 56
57 57 return tagList;
58 58 }
59 59 default:
60 60 break;
61 61 }
62 62
63 63 Q_ASSERT(false);
64 64 return QStringLiteral("Unknown Data");
65 65 }
66 66
67 67 void parseEventProduct(const std::shared_ptr<DBEvent> &event)
68 68 {
69 69 for (auto product : event->getEventProducts()) {
70 70 m_EventProducts[event.get()].append(std::make_shared<DBEventProduct>(product));
71 71 }
72 72 }
73 73
74 74 QVariant eventProductData(int col, const std::shared_ptr<DBEventProduct> &eventProduct) const
75 75 {
76 76 switch (static_cast<Column>(col)) {
77 77 case Column::Name:
78 78 return eventProduct->getProductId();
79 79 case Column::TStart:
80 80 return DateUtils::dateTime(eventProduct->getTStart());
81 81 case Column::TEnd:
82 82 return DateUtils::dateTime(eventProduct->getTEnd());
83 83 case Column::Product:
84 84 return eventProduct->getProductId();
85 85 case Column::Tags: {
86 86 return QString();
87 87 }
88 88 default:
89 89 break;
90 90 }
91 91
92 92 Q_ASSERT(false);
93 93 return QStringLiteral("Unknown Data");
94 94 }
95
96 enum class ItemType { Root, Event, EventProduct };
97 ItemType indexItemType(const QModelIndex &index) const
98 {
99
100 if (!index.isValid()) {
101 return ItemType::Root;
102 }
103 else if (index.internalPointer() == nullptr) {
104 return ItemType::Event;
105 }
106 else {
107 return ItemType::EventProduct;
108 }
109 }
110
111 std::shared_ptr<DBEventProduct> getEventProduct(const QModelIndex &index)
112 {
113 auto event = static_cast<DBEvent *>(index.internalPointer());
114 return m_EventProducts.at(event).value(index.row());
115 }
116 95 };
117 96
118 97 CatalogueEventsModel::CatalogueEventsModel(QObject *parent)
119 : QAbstractItemModel(parent),
120 impl{spimpl::make_unique_impl<CatalogueEventsTableModelPrivate>()}
98 : QAbstractItemModel(parent), impl{spimpl::make_unique_impl<CatalogueEventsModelPrivate>()}
121 99 {
122 100 }
123 101
124 102 void CatalogueEventsModel::setEvents(const QVector<std::shared_ptr<DBEvent> > &events)
125 103 {
126 104 beginResetModel();
127 105
128 106 impl->m_Events = events;
107 impl->m_EventProducts.clear();
129 108 for (auto event : events) {
130 109 impl->parseEventProduct(event);
131 110 }
132 111
133 112 endResetModel();
134 113 }
135 114
136 std::shared_ptr<DBEvent> CatalogueEventsModel::getEvent(int row) const
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
137 126 {
138 return impl->m_Events.value(row);
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 }
139 145 }
140 146
141 147 void CatalogueEventsModel::addEvent(const std::shared_ptr<DBEvent> &event)
142 148 {
143 149 beginInsertRows(QModelIndex(), impl->m_Events.count() - 1, impl->m_Events.count() - 1);
144 150 impl->m_Events.append(event);
145 151 impl->parseEventProduct(event);
146 152 endInsertRows();
147 153 }
148 154
149 155 void CatalogueEventsModel::removeEvent(const std::shared_ptr<DBEvent> &event)
150 156 {
151 157 auto index = impl->m_Events.indexOf(event);
152 158 if (index >= 0) {
153 159 beginRemoveRows(QModelIndex(), index, index);
154 160 impl->m_Events.removeAt(index);
155 161 impl->m_EventProducts.erase(event.get());
156 162 endRemoveRows();
157 163 }
158 164 }
159 165
160 166 void CatalogueEventsModel::refreshEvent(const std::shared_ptr<DBEvent> &event)
161 167 {
162 auto eventIndex = impl->m_Events.indexOf(event);
163 if (eventIndex >= 0) {
164 emit dataChanged(index(eventIndex, 0), index(eventIndex, columnCount()));
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));
165 176 }
166 177 }
167 178
168 179 QModelIndex CatalogueEventsModel::index(int row, int column, const QModelIndex &parent) const
169 180 {
170 181 if (!hasIndex(row, column, parent)) {
171 182 return QModelIndex();
172 183 }
173 184
174 switch (impl->indexItemType(parent)) {
175 case CatalogueEventsTableModelPrivate::ItemType::Root:
185 switch (itemTypeOf(parent)) {
186 case CatalogueEventsModel::ItemType::Root:
176 187 return createIndex(row, column);
177 case CatalogueEventsTableModelPrivate::ItemType::Event: {
178 auto event = getEvent(parent.row());
188 case CatalogueEventsModel::ItemType::Event: {
189 auto event = getEvent(parent);
179 190 return createIndex(row, column, event.get());
180 191 }
181 case CatalogueEventsTableModelPrivate::ItemType::EventProduct:
192 case CatalogueEventsModel::ItemType::EventProduct:
182 193 break;
183 194 default:
184 195 break;
185 196 }
186 197
187 198 return QModelIndex();
188 199 }
189 200
190 201 QModelIndex CatalogueEventsModel::parent(const QModelIndex &index) const
191 202 {
192 switch (impl->indexItemType(index)) {
193 case CatalogueEventsTableModelPrivate::ItemType::EventProduct: {
203 switch (itemTypeOf(index)) {
204 case CatalogueEventsModel::ItemType::EventProduct: {
194 205 auto parentEvent = static_cast<DBEvent *>(index.internalPointer());
195 206 auto it
196 207 = std::find_if(impl->m_Events.cbegin(), impl->m_Events.cend(),
197 208 [parentEvent](auto event) { return event.get() == parentEvent; });
198 209
199 210 if (it != impl->m_Events.cend()) {
200 211 return createIndex(it - impl->m_Events.cbegin(), 0);
201 212 }
202 213 else {
203 214 return QModelIndex();
204 215 }
205 216 }
206 case CatalogueEventsTableModelPrivate::ItemType::Root:
217 case CatalogueEventsModel::ItemType::Root:
207 218 break;
208 case CatalogueEventsTableModelPrivate::ItemType::Event:
219 case CatalogueEventsModel::ItemType::Event:
209 220 break;
210 221 default:
211 222 break;
212 223 }
213 224
214 225 return QModelIndex();
215 226 }
216 227
217 228 int CatalogueEventsModel::rowCount(const QModelIndex &parent) const
218 229 {
219 230 if (parent.column() > 0) {
220 231 return 0;
221 232 }
222 233
223 switch (impl->indexItemType(parent)) {
224 case CatalogueEventsTableModelPrivate::ItemType::Root:
234 switch (itemTypeOf(parent)) {
235 case CatalogueEventsModel::ItemType::Root:
225 236 return impl->m_Events.count();
226 case CatalogueEventsTableModelPrivate::ItemType::Event: {
227 auto event = getEvent(parent.row());
237 case CatalogueEventsModel::ItemType::Event: {
238 auto event = getEvent(parent);
228 239 return impl->m_EventProducts[event.get()].count();
229 240 }
230 case CatalogueEventsTableModelPrivate::ItemType::EventProduct:
241 case CatalogueEventsModel::ItemType::EventProduct:
231 242 break;
232 243 default:
233 244 break;
234 245 }
235 246
236 247 return 0;
237 248 }
238 249
239 250 int CatalogueEventsModel::columnCount(const QModelIndex &parent) const
240 251 {
241 return static_cast<int>(CatalogueEventsTableModelPrivate::Column::NbColumn);
252 return static_cast<int>(CatalogueEventsModelPrivate::Column::NbColumn);
242 253 }
243 254
244 255 Qt::ItemFlags CatalogueEventsModel::flags(const QModelIndex &index) const
245 256 {
246 257 return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
247 258 }
248 259
249 260 QVariant CatalogueEventsModel::data(const QModelIndex &index, int role) const
250 261 {
251 262 if (index.isValid()) {
252 263
253 auto type = impl->indexItemType(index);
254 if (type == CatalogueEventsTableModelPrivate::ItemType::Event) {
255 auto event = getEvent(index.row());
264 auto type = itemTypeOf(index);
265 if (type == CatalogueEventsModel::ItemType::Event) {
266 auto event = getEvent(index);
256 267 switch (role) {
257 268 case Qt::DisplayRole:
258 269 return impl->eventData(index.column(), event);
259 270 break;
260 271 }
261 272 }
262 else if (type == CatalogueEventsTableModelPrivate::ItemType::EventProduct) {
263 auto product = impl->getEventProduct(index);
273 else if (type == CatalogueEventsModel::ItemType::EventProduct) {
274 auto product = getEventProduct(index);
264 275 switch (role) {
265 276 case Qt::DisplayRole:
266 277 return impl->eventProductData(index.column(), product);
267 278 break;
268 279 }
269 280 }
270 281 }
271 282
272 283 return QVariant{};
273 284 }
274 285
275 286 QVariant CatalogueEventsModel::headerData(int section, Qt::Orientation orientation, int role) const
276 287 {
277 288 if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
278 289 return impl->columnNames().value(section);
279 290 }
280 291
281 292 return QVariant();
282 293 }
283 294
284 295 void CatalogueEventsModel::sort(int column, Qt::SortOrder order)
285 296 {
286 297 std::sort(impl->m_Events.begin(), impl->m_Events.end(),
287 298 [this, column, order](auto e1, auto e2) {
288 299 auto data1 = impl->eventData(column, e1);
289 300 auto data2 = impl->eventData(column, e2);
290 301
291 302 auto result = data1.toString() < data2.toString();
292 303
293 304 return order == Qt::AscendingOrder ? result : !result;
294 305 });
295 306
296 307 emit dataChanged(QModelIndex(), QModelIndex());
297 308 }
298 309
299 310 Qt::DropActions CatalogueEventsModel::supportedDragActions() const
300 311 {
301 312 return Qt::CopyAction | Qt::MoveAction;
302 313 }
303 314
304 315 QStringList CatalogueEventsModel::mimeTypes() const
305 316 {
306 317 return {MIME_TYPE_EVENT_LIST, MIME_TYPE_TIME_RANGE};
307 318 }
308 319
309 320 QMimeData *CatalogueEventsModel::mimeData(const QModelIndexList &indexes) const
310 321 {
311 322 auto mimeData = new QMimeData;
312 323
313 324 QVector<std::shared_ptr<DBEvent> > eventList;
314 325
315 326 SqpRange firstTimeRange;
316 327 for (const auto &index : indexes) {
317 328 if (index.column() == 0) { // only the first column
318 auto event = getEvent(index.row());
329 auto event = getEvent(index);
319 330 if (eventList.isEmpty()) {
320 331 // Gets the range of the first variable
321 332 // firstTimeRange.m_TStart = event->getTStart();
322 333 // firstTimeRange.m_TEnd = event->getTEnd();
323 334 }
324 335
325 336 eventList << event;
326 337 }
327 338 }
328 339
329 340 auto eventsEncodedData
330 341 = QByteArray{}; // sqpApp->catalogueController().->mimeDataForEvents(eventList); //TODO
331 342 mimeData->setData(MIME_TYPE_EVENT_LIST, eventsEncodedData);
332 343
333 344 if (eventList.count() == 1) {
334 345 // No time range MIME data if multiple events are dragged
335 346 auto timeEncodedData = TimeController::mimeDataForTimeRange(firstTimeRange);
336 347 mimeData->setData(MIME_TYPE_TIME_RANGE, timeEncodedData);
337 348 }
338 349
339 350 return mimeData;
340 351 }
352
353 CatalogueEventsModel::ItemType CatalogueEventsModel::itemTypeOf(const QModelIndex &index) const
354 {
355 if (!index.isValid()) {
356 return ItemType::Root;
357 }
358 else if (index.internalPointer() == nullptr) {
359 return ItemType::Event;
360 }
361 else {
362 return ItemType::EventProduct;
363 }
364 }
@@ -1,296 +1,314
1 1 #include "Catalogue/CatalogueEventsWidget.h"
2 2 #include "ui_CatalogueEventsWidget.h"
3 3
4 4 #include <Catalogue/CatalogueController.h>
5 5 #include <Catalogue/CatalogueEventsModel.h>
6 6 #include <CatalogueDao.h>
7 7 #include <DBCatalogue.h>
8 8 #include <SqpApplication.h>
9 9 #include <Visualization/VisualizationTabWidget.h>
10 10 #include <Visualization/VisualizationWidget.h>
11 11 #include <Visualization/VisualizationZoneWidget.h>
12 12
13 13 #include <QDialog>
14 14 #include <QDialogButtonBox>
15 15 #include <QListWidget>
16 16
17 17 Q_LOGGING_CATEGORY(LOG_CatalogueEventsWidget, "CatalogueEventsWidget")
18 18
19 19 /// Format of the dates appearing in the label of a cursor
20 20 const auto DATETIME_FORMAT = QStringLiteral("yyyy/MM/dd hh:mm:ss");
21 21
22 22 struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate {
23 23
24 24 CatalogueEventsModel *m_Model = nullptr;
25 25 QStringList m_ZonesForTimeMode;
26 26 QString m_ZoneForGraphMode;
27 27
28 28 VisualizationWidget *m_VisualizationWidget = nullptr;
29 29
30 30 void setEvents(const QVector<std::shared_ptr<DBEvent> > &events, QTreeView *treeView)
31 31 {
32 32 treeView->setSortingEnabled(false);
33 33 m_Model->setEvents(events);
34 34 treeView->setSortingEnabled(true);
35 35 }
36 36
37 37 void addEvent(const std::shared_ptr<DBEvent> &event, QTreeView *treeView)
38 38 {
39 39 treeView->setSortingEnabled(false);
40 40 m_Model->addEvent(event);
41 41 treeView->setSortingEnabled(true);
42 42 }
43 43
44 44 void removeEvent(const std::shared_ptr<DBEvent> &event, QTreeView *treeView)
45 45 {
46 46 treeView->setSortingEnabled(false);
47 47 m_Model->removeEvent(event);
48 48 treeView->setSortingEnabled(true);
49 49 }
50 50
51 51 QStringList getAvailableVisualizationZoneList() const
52 52 {
53 53 if (m_VisualizationWidget) {
54 54 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
55 55 return tab->availableZoneWidgets();
56 56 }
57 57 }
58 58
59 59 return QStringList{};
60 60 }
61 61
62 62 QStringList selectZone(QWidget *parent, const QStringList &selectedZones,
63 63 bool allowMultiSelection, const QPoint &location)
64 64 {
65 65 auto availableZones = getAvailableVisualizationZoneList();
66 66 if (availableZones.isEmpty()) {
67 67 return QStringList{};
68 68 }
69 69
70 70 QDialog d(parent, Qt::Tool);
71 71 d.setWindowTitle("Choose a zone");
72 72 auto layout = new QVBoxLayout{&d};
73 73 layout->setContentsMargins(0, 0, 0, 0);
74 74 auto listWidget = new QListWidget{&d};
75 75 layout->addWidget(listWidget);
76 76
77 77 QSet<QListWidgetItem *> checkedItems;
78 78 for (auto zone : availableZones) {
79 79 auto item = new QListWidgetItem{zone};
80 80 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
81 81 if (selectedZones.contains(zone)) {
82 82 item->setCheckState(Qt::Checked);
83 83 checkedItems << item;
84 84 }
85 85 else {
86 86 item->setCheckState(Qt::Unchecked);
87 87 }
88 88
89 89 listWidget->addItem(item);
90 90 }
91 91
92 92 auto buttonBox = new QDialogButtonBox{QDialogButtonBox::Ok, &d};
93 93 layout->addWidget(buttonBox);
94 94
95 95 QObject::connect(buttonBox, &QDialogButtonBox::accepted, &d, &QDialog::accept);
96 96 QObject::connect(buttonBox, &QDialogButtonBox::rejected, &d, &QDialog::reject);
97 97
98 98 QObject::connect(listWidget, &QListWidget::itemChanged,
99 99 [&checkedItems, allowMultiSelection, listWidget](auto item) {
100 100 if (item->checkState() == Qt::Checked) {
101 101 if (!allowMultiSelection) {
102 102 for (auto checkedItem : checkedItems) {
103 103 listWidget->blockSignals(true);
104 104 checkedItem->setCheckState(Qt::Unchecked);
105 105 listWidget->blockSignals(false);
106 106 }
107 107
108 108 checkedItems.clear();
109 109 }
110 110 checkedItems << item;
111 111 }
112 112 else {
113 113 checkedItems.remove(item);
114 114 }
115 115 });
116 116
117 117 QStringList result;
118 118
119 119 d.setMinimumWidth(120);
120 120 d.resize(d.minimumSizeHint());
121 121 d.move(location);
122 122 if (d.exec() == QDialog::Accepted) {
123 123 for (auto item : checkedItems) {
124 124 result += item->text();
125 125 }
126 126 }
127 127 else {
128 128 result = selectedZones;
129 129 }
130 130
131 131 return result;
132 132 }
133 133
134 134 void updateForTimeMode(QTreeView *treeView)
135 135 {
136 136 auto selectedRows = treeView->selectionModel()->selectedRows();
137 137
138 138 if (selectedRows.count() == 1) {
139 auto event = m_Model->getEvent(selectedRows.first().row());
139 auto event = m_Model->getEvent(selectedRows.first());
140 140 if (m_VisualizationWidget) {
141 141 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
142 142
143 143 for (auto zoneName : m_ZonesForTimeMode) {
144 144 if (auto zone = tab->getZoneWithName(zoneName)) {
145 145 SqpRange eventRange;
146 146 // eventRange.m_TStart = event->getTStart();
147 147 // eventRange.m_TEnd = event->getTEnd();
148 148 zone->setZoneRange(eventRange);
149 149 }
150 150 }
151 151 }
152 152 else {
153 153 qCWarning(LOG_CatalogueEventsWidget())
154 154 << "updateTimeZone: no tab found in the visualization";
155 155 }
156 156 }
157 157 else {
158 158 qCWarning(LOG_CatalogueEventsWidget())
159 159 << "updateTimeZone: visualization widget not found";
160 160 }
161 161 }
162 162 else {
163 163 qCWarning(LOG_CatalogueEventsWidget())
164 164 << "updateTimeZone: not compatible with multiple events selected";
165 165 }
166 166 }
167 167
168 168 void updateForGraphMode(QTreeView *treeView)
169 169 {
170 170 auto selectedRows = treeView->selectionModel()->selectedRows();
171 171
172 172 if (selectedRows.count() == 1) {
173 auto event = m_Model->getEvent(selectedRows.first().row());
173 auto event = m_Model->getEvent(selectedRows.first());
174 174 if (m_VisualizationWidget) {
175 175 if (auto tab = m_VisualizationWidget->currentTabWidget()) {
176 176 if (auto zone = tab->getZoneWithName(m_ZoneForGraphMode)) {
177 177 // TODO
178 178 }
179 179 }
180 180 else {
181 181 qCWarning(LOG_CatalogueEventsWidget())
182 182 << "updateGraphMode: no tab found in the visualization";
183 183 }
184 184 }
185 185 else {
186 186 qCWarning(LOG_CatalogueEventsWidget())
187 187 << "updateGraphMode: visualization widget not found";
188 188 }
189 189 }
190 190 else {
191 191 qCWarning(LOG_CatalogueEventsWidget())
192 192 << "updateGraphMode: not compatible with multiple events selected";
193 193 }
194 194 }
195 195 };
196 196
197 197 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
198 198 : QWidget(parent),
199 199 ui(new Ui::CatalogueEventsWidget),
200 200 impl{spimpl::make_unique_impl<CatalogueEventsWidgetPrivate>()}
201 201 {
202 202 ui->setupUi(this);
203 203
204 204 impl->m_Model = new CatalogueEventsModel{this};
205 205 ui->treeView->setModel(impl->m_Model);
206 206
207 207 ui->treeView->setSortingEnabled(true);
208 208 ui->treeView->setDragDropMode(QAbstractItemView::DragDrop);
209 209 ui->treeView->setDragEnabled(true);
210 210
211 211 connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) {
212 212 if (checked) {
213 213 ui->btnChart->setChecked(false);
214 214 impl->m_ZonesForTimeMode
215 215 = impl->selectZone(this, impl->m_ZonesForTimeMode, true,
216 216 this->mapToGlobal(ui->btnTime->frameGeometry().center()));
217 217
218 218 impl->updateForTimeMode(ui->treeView);
219 219 }
220 220 });
221 221
222 222 connect(ui->btnChart, &QToolButton::clicked, [this](auto checked) {
223 223 if (checked) {
224 224 ui->btnTime->setChecked(false);
225 225 impl->m_ZoneForGraphMode
226 226 = impl->selectZone(this, {impl->m_ZoneForGraphMode}, false,
227 227 this->mapToGlobal(ui->btnChart->frameGeometry().center()))
228 228 .value(0);
229 229
230 230 impl->updateForGraphMode(ui->treeView);
231 231 }
232 232 });
233 233
234 234 auto emitSelection = [this]() {
235 235 QVector<std::shared_ptr<DBEvent> > events;
236 QVector<QPair<std::shared_ptr<DBEvent>, std::shared_ptr<DBEventProduct> > > eventProducts;
237
236 238 for (auto rowIndex : ui->treeView->selectionModel()->selectedRows()) {
237 events << impl->m_Model->getEvent(rowIndex.row());
239
240 auto itemType = impl->m_Model->itemTypeOf(rowIndex);
241 if (itemType == CatalogueEventsModel::ItemType::Event) {
242 events << impl->m_Model->getEvent(rowIndex);
243 }
244 else if (itemType == CatalogueEventsModel::ItemType::EventProduct) {
245 eventProducts << qMakePair(impl->m_Model->getParentEvent(rowIndex),
246 impl->m_Model->getEventProduct(rowIndex));
247 }
238 248 }
239 249
250 if (!events.isEmpty() && eventProducts.isEmpty()) {
240 251 emit this->eventsSelected(events);
252 }
253 else if (events.isEmpty() && !eventProducts.isEmpty()) {
254 emit this->eventProductsSelected(eventProducts);
255 }
256 else {
257 emit this->selectionCleared();
258 }
241 259 };
242 260
243 261 connect(ui->treeView, &QTreeView::clicked, emitSelection);
244 262 connect(ui->treeView->selectionModel(), &QItemSelectionModel::selectionChanged, emitSelection);
245 263
246 264 connect(ui->treeView->selectionModel(), &QItemSelectionModel::selectionChanged, [this]() {
247 265 auto isNotMultiSelection = ui->treeView->selectionModel()->selectedRows().count() <= 1;
248 266 ui->btnChart->setEnabled(isNotMultiSelection);
249 267 ui->btnTime->setEnabled(isNotMultiSelection);
250 268
251 269 if (isNotMultiSelection && ui->btnTime->isChecked()) {
252 270 impl->updateForTimeMode(ui->treeView);
253 271 }
254 272 else if (isNotMultiSelection && ui->btnChart->isChecked()) {
255 273 impl->updateForGraphMode(ui->treeView);
256 274 }
257 275 });
258 276
259 277 ui->treeView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
260 278 ui->treeView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
261 279 ui->treeView->header()->setSortIndicatorShown(true);
262 280 }
263 281
264 282 CatalogueEventsWidget::~CatalogueEventsWidget()
265 283 {
266 284 delete ui;
267 285 }
268 286
269 287 void CatalogueEventsWidget::setVisualizationWidget(VisualizationWidget *visualization)
270 288 {
271 289 impl->m_VisualizationWidget = visualization;
272 290 }
273 291
274 292 void CatalogueEventsWidget::setEventChanges(const std::shared_ptr<DBEvent> &event, bool hasChanges)
275 293 {
276 294 impl->m_Model->refreshEvent(event);
277 295 }
278 296
279 297 void CatalogueEventsWidget::populateWithCatalogues(
280 298 const QVector<std::shared_ptr<DBCatalogue> > &catalogues)
281 299 {
282 300 QSet<QUuid> eventIds;
283 301 QVector<std::shared_ptr<DBEvent> > events;
284 302
285 303 for (auto catalogue : catalogues) {
286 304 auto catalogueEvents = sqpApp->catalogueController().retrieveEventsFromCatalogue(catalogue);
287 305 for (auto event : catalogueEvents) {
288 306 if (!eventIds.contains(event->getUniqId())) {
289 307 events << event;
290 308 eventIds.insert(event->getUniqId());
291 309 }
292 310 }
293 311 }
294 312
295 313 impl->setEvents(events, ui->treeView);
296 314 }
@@ -1,67 +1,83
1 1 #include "Catalogue/CatalogueExplorer.h"
2 2 #include "ui_CatalogueExplorer.h"
3 3
4 4 #include <Visualization/VisualizationWidget.h>
5 5
6 6 #include <DBCatalogue.h>
7 7 #include <DBEvent.h>
8 8
9 9 struct CatalogueExplorer::CatalogueExplorerPrivate {
10 10 };
11 11
12 12 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
13 13 : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
14 14 ui(new Ui::CatalogueExplorer),
15 15 impl{spimpl::make_unique_impl<CatalogueExplorerPrivate>()}
16 16 {
17 17 ui->setupUi(this);
18 18
19 19 connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto catalogues) {
20 20 if (catalogues.count() == 1) {
21 21 ui->inspector->setCatalogue(catalogues.first());
22 22 }
23 23 else {
24 24 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
25 25 }
26 26
27 27 ui->events->populateWithCatalogues(catalogues);
28 28 });
29 29
30 30 connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databases) {
31 31 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
32 32 });
33 33
34 34 connect(ui->catalogues, &CatalogueSideBarWidget::trashSelected,
35 35 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
36 36
37 37 connect(ui->catalogues, &CatalogueSideBarWidget::allEventsSelected,
38 38 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
39 39
40 40 connect(ui->catalogues, &CatalogueSideBarWidget::selectionCleared,
41 41 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
42 42
43 43 connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) {
44 44 if (events.count() == 1) {
45 45 ui->inspector->setEvent(events.first());
46 46 }
47 47 else {
48 48 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
49 49 }
50 50 });
51 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
52 65 connect(ui->inspector, &CatalogueInspectorWidget::catalogueUpdated,
53 66 [this](auto catalogue) { ui->catalogues->setCatalogueChanges(catalogue, true); });
54 67
55 68 connect(ui->inspector, &CatalogueInspectorWidget::eventUpdated,
56 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); });
57 73 }
58 74
59 75 CatalogueExplorer::~CatalogueExplorer()
60 76 {
61 77 delete ui;
62 78 }
63 79
64 80 void CatalogueExplorer::setVisualizationWidget(VisualizationWidget *visualization)
65 81 {
66 82 ui->events->setVisualizationWidget(visualization);
67 83 }
@@ -1,146 +1,172
1 1 #include "Catalogue/CatalogueInspectorWidget.h"
2 2 #include "ui_CatalogueInspectorWidget.h"
3 3
4 4 #include <Common/DateUtils.h>
5 5 #include <DBCatalogue.h>
6 6 #include <DBEvent.h>
7 #include <DBEventProduct.h>
7 8 #include <DBTag.h>
8 9
9 10 struct CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate {
10 11 std::shared_ptr<DBCatalogue> m_DisplayedCatalogue = nullptr;
11 12 std::shared_ptr<DBEvent> m_DisplayedEvent = nullptr;
13 std::shared_ptr<DBEventProduct> m_DisplayedEventProduct = nullptr;
12 14
13 15 void connectCatalogueUpdateSignals(CatalogueInspectorWidget *inspector,
14 16 Ui::CatalogueInspectorWidget *ui);
15 17 void connectEventUpdateSignals(CatalogueInspectorWidget *inspector,
16 18 Ui::CatalogueInspectorWidget *ui);
17 19 };
18 20
19 21 CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent)
20 22 : QWidget(parent),
21 23 ui(new Ui::CatalogueInspectorWidget),
22 24 impl{spimpl::make_unique_impl<CatalogueInspectorWidgetPrivate>()}
23 25 {
24 26 ui->setupUi(this);
25 27 showPage(Page::Empty);
26 28
27 29 impl->connectCatalogueUpdateSignals(this, ui);
28 30 impl->connectEventUpdateSignals(this, ui);
29 31 }
30 32
31 33 CatalogueInspectorWidget::~CatalogueInspectorWidget()
32 34 {
33 35 delete ui;
34 36 }
35 37
36 38 void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectCatalogueUpdateSignals(
37 39 CatalogueInspectorWidget *inspector, Ui::CatalogueInspectorWidget *ui)
38 40 {
39 41 connect(ui->leCatalogueName, &QLineEdit::editingFinished, [ui, inspector, this]() {
40 42 if (ui->leCatalogueName->text() != m_DisplayedCatalogue->getName()) {
41 43 m_DisplayedCatalogue->setName(ui->leCatalogueName->text());
42 44 emit inspector->catalogueUpdated(m_DisplayedCatalogue);
43 45 }
44 46 });
45 47
46 48 connect(ui->leCatalogueAuthor, &QLineEdit::editingFinished, [ui, inspector, this]() {
47 49 if (ui->leCatalogueAuthor->text() != m_DisplayedCatalogue->getAuthor()) {
48 50 m_DisplayedCatalogue->setAuthor(ui->leCatalogueAuthor->text());
49 51 emit inspector->catalogueUpdated(m_DisplayedCatalogue);
50 52 }
51 53 });
52 54 }
53 55
54 56 void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectEventUpdateSignals(
55 57 CatalogueInspectorWidget *inspector, Ui::CatalogueInspectorWidget *ui)
56 58 {
57 59 connect(ui->leEventName, &QLineEdit::editingFinished, [ui, inspector, this]() {
58 60 if (ui->leEventName->text() != m_DisplayedEvent->getName()) {
59 61 m_DisplayedEvent->setName(ui->leEventName->text());
60 62 emit inspector->eventUpdated(m_DisplayedEvent);
61 63 }
62 64 });
63 65
64 connect(ui->leEventMission, &QLineEdit::editingFinished, [ui, inspector, this]() {
65 // if (ui->leEventMission->text() != m_DisplayedEvent->getMission()) {
66 // m_DisplayedEvent->setMission(ui->leEventMission->text());
67 // emit inspector->eventUpdated(m_DisplayedEvent);
68 // }
69 });
70
71 66 connect(ui->leEventProduct, &QLineEdit::editingFinished, [ui, inspector, this]() {
72 // if (ui->leEventProduct->text() != m_DisplayedEvent->getProduct()) {
73 // m_DisplayedEvent->setProduct(ui->leEventProduct->text());
74 // emit inspector->eventUpdated(m_DisplayedEvent);
75 // }
67 if (ui->leEventProduct->text() != m_DisplayedEventProduct->getProductId()) {
68 m_DisplayedEventProduct->setProductId(ui->leEventProduct->text());
69 emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct);
70 }
76 71 });
77 72
78 73 connect(ui->leEventTags, &QLineEdit::editingFinished, [ui, inspector, this]() {
79 74 // TODO
80 75 });
81 76
82 77 connect(ui->dateTimeEventTStart, &QDateTimeEdit::editingFinished, [ui, inspector, this]() {
83 // auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTStart->dateTime());
84 // if (time != m_DisplayedEvent->getTStart()) {
85 // m_DisplayedEvent->setTStart(time);
86 // emit inspector->eventUpdated(m_DisplayedEvent);
87 // }
78 auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTStart->dateTime());
79 if (time != m_DisplayedEventProduct->getTStart()) {
80 m_DisplayedEventProduct->setTStart(time);
81 emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct);
82 }
88 83 });
89 84
90 85 connect(ui->dateTimeEventTEnd, &QDateTimeEdit::editingFinished, [ui, inspector, this]() {
91 // auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTEnd->dateTime());
92 // if (time != m_DisplayedEvent->getTEnd()) {
93 // m_DisplayedEvent->setTEnd(time);
94 // emit inspector->eventUpdated(m_DisplayedEvent);
95 // }
86 auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTEnd->dateTime());
87 if (time != m_DisplayedEventProduct->getTEnd()) {
88 m_DisplayedEventProduct->setTEnd(time);
89 emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct);
90 }
96 91 });
97 92 }
98 93
99 94 void CatalogueInspectorWidget::showPage(CatalogueInspectorWidget::Page page)
100 95 {
101 96 ui->stackedWidget->setCurrentIndex(static_cast<int>(page));
102 97 }
103 98
104 99 CatalogueInspectorWidget::Page CatalogueInspectorWidget::currentPage() const
105 100 {
106 101 return static_cast<Page>(ui->stackedWidget->currentIndex());
107 102 }
108 103
109 104 void CatalogueInspectorWidget::setEvent(const std::shared_ptr<DBEvent> &event)
110 105 {
111 106 impl->m_DisplayedEvent = event;
112 107
113 108 blockSignals(true);
114 109
115 110 showPage(Page::EventProperties);
111 ui->leEventName->setEnabled(true);
116 112 ui->leEventName->setText(event->getName());
117 // ui->leEventMission->setText(event->getMission());
118 // ui->leEventProduct->setText(event->getProduct());
113 ui->leEventProduct->setEnabled(false);
114 ui->leEventProduct->setText(
115 QString::number(event->getEventProducts().size()).append(" product(s)"));
119 116
120 117 QString tagList;
121 118 auto tags = event->getTags();
122 119 for (auto tag : tags) {
123 120 tagList += tag.getName();
124 121 tagList += ' ';
125 122 }
126 123
124 ui->leEventTags->setEnabled(true);
127 125 ui->leEventTags->setText(tagList);
128 126
127 ui->dateTimeEventTStart->setEnabled(false);
128 ui->dateTimeEventTEnd->setEnabled(false);
129
129 130 // ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(event->getTStart()));
130 131 // ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(event->getTEnd()));
131 132
132 133 blockSignals(false);
133 134 }
134 135
136 void CatalogueInspectorWidget::setEventProduct(const std::shared_ptr<DBEvent> &event,
137 const std::shared_ptr<DBEventProduct> &eventProduct)
138 {
139 impl->m_DisplayedEventProduct = eventProduct;
140
141 blockSignals(true);
142
143 showPage(Page::EventProperties);
144 ui->leEventName->setEnabled(false);
145 ui->leEventName->setText(event->getName());
146 ui->leEventProduct->setEnabled(true);
147 ui->leEventProduct->setText(eventProduct->getProductId());
148
149 ui->leEventTags->setEnabled(false);
150 ui->leEventTags->clear();
151
152 ui->dateTimeEventTStart->setEnabled(true);
153 ui->dateTimeEventTEnd->setEnabled(true);
154
155 ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(eventProduct->getTStart()));
156 ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(eventProduct->getTEnd()));
157
158 blockSignals(false);
159 }
160
135 161 void CatalogueInspectorWidget::setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue)
136 162 {
137 163 impl->m_DisplayedCatalogue = catalogue;
138 164
139 165 blockSignals(true);
140 166
141 167 showPage(Page::CatalogueProperties);
142 168 ui->leCatalogueName->setText(catalogue->getName());
143 169 ui->leCatalogueAuthor->setText(catalogue->getAuthor());
144 170
145 171 blockSignals(false);
146 172 }
@@ -1,139 +1,142
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <ui version="4.0">
3 3 <class>CatalogueEventsWidget</class>
4 4 <widget class="QWidget" name="CatalogueEventsWidget">
5 5 <property name="geometry">
6 6 <rect>
7 7 <x>0</x>
8 8 <y>0</y>
9 9 <width>566</width>
10 10 <height>258</height>
11 11 </rect>
12 12 </property>
13 13 <property name="windowTitle">
14 14 <string>Form</string>
15 15 </property>
16 16 <layout class="QVBoxLayout" name="verticalLayout">
17 17 <property name="leftMargin">
18 18 <number>0</number>
19 19 </property>
20 20 <property name="topMargin">
21 21 <number>0</number>
22 22 </property>
23 23 <property name="rightMargin">
24 24 <number>0</number>
25 25 </property>
26 26 <property name="bottomMargin">
27 27 <number>0</number>
28 28 </property>
29 29 <item>
30 30 <layout class="QHBoxLayout" name="horizontalLayout">
31 31 <item>
32 32 <widget class="QToolButton" name="btnAdd">
33 33 <property name="text">
34 34 <string>+</string>
35 35 </property>
36 36 <property name="icon">
37 37 <iconset resource="../../resources/sqpguiresources.qrc">
38 38 <normaloff>:/icones/add.png</normaloff>:/icones/add.png</iconset>
39 39 </property>
40 40 <property name="autoRaise">
41 41 <bool>true</bool>
42 42 </property>
43 43 </widget>
44 44 </item>
45 45 <item>
46 46 <widget class="QToolButton" name="btnRemove">
47 47 <property name="text">
48 48 <string> - </string>
49 49 </property>
50 50 <property name="icon">
51 51 <iconset resource="../../resources/sqpguiresources.qrc">
52 52 <normaloff>:/icones/remove.png</normaloff>:/icones/remove.png</iconset>
53 53 </property>
54 54 <property name="autoRaise">
55 55 <bool>true</bool>
56 56 </property>
57 57 </widget>
58 58 </item>
59 59 <item>
60 60 <widget class="Line" name="line">
61 61 <property name="orientation">
62 62 <enum>Qt::Vertical</enum>
63 63 </property>
64 64 </widget>
65 65 </item>
66 66 <item>
67 67 <widget class="QToolButton" name="btnTime">
68 68 <property name="text">
69 69 <string>T</string>
70 70 </property>
71 71 <property name="icon">
72 72 <iconset resource="../../resources/sqpguiresources.qrc">
73 73 <normaloff>:/icones/time.png</normaloff>:/icones/time.png</iconset>
74 74 </property>
75 75 <property name="checkable">
76 76 <bool>true</bool>
77 77 </property>
78 78 <property name="autoRaise">
79 79 <bool>true</bool>
80 80 </property>
81 81 </widget>
82 82 </item>
83 83 <item>
84 84 <widget class="QToolButton" name="btnChart">
85 85 <property name="text">
86 86 <string>G</string>
87 87 </property>
88 88 <property name="icon">
89 89 <iconset resource="../../resources/sqpguiresources.qrc">
90 90 <normaloff>:/icones/chart.png</normaloff>:/icones/chart.png</iconset>
91 91 </property>
92 92 <property name="checkable">
93 93 <bool>true</bool>
94 94 </property>
95 95 <property name="autoRaise">
96 96 <bool>true</bool>
97 97 </property>
98 98 </widget>
99 99 </item>
100 100 <item>
101 101 <widget class="Line" name="line_2">
102 102 <property name="orientation">
103 103 <enum>Qt::Vertical</enum>
104 104 </property>
105 105 </widget>
106 106 </item>
107 107 <item>
108 108 <widget class="QLineEdit" name="lineEdit">
109 109 <property name="enabled">
110 110 <bool>false</bool>
111 111 </property>
112 112 </widget>
113 113 </item>
114 114 </layout>
115 115 </item>
116 116 <item>
117 117 <widget class="QTreeView" name="treeView">
118 118 <property name="dragEnabled">
119 119 <bool>true</bool>
120 120 </property>
121 121 <property name="dragDropMode">
122 122 <enum>QAbstractItemView::DragDrop</enum>
123 123 </property>
124 <property name="selectionMode">
125 <enum>QAbstractItemView::ExtendedSelection</enum>
126 </property>
124 127 <property name="selectionBehavior">
125 128 <enum>QAbstractItemView::SelectRows</enum>
126 129 </property>
127 130 <attribute name="headerStretchLastSection">
128 131 <bool>false</bool>
129 132 </attribute>
130 133 </widget>
131 134 </item>
132 135 </layout>
133 136 </widget>
134 137 <resources>
135 138 <include location="../../resources/sqpguiresources.qrc"/>
136 139 <include location="../../resources/sqpguiresources.qrc"/>
137 140 </resources>
138 141 <connections/>
139 142 </ui>
@@ -1,222 +1,219
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <ui version="4.0">
3 3 <class>CatalogueInspectorWidget</class>
4 4 <widget class="QWidget" name="CatalogueInspectorWidget">
5 5 <property name="geometry">
6 6 <rect>
7 7 <x>0</x>
8 8 <y>0</y>
9 9 <width>400</width>
10 10 <height>300</height>
11 11 </rect>
12 12 </property>
13 13 <property name="windowTitle">
14 14 <string>Form</string>
15 15 </property>
16 16 <layout class="QVBoxLayout" name="verticalLayout_2">
17 17 <property name="leftMargin">
18 18 <number>0</number>
19 19 </property>
20 20 <property name="topMargin">
21 21 <number>0</number>
22 22 </property>
23 23 <property name="rightMargin">
24 24 <number>0</number>
25 25 </property>
26 26 <property name="bottomMargin">
27 27 <number>0</number>
28 28 </property>
29 29 <item>
30 30 <widget class="QFrame" name="frame">
31 31 <property name="frameShape">
32 32 <enum>QFrame::Box</enum>
33 33 </property>
34 34 <property name="frameShadow">
35 35 <enum>QFrame::Sunken</enum>
36 36 </property>
37 37 <property name="lineWidth">
38 38 <number>1</number>
39 39 </property>
40 40 <layout class="QVBoxLayout" name="verticalLayout">
41 41 <property name="leftMargin">
42 42 <number>0</number>
43 43 </property>
44 44 <property name="topMargin">
45 45 <number>0</number>
46 46 </property>
47 47 <property name="rightMargin">
48 48 <number>0</number>
49 49 </property>
50 50 <property name="bottomMargin">
51 51 <number>0</number>
52 52 </property>
53 53 <item>
54 54 <widget class="QStackedWidget" name="stackedWidget">
55 55 <property name="currentIndex">
56 <number>1</number>
56 <number>2</number>
57 57 </property>
58 58 <widget class="QWidget" name="emptyPage"/>
59 59 <widget class="QWidget" name="catalogueInspectorPage">
60 60 <layout class="QGridLayout" name="gridLayout_2">
61 61 <item row="1" column="0">
62 62 <widget class="QLabel" name="label_7">
63 63 <property name="text">
64 64 <string>Name</string>
65 65 </property>
66 66 </widget>
67 67 </item>
68 68 <item row="1" column="1">
69 69 <widget class="QLineEdit" name="leCatalogueName"/>
70 70 </item>
71 71 <item row="2" column="0">
72 72 <widget class="QLabel" name="label_8">
73 73 <property name="text">
74 74 <string>Author</string>
75 75 </property>
76 76 </widget>
77 77 </item>
78 78 <item row="2" column="1">
79 79 <widget class="QLineEdit" name="leCatalogueAuthor">
80 80 <property name="text">
81 81 <string/>
82 82 </property>
83 83 </widget>
84 84 </item>
85 85 <item row="3" column="1">
86 86 <spacer name="verticalSpacer_2">
87 87 <property name="orientation">
88 88 <enum>Qt::Vertical</enum>
89 89 </property>
90 90 <property name="sizeHint" stdset="0">
91 91 <size>
92 92 <width>20</width>
93 93 <height>40</height>
94 94 </size>
95 95 </property>
96 96 </spacer>
97 97 </item>
98 98 <item row="0" column="0" colspan="2">
99 99 <widget class="QLabel" name="label_9">
100 100 <property name="font">
101 101 <font>
102 102 <pointsize>10</pointsize>
103 103 <weight>75</weight>
104 104 <bold>true</bold>
105 105 </font>
106 106 </property>
107 107 <property name="text">
108 108 <string>Catalogue Properties</string>
109 109 </property>
110 110 </widget>
111 111 </item>
112 112 </layout>
113 113 </widget>
114 114 <widget class="QWidget" name="eventInspectorPage">
115 115 <layout class="QGridLayout" name="gridLayout">
116 <item row="5" column="1">
117 <widget class="QDateTimeEdit" name="dateTimeEventTEnd">
118 <property name="timeSpec">
119 <enum>Qt::UTC</enum>
116 <item row="4" column="0">
117 <widget class="QLabel" name="label_3">
118 <property name="text">
119 <string>Product</string>
120 120 </property>
121 121 </widget>
122 122 </item>
123 <item row="4" column="0">
123 <item row="5" column="0">
124 124 <widget class="QLabel" name="label_4">
125 125 <property name="text">
126 126 <string>TStart</string>
127 127 </property>
128 128 </widget>
129 129 </item>
130 <item row="6" column="0">
131 <widget class="QLabel" name="label_6">
130 <item row="1" column="0">
131 <widget class="QLabel" name="label">
132 132 <property name="text">
133 <string>Tags</string>
133 <string>Name</string>
134 134 </property>
135 135 </widget>
136 136 </item>
137 <item row="3" column="0">
138 <widget class="QLabel" name="label_3">
137 <item row="0" column="0" colspan="2">
138 <widget class="QLabel" name="label_10">
139 <property name="font">
140 <font>
141 <pointsize>10</pointsize>
142 <weight>75</weight>
143 <bold>true</bold>
144 </font>
145 </property>
139 146 <property name="text">
140 <string>Product</string>
147 <string>Event Properties</string>
141 148 </property>
142 149 </widget>
143 150 </item>
144 <item row="3" column="1">
145 <widget class="QLineEdit" name="leEventProduct"/>
146 </item>
147 <item row="5" column="0">
148 <widget class="QLabel" name="label_5">
149 <property name="text">
150 <string>Tend</string>
151 <item row="8" column="1">
152 <spacer name="verticalSpacer">
153 <property name="orientation">
154 <enum>Qt::Vertical</enum>
151 155 </property>
152 </widget>
156 <property name="sizeHint" stdset="0">
157 <size>
158 <width>20</width>
159 <height>40</height>
160 </size>
161 </property>
162 </spacer>
153 163 </item>
154 <item row="4" column="1">
164 <item row="1" column="1">
165 <widget class="QLineEdit" name="leEventName"/>
166 </item>
167 <item row="5" column="1">
155 168 <widget class="QDateTimeEdit" name="dateTimeEventTStart">
156 169 <property name="timeSpec">
157 170 <enum>Qt::UTC</enum>
158 171 </property>
159 172 </widget>
160 173 </item>
161 <item row="2" column="0">
162 <widget class="QLabel" name="label_2">
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">
163 179 <property name="text">
164 <string>Mission</string>
180 <string>Tend</string>
165 181 </property>
166 182 </widget>
167 183 </item>
168 <item row="1" column="1">
169 <widget class="QLineEdit" name="leEventName"/>
170 </item>
171 <item row="1" column="0">
172 <widget class="QLabel" name="label">
173 <property name="text">
174 <string>Name</string>
184 <item row="6" column="1">
185 <widget class="QDateTimeEdit" name="dateTimeEventTEnd">
186 <property name="timeSpec">
187 <enum>Qt::UTC</enum>
175 188 </property>
176 189 </widget>
177 190 </item>
178 191 <item row="2" column="1">
179 <widget class="QLineEdit" name="leEventMission"/>
180 </item>
181 <item row="6" column="1">
182 192 <widget class="QLineEdit" name="leEventTags"/>
183 193 </item>
184 <item row="7" column="1">
185 <spacer name="verticalSpacer">
186 <property name="orientation">
187 <enum>Qt::Vertical</enum>
188 </property>
189 <property name="sizeHint" stdset="0">
190 <size>
191 <width>20</width>
192 <height>40</height>
193 </size>
194 <item row="2" column="0">
195 <widget class="QLabel" name="label_6">
196 <property name="text">
197 <string>Tags</string>
194 198 </property>
195 </spacer>
199 </widget>
196 200 </item>
197 <item row="0" column="0" colspan="2">
198 <widget class="QLabel" name="label_10">
199 <property name="font">
200 <font>
201 <pointsize>10</pointsize>
202 <weight>75</weight>
203 <bold>true</bold>
204 </font>
205 </property>
206 <property name="text">
207 <string>Event Properties</string>
201 <item row="3" column="0" colspan="2">
202 <widget class="Line" name="line">
203 <property name="orientation">
204 <enum>Qt::Horizontal</enum>
208 205 </property>
209 206 </widget>
210 207 </item>
211 208 </layout>
212 209 </widget>
213 210 </widget>
214 211 </item>
215 212 </layout>
216 213 </widget>
217 214 </item>
218 215 </layout>
219 216 </widget>
220 217 <resources/>
221 218 <connections/>
222 219 </ui>
General Comments 0
You need to be logged in to leave comments. Login now