What this batch of patches does:
nothing much - setting the ground for the locationmanagement.

it's a start of the third attempt ( or fourth? ) of a rewrite from scratch.
From 1781ef7c8b034e5844dd4381bdf501a8cfa1d0e1 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Mon, 22 Jun 2015 18:44:05 -0300
Subject: [PATCH 8/8] Preferences infrastructure for GeoManagement

Simple preferences infrastructure with default prefs,
prefs and hooks for the Qt Settings system and our
preferences ui.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 pref.h                | 10 ++++++++++
 qt-ui/preferences.cpp | 32 ++++++++++++++++++++++++++++++++
 subsurfacestartup.c   | 10 +++++++++-
 3 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/pref.h b/pref.h
index ff5fd3d..d70e009 100644
--- a/pref.h
+++ b/pref.h
@@ -24,6 +24,15 @@ typedef struct {
 	char *album_id;
 } facebook_prefs_t;
 
+typedef struct {
+	bool enable_geocoding;
+	bool parse_dive_without_gps;
+	bool tag_existing_dives;
+	char *first_item;
+	char *second_item;
+	char *third_item;
+} geocoding_prefs_t;
+
 struct preferences {
 	const char *divelist_font;
 	const char *default_filename;
@@ -100,6 +109,7 @@ struct preferences {
 	bool save_password_local;
 	short cloud_verification_status;
 	bool cloud_background_sync;
+	geocoding_prefs_t geocoding;
 };
 enum unit_system_values {
 	METRIC,
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index 34960f6..d9622d2 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -1,6 +1,7 @@
 #include "preferences.h"
 #include "mainwindow.h"
 #include "models.h"
+#include "divelocationmodel.h"
 
 #include <QSettings>
 #include <QFileDialog>
@@ -45,6 +46,9 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDial
 	ui.proxyType->addItem(tr("SOCKS proxy"), QNetworkProxy::Socks5Proxy);
 	ui.proxyType->setCurrentIndex(-1);
 
+	ui.first_item->setModel(GeoReferencingOptionsModel::instance());
+	ui.second_item->setModel(GeoReferencingOptionsModel::instance());
+	ui.third_item->setModel(GeoReferencingOptionsModel::instance());
 	// Facebook stuff:
 #if !defined(Q_OS_ANDROID) && defined(FBSUPPORT)
 	FacebookManager *fb = FacebookManager::instance();
@@ -232,6 +236,14 @@ void PreferencesDialog::setUiFromPrefs()
 	ui.save_password_local->setChecked(prefs.save_password_local);
 	cloudPinNeeded();
 	ui.cloud_background_sync->setChecked(prefs.cloud_background_sync);
+
+	// GeoManagement
+	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->setCurrentText(prefs.geocoding.first_item);
+	ui.second_item->setCurrentText(prefs.geocoding.second_item);
+	ui.third_item->setCurrentText(prefs.geocoding.third_item);
 }
 
 void PreferencesDialog::restorePrefs()
@@ -438,6 +450,16 @@ void PreferencesDialog::syncSettings()
 	// it could go into some sort of "advanced setup" or something
 	SAVE_OR_REMOVE("cloud_base_url", default_prefs.cloud_base_url, prefs.cloud_base_url);
 	s.endGroup();
+
+	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("first_item", ui.first_item->currentText());
+	s.setValue("second_item", ui.second_item->currentText());
+	s.setValue("third_item", ui.third_item->currentText());
+	s.endGroup();
+
 	loadSettings();
 	emit settingsChanged();
 }
@@ -575,6 +597,16 @@ void PreferencesDialog::loadSettings()
 	GET_TXT("cloud_base_url", cloud_base_url);
 	prefs.cloud_git_url = strdup(qPrintable(QString(prefs.cloud_base_url) + "/git"));
 	s.endGroup();
+
+	// GeoManagement
+	s.beginGroup("geocoding");
+	GET_BOOL("enable_geocoding", geocoding.enable_geocoding);
+	GET_BOOL("parse_dives_without_gps", geocoding.parse_dive_without_gps);
+	GET_BOOL("tag_existing_dives", geocoding.tag_existing_dives);
+	GET_TXT("first_item", geocoding.first_item);
+	GET_TXT("second_item", geocoding.second_item);
+	GET_TXT("third_item", geocoding.third_item);
+	s.endGroup();
 }
 
 void PreferencesDialog::buttonClicked(QAbstractButton *button)
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index 7130f0f..655a1a5 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -68,7 +68,15 @@ struct preferences default_prefs = {
 		.access_token = NULL
 	},
 	.defaultsetpoint = 1100,
