From 5ed6b48f8b22583644e69068d79f56ec187d4f67 Mon Sep 17 00:00:00 2001
From: Stephane ALBERT <stephane.albert@c-s.fr>
Date: Wed, 21 Sep 2016 18:14:09 +0200
Subject: [PATCH] BUG: MANTIS-1267: Initialized overviews settings to default
 values in preferences dialog; Added serialization support for overviews
 settings.

---
 .../Monteverdi/src/mvdPreferencesDialog.cxx   | 43 ++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/Modules/Visualization/Monteverdi/src/mvdPreferencesDialog.cxx b/Modules/Visualization/Monteverdi/src/mvdPreferencesDialog.cxx
index 41995ae8b3..1878de3719 100644
--- a/Modules/Visualization/Monteverdi/src/mvdPreferencesDialog.cxx
+++ b/Modules/Visualization/Monteverdi/src/mvdPreferencesDialog.cxx
@@ -38,6 +38,7 @@
 
 //
 // Monteverdi includes (sorted by alphabetic order)
+#include "mvdCore.h"
 #include "mvdGui.h"
 #include "mvdI18nApplication.h"
 #include "mvdI18nMainWindow.h"
@@ -129,6 +130,35 @@ PreferencesDialog
     .toString()
   );
 
+  //
+  // GDAL overviews.
+  {
+    QVariant value(
+      I18nApplication::Instance()->RetrieveSettingsKey(
+	I18nCoreApplication::SETTINGS_KEY_OVERVIEWS_ENABLED
+      )
+    );
+
+    m_UI->overviewsCheckBox->setChecked(
+      !value.isValid()
+      ? OVERVIEWS_ENABLED_DEFAULT
+      : value.toBool()
+    );
+  }
+  {
+    QVariant value(
+      I18nApplication::Instance()->RetrieveSettingsKey(
+	I18nCoreApplication::SETTINGS_KEY_OVERVIEWS_SIZE
+      )
+    );
+
+    m_UI->overviewsSpinBox->setValue(
+      !value.isValid()
+      ? OVERVIEWS_SIZE_DEFAULT
+      : value.toInt()
+    );
+  }
+
   //
   // Rendering settings.
   {
@@ -140,7 +170,7 @@ PreferencesDialog
 
     m_UI->resolutionComboBox->setCurrentIndex(
       !value.isValid()
-      ? RESOLUTION_LOWER
+      ? RESOLUTION_DEFAULT
       : value.toInt()
     );
   }
@@ -261,6 +291,17 @@ PreferencesDialog
     m_UI->geoidLineEdit->text()
   );
 
+  //
+  // Overview settings.
+  I18nApplication::Instance()->StoreSettingsKey(
+    I18nCoreApplication::SETTINGS_KEY_OVERVIEWS_ENABLED,
+    m_UI->overviewsCheckBox->isChecked()
+  );
+  I18nApplication::Instance()->StoreSettingsKey(
+    I18nCoreApplication::SETTINGS_KEY_OVERVIEWS_SIZE,
+    m_UI->overviewsSpinBox->value()
+  );
+
   //
   // Rendering settings.
   I18nApplication::Instance()->StoreSettingsKey(
-- 
GitLab