[Kst] branches/work/kst/portto4/kst/src
Peter Kümmel
syntheticpp at gmx.net
Wed Nov 21 20:31:47 UTC 2012
On 21.11.2012 20:27, Barth Netterfield wrote:
> I'm not sure about this.
>
> There are now two ways that the axis display format is decided:
> i) through the plot dialog - where the format can be set as the default
> "[x] Save as Default" in the plot dialog.
> ii) by using the datasource input format.
>
> I think:
> - it would be better if the plot dialog default format were used in the
> data wizard and not the datasource input format.
> - datasources should return isTime() rather than timeFormatString() to
> let the datawizard know that it is a time axis, so it can use the dialog
> defaults values. The datawizard then only needs
> to plot->xAxis()->setAxisInterpret(true); if ds->isTime(). Then the
> existing default system already in place will do its work.
Yes, this would prevent formats like "dd.MM.yyyy; hh:mm:ss;".
Attached a patch witch you suggestions. But "Force offset" as default doesn't work.
Do you know the intention of the existing ds/time interface? Is it obsolete?
Should we use only these functions instead of adding new ones?
>
> To make the dialog system easier to work with/discover, I could create a
> plot defaults dialog to set them all.
>
>
>
> On Wed, Nov 21, 2012 at 4:05 AM, Peter Kümmel <syntheticpp at gmx.net> wrote:
>
>> 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);
>> }
>> _______________________________________________
>> Kst mailing list
>> Kst at kde.org
>> https://mail.kde.org/mailman/listinfo/kst
>>
>
>
>
>
>
> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: isTime.patch
Type: text/x-patch
Size: 2946 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kst/attachments/20121121/22b5a9b1/attachment.patch>
More information about the Kst
mailing list