-	.cloud_background_sync = true
+	.cloud_background_sync = true,
+	.geocoding = {
+		.enable_geocoding = false,
+		.parse_dive_without_gps = false,
+		.tag_existing_dives = false,
+		.first_item = NULL,
+		.second_item = NULL,
+		.third_item = NULL
+	}
 };
 
 int run_survey;
-- 
2.4.4

From 14b7c509ea9fda596f87ee63447d3b902745c207 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Mon, 22 Jun 2015 17:29:06 -0300
Subject: [PATCH 7/8] Defaults on the Preferences dialog for GeoCoding

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/preferences.ui | 200 +++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 172 insertions(+), 28 deletions(-)

diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui
index 6dd179b..980da4a 100644
--- a/qt-ui/preferences.ui
+++ b/qt-ui/preferences.ui
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>814</width>
-    <height>726</height>
+    <width>868</width>
+    <height>853</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -19,7 +19,16 @@
    </iconset>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2">
-   <property name="margin">
+   <property name="leftMargin">
+    <number>5</number>
+   </property>
+   <property name="topMargin">
+    <number>5</number>
+   </property>
+   <property name="rightMargin">
+    <number>5</number>
+   </property>
+   <property name="bottomMargin">
     <number>5</number>
    </property>
    <item>
@@ -166,7 +175,16 @@
          <property name="spacing">
           <number>5</number>
          </property>
-         <property name="margin">
+         <property name="leftMargin">
+          <number>5</number>
+         </property>
+         <property name="topMargin">
+          <number>5</number>
+         </property>
+         <property name="rightMargin">
+          <number>5</number>
+         </property>
+         <property name="bottomMargin">
           <number>5</number>
          </property>
          <item>
@@ -181,7 +199,16 @@
             <property name="verticalSpacing">
              <number>5</number>
             </property>
-            <property name="margin">
+            <property name="leftMargin">
+             <number>5</number>
+            </property>
+            <property name="topMargin">
+             <number>5</number>
+            </property>
+            <property name="rightMargin">
+             <number>5</number>
+            </property>
+            <property name="bottomMargin">
              <number>5</number>
             </property>
             <item row="0" column="0">
@@ -219,7 +246,16 @@
             <property name="verticalSpacing">
              <number>5</number>
             </property>
-            <property name="margin">
+            <property name="leftMargin">
+             <number>5</number>
+            </property>
+            <property name="topMargin">
+             <number>5</number>
+            </property>
+            <property name="rightMargin">
+             <number>5</number>
+            </property>
+            <property name="bottomMargin">
              <number>5</number>
             </property>
             <item row="0" column="0">
@@ -323,7 +359,16 @@
             <property name="verticalSpacing">
              <number>5</number>
             </property>
-            <property name="margin">
+            <property name="leftMargin">
+             <number>5</number>
+            </property>
+            <property name="topMargin">
+             <number>5</number>
+            </property>
+            <property name="rightMargin">
+             <number>5</number>
+            </property>
+            <property name="bottomMargin">
              <number>5</number>
             </property>
             <item row="0" column="0">
@@ -349,7 +394,16 @@
             <string>Animations</string>
            </property>
            <layout class="QHBoxLayout" name="horizontalLayout_7">
-            <property name="margin">
+            <property name="leftMargin">
+             <number>5</number>
+            </property>
+            <property name="topMargin">
+             <number>5</number>
+            </property>
+            <property name="rightMargin">
+             <number>5</number>
+            </property>
+            <property name="bottomMargin">
              <number>5</number>
             </property>
             <item>
@@ -388,7 +442,16 @@
             <property name="spacing">
              <number>5</number>
             </property>
-            <property name="margin">
+            <property name="leftMargin">
+             <number>5</number>
+            </property>
+            <property name="topMargin">
+             <number>5</number>
+            </property>
+            <property name="rightMargin">
+             <number>5</number>
+            </property>
+            <property name="bottomMargin">
              <number>5</number>
             </property>
             <item>
@@ -420,7 +483,16 @@
             <property name="spacing">
              <number>5</number>
             </property>
-            <property name="margin">
+            <property name="leftMargin">
+             <number>5</number>
+            </property>
+            <property name="topMargin">
+             <number>5</number>
+            </property>
+            <property name="rightMargin">
+             <number>5</number>
+            </property>
+            <property name="bottomMargin">
              <number>5</number>
             </property>
             <item>
@@ -453,7 +525,16 @@
          <property name="spacing">
           <number>5</number>
          </property>
