From 772be1a9f67504113850ac7fdff76608b84fb4ce Mon Sep 17 00:00:00 2001
From: Martyn Gigg <martyn.gigg@gmail.com>
Date: Thu, 26 Oct 2017 13:19:58 +0100
Subject: [PATCH] Replace to/fromAscii with to/fromLatin1

The former has been removed in Qt5.
Refs #0
---
 .../Widgets/QtWidgets/SimpleBinInputWidget.cpp |  2 +-
 .../ViewWidgets/src/ColorSelectionWidget.cpp   |  2 +-
 .../ViewWidgets/src/MultisliceView.cpp         |  4 ++--
 .../ViewWidgets/src/SplatterPlotView.cpp       | 18 +++++++++---------
 qt/widgets/common/src/DoubleSpinBox.cpp        |  2 +-
 qt/widgets/common/src/MantidWSIndexDialog.cpp  |  4 ++--
 qt/widgets/common/src/PythonRunner.cpp         |  4 ++--
 qt/widgets/common/src/ScriptEditor.cpp         |  2 +-
 .../instrumentview/src/InstrumentWidget.cpp    |  2 +-
 9 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/qt/paraview_ext/PVPlugins/Widgets/QtWidgets/SimpleBinInputWidget.cpp b/qt/paraview_ext/PVPlugins/Widgets/QtWidgets/SimpleBinInputWidget.cpp
index 52fc68982d8..b59dda6e67d 100644
--- a/qt/paraview_ext/PVPlugins/Widgets/QtWidgets/SimpleBinInputWidget.cpp
+++ b/qt/paraview_ext/PVPlugins/Widgets/QtWidgets/SimpleBinInputWidget.cpp
@@ -41,7 +41,7 @@ Getter for the current entry.
 @return current entry value
 */
 int SimpleBinInputWidget::getEntry(double, double) const {
-  return std::stoi(std::string(m_nBinsBox->text().toAscii()));
+  return std::stoi(std::string(m_nBinsBox->text().toLatin1()));
 }
 
 /// Destructor
diff --git a/qt/paraview_ext/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp b/qt/paraview_ext/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp
index 31e893f7f6d..9723fe01b3b 100644
--- a/qt/paraview_ext/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp
+++ b/qt/paraview_ext/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp
@@ -207,7 +207,7 @@ void ColorSelectionWidget::loadPreset() {
   preset.setCustomizableUsePresetRange(false, false);
   preset.setCustomizableLoadAnnotations(false, false);
   preset.setCurrentPreset(
-      m_mdSettings.getLastSessionColorMap().toAscii().constData());
+      m_mdSettings.getLastSessionColorMap().toLatin1().constData());
   this->connect(&preset, SIGNAL(applyPreset(const Json::Value &)), this,
                 SLOT(onApplyPreset(const Json::Value &)));
   preset.exec();
