Index: trunk/BNC/bncapp.h
===================================================================
--- trunk/BNC/bncapp.h	(revision 4069)
+++ trunk/BNC/bncapp.h	(revision 4070)
@@ -26,7 +26,5 @@
 #define BNCAPP_H
 
-#include <QApplication>
-#include <QFile>
-#include <QTextStream>
+#include <QtGui>
 
 #include "bnccaster.h"
@@ -40,4 +38,8 @@
 class bncApp : public QApplication {
   Q_OBJECT
+
+    friend class bncSettings;
+    QSettings::SettingsMap   _settings;
+
   public:
     enum e_mode {interactive, nonInteractive, batchPostProcessing};
Index: trunk/BNC/bncsettings.cpp
===================================================================
--- trunk/BNC/bncsettings.cpp	(revision 4069)
+++ trunk/BNC/bncsettings.cpp	(revision 4070)
@@ -15,7 +15,4 @@
  * -----------------------------------------------------------------------*/
 
-#include <QCoreApplication>
-#include <QStringList>
-
 #include "bncsettings.h"
 #include "bncapp.h"
@@ -23,156 +20,218 @@
 // Constructor
 ////////////////////////////////////////////////////////////////////////////
-bncSettings::bncSettings(bool noInit) : 
-  QSettings(((bncApp*) qApp)->confFileName(), QSettings::IniFormat) {
-
-  if (! noInit && allKeys().size() == 0) {
-//
-    setValue("startTab",            "0");
-    setValue("statusTab",           "0");
-    setValue("casterUrlList", (QStringList() 
-                               << "http://user:pass@www.euref-ip.net:2101" 
-                               << "http://user:pass@www.igs-ip.net:2101" 
-                               << "http://user:pass@products.igs-ip.net:2101"
-                               << "http://user:pass@mgex.igs-ip.net:2101"));
-    setValue("mountPoints",         "");
-    setValue("ntripVersion",        "1");
-// Network
-    setValue("proxyHost",           "");
-    setValue("proxyPort",           "");
-    setValue("sslCaCertPath",       "");
-    setValue("ignoreSslErrors",     "0");
-// General
-    setValue("logFile",             "");
-    setValue("rnxAppend",           "0");
-    setValue("onTheFlyInterval",    "1 day");
-    setValue("autoStart",           "0");
-    setValue("rawOutFile",          "");
-// RINEX Observations
-    setValue("rnxPath",             "");
-    setValue("rnxIntr",             "1 day");
-    setValue("rnxSampl",            "0");
-    setValue("rnxSkel",             "SKL");
-    setValue("rnxScript",           "");
-    setValue("rnxV3",               "0");
-// RINEX Ephemeris
-    setValue("ephPath",             "");
-    setValue("ephIntr",             "1 day");
-    setValue("outEphPort",          "");
-    setValue("ephV3",               "0");
-// Braodcast Corrections
-    setValue("corrPath",            "");
-    setValue("corrIntr",            "1 day");
-    setValue("corrPort",            "");
-    setValue("corrTime",            "5");
-// Feed Engine
-    setValue("outPort",             "");
-    setValue("waitTime",            "5");
-    setValue("binSampl",            "0");
-    setValue("outFile",             "");
-    setValue("outUPort",            "");
-// Serial Output
-    setValue("serialMountPoint",    "");
-    setValue("serialPortName",      "");
-    setValue("serialBaudRate",      "9600");
-    setValue("serialFlowControl",   "OFF");
-    setValue("serialDataBits",      "8");
-    setValue("serialParity",        "NONE");
-    setValue("serialStopBits",      "1");
-    setValue("serialAutoNMEA",      "Auto");
-    setValue("serialFileNMEA",      "");
-    setValue("serialHeightNMEA",    "");
-// Outages
-    setValue("obsRate",             "");
-    setValue("adviseFail",          "15");
-    setValue("adviseReco",          "5");
-    setValue("adviseScript",        "");
-// Miscellaneous
-    setValue("miscMount",           "");  
-    setValue("perfIntr",            "");
-    setValue("scanRTCM",            "0");
-// PPP
-    setValue("pppSPP",              "");
-    setValue("pppMount",            "");
-    setValue("pppCorrMount",        "");
-    setValue("pppRefCrdX",          "");
-    setValue("pppRefCrdY",          "");
-    setValue("pppRefCrdZ",          "");
-    setValue("pppRefdN",            "");
-    setValue("pppRefdE",            "");
-    setValue("pppRefdU",            "");
-    setValue("nmeaFile",            "");
-    setValue("nmeaPort",            "");
-    setValue("pppPlotCoordinates",  "");
-    setValue("postObsFile",         "");
-    setValue("postNavFile",         "");
-    setValue("postCorrFile",        "");
-    setValue("postOutFile",         "");
-    setValue("pppAntenna",          "");
-    setValue("pppAntex",            "");
-    setValue("pppApplySatAnt",      "0");
-    setValue("pppUsePhase",         "");
-    setValue("pppEstTropo",         "");
-    setValue("pppGLONASS",          "");
-    setValue("pppGalileo",          "");
-    setValue("pppSync",             "");
-    setValue("pppAverage",          "");
-    setValue("pppQuickStart",       "");
-    setValue("pppMaxSolGap",        "");
-    setValue("pppSigmaCode",        "10.0");
-    setValue("pppSigmaPhase",       "0.02");
-    setValue("pppSigCrd0",          "100.0");
-    setValue("pppSigCrdP",          "100.0");
-    setValue("pppSigTrp0",          "0.1");
-    setValue("pppSigTrpP",          "3e-6");
-// Reqc
-    setValue("reqcAction",          "");
-    setValue("reqcObsFile",         "");
-    setValue("reqcNavFile",         "");
-    setValue("reqcOutObsFile",      "");
-    setValue("reqcOutNavFile",      "");
-    setValue("reqcOutLogFile",      "");
-    setValue("reqcRnxVersion",      "");
-    setValue("reqcSampling",        "");
-    setValue("reqcStartDateTime",   "");
-    setValue("reqcEndDateTime",     "");
-    setValue("reqcOldMarkerName",   "");
-    setValue("reqcNewMarkerName",   "");
-    setValue("reqcOldAntennaName",  "");
-    setValue("reqcNewAntennaName",  "");
-    setValue("reqcOldReceiverName", "");
-    setValue("reqcNewReceiverName", "");
-// Combination
-    setValue("combineStreams",      "");
-    setValue("cmbMethod",           "");
-    setValue("cmbMaxres",           "");
-// Upload (clk)
-    setValue("uploadMountpointsOut","");
-    setValue("uploadIntr",          "1 day");
-    setValue("uploadSampl",         "5");
-    setValue("uploadSamplOrb",      "0");
-    setValue("trafo_dx",            "");
-    setValue("trafo_dy",            "");
-    setValue("trafo_dz",            "");
-    setValue("trafo_dxr",           "");
-    setValue("trafo_dyr",           "");
-    setValue("trafo_dzr",           "");
-    setValue("trafo_ox",            "");
-    setValue("trafo_oy",            "");
-    setValue("trafo_oz",            "");
-    setValue("trafo_oxr",           "");
-    setValue("trafo_oyr",           "");
-    setValue("trafo_ozr",           "");
-    setValue("trafo_sc",            "");
-    setValue("trafo_scr",           "");
-    setValue("trafo_t0",            "");
-// Upload (eph)
-    setValue("uploadEphHost",       "");
-    setValue("uploadEphPort",       "");
-    setValue("uploadEphMountpoint", "");
-    setValue("uploadEphPassword",   "");
-    setValue("uploadEphSample",     "5");
-    sync();
+bncSettings::bncSettings(bool noInit) {
+
+  _bncApp = static_cast<bncApp*>(qApp);
+
+  // First fill the options
+  // ---------------------- 
+  if (_bncApp->_settings.size() == 0) {
+    QSettings settings(_bncApp->confFileName(), QSettings::IniFormat);
+
+    // Read from File
+    // --------------
+    if (settings.allKeys().size() > 0) {
+      QStringListIterator it(settings.allKeys());
+      while (it.hasNext()) {
+        QString key = it.next();
+        _bncApp->_settings[key] = settings.value(key);
+      }
+    }
+
+    // Set Defaults
+    // ------------
+    else if (!noInit) {
+
+    }
   }
 }
 
-
+// Destructor
+////////////////////////////////////////////////////////////////////////////
+bncSettings::~bncSettings() {
+
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+QVariant bncSettings::value(const QString& key,
+                            const QVariant& defaultValue) const {
+  
+  if (_bncApp->_settings.contains(key)) {
+    return _bncApp->_settings[key];
+  }
+  else {
+    return defaultValue;
+  }
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void bncSettings::setValue(const QString &key, const QVariant& value) {
+  _bncApp->_settings[key] = value;
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void bncSettings::remove(const QString& key ) {
+
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void bncSettings::sync() {
+
+}
+
+//   QSettings(((bncApp*) qApp)->confFileName(), QSettings::IniFormat) {
+// 
+//   if (! noInit && allKeys().size() == 0) {
+// //
+//     setValue("startTab",            "0");
+//     setValue("statusTab",           "0");
+//     setValue("casterUrlList", (QStringList() 
+//                                << "http://user:pass@www.euref-ip.net:2101" 
+//                                << "http://user:pass@www.igs-ip.net:2101" 
+//                                << "http://user:pass@products.igs-ip.net:2101"
+//                                << "http://user:pass@mgex.igs-ip.net:2101"));
+//     setValue("mountPoints",         "");
+//     setValue("ntripVersion",        "1");
+// // Network
+//     setValue("proxyHost",           "");
+//     setValue("proxyPort",           "");
+//     setValue("sslCaCertPath",       "");
+//     setValue("ignoreSslErrors",     "0");
+// // General
+//     setValue("logFile",             "");
+//     setValue("rnxAppend",           "0");
+//     setValue("onTheFlyInterval",    "1 day");
+//     setValue("autoStart",           "0");
+//     setValue("rawOutFile",          "");
+// // RINEX Observations
+//     setValue("rnxPath",             "");
+//     setValue("rnxIntr",             "1 day");
+//     setValue("rnxSampl",            "0");
+//     setValue("rnxSkel",             "SKL");
+//     setValue("rnxScript",           "");
+//     setValue("rnxV3",               "0");
+// // RINEX Ephemeris
+//     setValue("ephPath",             "");
+//     setValue("ephIntr",             "1 day");
+//     setValue("outEphPort",          "");
+//     setValue("ephV3",               "0");
+// // Braodcast Corrections
+//     setValue("corrPath",            "");
+//     setValue("corrIntr",            "1 day");
+//     setValue("corrPort",            "");
+//     setValue("corrTime",            "5");
+// // Feed Engine
+//     setValue("outPort",             "");
+//     setValue("waitTime",            "5");
+//     setValue("binSampl",            "0");
+//     setValue("outFile",             "");
+//     setValue("outUPort",            "");
+// // Serial Output
+//     setValue("serialMountPoint",    "");
+//     setValue("serialPortName",      "");
+//     setValue("serialBaudRate",      "9600");
+//     setValue("serialFlowControl",   "OFF");
+//     setValue("serialDataBits",      "8");
+//     setValue("serialParity",        "NONE");
+//     setValue("serialStopBits",      "1");
+//     setValue("serialAutoNMEA",      "Auto");
+//     setValue("serialFileNMEA",      "");
+//     setValue("serialHeightNMEA",    "");
+// // Outages
+//     setValue("obsRate",             "");
+//     setValue("adviseFail",          "15");
+//     setValue("adviseReco",          "5");
+//     setValue("adviseScript",        "");
+// // Miscellaneous
+//     setValue("miscMount",           "");  
+//     setValue("perfIntr",            "");
+//     setValue("scanRTCM",            "0");
+// // PPP
+//     setValue("pppSPP",              "");
+//     setValue("pppMount",            "");
+//     setValue("pppCorrMount",        "");
+//     setValue("pppRefCrdX",          "");
+//     setValue("pppRefCrdY",          "");
+//     setValue("pppRefCrdZ",          "");
+//     setValue("pppRefdN",            "");
+//     setValue("pppRefdE",            "");
+//     setValue("pppRefdU",            "");
+//     setValue("nmeaFile",            "");
+//     setValue("nmeaPort",            "");
+//     setValue("pppPlotCoordinates",  "");
+//     setValue("postObsFile",         "");
+//     setValue("postNavFile",         "");
+//     setValue("postCorrFile",        "");
+//     setValue("postOutFile",         "");
+//     setValue("pppAntenna",          "");
+//     setValue("pppAntex",            "");
+//     setValue("pppApplySatAnt",      "0");
+//     setValue("pppUsePhase",         "");
+//     setValue("pppEstTropo",         "");
+//     setValue("pppGLONASS",          "");
+//     setValue("pppGalileo",          "");
+//     setValue("pppSync",             "");
+//     setValue("pppAverage",          "");
+//     setValue("pppQuickStart",       "");
+//     setValue("pppMaxSolGap",        "");
+//     setValue("pppSigmaCode",        "10.0");
+//     setValue("pppSigmaPhase",       "0.02");
+//     setValue("pppSigCrd0",          "100.0");
+//     setValue("pppSigCrdP",          "100.0");
+//     setValue("pppSigTrp0",          "0.1");
+//     setValue("pppSigTrpP",          "3e-6");
+// // Reqc
+//     setValue("reqcAction",          "");
+//     setValue("reqcObsFile",         "");
+//     setValue("reqcNavFile",         "");
+//     setValue("reqcOutObsFile",      "");
+//     setValue("reqcOutNavFile",      "");
+//     setValue("reqcOutLogFile",      "");
+//     setValue("reqcRnxVersion",      "");
+//     setValue("reqcSampling",        "");
+//     setValue("reqcStartDateTime",   "");
+//     setValue("reqcEndDateTime",     "");
+//     setValue("reqcOldMarkerName",   "");
+//     setValue("reqcNewMarkerName",   "");
+//     setValue("reqcOldAntennaName",  "");
+//     setValue("reqcNewAntennaName",  "");
+//     setValue("reqcOldReceiverName", "");
+//     setValue("reqcNewReceiverName", "");
+// // Combination
+//     setValue("combineStreams",      "");
+//     setValue("cmbMethod",           "");
+//     setValue("cmbMaxres",           "");
+// // Upload (clk)
+//     setValue("uploadMountpointsOut","");
+//     setValue("uploadIntr",          "1 day");
+//     setValue("uploadSampl",         "5");
+//     setValue("uploadSamplOrb",      "0");
+//     setValue("trafo_dx",            "");
+//     setValue("trafo_dy",            "");
+//     setValue("trafo_dz",            "");
+//     setValue("trafo_dxr",           "");
+//     setValue("trafo_dyr",           "");
+//     setValue("trafo_dzr",           "");
+//     setValue("trafo_ox",            "");
+//     setValue("trafo_oy",            "");
+//     setValue("trafo_oz",            "");
+//     setValue("trafo_oxr",           "");
+//     setValue("trafo_oyr",           "");
+//     setValue("trafo_ozr",           "");
+//     setValue("trafo_sc",            "");
+//     setValue("trafo_scr",           "");
+//     setValue("trafo_t0",            "");
+// // Upload (eph)
+//     setValue("uploadEphHost",       "");
+//     setValue("uploadEphPort",       "");
+//     setValue("uploadEphMountpoint", "");
+//     setValue("uploadEphPassword",   "");
+//     setValue("uploadEphSample",     "5");
+//     sync();
+//   }
+
+
Index: trunk/BNC/bncsettings.h
===================================================================
--- trunk/BNC/bncsettings.h	(revision 4069)
+++ trunk/BNC/bncsettings.h	(revision 4070)
@@ -4,9 +4,17 @@
 #include <QSettings>
 
-class bncSettings : public QSettings {
+class bncApp;
+
+class bncSettings {
  public:
   bncSettings(bool noInit = false);
-  virtual ~bncSettings() {};
+  ~bncSettings();
+  QVariant value(const QString& key, 
+                 const QVariant& defaultValue = QVariant()) const;
+  void setValue(const QString &key, const QVariant& value);
+  void remove(const QString& key );
+  void sync();
  private:
+  bncApp* _bncApp;
 };
 
Index: trunk/BNC/bnctabledlg.cpp
===================================================================
--- trunk/BNC/bnctabledlg.cpp	(revision 4069)
+++ trunk/BNC/bnctabledlg.cpp	(revision 4070)
@@ -172,5 +172,4 @@
   bncSettings settings;
   settings.setValue("ntripVersion", _ntripVersionComboBox->currentText());
-  settings.sync();
   delete _ntripVersionComboBox;
   delete _buttonGet;
@@ -512,5 +511,4 @@
   }
   settings.setValue("casterUrlList", newUrlList);
-  settings.sync();
 }
 
Index: trunk/BNC/bncwindow.cpp
===================================================================
--- trunk/BNC/bncwindow.cpp	(revision 4069)
+++ trunk/BNC/bncwindow.cpp	(revision 4070)
@@ -1383,5 +1383,4 @@
       settings.setValue("proxyHost",   _proxyHostLineEdit->text());
       settings.setValue("proxyPort",   _proxyPortLineEdit->text());
-      settings.sync();
     }
   }
@@ -1389,5 +1388,4 @@
   settings.setValue("sslCaCertPath",   _sslCaCertPathLineEdit->text());
   settings.setValue("ignoreSslErrors", _ignoreSslErrorsCheckBox->checkState());
-  settings.sync();
 
   QMessageBox msgBox;
@@ -1725,5 +1723,4 @@
     _caster->slotReadMountPoints();
   }
-  settings.sync();
 }
 
@@ -1844,4 +1841,6 @@
   else if (iRet == QMessageBox::Yes) {
     slotSaveOptions();
+    bncSettings settings;
+    settings.sync();
   }
 
Index: trunk/BNC/reqcdlg.cpp
===================================================================
--- trunk/BNC/reqcdlg.cpp	(revision 4069)
+++ trunk/BNC/reqcdlg.cpp	(revision 4070)
@@ -226,5 +226,3 @@
   settings.setValue("reqcOldReceiverName", _reqcOldReceiverName->text());
   settings.setValue("reqcNewReceiverName", _reqcNewReceiverName->text());
-   
-  settings.sync();
-}
+}
