From 315641b0b497a06dd508d8dee08b792623e091c7 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 17 Sep 2015 19:22:19 -0300 Subject: Preferences: add GeoReference Straigth port from the old version. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- desktop-widgets/preferences/CMakeLists.txt | 1 + .../preferences/preferences_georeference.cpp | 45 ++++++++ .../preferences/preferences_georeference.h | 21 ++++ desktop-widgets/preferences/preferencesdialog.cpp | 2 + desktop-widgets/preferences/prefs_georeference.ui | 123 +++++++++++++++++++++ 5 files changed, 192 insertions(+) create mode 100644 desktop-widgets/preferences/preferences_georeference.cpp create mode 100644 desktop-widgets/preferences/preferences_georeference.h create mode 100644 desktop-widgets/preferences/prefs_georeference.ui diff --git a/desktop-widgets/preferences/CMakeLists.txt b/desktop-widgets/preferences/CMakeLists.txt index 468501e7d..4eb2f7d23 100644 --- a/desktop-widgets/preferences/CMakeLists.txt +++ b/desktop-widgets/preferences/CMakeLists.txt @@ -13,6 +13,7 @@ set(SUBSURFACE_PREFERENCES_LIB_SRCS abstractpreferenceswidget.cpp preferencesdialog.cpp preferences_language.cpp + preferences_georeference.cpp ) source_group("Subsurface Preferences" FILES ${SUBSURFACE_PREFERENCES_LIB_SRCS}) 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 +#include + +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 diff --git a/desktop-widgets/preferences/preferences_georeference.h b/desktop-widgets/preferences/preferences_georeference.h new file mode 100644 index 000000000..5dd4bc445 --- /dev/null +++ b/desktop-widgets/preferences/preferences_georeference.h @@ -0,0 +1,21 @@ +#ifndef PREFERENCES_GEOREFERENCE_H +#define PREFERENCES_GEOREFERENCE_H + +#include "abstractpreferenceswidget.h" + +namespace Ui { + class PreferencesGeoreference; +} + +class PreferencesGeoreference : public AbstractPreferencesWidget { + Q_OBJECT +public: + PreferencesGeoreference(); + virtual ~PreferencesGeoreference(); + virtual void refreshSettings(); + virtual void syncSettings(); +private: + Ui::PreferencesGeoreference *ui; +}; + +#endif \ No newline at end of file diff --git a/desktop-widgets/preferences/preferencesdialog.cpp b/desktop-widgets/preferences/preferencesdialog.cpp index 5bdc75dbb..3975994a9 100644 --- a/desktop-widgets/preferences/preferencesdialog.cpp +++ b/desktop-widgets/preferences/preferencesdialog.cpp @@ -2,6 +2,7 @@ #include "abstractpreferenceswidget.h" #include "preferences_language.h" +#include "preferences_georeference.h" #include #include @@ -33,6 +34,7 @@ PreferencesDialogV2::PreferencesDialogV2() setLayout(v); addPreferencePage(new PreferencesLanguage()); + addPreferencePage(new PreferencesGeoreference()); refreshPages(); connect(pagesList, &QListWidget::currentRowChanged, diff --git a/desktop-widgets/preferences/prefs_georeference.ui b/desktop-widgets/preferences/prefs_georeference.ui new file mode 100644 index 000000000..7d4f0907e --- /dev/null +++ b/desktop-widgets/preferences/prefs_georeference.ui @@ -0,0 +1,123 @@ + + + PreferencesGeoreference + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Dive site geo lookup + + + + + + Enable geocoding for dive site management + + + + + + + Parse site without GPS data + + + + + + + Same format for existing dives + + + + + + + + + + Dive Site Layout + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + / + + + + + + + + 0 + 0 + + + + + + + + / + + + + + + + + 0 + 0 + + + + + + + + + + + Qt::Vertical + + + + 20 + 109 + + + + + + + + + -- cgit v1.2.3-70-g09d2