From 08196f17901feef917a2bd06e413ecec77010a08 Mon Sep 17 00:00:00 2001
From: Steven Hahn <hahnse@ornl.gov>
Date: Fri, 13 Nov 2015 19:15:46 -0500
Subject: [PATCH] Refs #14417. Work on properly setting defaults.

---
 .../ViewWidgets/src/ColorSelectionWidget.cpp  | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp
index 47baa14aaf7..68b269ec546 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp
+++ b/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp
@@ -101,12 +101,7 @@ void ColorSelectionWidget::loadBuiltinColorPresets()
   */
   void ColorSelectionWidget::loadColorMap(bool viewSwitched)
   {
-    /*int defaultColorMapIndex =
-    this->colorMapManager->getDefaultColorMapIndex(viewSwitched);
 
-    const pqColorMapModel *colorMap =
-    this->m_presets->getModel()->getColorMap(defaultColorMapIndex);
-    */
     QString defaultColorMap;
 
     // If the view has switched or the VSI is loaded use the last color map
@@ -128,12 +123,14 @@ void ColorSelectionWidget::loadBuiltinColorPresets()
       }
     }
 
-    // currently incorrect. json document more than just a number!
-    const Json::Value &colorMap = m_presets->GetFirstPresetWithName(
-        defaultColorMap.toStdString().c_str());
-    if (!colorMap.empty()) {
-      // emit this->colorMapChanged(colorMap);
-    }
+    // Mantid::VATES::ColorScaleLockGuard guard(m_colorScaleLock);
+    pqPresetDialog dialog(this, pqPresetDialog::SHOW_NON_INDEXED_COLORS_ONLY);
+    dialog.setCurrentPreset(defaultColorMap.toStdString().c_str());
+    Json::Value colorMap = dialog.currentPreset();
+    // cout << "default:" << defaultColorMap.toStdString() << " "  << colorMap
+    // << "\n";
+    if (!colorMap.empty())
+      emit this->colorMapChanged(colorMap);
   }
 
 /**
-- 
GitLab