Auto status change to "Under Review"
@@ -1,95 +1,98 | |||||
1 | #include "Catalogue/CatalogueExplorer.h" |
|
1 | #include "Catalogue/CatalogueExplorer.h" | |
2 | #include "ui_CatalogueExplorer.h" |
|
2 | #include "ui_CatalogueExplorer.h" | |
3 |
|
3 | |||
4 | #include <Catalogue/CatalogueActionManager.h> |
|
4 | #include <Catalogue/CatalogueActionManager.h> | |
5 | #include <Catalogue/CatalogueController.h> |
|
5 | #include <Catalogue/CatalogueController.h> | |
6 | #include <SqpApplication.h> |
|
6 | #include <SqpApplication.h> | |
7 | #include <Visualization/VisualizationWidget.h> |
|
7 | #include <Visualization/VisualizationWidget.h> | |
8 |
|
8 | |||
9 | #include <DBCatalogue.h> |
|
9 | #include <DBCatalogue.h> | |
10 | #include <DBEvent.h> |
|
10 | #include <DBEvent.h> | |
11 |
|
11 | |||
12 | struct CatalogueExplorer::CatalogueExplorerPrivate { |
|
12 | struct CatalogueExplorer::CatalogueExplorerPrivate { | |
13 | CatalogueActionManager m_ActionManager; |
|
13 | CatalogueActionManager m_ActionManager; | |
14 | }; |
|
14 | }; | |
15 |
|
15 | |||
16 | CatalogueExplorer::CatalogueExplorer(QWidget *parent) |
|
16 | CatalogueExplorer::CatalogueExplorer(QWidget *parent) | |
17 | : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), |
|
17 | : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), | |
18 | ui(new Ui::CatalogueExplorer), |
|
18 | ui(new Ui::CatalogueExplorer), | |
19 | impl{spimpl::make_unique_impl<CatalogueExplorerPrivate>()} |
|
19 | impl{spimpl::make_unique_impl<CatalogueExplorerPrivate>()} | |
20 | { |
|
20 | { | |
21 | ui->setupUi(this); |
|
21 | ui->setupUi(this); | |
22 |
|
22 | |||
23 | impl->m_ActionManager.installSelectionZoneActions(); |
|
23 | impl->m_ActionManager.installSelectionZoneActions(); | |
24 |
|
24 | |||
25 | connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto catalogues) { |
|
25 | connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto catalogues) { | |
26 | if (catalogues.count() == 1) { |
|
26 | if (catalogues.count() == 1) { | |
27 | ui->inspector->setCatalogue(catalogues.first()); |
|
27 | ui->inspector->setCatalogue(catalogues.first()); | |
28 | } |
|
28 | } | |
29 | else { |
|
29 | else { | |
30 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); |
|
30 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |
31 | } |
|
31 | } | |
32 |
|
32 | |||
33 | ui->events->populateWithCatalogues(catalogues); |
|
33 | ui->events->populateWithCatalogues(catalogues); | |
34 | }); |
|
34 | }); | |
35 |
|
35 | |||
36 | connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databases) { |
|
36 | connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databases) { | |
37 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); |
|
37 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |
38 | }); |
|
38 | }); | |
39 |
|
39 | |||
40 | connect(ui->catalogues, &CatalogueSideBarWidget::trashSelected, |
|
40 | connect(ui->catalogues, &CatalogueSideBarWidget::trashSelected, | |
41 | [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); }); |
|
41 | [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); }); | |
42 |
|
42 | |||
43 | connect(ui->catalogues, &CatalogueSideBarWidget::allEventsSelected, [this]() { |
|
43 | connect(ui->catalogues, &CatalogueSideBarWidget::allEventsSelected, [this]() { | |
44 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); |
|
44 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |
45 | ui->events->populateWithAllEvents(); |
|
45 | ui->events->populateWithAllEvents(); | |
46 | }); |
|
46 | }); | |
47 |
|
47 | |||
48 | connect(ui->catalogues, &CatalogueSideBarWidget::selectionCleared, |
|
48 | connect(ui->catalogues, &CatalogueSideBarWidget::selectionCleared, | |
49 | [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); }); |
|
49 | [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); }); | |
50 |
|
50 | |||
51 | connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) { |
|
51 | connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) { | |
52 | if (events.count() == 1) { |
|
52 | if (events.count() == 1) { | |
53 | ui->inspector->setEvent(events.first()); |
|
53 | ui->inspector->setEvent(events.first()); | |
54 | } |
|
54 | } | |
55 | else { |
|
55 | else { | |
56 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); |
|
56 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |
57 | } |
|
57 | } | |
58 | }); |
|
58 | }); | |
59 |
|
59 | |||
60 | connect(ui->events, &CatalogueEventsWidget::eventProductsSelected, [this](auto eventProducts) { |
|
60 | connect(ui->events, &CatalogueEventsWidget::eventProductsSelected, [this](auto eventProducts) { | |
61 | if (eventProducts.count() == 1) { |
|
61 | if (eventProducts.count() == 1) { | |
62 | ui->inspector->setEventProduct(eventProducts.first().first, |
|
62 | ui->inspector->setEventProduct(eventProducts.first().first, | |
63 | eventProducts.first().second); |
|
63 | eventProducts.first().second); | |
64 | } |
|
64 | } | |
65 | else { |
|
65 | else { | |
66 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); |
|
66 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |
67 | } |
|
67 | } | |
68 | }); |
|
68 | }); | |
69 |
|
69 | |||
70 | connect(ui->events, &CatalogueEventsWidget::selectionCleared, |
|
70 | connect(ui->events, &CatalogueEventsWidget::selectionCleared, | |
71 | [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); }); |
|
71 | [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); }); | |
72 |
|
72 | |||
73 | connect(ui->inspector, &CatalogueInspectorWidget::catalogueUpdated, [this](auto catalogue) { |
|
73 | connect(ui->inspector, &CatalogueInspectorWidget::catalogueUpdated, [this](auto catalogue) { | |
74 | sqpApp->catalogueController().updateCatalogue(catalogue); |
|
74 | sqpApp->catalogueController().updateCatalogue(catalogue); | |
75 | ui->catalogues->setCatalogueChanges(catalogue, true); |
|
75 | ui->catalogues->setCatalogueChanges(catalogue, true); | |
76 | }); |
|
76 | }); | |
77 |
|
77 | |||
78 | connect(ui->inspector, &CatalogueInspectorWidget::eventUpdated, [this](auto event) { |
|
78 | connect(ui->inspector, &CatalogueInspectorWidget::eventUpdated, [this](auto event) { | |
79 | sqpApp->catalogueController().updateEvent(event); |
|
79 | sqpApp->catalogueController().updateEvent(event); | |
80 | ui->events->setEventChanges(event, true); |
|
80 | ui->events->setEventChanges(event, true); | |
81 | }); |
|
81 | }); | |
82 |
|
82 | |||
83 | connect(ui->inspector, &CatalogueInspectorWidget::eventProductUpdated, |
|
83 | connect(ui->inspector, &CatalogueInspectorWidget::eventProductUpdated, | |
84 |
[this](auto event, auto eventProduct) { |
|
84 | [this](auto event, auto eventProduct) { | |
|
85 | sqpApp->catalogueController().updateEventProduct(eventProduct); | |||
|
86 | ui->events->setEventChanges(event, true); | |||
|
87 | }); | |||
85 | } |
|
88 | } | |
86 |
|
89 | |||
87 | CatalogueExplorer::~CatalogueExplorer() |
|
90 | CatalogueExplorer::~CatalogueExplorer() | |
88 | { |
|
91 | { | |
89 | delete ui; |
|
92 | delete ui; | |
90 | } |
|
93 | } | |
91 |
|
94 | |||
92 | void CatalogueExplorer::setVisualizationWidget(VisualizationWidget *visualization) |
|
95 | void CatalogueExplorer::setVisualizationWidget(VisualizationWidget *visualization) | |
93 | { |
|
96 | { | |
94 | ui->events->setVisualizationWidget(visualization); |
|
97 | ui->events->setVisualizationWidget(visualization); | |
95 | } |
|
98 | } |
@@ -1,181 +1,211 | |||||
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 <DBEventProduct.h> | |
8 | #include <DBTag.h> |
|
8 | #include <DBTag.h> | |
9 |
|
9 | |||
10 | struct CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate { |
|
10 | struct CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate { | |
11 | std::shared_ptr<DBCatalogue> m_DisplayedCatalogue = nullptr; |
|
11 | std::shared_ptr<DBCatalogue> m_DisplayedCatalogue = nullptr; | |
12 | std::shared_ptr<DBEvent> m_DisplayedEvent = nullptr; |
|
12 | std::shared_ptr<DBEvent> m_DisplayedEvent = nullptr; | |
13 | std::shared_ptr<DBEventProduct> m_DisplayedEventProduct = nullptr; |
|
13 | std::shared_ptr<DBEventProduct> m_DisplayedEventProduct = nullptr; | |
14 |
|
14 | |||
15 | void connectCatalogueUpdateSignals(CatalogueInspectorWidget *inspector, |
|
15 | void connectCatalogueUpdateSignals(CatalogueInspectorWidget *inspector, | |
16 | Ui::CatalogueInspectorWidget *ui); |
|
16 | Ui::CatalogueInspectorWidget *ui); | |
17 | void connectEventUpdateSignals(CatalogueInspectorWidget *inspector, |
|
17 | void connectEventUpdateSignals(CatalogueInspectorWidget *inspector, | |
18 | Ui::CatalogueInspectorWidget *ui); |
|
18 | Ui::CatalogueInspectorWidget *ui); | |
19 | }; |
|
19 | }; | |
20 |
|
20 | |||
21 | CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent) |
|
21 | CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent) | |
22 | : QWidget(parent), |
|
22 | : QWidget(parent), | |
23 | ui(new Ui::CatalogueInspectorWidget), |
|
23 | ui(new Ui::CatalogueInspectorWidget), | |
24 | impl{spimpl::make_unique_impl<CatalogueInspectorWidgetPrivate>()} |
|
24 | impl{spimpl::make_unique_impl<CatalogueInspectorWidgetPrivate>()} | |
25 | { |
|
25 | { | |
26 | ui->setupUi(this); |
|
26 | ui->setupUi(this); | |
27 | showPage(Page::Empty); |
|
27 | showPage(Page::Empty); | |
28 |
|
28 | |||
29 | impl->connectCatalogueUpdateSignals(this, ui); |
|
29 | impl->connectCatalogueUpdateSignals(this, ui); | |
30 | impl->connectEventUpdateSignals(this, ui); |
|
30 | impl->connectEventUpdateSignals(this, ui); | |
31 | } |
|
31 | } | |
32 |
|
32 | |||
33 | CatalogueInspectorWidget::~CatalogueInspectorWidget() |
|
33 | CatalogueInspectorWidget::~CatalogueInspectorWidget() | |
34 | { |
|
34 | { | |
35 | delete ui; |
|
35 | delete ui; | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectCatalogueUpdateSignals( |
|
38 | void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectCatalogueUpdateSignals( | |
39 | CatalogueInspectorWidget *inspector, Ui::CatalogueInspectorWidget *ui) |
|
39 | CatalogueInspectorWidget *inspector, Ui::CatalogueInspectorWidget *ui) | |
40 | { |
|
40 | { | |
41 | connect(ui->leCatalogueName, &QLineEdit::editingFinished, [ui, inspector, this]() { |
|
41 | connect(ui->leCatalogueName, &QLineEdit::editingFinished, [ui, inspector, this]() { | |
42 | if (ui->leCatalogueName->text() != m_DisplayedCatalogue->getName()) { |
|
42 | if (ui->leCatalogueName->text() != m_DisplayedCatalogue->getName()) { | |
43 | m_DisplayedCatalogue->setName(ui->leCatalogueName->text()); |
|
43 | m_DisplayedCatalogue->setName(ui->leCatalogueName->text()); | |
44 | emit inspector->catalogueUpdated(m_DisplayedCatalogue); |
|
44 | emit inspector->catalogueUpdated(m_DisplayedCatalogue); | |
45 | } |
|
45 | } | |
46 | }); |
|
46 | }); | |
47 |
|
47 | |||
48 | connect(ui->leCatalogueAuthor, &QLineEdit::editingFinished, [ui, inspector, this]() { |
|
48 | connect(ui->leCatalogueAuthor, &QLineEdit::editingFinished, [ui, inspector, this]() { | |
49 | if (ui->leCatalogueAuthor->text() != m_DisplayedCatalogue->getAuthor()) { |
|
49 | if (ui->leCatalogueAuthor->text() != m_DisplayedCatalogue->getAuthor()) { | |
50 | m_DisplayedCatalogue->setAuthor(ui->leCatalogueAuthor->text()); |
|
50 | m_DisplayedCatalogue->setAuthor(ui->leCatalogueAuthor->text()); | |
51 | emit inspector->catalogueUpdated(m_DisplayedCatalogue); |
|
51 | emit inspector->catalogueUpdated(m_DisplayedCatalogue); | |
52 | } |
|
52 | } | |
53 | }); |
|
53 | }); | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectEventUpdateSignals( |
|
56 | void CatalogueInspectorWidget::CatalogueInspectorWidgetPrivate::connectEventUpdateSignals( | |
57 | CatalogueInspectorWidget *inspector, Ui::CatalogueInspectorWidget *ui) |
|
57 | CatalogueInspectorWidget *inspector, Ui::CatalogueInspectorWidget *ui) | |
58 | { |
|
58 | { | |
59 | connect(ui->leEventName, &QLineEdit::editingFinished, [ui, inspector, this]() { |
|
59 | connect(ui->leEventName, &QLineEdit::editingFinished, [ui, inspector, this]() { | |
60 | if (ui->leEventName->text() != m_DisplayedEvent->getName()) { |
|
60 | if (ui->leEventName->text() != m_DisplayedEvent->getName()) { | |
61 | m_DisplayedEvent->setName(ui->leEventName->text()); |
|
61 | m_DisplayedEvent->setName(ui->leEventName->text()); | |
62 | emit inspector->eventUpdated(m_DisplayedEvent); |
|
62 | emit inspector->eventUpdated(m_DisplayedEvent); | |
63 | } |
|
63 | } | |
64 | }); |
|
64 | }); | |
65 |
|
65 | |||
66 | connect(ui->leEventTags, &QLineEdit::editingFinished, [ui, inspector, this]() { |
|
66 | connect(ui->leEventTags, &QLineEdit::editingFinished, [ui, inspector, this]() { | |
67 | auto tags = ui->leEventTags->text().split(QRegExp("\\s+")); |
|
67 | auto tags = ui->leEventTags->text().split(QRegExp("\\s+")); | |
68 | std::list<QString> tagNames; |
|
68 | std::list<QString> tagNames; | |
69 | for (auto tag : tags) { |
|
69 | for (auto tag : tags) { | |
70 | tagNames.push_back(tag); |
|
70 | tagNames.push_back(tag); | |
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 | if (m_DisplayedEvent->getTagsNames() != tagNames) { |
|
73 | if (m_DisplayedEvent->getTagsNames() != tagNames) { | |
74 | m_DisplayedEvent->setTagsNames(tagNames); |
|
74 | m_DisplayedEvent->setTagsNames(tagNames); | |
75 | emit inspector->eventUpdated(m_DisplayedEvent); |
|
75 | emit inspector->eventUpdated(m_DisplayedEvent); | |
76 | } |
|
76 | } | |
77 | }); |
|
77 | }); | |
78 |
|
78 | |||
79 | connect(ui->leEventProduct, &QLineEdit::editingFinished, [ui, inspector, this]() { |
|
79 | connect(ui->leEventProduct, &QLineEdit::editingFinished, [ui, inspector, this]() { | |
80 | if (ui->leEventProduct->text() != m_DisplayedEventProduct->getProductId()) { |
|
80 | if (ui->leEventProduct->text() != m_DisplayedEventProduct->getProductId()) { | |
|
81 | auto oldProductId = m_DisplayedEventProduct->getProductId(); | |||
81 | m_DisplayedEventProduct->setProductId(ui->leEventProduct->text()); |
|
82 | m_DisplayedEventProduct->setProductId(ui->leEventProduct->text()); | |
82 | emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct); |
|
83 | ||
|
84 | auto eventProducts = m_DisplayedEvent->getEventProducts(); | |||
|
85 | for (auto &eventProduct : eventProducts) { | |||
|
86 | if (eventProduct.getProductId() == oldProductId) { | |||
|
87 | eventProduct.setProductId(m_DisplayedEventProduct->getProductId()); | |||
|
88 | } | |||
|
89 | } | |||
|
90 | m_DisplayedEvent->setEventProducts(eventProducts); | |||
|
91 | ||||
|
92 | emit inspector->eventUpdated(m_DisplayedEvent); | |||
83 | } |
|
93 | } | |
84 | }); |
|
94 | }); | |
85 |
|
95 | |||
86 | connect(ui->dateTimeEventTStart, &QDateTimeEdit::editingFinished, [ui, inspector, this]() { |
|
96 | connect(ui->dateTimeEventTStart, &QDateTimeEdit::editingFinished, [ui, inspector, this]() { | |
87 | auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTStart->dateTime()); |
|
97 | auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTStart->dateTime()); | |
88 | if (time != m_DisplayedEventProduct->getTStart()) { |
|
98 | if (time != m_DisplayedEventProduct->getTStart()) { | |
89 | m_DisplayedEventProduct->setTStart(time); |
|
99 | m_DisplayedEventProduct->setTStart(time); | |
90 | emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct); |
|
100 | ||
|
101 | auto eventProducts = m_DisplayedEvent->getEventProducts(); | |||
|
102 | for (auto &eventProduct : eventProducts) { | |||
|
103 | if (eventProduct.getProductId() == m_DisplayedEventProduct->getProductId()) { | |||
|
104 | eventProduct.setTStart(m_DisplayedEventProduct->getTStart()); | |||
|
105 | } | |||
|
106 | } | |||
|
107 | m_DisplayedEvent->setEventProducts(eventProducts); | |||
|
108 | ||||
|
109 | emit inspector->eventUpdated(m_DisplayedEvent); | |||
91 | } |
|
110 | } | |
92 | }); |
|
111 | }); | |
93 |
|
112 | |||
94 | connect(ui->dateTimeEventTEnd, &QDateTimeEdit::editingFinished, [ui, inspector, this]() { |
|
113 | connect(ui->dateTimeEventTEnd, &QDateTimeEdit::editingFinished, [ui, inspector, this]() { | |
95 | auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTEnd->dateTime()); |
|
114 | auto time = DateUtils::secondsSinceEpoch(ui->dateTimeEventTEnd->dateTime()); | |
96 | if (time != m_DisplayedEventProduct->getTEnd()) { |
|
115 | if (time != m_DisplayedEventProduct->getTEnd()) { | |
97 | m_DisplayedEventProduct->setTEnd(time); |
|
116 | m_DisplayedEventProduct->setTEnd(time); | |
98 | emit inspector->eventProductUpdated(m_DisplayedEvent, m_DisplayedEventProduct); |
|
117 | ||
|
118 | auto eventProducts = m_DisplayedEvent->getEventProducts(); | |||
|
119 | for (auto &eventProduct : eventProducts) { | |||
|
120 | if (eventProduct.getProductId() == m_DisplayedEventProduct->getProductId()) { | |||
|
121 | eventProduct.setTEnd(m_DisplayedEventProduct->getTEnd()); | |||
|
122 | } | |||
|
123 | } | |||
|
124 | m_DisplayedEvent->setEventProducts(eventProducts); | |||
|
125 | ||||
|
126 | emit inspector->eventUpdated(m_DisplayedEvent); | |||
99 | } |
|
127 | } | |
100 | }); |
|
128 | }); | |
101 | } |
|
129 | } | |
102 |
|
130 | |||
103 | void CatalogueInspectorWidget::showPage(CatalogueInspectorWidget::Page page) |
|
131 | void CatalogueInspectorWidget::showPage(CatalogueInspectorWidget::Page page) | |
104 | { |
|
132 | { | |
105 | ui->stackedWidget->setCurrentIndex(static_cast<int>(page)); |
|
133 | ui->stackedWidget->setCurrentIndex(static_cast<int>(page)); | |
106 | } |
|
134 | } | |
107 |
|
135 | |||
108 | CatalogueInspectorWidget::Page CatalogueInspectorWidget::currentPage() const |
|
136 | CatalogueInspectorWidget::Page CatalogueInspectorWidget::currentPage() const | |
109 | { |
|
137 | { | |
110 | return static_cast<Page>(ui->stackedWidget->currentIndex()); |
|
138 | return static_cast<Page>(ui->stackedWidget->currentIndex()); | |
111 | } |
|
139 | } | |
112 |
|
140 | |||
113 | void CatalogueInspectorWidget::setEvent(const std::shared_ptr<DBEvent> &event) |
|
141 | void CatalogueInspectorWidget::setEvent(const std::shared_ptr<DBEvent> &event) | |
114 | { |
|
142 | { | |
115 | impl->m_DisplayedEvent = event; |
|
143 | impl->m_DisplayedEvent = event; | |
116 |
|
144 | |||
117 | blockSignals(true); |
|
145 | blockSignals(true); | |
118 |
|
146 | |||
119 | showPage(Page::EventProperties); |
|
147 | showPage(Page::EventProperties); | |
120 | ui->leEventName->setEnabled(true); |
|
148 | ui->leEventName->setEnabled(true); | |
121 | ui->leEventName->setText(event->getName()); |
|
149 | ui->leEventName->setText(event->getName()); | |
122 | ui->leEventProduct->setEnabled(false); |
|
150 | ui->leEventProduct->setEnabled(false); | |
123 | ui->leEventProduct->setText( |
|
151 | ui->leEventProduct->setText( | |
124 | QString::number(event->getEventProducts().size()).append(" product(s)")); |
|
152 | QString::number(event->getEventProducts().size()).append(" product(s)")); | |
125 |
|
153 | |||
126 | QString tagList; |
|
154 | QString tagList; | |
127 | auto tags = event->getTagsNames(); |
|
155 | auto tags = event->getTagsNames(); | |
128 | for (auto tag : tags) { |
|
156 | for (auto tag : tags) { | |
129 | tagList += tag; |
|
157 | tagList += tag; | |
130 | tagList += ' '; |
|
158 | tagList += ' '; | |
131 | } |
|
159 | } | |
132 |
|
160 | |||
133 | ui->leEventTags->setEnabled(true); |
|
161 | ui->leEventTags->setEnabled(true); | |
134 | ui->leEventTags->setText(tagList); |
|
162 | ui->leEventTags->setText(tagList); | |
135 |
|
163 | |||
136 | ui->dateTimeEventTStart->setEnabled(false); |
|
164 | ui->dateTimeEventTStart->setEnabled(false); | |
137 | ui->dateTimeEventTEnd->setEnabled(false); |
|
165 | ui->dateTimeEventTEnd->setEnabled(false); | |
138 |
|
166 | |||
139 | ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(event->getTStart())); |
|
167 | ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(event->getTStart())); | |
140 | ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(event->getTEnd())); |
|
168 | ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(event->getTEnd())); | |
141 |
|
169 | |||
142 | blockSignals(false); |
|
170 | blockSignals(false); | |
143 | } |
|
171 | } | |
144 |
|
172 | |||
145 | void CatalogueInspectorWidget::setEventProduct(const std::shared_ptr<DBEvent> &event, |
|
173 | void CatalogueInspectorWidget::setEventProduct(const std::shared_ptr<DBEvent> &event, | |
146 | const std::shared_ptr<DBEventProduct> &eventProduct) |
|
174 | const std::shared_ptr<DBEventProduct> &eventProduct) | |
147 | { |
|
175 | { | |
|
176 | ||||
|
177 | impl->m_DisplayedEvent = event; | |||
148 | impl->m_DisplayedEventProduct = eventProduct; |
|
178 | impl->m_DisplayedEventProduct = eventProduct; | |
149 |
|
179 | |||
150 | blockSignals(true); |
|
180 | blockSignals(true); | |
151 |
|
181 | |||
152 | showPage(Page::EventProperties); |
|
182 | showPage(Page::EventProperties); | |
153 | ui->leEventName->setEnabled(false); |
|
183 | ui->leEventName->setEnabled(false); | |
154 | ui->leEventName->setText(event->getName()); |
|
184 | ui->leEventName->setText(event->getName()); | |
155 | ui->leEventProduct->setEnabled(true); |
|
185 | ui->leEventProduct->setEnabled(true); | |
156 | ui->leEventProduct->setText(eventProduct->getProductId()); |
|
186 | ui->leEventProduct->setText(eventProduct->getProductId()); | |
157 |
|
187 | |||
158 | ui->leEventTags->setEnabled(false); |
|
188 | ui->leEventTags->setEnabled(false); | |
159 | ui->leEventTags->clear(); |
|
189 | ui->leEventTags->clear(); | |
160 |
|
190 | |||
161 | ui->dateTimeEventTStart->setEnabled(true); |
|
191 | ui->dateTimeEventTStart->setEnabled(true); | |
162 | ui->dateTimeEventTEnd->setEnabled(true); |
|
192 | ui->dateTimeEventTEnd->setEnabled(true); | |
163 |
|
193 | |||
164 | ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(eventProduct->getTStart())); |
|
194 | ui->dateTimeEventTStart->setDateTime(DateUtils::dateTime(eventProduct->getTStart())); | |
165 | ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(eventProduct->getTEnd())); |
|
195 | ui->dateTimeEventTEnd->setDateTime(DateUtils::dateTime(eventProduct->getTEnd())); | |
166 |
|
196 | |||
167 | blockSignals(false); |
|
197 | blockSignals(false); | |
168 | } |
|
198 | } | |
169 |
|
199 | |||
170 | void CatalogueInspectorWidget::setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue) |
|
200 | void CatalogueInspectorWidget::setCatalogue(const std::shared_ptr<DBCatalogue> &catalogue) | |
171 | { |
|
201 | { | |
172 | impl->m_DisplayedCatalogue = catalogue; |
|
202 | impl->m_DisplayedCatalogue = catalogue; | |
173 |
|
203 | |||
174 | blockSignals(true); |
|
204 | blockSignals(true); | |
175 |
|
205 | |||
176 | showPage(Page::CatalogueProperties); |
|
206 | showPage(Page::CatalogueProperties); | |
177 | ui->leCatalogueName->setText(catalogue->getName()); |
|
207 | ui->leCatalogueName->setText(catalogue->getName()); | |
178 | ui->leCatalogueAuthor->setText(catalogue->getAuthor()); |
|
208 | ui->leCatalogueAuthor->setText(catalogue->getAuthor()); | |
179 |
|
209 | |||
180 | blockSignals(false); |
|
210 | blockSignals(false); | |
181 | } |
|
211 | } |
General Comments 3
Status change > Approved
You need to be logged in to leave comments.
Login now