[Kst] branches/work/kst/portto4/kst/src
Peter Kümmel
syntheticpp at gmx.net
Wed Nov 21 10:05:41 UTC 2012
SVN commit 1325782 by kuemmel:
use time format defined in ASCII dialog
M +5 -0 datasources/ascii/asciisource.cpp
M +2 -0 datasources/ascii/asciisource.h
M +5 -3 datasources/ascii/kst_atof.cpp
M +3 -0 libkst/datasource.cpp
M +2 -0 libkst/datasource.h
M +9 -0 libkstapp/datawizard.cpp
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1325781:1325782
@@ -650,6 +650,11 @@
}
}
+//-------------------------------------------------------------------------------------------
+QString AsciiSource::timeFormatString() const
+{
+ return _config._indexTimeFormat;
+}
//-------------------------------------------------------------------------------------------
Kst::ObjectList<Kst::Object> AsciiSource::autoCurves(ObjectStore& objectStore)
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.h #1325781:1325782
@@ -53,6 +53,8 @@
int sampleForTime(const QDateTime& time, bool *ok);
+ QString timeFormatString() const;
+
virtual void reset();
virtual const QString& typeString() const;
--- branches/work/kst/portto4/kst/src/datasources/ascii/kst_atof.cpp #1325781:1325782
@@ -215,9 +215,11 @@
const QString time = QString::fromLatin1(p, end);
double sec = Kst::NOPOINT;
if (_timeWithDate) {
- const QDateTime t = QDateTime::fromString(time, _timeFormat);
- if (t.isValid())
- sec = QDateTime::fromString(time, _timeFormat).toMSecsSinceEpoch() / 1000.0;
+ QDateTime t = QDateTime::fromString(time, _timeFormat);
+ if (t.isValid()) {
+ t.setTimeSpec(Qt::UTC);
+ sec = t.toMSecsSinceEpoch() / 1000.0;
+ }
} else {
const QTime t = QTime::fromString(time, _timeFormat);
if (t.isValid())
--- branches/work/kst/portto4/kst/src/libkst/datasource.cpp #1325781:1325782
@@ -353,6 +353,9 @@
}
+QString DataSource::timeFormatString() const {
+ return QString();
+}
double DataSource::relativeTimeForSample(int sample, bool *ok) {
Q_UNUSED(sample)
--- branches/work/kst/portto4/kst/src/libkst/datasource.h #1325781:1325782
@@ -134,6 +134,8 @@
virtual QDateTime timeForSample(int sample, bool *ok = 0L);
+ virtual QString timeFormatString() const;
+
// in (ms)
virtual double relativeTimeForSample(int sample, bool *ok = 0L);
--- branches/work/kst/portto4/kst/src/libkstapp/datawizard.cpp #1325781:1325782
@@ -866,6 +866,8 @@
}
}
+ QString timeFormatString = ds->timeFormatString();
+
ds->unlock();
if (memoryRequested > memoryAvailable) {
QApplication::restoreOverrideCursor();
@@ -1218,6 +1220,13 @@
}
}
foreach (PlotItem* plot, plotList) {
+ if (!timeFormatString.isEmpty()) {
+ plot->xAxis()->setAxisInterpret(true);
+ plot->xAxis()->setAxisDisplay(AXIS_DISPLAY_QTDATETIME_FORMAT);
+ plot->xAxis()->setAxisDisplayFormatString(timeFormatString);
+ // start axis with first time in data
+ plot->xAxis()->setAxisForceOffsetMin(true);
+ }
plot->update();
plot->view()->appendToLayout(layout_type, plot, num_columns);
}
More information about the Kst
mailing list