##// END OF EJS Templates
Fix bug time precision with catalogue
perrinel -
r1315:b20dcec1c57b
parent child
Show More
@@ -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 */
@@ -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 {
@@ -48,10 +48,14 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 ? DateUtils::dateTime(event->getTStart())
51 return nbEventProducts(event) > 0
52 ? DateUtils::dateTime(event->getTStart())
53 .toString(DATETIME_FORMAT_ONE_LINE)
52 : QVariant{};
54 : QVariant{};
53 case CatalogueEventsModel::Column::TEnd:
55 case CatalogueEventsModel::Column::TEnd:
54 return nbEventProducts(event) > 0 ? DateUtils::dateTime(event->getTEnd())
56 return nbEventProducts(event) > 0
57 ? DateUtils::dateTime(event->getTEnd())
58 .toString(DATETIME_FORMAT_ONE_LINE)
55 : QVariant{};
59 : QVariant{};
56 case CatalogueEventsModel::Column::Product: {
60 case CatalogueEventsModel::Column::Product: {
57 auto eventProducts = event->getEventProducts();
61 auto eventProducts = event->getEventProducts();
@@ -105,9 +109,11 struct CatalogueEventsModel::CatalogueEventsModelPrivate {
105 case CatalogueEventsModel::Column::Name:
109 case CatalogueEventsModel::Column::Name:
106 return eventProduct->getProductId();
110 return eventProduct->getProductId();
107 case CatalogueEventsModel::Column::TStart:
111 case CatalogueEventsModel::Column::TStart:
108 return DateUtils::dateTime(eventProduct->getTStart());
112 return DateUtils::dateTime(eventProduct->getTStart())
113 .toString(DATETIME_FORMAT_ONE_LINE);
109 case CatalogueEventsModel::Column::TEnd:
114 case CatalogueEventsModel::Column::TEnd:
110 return DateUtils::dateTime(eventProduct->getTEnd());
115 return DateUtils::dateTime(eventProduct->getTEnd())
116 .toString(DATETIME_FORMAT_ONE_LINE);
111 case CatalogueEventsModel::Column::Product:
117 case CatalogueEventsModel::Column::Product:
112 return eventProduct->getProductId();
118 return eventProduct->getProductId();
113 case CatalogueEventsModel::Column::Tags:
119 case CatalogueEventsModel::Column::Tags:
@@ -355,6 +355,7 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
355 ui->treeView->setDragDropMode(QAbstractItemView::DragDrop);
355 ui->treeView->setDragDropMode(QAbstractItemView::DragDrop);
356 ui->treeView->setDragEnabled(true);
356 ui->treeView->setDragEnabled(true);
357
357
358
358 connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) {
359 connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) {
359 if (checked) {
360 if (checked) {
360 ui->btnChart->setChecked(false);
361 ui->btnChart->setChecked(false);
@@ -453,6 +454,10 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
453 QHeaderView::Interactive);
454 QHeaderView::Interactive);
454 ui->treeView->header()->resizeSection((int)CatalogueEventsModel::Column::Validation,
455 ui->treeView->header()->resizeSection((int)CatalogueEventsModel::Column::Validation,
455 VALIDATION_COLUMN_SIZE);
456 VALIDATION_COLUMN_SIZE);
457 ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::TStart,
458 QHeaderView::ResizeToContents);
459 ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::TEnd,
460 QHeaderView::ResizeToContents);
456 ui->treeView->header()->setSortIndicatorShown(true);
461 ui->treeView->header()->setSortIndicatorShown(true);
457
462
458 connect(impl->m_Model, &CatalogueEventsModel::modelSorted, [this]() {
463 connect(impl->m_Model, &CatalogueEventsModel::modelSorted, [this]() {
@@ -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()
@@ -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());
@@ -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