@@ -5,6 +5,10 | |||||
5 |
|
5 | |||
6 | #include <QDateTime> |
|
6 | #include <QDateTime> | |
7 |
|
7 | |||
|
8 | /// Format for datetimes | |||
|
9 | const auto DATETIME_FORMAT = QStringLiteral("dd/MM/yyyy \nhh:mm:ss:zzz"); | |||
|
10 | const auto DATETIME_FORMAT_ONE_LINE = QStringLiteral("dd/MM/yyyy hh:mm:ss:zzz"); | |||
|
11 | ||||
8 | /** |
|
12 | /** | |
9 | * Utility class with methods for dates |
|
13 | * Utility class with methods for dates | |
10 | */ |
|
14 | */ |
@@ -290,6 +290,14 void CatalogueController::saveCatalogue(std::shared_ptr<DBCatalogue> catalogue) | |||||
290 | { |
|
290 | { | |
291 | impl->saveCatalogue(catalogue, true); |
|
291 | impl->saveCatalogue(catalogue, true); | |
292 | impl->m_KeysWithChanges.remove(impl->catalogueUniqueKey(catalogue)); |
|
292 | impl->m_KeysWithChanges.remove(impl->catalogueUniqueKey(catalogue)); | |
|
293 | ||||
|
294 | // remove key of events of the catalogue | |||
|
295 | if (catalogue->getType() == CatalogueType::STATIC) { | |||
|
296 | auto events = this->retrieveEventsFromCatalogue(catalogue); | |||
|
297 | for (auto event : events) { | |||
|
298 | impl->m_KeysWithChanges.remove(impl->eventUniqueKey(event)); | |||
|
299 | } | |||
|
300 | } | |||
293 | } |
|
301 | } | |
294 |
|
302 | |||
295 | void CatalogueController::discardCatalogue(std::shared_ptr<DBCatalogue> catalogue, bool &removed) |
|
303 | void CatalogueController::discardCatalogue(std::shared_ptr<DBCatalogue> catalogue, bool &removed) |
@@ -52,9 +52,6 const auto COLUMN_PROPERTIES = QHash<int, ColumnProperties>{ | |||||
52 | {UNIT_COLUMN, {QObject::tr("Unit")}}, {MISSION_COLUMN, {QObject::tr("Mission")}}, |
|
52 | {UNIT_COLUMN, {QObject::tr("Unit")}}, {MISSION_COLUMN, {QObject::tr("Mission")}}, | |
53 | {PLUGIN_COLUMN, {QObject::tr("Plugin")}}}; |
|
53 | {PLUGIN_COLUMN, {QObject::tr("Plugin")}}}; | |
54 |
|
54 | |||
55 | /// Format for datetimes |
|
|||
56 | const auto DATETIME_FORMAT = QStringLiteral("dd/MM/yyyy \nhh:mm:ss:zzz"); |
|
|||
57 |
|
||||
58 | QString uniqueName(const QString &defaultName, |
|
55 | QString uniqueName(const QString &defaultName, | |
59 | const std::vector<std::shared_ptr<Variable> > &variables) |
|
56 | const std::vector<std::shared_ptr<Variable> > &variables) | |
60 | { |
|
57 | { |
@@ -30,6 +30,8 signals: | |||||
30 | void selectionZoneAdded(const std::shared_ptr<DBEvent> &event, const QString &productId, |
|
30 | void selectionZoneAdded(const std::shared_ptr<DBEvent> &event, const QString &productId, | |
31 | VisualizationSelectionZoneItem *selectionZone); |
|
31 | VisualizationSelectionZoneItem *selectionZone); | |
32 |
|
32 | |||
|
33 | void eventCataloguesModified(const QVector<std::shared_ptr<DBCatalogue> > &catalogues); | |||
|
34 | ||||
33 | public: |
|
35 | public: | |
34 | explicit CatalogueEventsWidget(QWidget *parent = 0); |
|
36 | explicit CatalogueEventsWidget(QWidget *parent = 0); | |
35 | virtual ~CatalogueEventsWidget(); |
|
37 | virtual ~CatalogueEventsWidget(); | |
@@ -38,6 +40,7 public: | |||||
38 |
|
40 | |||
39 | void addEvent(const std::shared_ptr<DBEvent> &event); |
|
41 | void addEvent(const std::shared_ptr<DBEvent> &event); | |
40 | void setEventChanges(const std::shared_ptr<DBEvent> &event, bool hasChanges); |
|
42 | void setEventChanges(const std::shared_ptr<DBEvent> &event, bool hasChanges); | |
|
43 | void setEventsChanges(const std::shared_ptr<DBEvent> &event, bool hasChanges); | |||
41 |
|
44 | |||
42 | QVector<std::shared_ptr<DBCatalogue> > displayedCatalogues() const; |
|
45 | QVector<std::shared_ptr<DBCatalogue> > displayedCatalogues() const; | |
43 | bool isAllEventsDisplayed() const; |
|
46 | bool isAllEventsDisplayed() const; | |
@@ -51,6 +54,11 public slots: | |||||
51 | void clear(); |
|
54 | void clear(); | |
52 | void refresh(); |
|
55 | void refresh(); | |
53 |
|
56 | |||
|
57 | // QWidget interface | |||
|
58 | protected: | |||
|
59 | void keyPressEvent(QKeyEvent *event); | |||
|
60 | ||||
|
61 | ||||
54 | private: |
|
62 | private: | |
55 | Ui::CatalogueEventsWidget *ui; |
|
63 | Ui::CatalogueEventsWidget *ui; | |
56 |
|
64 |
@@ -24,6 +24,7 signals: | |||||
24 | void allEventsSelected(); |
|
24 | void allEventsSelected(); | |
25 | void trashSelected(); |
|
25 | void trashSelected(); | |
26 | void selectionCleared(); |
|
26 | void selectionCleared(); | |
|
27 | void catalogueSaved(const std::shared_ptr<DBCatalogue> &catalogue); | |||
27 |
|
28 | |||
28 | public: |
|
29 | public: | |
29 | explicit CatalogueSideBarWidget(QWidget *parent = 0); |
|
30 | explicit CatalogueSideBarWidget(QWidget *parent = 0); | |
@@ -35,6 +36,10 public: | |||||
35 |
|
36 | |||
36 | QVector<std::shared_ptr<DBCatalogue> > getCatalogues(const QString &repository) const; |
|
37 | QVector<std::shared_ptr<DBCatalogue> > getCatalogues(const QString &repository) const; | |
37 |
|
38 | |||
|
39 | // QWidget interface | |||
|
40 | protected: | |||
|
41 | void keyPressEvent(QKeyEvent *event); | |||
|
42 | ||||
38 | private slots: |
|
43 | private slots: | |
39 | void emitSelection(); |
|
44 | void emitSelection(); | |
40 |
|
45 |
1 | NO CONTENT: modified file chmod 100644 => 100755, binary diff hidden |
|
NO CONTENT: modified file chmod 100644 => 100755, binary diff hidden |
@@ -48,13 +48,23 struct CatalogueEventsModel::CatalogueEventsModelPrivate { | |||||
48 | case CatalogueEventsModel::Column::Name: |
|
48 | case CatalogueEventsModel::Column::Name: | |
49 | return event->getName(); |
|
49 | return event->getName(); | |
50 | case CatalogueEventsModel::Column::TStart: |
|
50 | case CatalogueEventsModel::Column::TStart: | |
51 |
return nbEventProducts(event) > 0 |
|
51 | return nbEventProducts(event) > 0 | |
52 | : QVariant{}; |
|
52 | ? DateUtils::dateTime(event->getTStart()) | |
|
53 | .toString(DATETIME_FORMAT_ONE_LINE) | |||
|
54 | : QVariant{}; | |||
53 | case CatalogueEventsModel::Column::TEnd: |
|
55 | case CatalogueEventsModel::Column::TEnd: | |
54 |
return nbEventProducts(event) > 0 |
|
56 | return nbEventProducts(event) > 0 | |
55 | : QVariant{}; |
|
57 | ? DateUtils::dateTime(event->getTEnd()) | |
56 | case CatalogueEventsModel::Column::Product: |
|
58 | .toString(DATETIME_FORMAT_ONE_LINE) | |
57 | return QString::number(nbEventProducts(event)) + " product(s)"; |
|
59 | : QVariant{}; | |
|
60 | case CatalogueEventsModel::Column::Product: { | |||
|
61 | auto eventProducts = event->getEventProducts(); | |||
|
62 | QStringList eventProductList; | |||
|
63 | for (auto evtProduct : eventProducts) { | |||
|
64 | eventProductList << evtProduct.getProductId(); | |||
|
65 | } | |||
|
66 | return eventProductList.join(";"); | |||
|
67 | } | |||
58 | case CatalogueEventsModel::Column::Tags: { |
|
68 | case CatalogueEventsModel::Column::Tags: { | |
59 | QString tagList; |
|
69 | QString tagList; | |
60 | auto tags = event->getTags(); |
|
70 | auto tags = event->getTags(); | |
@@ -99,9 +109,11 struct CatalogueEventsModel::CatalogueEventsModelPrivate { | |||||
99 | case CatalogueEventsModel::Column::Name: |
|
109 | case CatalogueEventsModel::Column::Name: | |
100 | return eventProduct->getProductId(); |
|
110 | return eventProduct->getProductId(); | |
101 | case CatalogueEventsModel::Column::TStart: |
|
111 | case CatalogueEventsModel::Column::TStart: | |
102 |
return DateUtils::dateTime(eventProduct->getTStart()) |
|
112 | return DateUtils::dateTime(eventProduct->getTStart()) | |
|
113 | .toString(DATETIME_FORMAT_ONE_LINE); | |||
103 | case CatalogueEventsModel::Column::TEnd: |
|
114 | case CatalogueEventsModel::Column::TEnd: | |
104 |
return DateUtils::dateTime(eventProduct->getTEnd()) |
|
115 | return DateUtils::dateTime(eventProduct->getTEnd()) | |
|
116 | .toString(DATETIME_FORMAT_ONE_LINE); | |||
105 | case CatalogueEventsModel::Column::Product: |
|
117 | case CatalogueEventsModel::Column::Product: | |
106 | return eventProduct->getProductId(); |
|
118 | return eventProduct->getProductId(); | |
107 | case CatalogueEventsModel::Column::Tags: |
|
119 | case CatalogueEventsModel::Column::Tags: |
@@ -19,14 +19,12 | |||||
19 |
|
19 | |||
20 | #include <QDialog> |
|
20 | #include <QDialog> | |
21 | #include <QDialogButtonBox> |
|
21 | #include <QDialogButtonBox> | |
|
22 | #include <QKeyEvent> | |||
22 | #include <QListWidget> |
|
23 | #include <QListWidget> | |
23 | #include <QMessageBox> |
|
24 | #include <QMessageBox> | |
24 |
|
25 | |||
25 | Q_LOGGING_CATEGORY(LOG_CatalogueEventsWidget, "CatalogueEventsWidget") |
|
26 | Q_LOGGING_CATEGORY(LOG_CatalogueEventsWidget, "CatalogueEventsWidget") | |
26 |
|
27 | |||
27 | /// Fixed size of the validation column |
|
|||
28 | const auto VALIDATION_COLUMN_SIZE = 35; |
|
|||
29 |
|
||||
30 | /// Percentage added to the range of a event when it is displayed |
|
28 | /// Percentage added to the range of a event when it is displayed | |
31 | const auto EVENT_RANGE_MARGE = 30; // in % |
|
29 | const auto EVENT_RANGE_MARGE = 30; // in % | |
32 |
|
30 | |||
@@ -354,6 +352,7 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent) | |||||
354 | ui->treeView->setDragDropMode(QAbstractItemView::DragDrop); |
|
352 | ui->treeView->setDragDropMode(QAbstractItemView::DragDrop); | |
355 | ui->treeView->setDragEnabled(true); |
|
353 | ui->treeView->setDragEnabled(true); | |
356 |
|
354 | |||
|
355 | ||||
357 | connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) { |
|
356 | connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) { | |
358 | if (checked) { |
|
357 | if (checked) { | |
359 | ui->btnChart->setChecked(false); |
|
358 | ui->btnChart->setChecked(false); | |
@@ -384,17 +383,37 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent) | |||||
384 |
|
383 | |||
385 | if (!events.isEmpty() && eventProducts.isEmpty()) { |
|
384 | if (!events.isEmpty() && eventProducts.isEmpty()) { | |
386 |
|
385 | |||
387 | if (QMessageBox::warning(this, tr("Remove Event(s)"), |
|
386 | auto canRemoveEvent | |
388 | tr("The selected event(s) will be permanently removed " |
|
387 | = !this->isAllEventsDisplayed() | |
389 | "from the repository!\nAre you sure you want to continue?"), |
|
388 | || (QMessageBox::warning( | |
390 | QMessageBox::Yes | QMessageBox::No, QMessageBox::No) |
|
389 | this, tr("Remove Event(s)"), | |
391 | == QMessageBox::Yes) { |
|
390 | tr("The selected event(s) will be permanently removed " | |
|
391 | "from the repository!\nAre you sure you want to continue?"), | |||
|
392 | QMessageBox::Yes | QMessageBox::No, QMessageBox::No) | |||
|
393 | == QMessageBox::Yes); | |||
392 |
|
394 | |||
|
395 | if (canRemoveEvent) { | |||
393 | for (auto event : events) { |
|
396 | for (auto event : events) { | |
394 | sqpApp->catalogueController().removeEvent(event); |
|
397 | if (this->isAllEventsDisplayed()) { | |
395 |
|
|
398 | sqpApp->catalogueController().removeEvent(event); | |
|
399 | impl->removeEvent(event, ui->treeView); | |||
|
400 | } | |||
|
401 | else { | |||
|
402 | QVector<std::shared_ptr<DBCatalogue> > modifiedCatalogues; | |||
|
403 | for (auto catalogue : this->displayedCatalogues()) { | |||
|
404 | if (catalogue->removeEvent(event->getUniqId())) { | |||
|
405 | sqpApp->catalogueController().updateCatalogue(catalogue); | |||
|
406 | modifiedCatalogues << catalogue; | |||
|
407 | } | |||
|
408 | } | |||
|
409 | if (!modifiedCatalogues.empty()) { | |||
|
410 | emit eventCataloguesModified(modifiedCatalogues); | |||
|
411 | } | |||
|
412 | } | |||
|
413 | impl->m_Model->removeEvent(event); | |||
396 | } |
|
414 | } | |
397 |
|
415 | |||
|
416 | ||||
398 | emit this->eventsRemoved(events); |
|
417 | emit this->eventsRemoved(events); | |
399 | } |
|
418 | } | |
400 | } |
|
419 | } | |
@@ -427,11 +446,13 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent) | |||||
427 | ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::Tags, |
|
446 | ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::Tags, | |
428 | QHeaderView::Stretch); |
|
447 | QHeaderView::Stretch); | |
429 | ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::Validation, |
|
448 | ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::Validation, | |
430 |
QHeaderView:: |
|
449 | QHeaderView::ResizeToContents); | |
431 | ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::Name, |
|
450 | ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::Name, | |
432 | QHeaderView::Interactive); |
|
451 | QHeaderView::Interactive); | |
433 |
ui->treeView->header()-> |
|
452 | ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::TStart, | |
434 |
|
|
453 | QHeaderView::ResizeToContents); | |
|
454 | ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::TEnd, | |||
|
455 | QHeaderView::ResizeToContents); | |||
435 | ui->treeView->header()->setSortIndicatorShown(true); |
|
456 | ui->treeView->header()->setSortIndicatorShown(true); | |
436 |
|
457 | |||
437 | connect(impl->m_Model, &CatalogueEventsModel::modelSorted, [this]() { |
|
458 | connect(impl->m_Model, &CatalogueEventsModel::modelSorted, [this]() { | |
@@ -489,6 +510,8 void CatalogueEventsWidget::setEventChanges(const std::shared_ptr<DBEvent> &even | |||||
489 | emitSelection(); |
|
510 | emitSelection(); | |
490 | }); |
|
511 | }); | |
491 | ui->treeView->setIndexWidget(validationIndex, widget); |
|
512 | ui->treeView->setIndexWidget(validationIndex, widget); | |
|
513 | ui->treeView->header()->resizeSection((int)CatalogueEventsModel::Column::Validation, | |||
|
514 | QHeaderView::ResizeToContents); | |||
492 | } |
|
515 | } | |
493 | } |
|
516 | } | |
494 | else { |
|
517 | else { | |
@@ -592,3 +615,15 void CatalogueEventsWidget::emitSelection() | |||||
592 | emit selectionCleared(); |
|
615 | emit selectionCleared(); | |
593 | } |
|
616 | } | |
594 | } |
|
617 | } | |
|
618 | ||||
|
619 | ||||
|
620 | void CatalogueEventsWidget::keyPressEvent(QKeyEvent *event) | |||
|
621 | { | |||
|
622 | switch (event->key()) { | |||
|
623 | case Qt::Key_Delete: { | |||
|
624 | ui->btnRemove->click(); | |||
|
625 | } | |||
|
626 | default: | |||
|
627 | break; | |||
|
628 | } | |||
|
629 | } |
@@ -76,6 +76,9 CatalogueExplorer::CatalogueExplorer(QWidget *parent) | |||||
76 | ui->events->clear(); |
|
76 | ui->events->clear(); | |
77 | }); |
|
77 | }); | |
78 |
|
78 | |||
|
79 | connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSaved, ui->events, | |||
|
80 | &CatalogueEventsWidget::refresh); | |||
|
81 | ||||
79 | // Updates the inspectot when something is selected in the events |
|
82 | // Updates the inspectot when something is selected in the events | |
80 | connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) { |
|
83 | connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) { | |
81 | if (events.count() == 1) { |
|
84 | if (events.count() == 1) { | |
@@ -135,6 +138,13 CatalogueExplorer::CatalogueExplorer(QWidget *parent) | |||||
135 | sqpApp->catalogueController().updateEventProduct(eventProduct); |
|
138 | sqpApp->catalogueController().updateEventProduct(eventProduct); | |
136 | ui->events->setEventChanges(event, true); |
|
139 | ui->events->setEventChanges(event, true); | |
137 | }); |
|
140 | }); | |
|
141 | ||||
|
142 | connect(ui->events, &CatalogueEventsWidget::eventCataloguesModified, | |||
|
143 | [this](const QVector<std::shared_ptr<DBCatalogue> > &catalogues) { | |||
|
144 | for (auto catalogue : catalogues) { | |||
|
145 | ui->catalogues->setCatalogueChanges(catalogue, true); | |||
|
146 | } | |||
|
147 | }); | |||
138 | } |
|
148 | } | |
139 |
|
149 | |||
140 | CatalogueExplorer::~CatalogueExplorer() |
|
150 | CatalogueExplorer::~CatalogueExplorer() |
@@ -3,7 +3,6 | |||||
3 | #include <QBoxLayout> |
|
3 | #include <QBoxLayout> | |
4 | #include <QToolButton> |
|
4 | #include <QToolButton> | |
5 |
|
5 | |||
6 | const auto VALIDATION_BUTTON_ICON_SIZE = 12; |
|
|||
7 |
|
6 | |||
8 | QWidget *CatalogueExplorerHelper::buildValidationWidget(QWidget *parent, std::function<void()> save, |
|
7 | QWidget *CatalogueExplorerHelper::buildValidationWidget(QWidget *parent, std::function<void()> save, | |
9 | std::function<void()> discard) |
|
8 | std::function<void()> discard) | |
@@ -11,22 +10,21 QWidget *CatalogueExplorerHelper::buildValidationWidget(QWidget *parent, std::fu | |||||
11 | auto widget = new QWidget{parent}; |
|
10 | auto widget = new QWidget{parent}; | |
12 |
|
11 | |||
13 | auto layout = new QHBoxLayout{widget}; |
|
12 | auto layout = new QHBoxLayout{widget}; | |
14 | layout->setContentsMargins(0, 0, 0, 0); |
|
|||
15 | layout->setSpacing(0); |
|
|||
16 |
|
13 | |||
17 | auto btnValid = new QToolButton{widget}; |
|
14 | auto btnValid = new QToolButton{widget}; | |
18 | btnValid->setIcon(QIcon{":/icones/save"}); |
|
15 | btnValid->setIcon(QIcon{":/icones/save"}); | |
19 | btnValid->setIconSize(QSize{VALIDATION_BUTTON_ICON_SIZE, VALIDATION_BUTTON_ICON_SIZE}); |
|
|||
20 | btnValid->setAutoRaise(true); |
|
16 | btnValid->setAutoRaise(true); | |
21 | QObject::connect(btnValid, &QToolButton::clicked, save); |
|
17 | QObject::connect(btnValid, &QToolButton::clicked, save); | |
22 | layout->addWidget(btnValid); |
|
18 | layout->addWidget(btnValid); | |
23 |
|
19 | |||
24 | auto btnDiscard = new QToolButton{widget}; |
|
20 | auto btnDiscard = new QToolButton{widget}; | |
25 | btnDiscard->setIcon(QIcon{":/icones/discard"}); |
|
21 | btnDiscard->setIcon(QIcon{":/icones/discard"}); | |
26 | btnDiscard->setIconSize(QSize{VALIDATION_BUTTON_ICON_SIZE, VALIDATION_BUTTON_ICON_SIZE}); |
|
|||
27 | btnDiscard->setAutoRaise(true); |
|
22 | btnDiscard->setAutoRaise(true); | |
28 | QObject::connect(btnDiscard, &QToolButton::clicked, discard); |
|
23 | QObject::connect(btnDiscard, &QToolButton::clicked, discard); | |
29 | layout->addWidget(btnDiscard); |
|
24 | layout->addWidget(btnDiscard); | |
30 |
|
25 | |||
|
26 | layout->setContentsMargins(0, 0, 0, 0); | |||
|
27 | layout->setSpacing(0); | |||
|
28 | ||||
31 | return widget; |
|
29 | return widget; | |
32 | } |
|
30 | } |
@@ -28,6 +28,9 CatalogueInspectorWidget::CatalogueInspectorWidget(QWidget *parent) | |||||
28 |
|
28 | |||
29 | impl->connectCatalogueUpdateSignals(this, ui); |
|
29 | impl->connectCatalogueUpdateSignals(this, ui); | |
30 | impl->connectEventUpdateSignals(this, ui); |
|
30 | impl->connectEventUpdateSignals(this, ui); | |
|
31 | ||||
|
32 | ui->dateTimeEventTStart->setDisplayFormat(DATETIME_FORMAT); | |||
|
33 | ui->dateTimeEventTEnd->setDisplayFormat(DATETIME_FORMAT); | |||
31 | } |
|
34 | } | |
32 |
|
35 | |||
33 | CatalogueInspectorWidget::~CatalogueInspectorWidget() |
|
36 | CatalogueInspectorWidget::~CatalogueInspectorWidget() | |
@@ -148,8 +151,14 void CatalogueInspectorWidget::setEvent(const std::shared_ptr<DBEvent> &event) | |||||
148 | ui->leEventName->setEnabled(true); |
|
151 | ui->leEventName->setEnabled(true); | |
149 | ui->leEventName->setText(event->getName()); |
|
152 | ui->leEventName->setText(event->getName()); | |
150 | ui->leEventProduct->setEnabled(false); |
|
153 | ui->leEventProduct->setEnabled(false); | |
151 | ui->leEventProduct->setText( |
|
154 | ||
152 | QString::number(event->getEventProducts().size()).append(" product(s)")); |
|
155 | auto eventProducts = event->getEventProducts(); | |
|
156 | QStringList eventProductList; | |||
|
157 | for (auto evtProduct : eventProducts) { | |||
|
158 | eventProductList << evtProduct.getProductId(); | |||
|
159 | } | |||
|
160 | ||||
|
161 | ui->leEventProduct->setText(eventProductList.join(";")); | |||
153 |
|
162 | |||
154 | QString tagList; |
|
163 | QString tagList; | |
155 | auto tags = event->getTagsNames(); |
|
164 | auto tags = event->getTagsNames(); |
@@ -12,6 +12,7 | |||||
12 | #include <ComparaisonPredicate.h> |
|
12 | #include <ComparaisonPredicate.h> | |
13 | #include <DBCatalogue.h> |
|
13 | #include <DBCatalogue.h> | |
14 |
|
14 | |||
|
15 | #include <QKeyEvent> | |||
15 | #include <QMenu> |
|
16 | #include <QMenu> | |
16 | #include <QMessageBox> |
|
17 | #include <QMessageBox> | |
17 | #include <QMimeData> |
|
18 | #include <QMimeData> | |
@@ -110,7 +111,8 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent) | |||||
110 |
|
111 | |||
111 | ui->treeView->header()->setStretchLastSection(false); |
|
112 | ui->treeView->header()->setStretchLastSection(false); | |
112 | ui->treeView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); |
|
113 | ui->treeView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); | |
113 |
ui->treeView->header()->setSectionResizeMode( |
|
114 | ui->treeView->header()->setSectionResizeMode((int)CatalogueTreeModel::Column::Name, | |
|
115 | QHeaderView::Stretch); | |||
114 |
|
116 | |||
115 | connect(ui->treeView, &QTreeView::clicked, this, &CatalogueSideBarWidget::emitSelection); |
|
117 | connect(ui->treeView, &QTreeView::clicked, this, &CatalogueSideBarWidget::emitSelection); | |
116 | connect(ui->treeView->selectionModel(), &QItemSelectionModel::currentChanged, this, |
|
118 | connect(ui->treeView->selectionModel(), &QItemSelectionModel::currentChanged, this, | |
@@ -175,6 +177,7 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent) | |||||
175 | catalogueToItem.second, |
|
177 | catalogueToItem.second, | |
176 | impl->m_TreeModel->indexOf(catalogueToItem.second->parent())); |
|
178 | impl->m_TreeModel->indexOf(catalogueToItem.second->parent())); | |
177 | } |
|
179 | } | |
|
180 | emitSelection(); | |||
178 | } |
|
181 | } | |
179 | } |
|
182 | } | |
180 | }); |
|
183 | }); | |
@@ -393,6 +396,7 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::setHasChanges( | |||||
393 | [this, validationIndex, sideBarWidget, catalogue]() { |
|
396 | [this, validationIndex, sideBarWidget, catalogue]() { | |
394 | if (catalogue) { |
|
397 | if (catalogue) { | |
395 | sqpApp->catalogueController().saveCatalogue(catalogue); |
|
398 | sqpApp->catalogueController().saveCatalogue(catalogue); | |
|
399 | emit sideBarWidget->catalogueSaved(catalogue); | |||
396 | } |
|
400 | } | |
397 | setHasChanges(false, validationIndex, sideBarWidget); |
|
401 | setHasChanges(false, validationIndex, sideBarWidget); | |
398 | }, |
|
402 | }, | |
@@ -413,6 +417,8 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::setHasChanges( | |||||
413 | } |
|
417 | } | |
414 | }); |
|
418 | }); | |
415 | sideBarWidget->ui->treeView->setIndexWidget(validationIndex, widget); |
|
419 | sideBarWidget->ui->treeView->setIndexWidget(validationIndex, widget); | |
|
420 | sideBarWidget->ui->treeView->header()->resizeSection( | |||
|
421 | (int)CatalogueTreeModel::Column::Validation, QHeaderView::ResizeToContents); | |||
416 | } |
|
422 | } | |
417 | } |
|
423 | } | |
418 | else { |
|
424 | else { | |
@@ -427,3 +433,15 bool CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::hasChanges(const QMo | |||||
427 | auto validationIndex = index.sibling(index.row(), (int)CatalogueTreeModel::Column::Validation); |
|
433 | auto validationIndex = index.sibling(index.row(), (int)CatalogueTreeModel::Column::Validation); | |
428 | return treeView->indexWidget(validationIndex) != nullptr; |
|
434 | return treeView->indexWidget(validationIndex) != nullptr; | |
429 | } |
|
435 | } | |
|
436 | ||||
|
437 | ||||
|
438 | void CatalogueSideBarWidget::keyPressEvent(QKeyEvent *event) | |||
|
439 | { | |||
|
440 | switch (event->key()) { | |||
|
441 | case Qt::Key_Delete: { | |||
|
442 | ui->btnRemove->click(); | |||
|
443 | } | |||
|
444 | default: | |||
|
445 | break; | |||
|
446 | } | |||
|
447 | } |
@@ -111,16 +111,13 bool CatalogueTreeItem::dropMimeData(const QMimeData *data, Qt::DropAction actio | |||||
111 | if (action == Qt::MoveAction) { |
|
111 | if (action == Qt::MoveAction) { | |
112 | for (auto catalogue : sourceCatalogues) { |
|
112 | for (auto catalogue : sourceCatalogues) { | |
113 | catalogue->removeEvent(event->getUniqId()); |
|
113 | catalogue->removeEvent(event->getUniqId()); | |
|
114 | sqpApp->catalogueController().updateCatalogue(catalogue); | |||
114 | } |
|
115 | } | |
115 | } |
|
116 | } | |
116 |
|
117 | |||
117 | impl->m_Catalogue->addEvent(event->getUniqId()); |
|
118 | impl->m_Catalogue->addEvent(event->getUniqId()); | |
|
119 | sqpApp->catalogueController().updateCatalogue(impl->m_Catalogue); | |||
118 | } |
|
120 | } | |
119 |
|
||||
120 | for (auto catalogue : sourceCatalogues) { |
|
|||
121 | sqpApp->catalogueController().updateCatalogue(catalogue); |
|
|||
122 | } |
|
|||
123 | sqpApp->catalogueController().updateCatalogue(impl->m_Catalogue); |
|
|||
124 | } |
|
121 | } | |
125 |
|
122 | |||
126 | std::shared_ptr<DBCatalogue> CatalogueTreeItem::catalogue() const |
|
123 | std::shared_ptr<DBCatalogue> CatalogueTreeItem::catalogue() const |
@@ -13,8 +13,6 Q_LOGGING_CATEGORY(LOG_AxisRenderingUtils, "AxisRenderingUtils") | |||||
13 |
|
13 | |||
14 | namespace { |
|
14 | namespace { | |
15 |
|
15 | |||
16 | const auto DATETIME_FORMAT = QStringLiteral("yyyy/MM/dd hh:mm:ss:zzz"); |
|
|||
17 |
|
||||
18 | /// Format for datetimes on a axis |
|
16 | /// Format for datetimes on a axis | |
19 | const auto DATETIME_TICKER_FORMAT = QStringLiteral("yyyy/MM/dd \nhh:mm:ss"); |
|
17 | const auto DATETIME_TICKER_FORMAT = QStringLiteral("yyyy/MM/dd \nhh:mm:ss"); | |
20 |
|
18 |
@@ -4,7 +4,7 | |||||
4 | #include "Common/DateUtils.h" |
|
4 | #include "Common/DateUtils.h" | |
5 | #include "Visualization/VisualizationSelectionZoneItem.h" |
|
5 | #include "Visualization/VisualizationSelectionZoneItem.h" | |
6 |
|
6 | |||
7 | const auto DATETIME_FORMAT = QStringLiteral("yyyy/MM/dd hh:mm:ss"); |
|
7 | const auto DATETIME_FORMAT_S = QStringLiteral("yyyy/MM/dd hh:mm:ss"); | |
8 |
|
8 | |||
9 | struct VisualizationMultiZoneSelectionDialog::VisualizationMultiZoneSelectionDialogPrivate { |
|
9 | struct VisualizationMultiZoneSelectionDialog::VisualizationMultiZoneSelectionDialogPrivate { | |
10 | QVector<VisualizationSelectionZoneItem *> m_Zones; |
|
10 | QVector<VisualizationSelectionZoneItem *> m_Zones; | |
@@ -46,9 +46,9 void VisualizationMultiZoneSelectionDialog::setZones( | |||||
46 | } |
|
46 | } | |
47 |
|
47 | |||
48 | auto range = zone->range(); |
|
48 | auto range = zone->range(); | |
49 | name += DateUtils::dateTime(range.m_TStart).toString(DATETIME_FORMAT); |
|
49 | name += DateUtils::dateTime(range.m_TStart).toString(DATETIME_FORMAT_S); | |
50 | name += " - "; |
|
50 | name += " - "; | |
51 | name += DateUtils::dateTime(range.m_TEnd).toString(DATETIME_FORMAT); |
|
51 | name += DateUtils::dateTime(range.m_TEnd).toString(DATETIME_FORMAT_S); | |
52 |
|
52 | |||
53 | auto item = new QListWidgetItem(name, ui->listWidget); |
|
53 | auto item = new QListWidgetItem(name, ui->listWidget); | |
54 | item->setSelected(zone->selected()); |
|
54 | item->setSelected(zone->selected()); |
@@ -270,10 +270,10 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V | |||||
270 | break; |
|
270 | break; | |
271 | } |
|
271 | } | |
272 | graphChild->setFlags(GraphFlag::DisableAll); |
|
272 | graphChild->setFlags(GraphFlag::DisableAll); | |
273 | qCDebug(LOG_VisualizationZoneWidget()) |
|
273 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: Range before: ") | |
274 |
|
|
274 | << graphChild->graphRange(); | |
275 | qCDebug(LOG_VisualizationZoneWidget()) |
|
275 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: Range after : ") | |
276 | << tr("TORM: Range after : ") << graphChildRange; |
|
276 | << graphChildRange; | |
277 | qCDebug(LOG_VisualizationZoneWidget()) |
|
277 | qCDebug(LOG_VisualizationZoneWidget()) | |
278 | << tr("TORM: child dt") << graphChildRange.m_TEnd - graphChildRange.m_TStart; |
|
278 | << tr("TORM: child dt") << graphChildRange.m_TEnd - graphChildRange.m_TStart; | |
279 | graphChild->setGraphRange(graphChildRange); |
|
279 | graphChild->setGraphRange(graphChildRange); |
@@ -139,7 +139,6 | |||||
139 | </widget> |
|
139 | </widget> | |
140 | <resources> |
|
140 | <resources> | |
141 | <include location="../../resources/sqpguiresources.qrc"/> |
|
141 | <include location="../../resources/sqpguiresources.qrc"/> | |
142 | <include location="../../resources/sqpguiresources.qrc"/> |
|
|||
143 | </resources> |
|
142 | </resources> | |
144 | <connections/> |
|
143 | <connections/> | |
145 | </ui> |
|
144 | </ui> |
General Comments 0
You need to be logged in to leave comments.
Login now