-         <property name="margin">
+         <property name="leftMargin">
+          <number>5</number>
+         </property>
+         <property name="topMargin">
+          <number>5</number>
+         </property>
+         <property name="rightMargin">
+          <number>5</number>
+         </property>
+         <property name="bottomMargin">
           <number>5</number>
          </property>
          <item>
@@ -743,7 +824,16 @@
          <property name="spacing">
           <number>5</number>
          </property>
-         <property name="margin">
+         <property name="leftMargin">
+          <number>5</number>
+         </property>
+         <property name="topMargin">
+          <number>5</number>
+         </property>
+         <property name="rightMargin">
+          <number>5</number>
+         </property>
+         <property name="bottomMargin">
           <number>5</number>
          </property>
          <item>
@@ -1028,7 +1118,16 @@
          <property name="spacing">
           <number>5</number>
          </property>
-         <property name="margin">
+         <property name="leftMargin">
+          <number>5</number>
+         </property>
+         <property name="topMargin">
+          <number>5</number>
+         </property>
+         <property name="rightMargin">
+          <number>5</number>
+         </property>
+         <property name="bottomMargin">
           <number>5</number>
          </property>
          <item>
@@ -1075,7 +1174,16 @@
          <property name="spacing">
           <number>5</number>
          </property>
-         <property name="margin">
+         <property name="leftMargin">
+          <number>5</number>
+         </property>
+         <property name="topMargin">
+          <number>5</number>
+         </property>
+         <property name="rightMargin">
+          <number>5</number>
+         </property>
+         <property name="bottomMargin">
           <number>5</number>
          </property>
          <item>
@@ -1298,7 +1406,16 @@
          <property name="spacing">
           <number>5</number>
          </property>
-         <property name="margin">
+         <property name="leftMargin">
+          <number>5</number>
+         </property>
+         <property name="topMargin">
+          <number>5</number>
+         </property>
+         <property name="rightMargin">
+          <number>5</number>
+         </property>
+         <property name="bottomMargin">
           <number>5</number>
          </property>
          <item>
@@ -1343,21 +1460,21 @@
        <widget class="QWidget" name="page">
         <layout class="QVBoxLayout" name="verticalLayout_8">
          <item>
-          <widget class="QCheckBox" name="checkBox">
+          <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="checkBox_2">
+          <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="checkBox_3">
+          <widget class="QCheckBox" name="tag_existing_dives">
            <property name="text">
             <string>Same format for existing dives</string>
            </property>
@@ -1370,17 +1487,37 @@
            </property>
            <layout class="QHBoxLayout" name="horizontalLayout_10">
             <item>
-             <widget class="QComboBox" name="comboBox"/>
+             <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="comboBox_2"/>
+             <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">
@@ -1390,7 +1527,14 @@
              </widget>
             </item>
             <item>
-             <widget class="QComboBox" name="comboBox_3"/>
+             <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>
@@ -1766,14 +1910,14 @@
   </connection>
  </connections>
  <buttongroups>
-  <buttongroup name="verticalSpeed"/>
-  <buttongroup name="buttonGroup_2"/>
-  <buttongroup name="buttonGroup_3"/>
-  <buttongroup name="buttonGroup_4"/>
-  <buttongroup name="defaultFileGroup"/>
-  <buttongroup name="buttonGroup_5"/>
   <buttongroup name="buttonGroup_6"/>
-  <buttongroup name="buttonGroup_7"/>
+  <buttongroup name="defaultFileGroup"/>
   <buttongroup name="buttonGroup"/>
+  <buttongroup name="buttonGroup_3"/>
+  <buttongroup name="buttonGroup_7"/>
+  <buttongroup name="buttonGroup_5"/>
+  <buttongroup name="buttonGroup_2"/>
+  <buttongroup name="verticalSpeed"/>
+  <buttongroup name="buttonGroup_4"/>
  </buttongroups>
 </ui>
-- 
2.4.4

From ba093ede13312d2006c9c50127feccbb35333856 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Mon, 22 Jun 2015 17:24:15 -0300
Subject: [PATCH 6/8] Add model to populate the Preferences for GeoRef

Simple model that list the options for GeoRef.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-models/divelocationmodel.cpp | 15 ++++++++++++++-
 qt-models/divelocationmodel.h   |  9 +++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp
index c917cdd..e34e20a 100644
--- a/qt-models/divelocationmodel.cpp
+++ b/qt-models/divelocationmodel.cpp
@@ -77,7 +77,8 @@ bool LocationInformationModel::setData(const QModelIndex &index, const QVariant
 	return true;
 }
 
