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