mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
5461eadd1b
commit
315641b0b4
5 changed files with 192 additions and 0 deletions
|
@ -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})
|
||||
|
|
45
desktop-widgets/preferences/preferences_georeference.cpp
Normal file
45
desktop-widgets/preferences/preferences_georeference.cpp
Normal file
|
@ -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();
|
||||
}
|
21
desktop-widgets/preferences/preferences_georeference.h
Normal file
21
desktop-widgets/preferences/preferences_georeference.h
Normal file
|
@ -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
|
|
@ -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,
|
||||
|
|
123
desktop-widgets/preferences/prefs_georeference.ui
Normal file
123
desktop-widgets/preferences/prefs_georeference.ui
Normal file
|
@ -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>
|
Loading…
Add table
Reference in a new issue