-bool LocationInformationModel::removeRows(int row, int count, const QModelIndex & parent) {
+bool LocationInformationModel::removeRows(int row, int count, const QModelIndex & parent)
+{
 	if(row >= rowCount())
 		return false;
 
@@ -89,3 +90,15 @@ bool LocationInformationModel::removeRows(int row, int count, const QModelIndex
 	endRemoveRows();
 	return true;
 }
+
+GeoReferencingOptionsModel *GeoReferencingOptionsModel::instance() {
+	static GeoReferencingOptionsModel *self = new GeoReferencingOptionsModel();
+	return self;
+}
+
+GeoReferencingOptionsModel::GeoReferencingOptionsModel(QObject *parent) : QStringListModel(parent)
+{
+	QStringList list;
+	list << "Country" << "State" << "District" << "Town" << "Suburb" << "Body of Water" << "Site Name";
+	setStringList(list);
+}
diff --git a/qt-models/divelocationmodel.h b/qt-models/divelocationmodel.h
index 4e5adf1..c7d8c2e 100644
--- a/qt-models/divelocationmodel.h
+++ b/qt-models/divelocationmodel.h
@@ -2,6 +2,7 @@
 #define DIVELOCATIONMODEL_H
 
 #include <QAbstractListModel>
+#include <QStringListModel>
 #include <stdint.h>
 
 class LocationInformationModel : public QAbstractListModel {
@@ -22,4 +23,12 @@ private:
 	int internalRowCount;
 };
 
+class GeoReferencingOptionsModel : public QStringListModel {
+Q_OBJECT
+public:
+	static GeoReferencingOptionsModel *instance();
+private:
+	GeoReferencingOptionsModel(QObject *parent = 0);
+};
+
 #endif
-- 
2.4.4

From 3ce76d43f1721718cf14a99be58511943d45fa82 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Mon, 22 Jun 2015 16:33:21 -0300
Subject: [PATCH 5/8] Add configuration options to Geo Coding

Just the interface changes for configuration options to
geo coding.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/preferences.ui | 133 ++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 104 insertions(+), 29 deletions(-)

diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui
index b5c6836..6dd179b 100644
--- a/qt-ui/preferences.ui
+++ b/qt-ui/preferences.ui
@@ -143,6 +143,11 @@
          </iconset>
         </property>
        </item>
+       <item>
+        <property name="text">
+         <string>Georeference</string>
+        </property>
+       </item>
       </widget>
      </item>
      <item>
@@ -154,7 +159,7 @@
         </sizepolicy>
        </property>
        <property name="currentIndex">
-        <number>4</number>
+        <number>6</number>
        </property>
        <widget class="QWidget" name="defaults_page">
         <layout class="QVBoxLayout" name="verticalLayout_3">
@@ -1335,6 +1340,76 @@
          </item>
         </layout>
        </widget>
+       <widget class="QWidget" name="page">
+        <layout class="QVBoxLayout" name="verticalLayout_8">
+         <item>
+          <widget class="QCheckBox" name="checkBox">
+           <property name="text">
+            <string>Enable geocoding for dive site management</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="checkBox_2">
+           <property name="text">
+            <string>Parse site without GPS data</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="checkBox_3">
+           <property name="text">
+            <string>Same format for existing dives</string>
+           </property>
+          </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="comboBox"/>
+            </item>
+            <item>
+             <widget class="QLabel" name="label_29">
+              <property name="text">
+               <string>/</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QComboBox" name="comboBox_2"/>
+            </item>
+            <item>
+             <widget class="QLabel" name="label_30">
+              <property name="text">
+               <string>/</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QComboBox" name="comboBox_3"/>
+            </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>495</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </widget>
       </widget>
      </item>
     </layout>
@@ -1360,8 +1435,8 @@
    <slot>accept()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>259</x>
-     <y>817</y>
+     <x>264</x>
+     <y>720</y>
     </hint>
     <hint type="destinationlabel">
      <x>157</x>
@@ -1376,8 +1451,8 @@
    <slot>reject()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>327</x>
-     <y>817</y>
+     <x>332</x>
+     <y>720</y>
     </hint>
     <hint type="destinationlabel">
      <x>286</x>
@@ -1424,8 +1499,8 @@
    <slot>setDisabled(bool)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>126</x>
-     <y>20</y>
+     <x>231</x>
+     <y>26</y>
     </hint>
     <hint type="destinationlabel">
      <x>186</x>
@@ -1440,8 +1515,8 @@
    <slot>setDisabled(bool)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>126</x>
-     <y>20</y>
+     <x>231</x>
+     <y>26</y>
     </hint>
     <hint type="destinationlabel">
      <x>185</x>
@@ -1616,12 +1691,12 @@
    <slot>setValue(int)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>361</x>
-     <y>439</y>
+     <x>236</x>
+     <y>52</y>
     </hint>
     <hint type="destinationlabel">
-     <x>831</x>
-     <y>447</y>
+     <x>236</x>
+     <y>52</y>
     </hint>
    </hints>
   </connection>
@@ -1632,12 +1707,12 @@
    <slot>setValue(int)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>831</x>
-     <y>447</y>
+     <x>236</x>
+     <y>52</y>
     </hint>
     <hint type="destinationlabel">
-     <x>361</x>
-     <y>439</y>
+     <x>236</x>
+     <y>52</y>
     </hint>
    </hints>
   </connection>
@@ -1648,12 +1723,12 @@
    <slot>setEnabled(bool)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>200</x>
-     <y>42</y>
+     <x>409</x>
+     <y>123</y>
     </hint>
     <hint type="destinationlabel">
-     <x>200</x>
-     <y>42</y>
+     <x>409</x>
+     <y>153</y>
     </hint>
    </hints>
   </connection>
@@ -1664,12 +1739,12 @@
    <slot>setEnabled(bool)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>200</x>
-     <y>42</y>
+     <x>409</x>
+     <y>123</y>
     </hint>
     <hint type="destinationlabel">
-     <x>200</x>
-     <y>42</y>
+     <x>409</x>
+     <y>183</y>
     </hint>
    </hints>
   </connection>
@@ -1680,12 +1755,12 @@
    <slot>setHidden(bool)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>754</x>
-     <y>216</y>
+     <x>236</x>
+     <y>44</y>
     </hint>
     <hint type="destinationlabel">
-     <x>801</x>
-     <y>213</y>
+     <x>236</x>
+     <y>44</y>
     </hint>
    </hints>
   </connection>
-- 
2.4.4

From a4b552adff51a34db2a8c06c9e7c429496db0626 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Mon, 22 Jun 2015 16:14:42 -0300
Subject: [PATCH 4/8] Show warning if user loads a old datafile

Show the user a warning if he opens an old version of the divelog
file, the warning tries to explain some things that are different
on the new version.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/mainwindow.cpp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index fd85b2c..23f0b04 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1542,9 +1542,19 @@ void MainWindow::loadFiles(const QStringList fileNames)
 	addRecentFile(fileNames);
 	removeRecentFile(failedParses);
 
-
 	refreshDisplay();
 	ui.actionAutoGroup->setChecked(autogroup);
+
+	if (get_min_datafile_version() < DATAFORMAT_VERSION) {
+		QMessageBox::warning(this, trUtf8("Old version detected."),
+			trUtf8("Because you opened an old version of subsurface divelog file, it's extremelly\n "
+			       "recommended that you read the manual to see the changes on the new version, specially\n"
+			       "about dive site management, it changed a lot. We already prepopulated everything you \n"
+			       "would need to do, so if you wanna just ignore this warning, be my guest. But take\n"
+			       "your time to take a look at the new dive site management system and be amazed."
+			)
+		);
+	}
 }
 
 void MainWindow::on_actionImportDiveLog_triggered()
-- 
2.4.4

From 7a9a8fbd76bbd85b5c40be3ccfbfac738d94e8cf Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Mon, 22 Jun 2015 16:09:15 -0300
Subject: [PATCH 3/8] Do not mess with dive location automatically

This could be what the user wanted, but also, couldn't
be it. so wait for the user to request it manually.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 parse-xml.c          | 3 ---
 qt-ui/mainwindow.cpp | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/parse-xml.c b/parse-xml.c
index 381bd38..4b6901f 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -1167,7 +1167,6 @@ static void gps_location(char *buffer, struct dive_site *ds)
 
 /* this is in qthelper.cpp, so including the .h file is a pain */
 extern const char *printGPSCoords(int lat, int lon);
-extern void add_geo_information_for_lookup(degrees_t latitude, degrees_t longitude, uint32_t uuid);
 
 static void gps_in_dive(char *buffer, struct dive *dive)
 {
@@ -1213,8 +1212,6 @@ static void gps_in_dive(char *buffer, struct dive *dive)
 			ds->longitude = longitude;
 		}
 	}
