Commit a893d578 authored by Jan Becker's avatar Jan Becker
Browse files

[gui] Use timeToString to display times either in local time or GMT

parent 7e5fad90
......@@ -83,6 +83,9 @@
<parameter name="alternateForeground" type="color" default="808080">
<description>A general trace color of the alternate trace (eg scheli).</description>
</parameter>
<parameter name="spectrogram" type="color" default="000000">
<description>The trace color used on top of a spectrogram.</description>
</parameter>
<parameter name="gaps" type="color" default="FFFF0040">
<description>The color of data gaps in trace views.</description>
</parameter>
......@@ -528,6 +531,13 @@
</description>
</parameter>
</group>
<group name="dateTime">
<parameter name="useLocalTime" type="boolean" default="false">
<description>
Display times in localtime or UTC (default).
</description>
</parameter>
</group>
</group>
<group name="picker">
<parameter name="filters" type="list:string" default="&quot;BP 0.1 - 1 Hz 3rd order;BW(3,0.1,1)&quot;,&quot;BP 0.1 - 2 Hz 3rd order;BW(3,0.1,2)&quot;,&quot;BP 0.4 - 1 Hz 3rd order;BW(3,0.4,1)&quot;,&quot;@BP 0.7 - 2 Hz 3rd order;BW(3,0.7,2)&quot;&quot;BP 1 - 3 Hz 3rd order;BW(3,1.0,3)&quot;,&quot;BP 2 - 4 Hz 3rd order;BW(3,2.0,4)&quot;,&quot;BP 3 - 6 Hz 3rd order;BW(3,3.0,6)&quot;,&quot;BP 4 - 8 Hz 3rd order;BW(3,4.0,8)&quot;,&quot;BP 1 - 5 Hz 3rd order;BW(3,1.0,5)&quot;,&quot;BP 0.7 - 2 Hz + STA/LTA(1,50);RMHP(10)->ITAPER(30)->BW(3,0.7,2)->STALTA(1,50)&quot;">
......
......@@ -34,9 +34,9 @@ QTableWidgetItem* createTableWidgetItem(const QString& text, bool isActiveEvent
EventTableWidget::EventTableWidget(QWidget* parent)
: QTableWidget(parent),
_controlKeyPressed(false),
_selectedRow(-1) {
: QTableWidget(parent)
, _controlKeyPressed(false)
, _selectedRow(-1) {
uiInit();
......@@ -46,7 +46,6 @@ EventTableWidget::EventTableWidget(QWidget* parent)
EventTableWidget::~EventTableWidget() {
}
......@@ -132,7 +131,8 @@ void EventTableWidget::handleCellPressedEvent(int row) {
setSelectedRow(-1);
clearSelection();
emit eventDeselected(eventId);
} else {
}
else {
setSelectedRow(row);
emit eventSelected(eventId);
}
......@@ -144,13 +144,13 @@ void EventTableWidget::handleCellPressedEvent(int row) {
void EventTableWidget::uiInit() {
QStringList tableHeader;
tableHeader << "Event" << "Origin Time" << "Magnitude" << "Magnitude Type"
<< "Region" << "Latitude" << "Longitude" << "Depth";
<< "Region" << "Latitude" << "Longitude" << "Depth";
setRowCount(0);
setColumnCount(tableHeader.size());
setHorizontalHeaderLabels(tableHeader);
QHeaderView* horizontalHeaderRef = horizontalHeader();
QHeaderView *horizontalHeaderRef = horizontalHeader();
horizontalHeaderRef->setResizeMode(horizontalHeaderRef->count()-1, QHeaderView::Stretch);
resizeColumnsToContents();
......@@ -158,7 +158,7 @@ void EventTableWidget::uiInit() {
setSelectionBehavior(QAbstractItemView::SelectRows);
setSelectionMode(QAbstractItemView::SingleSelection);
QVBoxLayout* layout = new QVBoxLayout;
QVBoxLayout *layout = new QVBoxLayout;
setLayout(layout);
QSizePolicy sizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
......
This diff is collapsed.
......@@ -163,8 +163,6 @@ class StationInfoWidget : public InfoWidget {
void resizeColumnsToContent();
private slots:
// void showWaveformData();
void updateRecordWidget(Seiscomp::Record* record);
void updateRecordWidgetAlignment();
......@@ -198,7 +196,7 @@ class StationInfoWidget : public InfoWidget {
class OriginInfoWidget : public InfoWidget {
Q_OBJECT
private:
enum OriginInfoTag {
ORIGIN_ID_TAG,
......@@ -241,6 +239,9 @@ class OriginInfoWidget : public InfoWidget {
void setMinimumDistance(const QString& minimumDistance);
void setMaximumDistance(const QString& maximumDistance);
private slots:
void showDetails();
private:
void uiInit();
......
......@@ -23,6 +23,7 @@
#include <seiscomp3/gui/core/application.h>
#include <seiscomp3/gui/core/messages.h>
#include <seiscomp3/gui/core/utils.h>
#include <seiscomp3/gui/datamodel/stationsymbol.h>
#include <seiscomp3/gui/datamodel/origindialog.h>
#include <seiscomp3/gui/datamodel/ttdecorator.h>
......@@ -117,7 +118,7 @@ void addEventWidgetRowData(EventTableWidget::RowData& rowData,
const EventData& eventData,
const DataModel::Origin* origin) {
QString eventId = QString(eventData.id().c_str());
QString originTime(origin->time().value().toString("%d.%m.%y %T").c_str());
QString originTime = Gui::timeToString(origin->time().value(), "%d.%m.%y %T");
QString eventRegion(DataModel::eventRegion(eventData.object()).c_str());
......@@ -168,7 +169,7 @@ void configureInfoWidgetForRecordAcquisition(StationInfoWidget* infoWidget,
void setInfoWidgetContent(StationInfoWidget* infoWidget, const DataModel::Amplitude* amplitude) {
try {
QString time = amplitude->timeWindow().reference().toString("%F-%T").c_str();
QString time = Gui::timeToString(amplitude->timeWindow().reference(), "%F-%T");
infoWidget->setAmplitudeTime(time);
}
catch ( Core::ValueException& ) {}
......@@ -178,8 +179,8 @@ void setInfoWidgetContent(StationInfoWidget* infoWidget, const DataModel::Amplit
try {
Core::Time amplTime(amplitude->timeWindow().reference()
+ Core::TimeSpan(amplitude->timeWindow().end()));
QString amplitudeValueTime = amplTime.toString("%F-%T").c_str();
+ Core::TimeSpan(amplitude->timeWindow().end()));
QString amplitudeValueTime = Gui::timeToString(amplTime, "%F-%T");
infoWidget->setAmplitudeMaxValueTime(amplitudeValueTime);
}
catch ( Core::ValueException& ) {}
......@@ -229,11 +230,12 @@ void setInfoWidgetContent(StationInfoWidget* infoWidget, StationData* stationDat
}
void setInfoWidgetContent(OriginInfoWidget* infoWidget, const DataModel::Origin* origin,
void setInfoWidgetContent(OriginInfoWidget* infoWidget, const std::string &eventID,
const DataModel::Origin* origin,
const std::string& preferredMagnitudeId) {
infoWidget->setPreferredOriginId(origin->publicID().c_str());
QString time = origin->time().value().toString("%F - %T").c_str();
QString time = Gui::timeToString(origin->time().value(), "%F - %T");
infoWidget->setTime(time);
QString latitude = QString("%1").arg(origin->latitude());
......@@ -883,7 +885,7 @@ bool MvMainWindow::handleMapContextMenu(QContextMenuEvent* contextMenuEvent) {
QAction* MvMainWindow::createAndConfigureContextMenuAction(const QString& title, Gui::Map::Symbol* mapSymbol) {
QAction* MvMainWindow::createAndConfigureContextMenuAction(const QString &title, Gui::Map::Symbol *mapSymbol) {
QAction* action = new QAction(title, NULL);
QVariant variant = qVariantFromValue(static_cast<void*>(mapSymbol));
......@@ -1641,14 +1643,14 @@ void MvMainWindow::updateInfoWidget(const DataModel::Amplitude* amplitude) {
void MvMainWindow::updateInfoWidget(const DataModel::Event* event) {
if ( EventInfoWidgetRegistry::Instance()->count() == 0 ) return;
std::string eventId = event->publicID();
const std::string &eventId = event->publicID();
OriginInfoWidget* infoWidget = EventInfoWidgetRegistry::Instance()->find(eventId);
if ( !infoWidget ) return;
std::string originId = event->preferredOriginID();
DataModel::Origin* origin = _eventDataRepository.findOrigin(originId);
setInfoWidgetContent(infoWidget, origin, event->preferredMagnitudeID());
setInfoWidgetContent(infoWidget, eventId, origin, event->preferredMagnitudeID());
infoWidget->updateContent();
}
......@@ -1963,7 +1965,7 @@ void MvMainWindow::showInfoWidget() {
QVariant variant = contextMenuAction->data();
void* data = variant.value<void*>();
Gui::Map::Symbol* mapSymbol = static_cast<Gui::Map::Symbol*>(data);
Gui::Map::Symbol *mapSymbol = static_cast<Gui::Map::Symbol*>(data);
std::string mapSymbolId = mapSymbol->id();
......@@ -1994,15 +1996,15 @@ void MvMainWindow::showInfoWidget() {
::showInfoWidget(infoWidget);
}
else if ( mapSymbol->typeInfo() == Gui::OriginSymbol::TypeInfo() ) {
OriginInfoWidget* infoWidget = new OriginInfoWidget(mapSymbolId, this);
OriginInfoWidget *infoWidget = new OriginInfoWidget(mapSymbolId, this);
std::string eventId = mapSymbol->id();
EventData* eventData = _eventDataRepository.findEvent(eventId);
const std::string &eventId = mapSymbol->id();
EventData *eventData = _eventDataRepository.findEvent(eventId);
std::string preferredOriginId = eventData->object()->preferredOriginID();
DataModel::Origin* origin = _eventDataRepository.findOrigin(preferredOriginId);
DataModel::Origin *origin = _eventDataRepository.findOrigin(preferredOriginId);
setInfoWidgetContent(infoWidget, origin, eventData->object()->preferredMagnitudeID());
setInfoWidgetContent(infoWidget, eventId, origin, eventData->object()->preferredMagnitudeID());
::showInfoWidget(infoWidget);
}
}
......
......@@ -15,6 +15,8 @@
#define SEISCOMP_COMPONENT Gui::QcView
#include <seiscomp3/logging/log.h>
#include <seiscomp3/core/baseobject.h>
#include <seiscomp3/gui/core/utils.h>
#include "qcmodel.h"
#include "qcviewconfig.h"
......@@ -548,8 +550,8 @@ QString QcModel::wfq2str(const DataModel::WaveformQuality* wfq) const {
QString text = QString();
text.append(QString("value: %1 (+/- %2)\n").arg(wfq->value()).arg(wfq->lowerUncertainty()));
text.append(QString("start: %1\n").arg(wfq->start().toString("%Y-%m-%d %H:%M:%S UTC").c_str()));
try { text.append(QString("end : %1\n").arg(wfq->end().toString("%Y-%m-%d %H:%M:%S UTC").c_str())); }
text.append(QString("start: %1\n").arg(Gui::timeToString(wfq->start(), "%Y-%m-%d %H:%M:%S UTC")));
try { text.append(QString("end : %1\n").arg(Gui::timeToString(wfq->end(), "%Y-%m-%d %H:%M:%S UTC"))); }
catch(...) {};
try { text.append(QString("window length: %1 s").arg(wfq->windowLength())); }
catch(...) {};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment