[Kst] kdeextragear-2/kst/kst [POSSIBLY UNSAFE]

Andrew Walker arwalker at sumusltd.com
Tue Oct 12 21:13:52 CEST 2004


CVS commit by arwalker: 

Add additional x-axis date display options.


  M +21 -6     kst2dplot.cpp   1.281 [POSSIBLY UNSAFE: printf]
  M +2 -0      kst2dplot.h   1.117
  M +2 -0      kstplotdialog_i.cpp   1.105


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.280:1.281
@@ -442,5 +442,7 @@ void Kst2DPlot::commonConstructor(const 
   _labelList.setAutoDelete(true);
 
-  //Let this Kst2DPlot register doc changes.
+  //
+  // let this Kst2DPlot register doc changes.
+  //
   connect(this, SIGNAL(modified()), KstApp::inst(), SLOT(registerDocChange()));
 }
@@ -468,6 +470,6 @@ Kst2DPlot::~Kst2DPlot() {
 /*** initialize the fonts in a plot: boost size by font_size ***/
 void Kst2DPlot::initFonts(const QFont& in_font, int font_size) {
-  // Still have to set symbol font info as well //
-  // We also may want to change different label fonts separately. //
+  // Still have to set symbol font info as well
+  // We also may want to change different label fonts separately.
   int point_size = in_font.pointSize() + font_size;
 
@@ -1212,4 +1214,5 @@ double Kst2DPlot::convertTimeDiffValueTo
 
 void Kst2DPlot::convertJDToDateString(QString& label, uint& length, KstXAxisDisplay display, double dJD) {
+  QDate date;
   QRect pr = GetPlotRegion();
   double xmin, ymin, xmax, ymax;
@@ -1339,4 +1342,12 @@ void Kst2DPlot::convertJDToDateString(QS
       label.sprintf("%02d/%02d/%d %02d:%02d:%02.*f", day, month, year, hour, minute, accuracy, second);
       break;
+    case X_AXIS_DISPLAY_QTTEXTDATEHHMMSS_SS:
+      date.setYMD(year, month, day);
+      label.sprintf("%s %02d:%02d:%02.*f", date.toString(Qt::TextDate).ascii(), hour, minute, accuracy, second);
+      break;
+    case X_AXIS_DISPLAY_QTLOCALDATEHHMMSS_SS:
+      date.setYMD(year, month, day);
+      label.sprintf("%s %02d:%02d:%02.*f", date.toString(Qt::LocalDate).ascii(), hour, minute, accuracy, second);
+      break;
     default:
       break;
@@ -1368,8 +1379,8 @@ void Kst2DPlot::convertTimeValueToString
       break;
     case X_AXIS_DISPLAY_YYMMDDHHMMSS_SS:
-      convertJDToDateString(label, length, X_AXIS_DISPLAY_YYMMDDHHMMSS_SS, value);
-      break;
     case X_AXIS_DISPLAY_DDMMYYHHMMSS_SS:
-      convertJDToDateString(label, length, X_AXIS_DISPLAY_DDMMYYHHMMSS_SS, value);
+    case X_AXIS_DISPLAY_QTTEXTDATEHHMMSS_SS:
+    case X_AXIS_DISPLAY_QTLOCALDATEHHMMSS_SS:
+      convertJDToDateString(label, length, _xAxisDisplay, value);
       break;
     case X_AXIS_DISPLAY_JD:
@@ -1411,4 +1422,6 @@ void Kst2DPlot::convertDiffTimevalueToSt
     case X_AXIS_DISPLAY_YYMMDDHHMMSS_SS:
     case X_AXIS_DISPLAY_DDMMYYHHMMSS_SS:
+    case X_AXIS_DISPLAY_QTTEXTDATEHHMMSS_SS:
+    case X_AXIS_DISPLAY_QTLOCALDATEHHMMSS_SS:
       zdiff *= 24.0 * 60.0 * 60.0;
       break;
@@ -1538,4 +1551,6 @@ void Kst2DPlot::genAxisTickLabels(QPaint
       case X_AXIS_DISPLAY_YYMMDDHHMMSS_SS:
       case X_AXIS_DISPLAY_DDMMYYHHMMSS_SS:
+      case X_AXIS_DISPLAY_QTTEXTDATEHHMMSS_SS:
+      case X_AXIS_DISPLAY_QTLOCALDATEHHMMSS_SS:
         strUnits  = i18n("seconds");
         break;

--- kdeextragear-2/kst/kst/kst2dplot.h  #1.116:1.117
@@ -55,4 +55,6 @@ enum KstXAxisDisplay { X_AXIS_DISPLAY_YE
   X_AXIS_DISPLAY_YYMMDDHHMMSS_SS,
   X_AXIS_DISPLAY_DDMMYYHHMMSS_SS,
+  X_AXIS_DISPLAY_QTTEXTDATEHHMMSS_SS,
+  X_AXIS_DISPLAY_QTLOCALDATEHHMMSS_SS,
   X_AXIS_DISPLAY_JD,
   X_AXIS_DISPLAY_MJD,

--- kdeextragear-2/kst/kst/kstplotdialog_i.cpp  #1.104:1.105
@@ -105,4 +105,6 @@ const XAxisDisplay XAxisDisplays[] = {
   { i18n("YYYY/MM/DD HH:MM:SS.SS"), X_AXIS_DISPLAY_YYMMDDHHMMSS_SS },
   { i18n("DD/MM/YYYY HH:MM:SS.SS"), X_AXIS_DISPLAY_DDMMYYHHMMSS_SS },
+  { i18n("<Qt Text Date> HH:MM:SS.SS"), X_AXIS_DISPLAY_QTTEXTDATEHHMMSS_SS },
+  { i18n("<Qt Local Date> HH:MM:SS.SS"), X_AXIS_DISPLAY_QTLOCALDATEHHMMSS_SS },
   { i18n("JD"), X_AXIS_DISPLAY_JD },
   { i18n("MJD"), X_AXIS_DISPLAY_MJD },





More information about the Kst mailing list