-	if (ds && (!ds->notes || strstr(ds->notes, "countrytag:") == NULL))
-		add_geo_information_for_lookup(latitude, longitude, dive->dive_site_uuid);
 }
 
 static void add_dive_site(char *ds_name, struct dive *dive)
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 349b84a..fd85b2c 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1542,9 +1542,6 @@ void MainWindow::loadFiles(const QStringList fileNames)
 	addRecentFile(fileNames);
 	removeRecentFile(failedParses);
 
-	// searches for geo lookup information in a thread so it doesn`t
-	// freezes the ui.
-	ReverseGeoLookupThread::instance()->start();
 
 	refreshDisplay();
 	ui.actionAutoGroup->setChecked(autogroup);
-- 
2.4.4

From 23c96239e17974f449fb9224c978fee68e66c805 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Mon, 22 Jun 2015 14:15:08 -0300
Subject: [PATCH 2/8] Create layout on parent, not on items around it.

Correctly handles resizing of interface items by
creating the layout on the parent instead of selecting the
items and applying the layout around them.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/preferences.ui | 129 +++++++++++++++++++++++----------------------------
 1 file changed, 58 insertions(+), 71 deletions(-)

diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui
index 978914b..b5c6836 100644
--- a/qt-ui/preferences.ui
+++ b/qt-ui/preferences.ui
@@ -154,7 +154,7 @@
         </sizepolicy>
        </property>
        <property name="currentIndex">
-        <number>5</number>
+        <number>4</number>
        </property>
        <widget class="QWidget" name="defaults_page">
         <layout class="QVBoxLayout" name="verticalLayout_3">
@@ -1214,76 +1214,63 @@
            <property name="title">
             <string>Subsurface cloud storage</string>
            </property>
-           <widget class="QWidget" name="layoutWidget">
-            <property name="geometry">
-             <rect>
-              <x>12</x>
-              <y>37</y>
-              <width>641</width>
-              <height>83</height>
-             </rect>
-            </property>
-            <layout class="QGridLayout" name="gridLayout_3" rowstretch="1,1,1" columnstretch="1,1,0">
-             <property name="sizeConstraint">
-              <enum>QLayout::SetMaximumSize</enum>
-             </property>
-             <item row="0" column="0">
-              <widget class="QLabel" name="label_16b">
-               <property name="toolTip">
-                <string extracomment="Email address used for the Subsurface cloud storage infrastructure"/>
-               </property>
-               <property name="text">
-                <string>Email address</string>
-               </property>
-              </widget>
-             </item>
-             <item row="0" column="1">
-              <widget class="QLabel" name="label_16c">
-               <property name="text">
-                <string>Password</string>
-               </property>
-              </widget>
-             </item>
-             <item row="1" column="0">
-              <widget class="QLineEdit" name="cloud_storage_email">
-               <property name="toolTip">
-                <string extracomment="Email address used for the Subsurface cloud storage infrastructure"/>
-               </property>
-              </widget>
-             </item>
-             <item row="1" column="1">
-              <widget class="QLineEdit" name="cloud_storage_password"/>
-             </item>
-             <item row="2" column="1">
-              <widget class="QCheckBox" name="save_password_local">
-               <property name="text">
-                <string>Save Password locally?</string>
-               </property>
-              </widget>
-             </item>
-             <item row="0" column="2">
-              <widget class="QLabel" name="cloud_storage_pin_label">
-               <property name="text">
-                <string>Verification PIN</string>
-               </property>
-              </widget>
-             </item>
-             <item row="1" column="2">
-              <widget class="QLineEdit" name="cloud_storage_pin">
-               <property name="toolTip">
-                <string extracomment="One time verification PIN for Subsurface cloud storage infrastructure"/>
-               </property>
-              </widget>
-             </item>
-             <item row="2" column="0">
-              <widget class="QCheckBox" name="cloud_background_sync">
-               <property name="text">
-                <string>Sync to cloud in the background?</string>
-               </property>
-              </widget>
-             </item>
-            </layout>
-           </widget>
+           <layout class="QGridLayout" name="gridLayout_3">
+            <item row="0" column="0">
+             <widget class="QLabel" name="label_16b">
+              <property name="toolTip">
+               <string extracomment="Email address used for the Subsurface cloud storage infrastructure"/>
+              </property>
+              <property name="text">
+               <string>Email address</string>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="1">
+             <widget class="QLabel" name="label_16c">
+              <property name="text">
+               <string>Password</string>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="2">
+             <widget class="QLabel" name="cloud_storage_pin_label">
+              <property name="text">
+               <string>Verification PIN</string>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="0">
+             <widget class="QLineEdit" name="cloud_storage_email">
+              <property name="toolTip">
+               <string extracomment="Email address used for the Subsurface cloud storage infrastructure"/>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="1">
+             <widget class="QLineEdit" name="cloud_storage_password"/>
+            </item>
+            <item row="1" column="2">
+             <widget class="QLineEdit" name="cloud_storage_pin">
+              <property name="toolTip">
+               <string extracomment="One time verification PIN for Subsurface cloud storage infrastructure"/>
+              </property>
+             </widget>
+            </item>
+            <item row="2" column="0">
+             <widget class="QCheckBox" name="cloud_background_sync">
+              <property name="text">
+               <string>Sync to cloud in the background?</string>
+              </property>
+             </widget>
+            </item>
+            <item row="2" column="1">
+             <widget class="QCheckBox" name="save_password_local">
+              <property name="text">
+               <string>Save Password locally?</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
           </widget>
          </item>
          <item>
-- 
2.4.4

From 97d3545eb7502ed7aacfe0ece8cd54390843dc09 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Mon, 22 Jun 2015 14:13:42 -0300
Subject: [PATCH 1/8] do not set default sizes for expanders

This was creating a lot of empty spaces on the preferences
dialog and making Dirk unhappy.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/preferences.ui | 169 ++++++++-------------------------------------------
 1 file changed, 26 insertions(+), 143 deletions(-)

diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui
index a8ee076..978914b 100644
--- a/qt-ui/preferences.ui
+++ b/qt-ui/preferences.ui
@@ -19,16 +19,7 @@
    </iconset>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2">
-   <property name="leftMargin">
-    <number>5</number>
-   </property>
-   <property name="topMargin">
-    <number>5</number>
-   </property>
-   <property name="rightMargin">
-    <number>5</number>
-   </property>
-   <property name="bottomMargin">
+   <property name="margin">
     <number>5</number>
    </property>
    <item>
@@ -170,16 +161,7 @@
          <property name="spacing">
           <number>5</number>
          </property>
-         <property name="leftMargin">
-          <number>5</number>
-         </property>
-         <property name="topMargin">
-          <number>5</number>
-         </property>
-         <property name="rightMargin">
-          <number>5</number>
-         </property>
-         <property name="bottomMargin">
+         <property name="margin">
           <number>5</number>
          </property>
          <item>
@@ -194,16 +176,7 @@
             <property name="verticalSpacing">
              <number>5</number>
             </property>
-            <property name="leftMargin">
-             <number>5</number>
-            </property>
-            <property name="topMargin">
-             <number>5</number>
-            </property>
-            <property name="rightMargin">
-             <number>5</number>
-            </property>
-            <property name="bottomMargin">
+            <property name="margin">
              <number>5</number>
             </property>
             <item row="0" column="0">
@@ -241,16 +214,7 @@
             <property name="verticalSpacing">
              <number>5</number>
             </property>
-            <property name="leftMargin">
-             <number>5</number>
-            </property>
-            <property name="topMargin">
-             <number>5</number>
-            </property>
-            <property name="rightMargin">
-             <number>5</number>
-            </property>
-            <property name="bottomMargin">
+            <property name="margin">
              <number>5</number>
             </property>
             <item row="0" column="0">
@@ -354,16 +318,7 @@
             <property name="verticalSpacing">
              <number>5</number>
             </property>
-            <property name="leftMargin">
-             <number>5</number>
-            </property>
-            <property name="topMargin">
-             <number>5</number>
-            </property>
-            <property name="rightMargin">
-             <number>5</number>
-            </property>
-            <property name="bottomMargin">
+            <property name="margin">
              <number>5</number>
             </property>
             <item row="0" column="0">
@@ -389,16 +344,7 @@
             <string>Animations</string>
            </property>
            <layout class="QHBoxLayout" name="horizontalLayout_7">
-            <property name="leftMargin">
-             <number>5</number>
-            </property>
-            <property name="topMargin">
-             <number>5</number>
-            </property>
-            <property name="rightMargin">
-             <number>5</number>
-            </property>
-            <property name="bottomMargin">
+            <property name="margin">
              <number>5</number>
             </property>
             <item>
@@ -437,16 +383,7 @@
             <property name="spacing">
              <number>5</number>
             </property>
-            <property name="leftMargin">
-             <number>5</number>
-            </property>
-            <property name="topMargin">
-             <number>5</number>
-            </property>
-            <property name="rightMargin">
-             <number>5</number>
-            </property>
-            <property name="bottomMargin">
+            <property name="margin">
              <number>5</number>
             </property>
             <item>
@@ -478,16 +415,7 @@
             <property name="spacing">
              <number>5</number>
             </property>
-            <property name="leftMargin">
-             <number>5</number>
-            </property>
-            <property name="topMargin">
-             <number>5</number>
-            </property>
-            <property name="rightMargin">
-             <number>5</number>
-            </property>
-            <property name="bottomMargin">
+            <property name="margin">
              <number>5</number>
             </property>
             <item>
@@ -507,8 +435,8 @@
            </property>
            <property name="sizeHint" stdset="0">
             <size>
-             <width>20</width>
-             <height>40</height>
+             <width>0</width>
+             <height>0</height>
             </size>
            </property>
           </spacer>
@@ -520,16 +448,7 @@
          <property name="spacing">
           <number>5</number>
          </property>
-         <property name="leftMargin">
-          <number>5</number>
-         </property>
-         <property name="topMargin">
-          <number>5</number>
-         </property>
-         <property name="rightMargin">
-          <number>5</number>
-         </property>
-         <property name="bottomMargin">
+         <property name="margin">
           <number>5</number>
          </property>
          <item>
@@ -806,8 +725,8 @@
            </property>
            <property name="sizeHint" stdset="0">
             <size>
-             <width>20</width>
-             <height>40</height>
+             <width>0</width>
+             <height>0</height>
             </size>
            </property>
           </spacer>
@@ -819,16 +738,7 @@
          <property name="spacing">
           <number>5</number>
          </property>
-         <property name="leftMargin">
-          <number>5</number>
-         </property>
-         <property name="topMargin">
-          <number>5</number>
-         </property>
-         <property name="rightMargin">
-          <number>5</number>
-         </property>
-         <property name="bottomMargin">
+         <property name="margin">
           <number>5</number>
          </property>
          <item>
@@ -1100,8 +1010,8 @@
            </property>
            <property name="sizeHint" stdset="0">
             <size>
-             <width>20</width>
-             <height>40</height>
+             <width>0</width>
+             <height>0</height>
             </size>
            </property>
           </spacer>
@@ -1113,16 +1023,7 @@
          <property name="spacing">
           <number>5</number>
          </property>
-         <property name="leftMargin">
-          <number>5</number>
-         </property>
-         <property name="topMargin">
-          <number>5</number>
-         </property>
-         <property name="rightMargin">
-          <number>5</number>
-         </property>
-         <property name="bottomMargin">
+         <property name="margin">
           <number>5</number>
          </property>
          <item>
@@ -1169,16 +1070,7 @@
          <property name="spacing">
           <number>5</number>
          </property>
-         <property name="leftMargin">
-          <number>5</number>
-         </property>
-         <property name="topMargin">
-          <number>5</number>
-         </property>
-         <property name="rightMargin">
-          <number>5</number>
-         </property>
-         <property name="bottomMargin">
+         <property name="margin">
           <number>5</number>
          </property>
          <item>
@@ -1401,8 +1293,8 @@
            </property>
            <property name="sizeHint" stdset="0">
             <size>
-             <width>20</width>
-             <height>40</height>
+             <width>0</width>
+             <height>0</height>
             </size>
            </property>
           </spacer>
@@ -1414,16 +1306,7 @@
          <property name="spacing">
           <number>5</number>
          </property>
-         <property name="leftMargin">
-          <number>5</number>
-         </property>
-         <property name="topMargin">
-          <number>5</number>
-         </property>
-         <property name="rightMargin">
-          <number>5</number>
-         </property>
-         <property name="bottomMargin">
+         <property name="margin">
           <number>5</number>
          </property>
          <item>
@@ -1457,8 +1340,8 @@
            </property>
            <property name="sizeHint" stdset="0">
             <size>
-             <width>20</width>
-             <height>40</height>
+             <width>0</width>
+             <height>0</height>
             </size>
            </property>
           </spacer>
@@ -1821,14 +1704,14 @@
   </connection>
  </connections>
  <buttongroups>
+  <buttongroup name="verticalSpeed"/>
   <buttongroup name="buttonGroup_2"/>
+  <buttongroup name="buttonGroup_3"/>
+  <buttongroup name="buttonGroup_4"/>
   <buttongroup name="defaultFileGroup"/>
-  <buttongroup name="verticalSpeed"/>
   <buttongroup name="buttonGroup_5"/>
-  <buttongroup name="buttonGroup_3"/>
   <buttongroup name="buttonGroup_6"/>
   <buttongroup name="buttonGroup_7"/>
   <buttongroup name="buttonGroup"/>
-  <buttongroup name="buttonGroup_4"/>
  </buttongroups>
 </ui>
-- 
2.4.4

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to