[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Mon Jul 7 22:58:31 CEST 2003


CVS commit by staikos: 

- use a static deleter
- convert the rest of the color stuff that I could find to use KstColorSequence


  M +3 -1      kstcolorsequence.cpp   1.2
  M +2 -0      kstcolorsequence.h   1.2
  M +2 -4      kstquickpsddialog_i.cpp   1.19
  M +2 -1      kstvcurve.cpp   1.16


--- kdeextragear-2/kst/kst/kstcolorsequence.cpp  #1.1:1.2
@@ -29,9 +29,11 @@ static const char *const colors[colorcnt
                                             };
 
+static KStaticDeleter<KstColorSequence> sd;
+
 QColor KstColorSequence::next() {
   bool shift = false;
 
   if (!_self) {
-    _self = new KstColorSequence;
+    _self = sd.setObject(_self, new KstColorSequence);
   }
 

--- kdeextragear-2/kst/kst/kstcolorsequence.h  #1.1:1.2
@@ -20,6 +20,8 @@
 
 #include <qcolor.h>
+#include <kstaticdeleter.h>
 
 class KstColorSequence {
+friend class KStaticDeleter<KstColorSequence>;
   public:
     static QColor next();

--- kdeextragear-2/kst/kst/kstquickpsddialog_i.cpp  #1.18:1.19
@@ -17,4 +17,5 @@
 #include "kstplotlist.h"
 #include "kstrvector.h"
+#include "kstcolorsequence.h"
 #include "kstdatacollection.h"
 
@@ -53,9 +54,6 @@ void KstQuickPSDDialogI::showQuickPSDDia
 void KstQuickPSDDialogI::update() {
   unsigned int i, j_v;
-  const int n_colors = 8;
   KstRVectorPtr v0;
   int j;
-  char colorlist[n_colors][16] = {"red", "blue", "green", "black",
-                                  "magenta","steelblue", "#501010", "#105010"};
 
   _curves = kstObjectSubList<KstDataObject,KstPSDCurve>(KST::dataObjectList);
@@ -118,5 +116,5 @@ void KstQuickPSDDialogI::update() {
 
   /* set the color and draw the line */
-  setCurveColor(colorlist[_curves.count()%n_colors]);
+  setCurveColor(KstColorSequence::next());
   drawCurveLine();
 }

--- kdeextragear-2/kst/kst/kstvcurve.cpp  #1.15:1.16
@@ -20,4 +20,5 @@
 #include "kstvcurve.h"
 #include "kstdoc.h"
+#include "kstcolorsequence.h"
 #include "kstdatacollection.h"
 #include "kstcurvedialog_i.h"
@@ -38,5 +39,5 @@ KstVCurve::KstVCurve(QDomElement &e)
   QString in_tag;
   KstVectorPtr in_X, in_Y, in_EX, in_EY;
-  QColor in_color("red");
+  QColor in_color(KstColorSequence::next());
 
   setHasPoints(false);




More information about the Kst mailing list