summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/preferences/preferences_georeference.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-09-17 19:22:19 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-30 10:36:50 -0700
commit315641b0b497a06dd508d8dee08b792623e091c7 (patch)
tree53b0880dc35ea95085afc498c877ad64edf65d7f /desktop-widgets/preferences/preferences_georeference.cpp
parent5461eadd1bd88844194073c56a2f8397c98dda04 (diff)
downloadsubsurface-315641b0b497a06dd508d8dee08b792623e091c7.tar.gz
Preferences: add GeoReference
Straigth port from the old version. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/preferences/preferences_georeference.cpp')
-rw-r--r--desktop-widgets/preferences/preferences_georeference.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/desktop-widgets/preferences/preferences_georeference.cpp b/desktop-widgets/preferences/preferences_georeference.cpp
new file mode 100644
index 000000000..7e8ccec9d
--- /dev/null
+++ b/desktop-widgets/preferences/preferences_georeference.cpp
@@ -0,0 +1,45 @@
+#include "preferences_georeference.h"
+#include "ui_prefs_georeference.h"
+#include "prefs-macros.h"
+#include "qthelper.h"
+#include "qt-models/divelocationmodel.h"
+
+#include <ctime>
+#include <QSettings>
+
+PreferencesGeoreference::PreferencesGeoreference() : AbstractPreferencesWidget(tr("Georeference"), QIcon(":/georeference"), 9)
+{
+ ui = new Ui::PreferencesGeoreference();
+ ui->setupUi(this);
+ ui->first_item->setModel(GeoReferencingOptionsModel::instance());
+ ui->second_item->setModel(GeoReferencingOptionsModel::instance());
+ ui->third_item->setModel(GeoReferencingOptionsModel::instance());
+}
+
+PreferencesGeoreference::~PreferencesGeoreference()
+{
+ delete ui;
+}
+
+void PreferencesGeoreference::refreshSettings()
+{
+ ui->enable_geocoding->setChecked(prefs.geocoding.enable_geocoding);
+ ui->parse_without_gps->setChecked(prefs.geocoding.parse_dive_without_gps);
+ ui->tag_existing_dives->setChecked(prefs.geocoding.tag_existing_dives);
+ ui->first_item->setCurrentIndex(prefs.geocoding.category[0]);
+ ui->second_item->setCurrentIndex(prefs.geocoding.category[1]);
+ ui->third_item->setCurrentIndex(prefs.geocoding.category[2]);
+}
+
+void PreferencesGeoreference::syncSettings()
+{
+ QSettings s;
+ s.beginGroup("geocoding");
+ s.setValue("enable_geocoding", ui->enable_geocoding->isChecked());
+ s.setValue("parse_dives_without_gps", ui->parse_without_gps->isChecked());
+ s.setValue("tag_existing_dives", ui->tag_existing_dives->isChecked());
+ s.setValue("cat0", ui->first_item->currentIndex());
+ s.setValue("cat1", ui->second_item->currentIndex());
+ s.setValue("cat2", ui->third_item->currentIndex());
+ s.endGroup();
+} \ No newline at end of file