[Kst] branches/work/kst/kst1kde4/kst/src/libkstapp

Zongyi Zhang freebody.kst at gmail.com
Wed Apr 14 00:37:29 CEST 2010


SVN commit 1114560 by zhang:

replace kconfig with qsettings

 M  +7 -8      extensionmgr.cpp  
 M  +26 -23    kstcurvedifferentiate.cpp  
 M  +1 -1      kstpluginmanager.cpp  


--- branches/work/kst/kst1kde4/kst/src/libkstapp/extensionmgr.cpp #1114559:1114560
@@ -17,6 +17,8 @@
 
 #include <assert.h>
 
+#include <QSettings>
+
 #include <kparts/componentfactory.h>
 #include <kservicetype.h>
 
@@ -35,7 +37,7 @@
 
 void ExtensionMgr::save() {
   QMap<QString,bool>::const_iterator i;
-//  QSettings cfg("kstextensionsrc", false, false);
+  QSettings cfg("kstextensionsrc", QSettings::NativeFormat, this);
   QStringList disabled;
   QStringList enabled;
 
@@ -51,20 +53,17 @@
 
   cfg.setValue("Disabled", disabled);
   cfg.setValue("Enabled", enabled);
-
+  cfg.endGroup();
 }
 
 
 ExtensionMgr::ExtensionMgr() : QObject(), _window(0L) {
   QStringList::const_iterator i;
-// xxx  KConfig cfg("kstextensionsrc", true, false);
-  QStringList disabled;
-  QStringList enabled;
+  QSettings cfg("kstextensionsrc", QSettings::NativeFormat, this);
 
-// xxx  disabled = cfg.readListEntry("Disabled");
-// xxx  enabled = cfg.readListEntry("Enabled");
+  QStringList disabled = cfg.value("Disabled").toStringList();
+  QStringList enabled = cfg.value("Enabled").toStringList();
 
-// xxx  cfg.setGroup("Extensions");
   for (i = disabled.begin(); i != disabled.end(); ++i) {
     _extensions[*i] = false;
   }
--- branches/work/kst/kst1kde4/kst/src/libkstapp/kstcurvedifferentiate.cpp #1114559:1114560
@@ -122,35 +122,38 @@
 
 
 void KstCurveDifferentiate::loadProperties( ) {
-  KConfig cfg("kstrc");
-  KConfigGroup cfgGroup(&cfg, "curveDifferentiate");
-/* xxx
-  _lineColorOrder = cfgGroup.readNumEntry("DifferentiateLineColor", -1);
-  _pointStyleOrder = cfgGroup.readNumEntry("DifferentiatePointStyle", -1);
-  _lineStyleOrder = cfgGroup.readNumEntry("DifferentiateLineStyle", -1);
-  _lineWidthOrder = cfgGroup.readNumEntry("DifferentiateLineWidth", -1);
-  _maxLineWidth = cfgGroup.readNumEntry("DifferentiateMaxLineWidth", 1);
-  _pointDensity = cfgGroup.readNumEntry("DifferentiatePointDensity", 0);
-  _repeatAcross = cfgGroup.readNumEntry("DifferentiateRepeatAcross", 0);
-  _applyTo = cfgGroup.readNumEntry("DifferentiateApplyTo", 0);
-*/
+  QSettings cfg("kstrc");
+  cfg.beginGroup("curveDifferentiate");
+
+  _lineColorOrder = cfg.value("DifferentiateLineColor", -1).toInt();
+  _pointStyleOrder = cfg.value("DifferentiatePointStyle", -1).toInt();
+  _lineStyleOrder = cfg.value("DifferentiateLineStyle", -1).toInt();
+  _lineWidthOrder = cfg.value("DifferentiateLineWidth", -1).toInt();
+  _maxLineWidth = cfg.value("DifferentiateMaxLineWidth", 1).toInt();
+  _pointDensity = cfg.value("DifferentiatePointDensity", 0).toInt();
+  _repeatAcross = cfg.value("DifferentiateRepeatAcross", 0).toInt();
+  _applyTo = cfg.value("DifferentiateApplyTo", 0).toInt();
+
+  cfg.endGroup();
+  cfg.sync();
 }
 
 
 void KstCurveDifferentiate::saveProperties( ) {  
-  KConfig cfg("kstrc");
-  KConfigGroup cfgGroup(&cfg, "curveDifferentiate");
+  QSettings cfg("kstrc");
+  cfg.beginGroup("curveDifferentiate");
 
-  cfgGroup.writeEntry("DifferentiateLineColor", _lineColorOrder);
-  cfgGroup.writeEntry("DifferentiatePointStyle", _pointStyleOrder);
-  cfgGroup.writeEntry("DifferentiateLineStyle", _lineStyleOrder);
-  cfgGroup.writeEntry("DifferentiateLineWidth", _lineWidthOrder);
-  cfgGroup.writeEntry("DifferentiateMaxLineWidth", _maxLineWidth);
-  cfgGroup.writeEntry("DifferentiatePointDensity", _pointDensity);
-  cfgGroup.writeEntry("DifferentiateRepeatAcross", _repeatAcross);
-  cfgGroup.writeEntry("DifferentiateApplyTo", _applyTo);
+  cfg.setValue("DifferentiateLineColor", _lineColorOrder);
+  cfg.setValue("DifferentiatePointStyle", _pointStyleOrder);
+  cfg.setValue("DifferentiateLineStyle", _lineStyleOrder);
+  cfg.setValue("DifferentiateLineWidth", _lineWidthOrder);
+  cfg.setValue("DifferentiateMaxLineWidth", _maxLineWidth);
+  cfg.setValue("DifferentiatePointDensity", _pointDensity);
+  cfg.setValue("DifferentiateRepeatAcross", _repeatAcross);
+  cfg.setValue("DifferentiateApplyTo", _applyTo);
 
-  cfgGroup.sync();
+  cfg.endGroup();
+  cfg.sync();
 }  
 
 
--- branches/work/kst/kst1kde4/kst/src/libkstapp/kstpluginmanager.cpp #1114559:1114560
@@ -24,7 +24,7 @@
 #include <QRadioButton>
 #include <QRegExp>
 
-#include <kconfig.h>
+// xxx #include <kconfig.h>
 #include <kfiledialog.h>
 #include <kimageio.h>
 #include <kio/netaccess.h>


More information about the Kst mailing list