<div>Peter,</div><div><br></div>This patch looks right to me.<div><br></div><div><div class="gmail_extra">cbn</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 21, 2012 at 3:31 PM, Peter Kümmel <span dir="ltr"><<a href="mailto:syntheticpp@gmx.net" target="_blank">syntheticpp@gmx.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 21.11.2012 20:27, Barth Netterfield wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm not sure about this.<br>
<br>
There are now two ways that the axis display format is decided:<br>
   i) through the plot dialog - where the format can be set as the default<br>
"[x] Save as Default" in the plot dialog.<br>
   ii) by using the datasource input format.<br>
<br>
I think:<br>
   - it would be better if the plot dialog default format were used in the<br>
data wizard and not the datasource input format.<br>
   - datasources should return isTime() rather than timeFormatString() to<br>
let the datawizard know that it is a time axis, so it can use the dialog<br>
defaults values.  The datawizard then only needs<br>
to plot->xAxis()-><u></u>setAxisInterpret(true); if ds->isTime().  Then the<br>
existing default system already in place will do its work.<br>
</blockquote>
<br></div>
Yes, this would prevent formats like "dd.MM.yyyy; hh:mm:ss;".<br>
Attached a patch witch you suggestions. But "Force offset" as default doesn't work.<br>
<br>
Do you know the intention of the existing ds/time interface? Is it obsolete?<br>
Should we use only these functions instead of adding new ones?<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
To make the dialog system easier to work with/discover, I could create a<br>
plot defaults dialog to set them all.<br>
<br>
<br>
<br>
On Wed, Nov 21, 2012 at 4:05 AM, Peter Kümmel <<a href="mailto:syntheticpp@gmx.net" target="_blank">syntheticpp@gmx.net</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
SVN commit 1325782 by kuemmel:<br>
<br>
use time format defined in ASCII dialog<br>
<br>
  M  +5 -0      datasources/ascii/asciisource.<u></u>cpp<br>
  M  +2 -0      datasources/ascii/asciisource.<u></u>h<br>
  M  +5 -3      datasources/ascii/kst_atof.cpp<br>
  M  +3 -0      libkst/datasource.cpp<br>
  M  +2 -0      libkst/datasource.h<br>
  M  +9 -0      libkstapp/datawizard.cpp<br>
<br>
<br>
--- branches/work/kst/portto4/kst/<u></u>src/datasources/ascii/<u></u>asciisource.cpp<br>
#1325781:1325782<br>
@@ -650,6 +650,11 @@<br>
    }<br>
  }<br>
<br>
<br>
+//---------------------------<u></u>------------------------------<u></u>------------------------------<u></u>----<br>
+QString AsciiSource::timeFormatString(<u></u>) const<br>
+{<br>
+  return _config._indexTimeFormat;<br>
+}<br>
<br>
<br>
  //----------------------------<u></u>------------------------------<u></u>------------------------------<u></u>---<br>
  Kst::ObjectList<Kst::Object> AsciiSource::autoCurves(<u></u>ObjectStore&<br>
objectStore)<br>
--- branches/work/kst/portto4/kst/<u></u>src/datasources/ascii/<u></u>asciisource.h<br>
#1325781:1325782<br>
@@ -53,6 +53,8 @@<br>
<br>
      int sampleForTime(const QDateTime& time, bool *ok);<br>
<br>
+    QString timeFormatString() const;<br>
+<br>
      virtual void reset();<br>
<br>
      virtual const QString& typeString() const;<br>
--- branches/work/kst/portto4/kst/<u></u>src/datasources/ascii/kst_<u></u>atof.cpp<br>
#1325781:1325782<br>
@@ -215,9 +215,11 @@<br>
    const QString time = QString::fromLatin1(p, end);<br>
    double sec = Kst::NOPOINT;<br>
    if (_timeWithDate) {<br>
-    const QDateTime t = QDateTime::fromString(time, _timeFormat);<br>
-    if (t.isValid())<br>
-      sec = QDateTime::fromString(time, _timeFormat).<u></u>toMSecsSinceEpoch()<br>
/ 1000.0;<br>
+    QDateTime t = QDateTime::fromString(time, _timeFormat);<br>
+    if (t.isValid()) {<br>
+      t.setTimeSpec(Qt::UTC);<br>
+      sec = t.toMSecsSinceEpoch() / 1000.0;<br>
+    }<br>
    } else {<br>
      const QTime t = QTime::fromString(time, _timeFormat);<br>
      if (t.isValid())<br>
--- branches/work/kst/portto4/kst/<u></u>src/libkst/datasource.cpp<br>
#1325781:1325782<br>
@@ -353,6 +353,9 @@<br>
  }<br>
<br>
<br>
+QString DataSource::timeFormatString() const {<br>
+  return QString();<br>
+}<br>
<br>
  double DataSource::<u></u>relativeTimeForSample(int sample, bool *ok) {<br>
    Q_UNUSED(sample)<br>
--- branches/work/kst/portto4/kst/<u></u>src/libkst/datasource.h #1325781:1325782<br>
@@ -134,6 +134,8 @@<br>
<br>
      virtual QDateTime timeForSample(int sample, bool *ok = 0L);<br>
<br>
+    virtual QString timeFormatString() const;<br>
+<br>
      // in (ms)<br>
      virtual double relativeTimeForSample(int sample, bool *ok = 0L);<br>
<br>
--- branches/work/kst/portto4/kst/<u></u>src/libkstapp/datawizard.cpp<br>
#1325781:1325782<br>
@@ -866,6 +866,8 @@<br>
      }<br>
    }<br>
<br>
+  QString timeFormatString = ds->timeFormatString();<br>
+<br>
    ds->unlock();<br>
    if (memoryRequested > memoryAvailable) {<br>
      QApplication::<u></u>restoreOverrideCursor();<br>
@@ -1218,6 +1220,13 @@<br>
        }<br>
      }<br>
      foreach (PlotItem* plot, plotList) {<br>
+      if (!timeFormatString.isEmpty()) {<br>
+        plot->xAxis()-><u></u>setAxisInterpret(true);<br>
+        plot->xAxis()->setAxisDisplay(<u></u>AXIS_DISPLAY_QTDATETIME_<u></u>FORMAT);<br>
+        plot->xAxis()-><u></u>setAxisDisplayFormatString(<u></u>timeFormatString);<br>
+        // start axis with first time in data<br>
+        plot->xAxis()-><u></u>setAxisForceOffsetMin(true);<br>
+      }<br>
        plot->update();<br>
        plot->view()->appendToLayout(<u></u>layout_type, plot, num_columns);<br>
      }<br>
______________________________<u></u>_________________<br>
Kst mailing list<br>
<a href="mailto:Kst@kde.org" target="_blank">Kst@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kst" target="_blank">https://mail.kde.org/mailman/<u></u>listinfo/kst</a><br>
<br>
</blockquote>
<br>
<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
Kst mailing list<br>
<a href="mailto:Kst@kde.org" target="_blank">Kst@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kst" target="_blank">https://mail.kde.org/mailman/<u></u>listinfo/kst</a><br>
<br>
</blockquote>
</div></div><br>_______________________________________________<br>
Kst mailing list<br>
<a href="mailto:Kst@kde.org">Kst@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kst" target="_blank">https://mail.kde.org/mailman/listinfo/kst</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse;color:rgb(136,136,136)">C. Barth Netterfield<br>University of Toronto<br>
416-845-0946</span><div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse;color:rgb(136,136,136)"><br></span></div><br>
</div></div>