diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-09-17 19:22:19 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-10-30 10:36:50 -0700 |
commit | 315641b0b497a06dd508d8dee08b792623e091c7 (patch) | |
tree | 53b0880dc35ea95085afc498c877ad64edf65d7f | |
parent | 5461eadd1bd88844194073c56a2f8397c98dda04 (diff) | |
download | subsurface-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>
-rw-r--r-- | desktop-widgets/preferences/CMakeLists.txt | 1 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_georeference.cpp | 45 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_georeference.h | 21 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferencesdialog.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/preferences/prefs_georeference.ui | 123 |
5 files changed, 192 insertions, 0 deletions
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 <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 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 <QVBoxLayout> #include <QHBoxLayout> @@ -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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PreferencesGeoreference</class> + <widget class="QWidget" name="PreferencesGeoreference"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QGroupBox" name="groupBox_Geocoding"> + <property name="title"> + <string>Dive site geo lookup</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <item> + <widget class="QCheckBox" name="enable_geocoding"> + <property name="text"> + <string>Enable geocoding for dive site management</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="parse_without_gps"> + <property name="text"> + <string>Parse site without GPS data</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="tag_existing_dives"> + <property name="text"> + <string>Same format for existing dives</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_12"> + <property name="title"> + <string>Dive Site Layout</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_10"> + <item> + <widget class="QComboBox" name="first_item"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_29"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>/</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="second_item"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_30"> + <property name="text"> + <string>/</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="third_item"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer_6"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>109</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> |