diff --git a/qt/paraview_ext/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp b/qt/paraview_ext/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp
index b610173d51e..ebe24e848db 100644
--- a/qt/paraview_ext/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp
+++ b/qt/paraview_ext/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp
@@ -294,7 +294,7 @@ void MultiSliceView::showCutInSliceViewer(int axisIndex,
 
     std::vector<double> scaling =
         vtkSMPropertyHelper(src2->getProxy(),
-                            scalingProperty.toAscii().constData(),
+                            scalingProperty.toLatin1().constData(),
                             true).GetDoubleArray();
 
     if (!scaling.empty()) {
@@ -334,7 +334,7 @@ void MultiSliceView::showCutInSliceViewer(int axisIndex,
         "The slice could not be shown because of the following error:\n" +
         QString(e.what());
     QMessageBox::warning(this, tr("MantidPlot"),
-                         tr(message.toAscii().constData()), QMessageBox::Ok,
+                         tr(message.toLatin1().constData()), QMessageBox::Ok,
                          QMessageBox::Ok);
     delete w;
   }
diff --git a/qt/paraview_ext/VatesSimpleGui/ViewWidgets/src/SplatterPlotView.cpp b/qt/paraview_ext/VatesSimpleGui/ViewWidgets/src/SplatterPlotView.cpp
index c3880dfa57e..2c4c09db88f 100644
--- a/qt/paraview_ext/VatesSimpleGui/ViewWidgets/src/SplatterPlotView.cpp
+++ b/qt/paraview_ext/VatesSimpleGui/ViewWidgets/src/SplatterPlotView.cpp
@@ -269,7 +269,7 @@ void SplatterPlotView::checkPeaksCoordinates() {
         vtkSMPropertyHelper(
             this->origSrc->getProxy(),
             MantidQt::API::MdConstants::MantidParaViewSpecialCoordinates
-                .toAscii()
+                .toLatin1()
                 .constData()).GetAsInt();
     // Make commensurate with vtkPeakMarkerFactory
     peakViewCoords--;
@@ -277,7 +277,7 @@ void SplatterPlotView::checkPeaksCoordinates() {
     foreach (pqPipelineSource *src, this->m_peaksSource) {
       vtkSMPropertyHelper(
           src->getProxy(),
-          MantidQt::API::MdConstants::PeakDimensions.toAscii().constData())
+          MantidQt::API::MdConstants::PeakDimensions.toLatin1().constData())
           .Set(peakViewCoords);
       src->getProxy()->UpdateVTKObjects();
     }
@@ -367,7 +367,7 @@ void SplatterPlotView::readAndSendCoordinates() {
         vtkSMPropertyHelper(
             this->origSrc->getProxy(),
             MantidQt::API::MdConstants::MantidParaViewSpecialCoordinates
-                .toAscii()
+                .toLatin1()
                 .constData()).GetAsInt();
     // Make commensurate with vtkPeakMarkerFactory
     peakViewCoords--;
@@ -555,12 +555,12 @@ void SplatterPlotView::setPeakSourceFrame(pqPipelineSource *source) {
   int peakViewCoords =
       vtkSMPropertyHelper(
           this->origSrc->getProxy(),
-          MantidQt::API::MdConstants::MantidParaViewSpecialCoordinates.toAscii()
+          MantidQt::API::MdConstants::MantidParaViewSpecialCoordinates.toLatin1()
               .constData()).GetAsInt();
   peakViewCoords--;
   vtkSMPropertyHelper(
       source->getProxy(),
-      MantidQt::API::MdConstants::PeakDimensions.toAscii().constData())
+      MantidQt::API::MdConstants::PeakDimensions.toLatin1().constData())
       .Set(peakViewCoords);
 }
 
@@ -573,14 +573,14 @@ bool SplatterPlotView::checkIfPeaksWorkspaceIsAlreadyBeingTracked(
   std::string sourceName(
       vtkSMPropertyHelper(
           source->getProxy(),
-          MantidQt::API::MdConstants::WorkspaceName.toAscii().constData())
+          MantidQt::API::MdConstants::WorkspaceName.toLatin1().constData())
           .GetAsString());
   for (QList<QPointer<pqPipelineSource>>::Iterator it = m_peaksSource.begin();
        it != m_peaksSource.end(); ++it) {
     std::string trackedName(
         vtkSMPropertyHelper(
             (*it)->getProxy(),
-            MantidQt::API::MdConstants::WorkspaceName.toAscii().constData())
+            MantidQt::API::MdConstants::WorkspaceName.toLatin1().constData())
             .GetAsString());
     if ((*it == source) || (sourceName == trackedName)) {
       isContained = true;
@@ -615,11 +615,11 @@ void SplatterPlotView::updatePeaksFilter(pqPipelineSource *filter) {
 
     vtkSMPropertyHelper(
         filter->getProxy(),
-        MantidQt::API::MdConstants::PeaksWorkspace.toAscii().constData())
+        MantidQt::API::MdConstants::PeaksWorkspace.toLatin1().constData())
         .Set(0, workspaceNamesConcatentated.c_str());
     vtkSMPropertyHelper(
         filter->getProxy(),
-        MantidQt::API::MdConstants::PeaksWorkspace.toAscii().constData())
+        MantidQt::API::MdConstants::PeaksWorkspace.toLatin1().constData())
         .Set(1, m_peaksWorkspaceNameDelimiter.c_str());
     emit this->triggerAccept();
     filter->updatePipeline();
diff --git a/qt/widgets/common/src/DoubleSpinBox.cpp b/qt/widgets/common/src/DoubleSpinBox.cpp
index 295e076e4bd..9ca670a83b4 100644
--- a/qt/widgets/common/src/DoubleSpinBox.cpp
+++ b/qt/widgets/common/src/DoubleSpinBox.cpp
@@ -131,7 +131,7 @@ void DoubleSpinBox::interpretText(bool notify) {
   //    parser.addGSLConstants();
   //    try
   //    {
-  //      parser.SetExpr(s.toAscii().constData());
+  //      parser.SetExpr(s.toLatin1().constData());
   //      value = parser.Eval();
   //    } catch (mu::ParserError &e)
   //    {
diff --git a/qt/widgets/common/src/MantidWSIndexDialog.cpp b/qt/widgets/common/src/MantidWSIndexDialog.cpp
index b403700ab9b..20d44498ad0 100644
--- a/qt/widgets/common/src/MantidWSIndexDialog.cpp
+++ b/qt/widgets/common/src/MantidWSIndexDialog.cpp
@@ -457,7 +457,7 @@ void MantidWSIndexWidget::initWorkspaceBox() {
   m_wsBox = new QVBoxLayout;
   const QString wsIndices = m_wsIndexIntervals.toQString();
   const QString label = "Enter Workspace Indices: " + wsIndices;
-  m_wsMessage = new QLabel(tr(label.toAscii().constData()));
+  m_wsMessage = new QLabel(tr(label.toLatin1().constData()));
   m_wsField = new QLineEditWithErrorMark();
 
   m_wsField->lineEdit()->setValidator(
@@ -481,7 +481,7 @@ void MantidWSIndexWidget::initSpectraBox() {
   m_spectraBox = new QVBoxLayout;
   const QString spectraNumbers = m_spectraNumIntervals.toQString();
   const QString label = "Enter Spectra Numbers: " + spectraNumbers;
-  m_spectraMessage = new QLabel(tr(label.toAscii().constData()));
+  m_spectraMessage = new QLabel(tr(label.toLatin1().constData()));
   m_spectraField = new QLineEditWithErrorMark();
   m_orMessage = new QLabel(tr("<br>Or"));
 
diff --git a/qt/widgets/common/src/PythonRunner.cpp b/qt/widgets/common/src/PythonRunner.cpp
index 624bbb44c83..ac4d8218c87 100644
--- a/qt/widgets/common/src/PythonRunner.cpp
+++ b/qt/widgets/common/src/PythonRunner.cpp
@@ -26,7 +26,7 @@ QString PythonRunner::runPythonCode(const QString &code, bool no_output) {
   using Mantid::Kernel::Logger;
 
   if (g_log.is(Logger::Priority::PRIO_DEBUG))
-    g_log.debug() << "Running Python code:\n" << code.toAscii().data() << "\n";
+    g_log.debug() << "Running Python code:\n" << code.toLatin1().data() << "\n";
 
   if (no_output) {
     emit runAsPythonScript(code, true);
@@ -64,7 +64,7 @@ QString PythonRunner::runPythonCode(const QString &code, bool no_output) {
   // with clang
   if (g_log.is(Logger::Priority::PRIO_DEBUG))
     g_log.debug() << "Raw output from execution:\n"
-                  << tmpstring.toAscii().data() << "\n";
+                  << tmpstring.toLatin1().data() << "\n";
   return tmpstring;
 }
 /** This Python helper function converts a list of strings into one
diff --git a/qt/widgets/common/src/ScriptEditor.cpp b/qt/widgets/common/src/ScriptEditor.cpp
index 5accd2bc719..06c62924ff9 100644
--- a/qt/widgets/common/src/ScriptEditor.cpp
+++ b/qt/widgets/common/src/ScriptEditor.cpp
@@ -294,7 +294,7 @@ void ScriptEditor::saveScript(const QString &filename) {
   if (!file.open(QIODevice::WriteOnly)) {
     QString msg =
         QString("Could not open file \"%1\" for writing.").arg(filename);
-    throw std::runtime_error(msg.toAscii().data());
+    throw std::runtime_error(msg.toLatin1().data());
   }
 
   m_filename = filename;
diff --git a/qt/widgets/instrumentview/src/InstrumentWidget.cpp b/qt/widgets/instrumentview/src/InstrumentWidget.cpp
index 887cbc21aa4..a7f95ce00e7 100644
--- a/qt/widgets/instrumentview/src/InstrumentWidget.cpp
+++ b/qt/widgets/instrumentview/src/InstrumentWidget.cpp
@@ -669,7 +669,7 @@ void InstrumentWidget::saveImage(QString filename) {
     filename += defaultExt;
     ext = QFileInfo(filename).completeSuffix();
   } else {
-    if (!formats.contains(ext.toAscii())) {
+    if (!formats.contains(ext.toLatin1())) {
       QString msg("Unsupported file extension. Choose one of the following: ");
       QListIterator<QByteArray> itr(formats);
       while (itr.hasNext()) {
-- 
GitLab