From 96b0d1693ce44f558a56cb5e63459bcaa827b2a8 Mon Sep 17 00:00:00 2001
From: Steve Williams <stephen.williams@stfc.ac.uk>
Date: Fri, 12 Nov 2010 11:19:19 +0000
Subject: [PATCH] MantidDialog now replaces MantidQTDialog and the new class
 has a PythonRunner object re #1747

---
 Code/qtiplot/MantidQt/API/API.pro             |  6 +-
 .../inc/{MantidQtDialog.h => MantidDialog.h}  | 30 +++++---
 Code/qtiplot/MantidQt/API/inc/MantidWidget.h  | 12 +++-
 .../qtiplot/MantidQt/API/src/MantidDialog.cpp | 70 +++++++++++++++++++
 .../MantidQt/API/src/MantidQtDialog.cpp       | 57 ---------------
 .../qtiplot/MantidQt/API/src/MantidWidget.cpp | 39 ++---------
 .../CustomInterfaces/inc/Background.h         |  4 +-
 .../CustomInterfaces/inc/SANSUtilityDialogs.h |  4 +-
 .../src/SANSUtilityDialogs.cpp                |  2 +-
 .../CustomInterfaces/src/background.cpp       |  2 +-
 .../MantidQt/MantidWidgets/inc/DiagResults.h  |  4 +-
 .../MantidQt/MantidWidgets/inc/MWDiag.h       |  1 -
 .../MantidWidgets/inc/SaveWorkspaces.h        |  4 +-
 .../MantidWidgets/src/DiagResults.cpp         |  2 +-
 .../MantidWidgets/src/SaveWorkspaces.cpp      |  2 +-
 .../src/Mantid/AlgorithmHistoryWindow.cpp     |  2 +-
 .../src/Mantid/AlgorithmHistoryWindow.h       |  6 +-
 .../qtiplot/src/Mantid/MantidAbout.cpp        | 62 ++++++++--------
 Code/qtiplot/qtiplot/src/Mantid/MantidAbout.h |  5 +-
 .../qtiplot/src/Mantid/MantidApplication.cpp  |  4 +-
 20 files changed, 161 insertions(+), 157 deletions(-)
 rename Code/qtiplot/MantidQt/API/inc/{MantidQtDialog.h => MantidDialog.h} (71%)
 create mode 100644 Code/qtiplot/MantidQt/API/src/MantidDialog.cpp
 delete mode 100644 Code/qtiplot/MantidQt/API/src/MantidQtDialog.cpp

diff --git a/Code/qtiplot/MantidQt/API/API.pro b/Code/qtiplot/MantidQt/API/API.pro
index c9a8d676d8b..1c17102e000 100644
--- a/Code/qtiplot/MantidQt/API/API.pro
+++ b/Code/qtiplot/MantidQt/API/API.pro
@@ -20,6 +20,7 @@ HEADERDIR = inc
 SRCDIR = src
 
 SOURCES = \
+  $$SRCDIR/PythonRunner.cpp \
   $$SRCDIR/MantidWidget.cpp \
   $$SRCDIR/InterfaceFactory.cpp \
   $$SRCDIR/InterfaceManager.cpp \
@@ -27,11 +28,12 @@ SOURCES = \
   $$SRCDIR/AlgorithmDialog.cpp \
   $$SRCDIR/GenericDialog.cpp \
   $$SRCDIR/UserSubWindow.cpp \
-  $$SRCDIR/MantidQtDialog.cpp \
+  $$SRCDIR/MantidDialog.cpp \
   $$SRCDIR/ManageUserDirectories.cpp
 
   
 HEADERS = \
+  $$HEADERDIR/PythonRunner.h \
   $$HEADERDIR/MantidWidget.h \
   $$HEADERDIR/DllOption.h \
   $$HEADERDIR/InterfaceFactory.h \
@@ -40,7 +42,7 @@ HEADERS = \
   $$HEADERDIR/AlgorithmDialog.h \
   $$HEADERDIR/GenericDialog.h \
   $$HEADERDIR/UserSubWindow.h \
-  $$HEADERDIR/MantidQtDialog.h \
+  $$HEADERDIR/MantidDialog.h \
   $$HEADERDIR/FileDialogHandler.h \
   $$HEADERDIR/ManageUserDirectories.h
 
diff --git a/Code/qtiplot/MantidQt/API/inc/MantidQtDialog.h b/Code/qtiplot/MantidQt/API/inc/MantidDialog.h
similarity index 71%
rename from Code/qtiplot/MantidQt/API/inc/MantidQtDialog.h
rename to Code/qtiplot/MantidQt/API/inc/MantidDialog.h
index 767b4e555b4..1e7fa8ebaf3 100644
--- a/Code/qtiplot/MantidQt/API/inc/MantidQtDialog.h
+++ b/Code/qtiplot/MantidQt/API/inc/MantidDialog.h
@@ -1,12 +1,13 @@
-#ifndef MANTIDQT_API_MANTIDQTDIALOG_H_
-#define MANTIDQT_API_MANTIDQTDIALOG_H_
+#ifndef MANTIDQT_API_MANTIDDIALOG_H_
+#define MANTIDQT_API_MANTIDDIALOG_H_
 
 //----------------------------------
 // Includes
 //----------------------------------
 #include "DllOption.h"
-
+#include "MantidQtAPI/PythonRunner.h"
 #include <QDialog>
+#include <boost/shared_ptr.hpp>
 
 //----------------------------------
 // Qt Forward declarations
@@ -32,7 +33,7 @@ namespace API
             }
             catch(std::exception& e)
             {
-                if (MantidQt::API::MantidQtDialog::handle(receiver,e))
+                if (MantidQt::API::MantidDialog::handle(receiver,e))
                     return true; // stops event propagation
                 else
                    // do somethig else ... 
@@ -66,7 +67,7 @@ namespace API
     File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>
     Code Documentation is available at: <http://doxygen.mantidproject.org>    
 */
-class EXPORT_OPT_MANTIDQT_API MantidQtDialog : public QDialog
+class EXPORT_OPT_MANTIDQT_API MantidDialog : public QDialog
 {
   
   Q_OBJECT
@@ -74,19 +75,30 @@ class EXPORT_OPT_MANTIDQT_API MantidQtDialog : public QDialog
 public:
 
   /// DefaultConstructor
-  MantidQtDialog(QWidget* parent = 0);
+  MantidDialog(QWidget* parent = 0);
   /// Destructor
-  virtual ~MantidQtDialog();
+  virtual ~MantidDialog();
 
   /// Handles the exception caught in an event handler.
   static bool handle( QObject* receiver, const std::exception& e );
 
-  // Override this method to handle an exception in a derived class.
+
+signals:
+  void runAsPythonScript(const QString& code);
+
+protected:
+  /// Run python code that is passed to it and, optionally, return anything it wrote to standard output as a string
+  QString runPythonCode(const QString & code, bool no_output = false);
+
+  /// Override this method to handle an exception in a derived class.
   virtual void handleException( const std::exception& e );
 
+private:
+  /// This object implements the runPythonCode() function, by emitting the code as a runAsPythonScript signal
+  boost::shared_ptr<PythonRunner> m_pyRunner;
 };
 
 }
 }
 
-#endif //MANTIDQT_API_MANTIDQTDIALOG_H_
+#endif //MANTIDQT_API_MANTIDDIALOG_H_
diff --git a/Code/qtiplot/MantidQt/API/inc/MantidWidget.h b/Code/qtiplot/MantidQt/API/inc/MantidWidget.h
index 2d102cb75fe..99cee151d21 100644
--- a/Code/qtiplot/MantidQt/API/inc/MantidWidget.h
+++ b/Code/qtiplot/MantidQt/API/inc/MantidWidget.h
@@ -1,8 +1,10 @@
 #ifndef MANTIDQTAPI_MANTIDWIDGET_H_
 #define MANTIDQTAPI_MANTIDWIDGET_H_
 
+#include "MantidQtAPI/PythonRunner.h"
 #include <QWidget>
 #include "DllOption.h"
+#include <boost/shared_ptr.hpp>
 
 /** The ase class from which mantid custom widgets are derived it contains
 *  some useful functions
@@ -43,15 +45,21 @@ namespace MantidQt
     Q_OBJECT
 
     public:
-      //
+      /// empty virtual destructor
+      ~MantidWidget(){}
+
     signals:
       void runAsPythonScript(const QString& code);
 
     protected:
       /// Default constructor
       MantidWidget(QWidget *parent = NULL);
-      /// Run python code
+      /// Run python code that is passed to it and, optionally, return anything it wrote to standard output as a string
       QString runPythonCode(const QString & code, bool no_output = false);
+
+    private:
+      /// This object implements the runPythonCode() function, by emitting the code as a runAsPythonScript signal
+      boost::shared_ptr<PythonRunner> m_pyRunner;
     };
   }
 }
diff --git a/Code/qtiplot/MantidQt/API/src/MantidDialog.cpp b/Code/qtiplot/MantidQt/API/src/MantidDialog.cpp
new file mode 100644
index 00000000000..1270ba0bef2
--- /dev/null
+++ b/Code/qtiplot/MantidQt/API/src/MantidDialog.cpp
@@ -0,0 +1,70 @@
+//----------------------------------
+// Includes
+//----------------------------------
+#include "MantidQtAPI/MantidDialog.h"
+
+#include <QMessageBox>
+
+using namespace MantidQt::API;
+
+//------------------------------------------------------
+// Public member functions
+//------------------------------------------------------
+/**
+ * Default Constructor
+ */
+MantidDialog::MantidDialog(QWidget* parent):QDialog(parent)
+{
+  m_pyRunner = boost::shared_ptr<PythonRunner>(new PythonRunner());
+  // re-emit the run Python code from m_pyRunner, to work this signal must reach the slot in QtiPlot
+  connect(m_pyRunner.get(), SIGNAL(runAsPythonScript(const QString&)),
+    this, SIGNAL(runAsPythonScript(const QString&)));
+}
+
+/**
+ * Destructor
+ */
+MantidDialog::~MantidDialog()
+{
+}
+
+/**
+ *   Checks if receiver derives from MantidDialog. If it does calls the virtual handleException method.
+ *   @param receiver The Qt event receiver
+ *   @param e The exception
+ *   @return True if the exception was handled, false otherwise.
+ */
+bool MantidDialog::handle( QObject* receiver, const std::exception& e )
+{
+    QObject* obj = receiver;
+    while(obj)
+    {
+        if (obj->inherits("MantidQt::API::MantidDialog"))
+        {
+            qobject_cast<MantidDialog*>(obj)->handleException(e);
+            return true;
+        }
+        obj = obj->parent();
+    };
+    return false;
+}
+
+/** Override this method to handle an exception in a derived class.
+ *  @param e exception to handle
+ */
+void MantidDialog::handleException( const std::exception& e )
+{
+    QMessageBox::critical(qobject_cast<QWidget*>(parent()),"Mantid - Error",
+        "Exception is caught in dialog:\n\n"+QString::fromStdString(e.what()));
+    close();
+}
+
+/** Run a piece of python code and return any output that it writes to stdout
+*  @param code the Python commands to execute
+*  @param no_output if set to true this method returns an empty string, if false it returns the output from any Python print statements
+*  @return output from Python print statements unless no_output is false
+*/
+QString MantidDialog::runPythonCode(const QString & code, bool no_output)
+{
+  return m_pyRunner->runPythonCode(code, no_output);
+}
diff --git a/Code/qtiplot/MantidQt/API/src/MantidQtDialog.cpp b/Code/qtiplot/MantidQt/API/src/MantidQtDialog.cpp
deleted file mode 100644
index 35ea1d0599c..00000000000
--- a/Code/qtiplot/MantidQt/API/src/MantidQtDialog.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-//----------------------------------
-// Includes
-//----------------------------------
-#include "MantidQtAPI/MantidQtDialog.h"
-
-#include <QMessageBox>
-#include <iostream>
-
-using namespace MantidQt::API;
-
-//------------------------------------------------------
-// Public member functions
-//------------------------------------------------------
-/**
- * Default Constructor
- */
-MantidQtDialog::MantidQtDialog(QWidget* parent):QDialog(parent)
-{
-}
-
-/**
- * Destructor
- */
-MantidQtDialog::~MantidQtDialog()
-{
-}
-
-/**
- *   Checks if receiver derives from MantidQtDialog. If it does calls the virtual handleException method.
- *   @param receiver The Qt event receiver
- *   @param e The exception
- *   @return True if the exception was handled, false otherwise.
- */
-bool MantidQtDialog::handle( QObject* receiver, const std::exception& e )
-{
-    QObject* obj = receiver;
-    while(obj)
-    {
-        if (obj->inherits("MantidQt::API::MantidQtDialog"))
-        {
-            qobject_cast<MantidQtDialog*>(obj)->handleException(e);
-            return true;
-        }
-        obj = obj->parent();
-    };
-    return false;
-}
-
-/** Override this method to handle an exception in a derived class.
- *  @param e exception to handle
- */
-void MantidQtDialog::handleException( const std::exception& e )
-{
-    QMessageBox::critical(qobject_cast<QWidget*>(parent()),"Mantid - Error",
-        "Exception is caught in dialog:\n\n"+QString::fromStdString(e.what()));
-    close();
-}
diff --git a/Code/qtiplot/MantidQt/API/src/MantidWidget.cpp b/Code/qtiplot/MantidQt/API/src/MantidWidget.cpp
index aad18c411c7..752b81d25c2 100644
--- a/Code/qtiplot/MantidQt/API/src/MantidWidget.cpp
+++ b/Code/qtiplot/MantidQt/API/src/MantidWidget.cpp
@@ -1,10 +1,6 @@
 #include "MantidQtAPI/MantidWidget.h"
 #include "MantidKernel/Exception.h"
 
-#include <QTemporaryFile>
-#include <QTextStream>
-#include <QDir>
-
 using namespace MantidQt::API;
 
 /**
@@ -13,6 +9,10 @@ using namespace MantidQt::API;
 */
 MantidWidget::MantidWidget(QWidget *parent) : QWidget(parent)
 {
+  m_pyRunner = boost::shared_ptr<PythonRunner>(new PythonRunner());
+  // re-emit the run Python code from m_pyRunner, to work this signal must reach the slot in QtiPlot
+  connect(m_pyRunner.get(), SIGNAL(runAsPythonScript(const QString&)),
+    this, SIGNAL(runAsPythonScript(const QString&)));
 }
 
 /** Run a piece of python code and return any output that it writes to stdout
@@ -22,34 +22,5 @@ MantidWidget::MantidWidget(QWidget *parent) : QWidget(parent)
 */
 QString MantidWidget::runPythonCode(const QString & code, bool no_output)
 {
-  if( no_output )
-  {
-    emit runAsPythonScript(code);
-    return QString();
-  }
-  
-  // Otherwise we need to gather the information from stdout. This is achieved by redirecting the stdout stream
-  // to a temproary file and then reading its contents
-  // A QTemporaryFile object is used since the file is automatically deleted when the object goes out of scope
-  QTemporaryFile tmp_file;
-  if( !tmp_file.open() )
-  {
-    throw std::runtime_error("An error occurred opening a temporary file in " + QDir::tempPath().toStdString());
-  }
-  //The file name is only valid when the file is open
-   QString tmpstring = tmp_file.fileName();
-   tmp_file.close();
-   QString code_to_run = "import sys; sys.stdout = open('" + tmpstring + "', 'w')\n" + code;
-
-   emit runAsPythonScript(code_to_run);
-
-   //Now get the output
-   tmp_file.open();
-   QTextStream stream(&tmp_file);
-   tmpstring.clear();
-   while( !stream.atEnd() )
-   {
-     tmpstring.append(stream.readLine().trimmed() + "\n");
-   }
-   return tmpstring;
+  return m_pyRunner->runPythonCode(code, no_output);
 }
diff --git a/Code/qtiplot/MantidQt/CustomInterfaces/inc/Background.h b/Code/qtiplot/MantidQt/CustomInterfaces/inc/Background.h
index 34653185544..5938794caa8 100644
--- a/Code/qtiplot/MantidQt/CustomInterfaces/inc/Background.h
+++ b/Code/qtiplot/MantidQt/CustomInterfaces/inc/Background.h
@@ -1,7 +1,7 @@
 #ifndef MANTIDQTCUSTOMINTERFACES_BACKGROUND_H_
 #define MANTIDQTCUSTOMINTERFACES_BACKGROUND_H_
 
-#include "MantidQtAPI/MantidQtDialog.h"
+#include "MantidQtAPI/MantidDialog.h"
 #include <QCheckBox>
 #include <QLineEdit>
 #include <QPair>
@@ -17,7 +17,7 @@ namespace MantidQt
   namespace CustomInterfaces
   {
 
-    class Background : public API::MantidQtDialog
+    class Background : public API::MantidDialog
     {
       Q_OBJECT
 
diff --git a/Code/qtiplot/MantidQt/CustomInterfaces/inc/SANSUtilityDialogs.h b/Code/qtiplot/MantidQt/CustomInterfaces/inc/SANSUtilityDialogs.h
index 9b6f056d66a..bdaeec621a9 100644
--- a/Code/qtiplot/MantidQt/CustomInterfaces/inc/SANSUtilityDialogs.h
+++ b/Code/qtiplot/MantidQt/CustomInterfaces/inc/SANSUtilityDialogs.h
@@ -4,7 +4,7 @@
 //------------------------------
 // Includes
 //------------------------------
-#include "MantidQtAPI/MantidQtDialog.h"
+#include "MantidQtAPI/MantidDialog.h"
 
 #include <QDialog>
 #include <QStringList>
@@ -22,7 +22,7 @@ namespace MantidQt
 namespace CustomInterfaces
 {
 
-class SANSPlotDialog : public API::MantidQtDialog
+class SANSPlotDialog : public API::MantidDialog
 {
   Q_OBJECT
   
diff --git a/Code/qtiplot/MantidQt/CustomInterfaces/src/SANSUtilityDialogs.cpp b/Code/qtiplot/MantidQt/CustomInterfaces/src/SANSUtilityDialogs.cpp
index a150b539ec7..088f6de67b9 100644
--- a/Code/qtiplot/MantidQt/CustomInterfaces/src/SANSUtilityDialogs.cpp
+++ b/Code/qtiplot/MantidQt/CustomInterfaces/src/SANSUtilityDialogs.cpp
@@ -27,7 +27,7 @@ using namespace MantidQt::CustomInterfaces;
  * Default constructor
  */
 SANSPlotDialog::SANSPlotDialog(QWidget *parent) : 
-  API::MantidQtDialog(parent), m_workspaces()
+  API::MantidDialog(parent), m_workspaces()
 {
   setWindowTitle("SANS - Plot Dialog");
 
diff --git a/Code/qtiplot/MantidQt/CustomInterfaces/src/background.cpp b/Code/qtiplot/MantidQt/CustomInterfaces/src/background.cpp
index f2b0b0de680..cfcba4446b5 100644
--- a/Code/qtiplot/MantidQt/CustomInterfaces/src/background.cpp
+++ b/Code/qtiplot/MantidQt/CustomInterfaces/src/background.cpp
@@ -23,7 +23,7 @@ using namespace MantidQt::CustomInterfaces;
  *  @param parent used by QT
  */
 Background::Background(QWidget *parent) :
-  API::MantidQtDialog(parent), m_ckDoRemove(new QCheckBox),
+  API::MantidDialog(parent), m_ckDoRemove(new QCheckBox),
   m_leStart(new QLineEdit), m_leEnd(new QLineEdit), m_rangeMin(-1.0), 
   m_rangeMax(-1.0), m_doRemoval(false)
 {
diff --git a/Code/qtiplot/MantidQt/MantidWidgets/inc/DiagResults.h b/Code/qtiplot/MantidQt/MantidWidgets/inc/DiagResults.h
index ece20dcd3a8..949a3f603b7 100644
--- a/Code/qtiplot/MantidQt/MantidWidgets/inc/DiagResults.h
+++ b/Code/qtiplot/MantidQt/MantidWidgets/inc/DiagResults.h
@@ -1,7 +1,7 @@
 #ifndef MANTIDQTCUSTOMINTERFACES_EXCITATIONSDIAGRESULTS_H_
 #define MANTIDQTCUSTOMINTERFACES_EXCITATIONSDIAGRESULTS_H_
 
-#include "MantidQtAPI/MantidQtDialog.h"
+#include "MantidQtAPI/MantidDialog.h"
 #include "WidgetDllOption.h"
 #include <QHash>
 #include <QSignalMapper>
@@ -12,7 +12,7 @@ namespace MantidQt
   namespace MantidWidgets
   {
 
-    class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS DiagResults : public API::MantidQtDialog
+    class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS DiagResults : public API::MantidDialog
     {
       Q_OBJECT
 
diff --git a/Code/qtiplot/MantidQt/MantidWidgets/inc/MWDiag.h b/Code/qtiplot/MantidQt/MantidWidgets/inc/MWDiag.h
index 2224852ee17..e37f7959ce8 100644
--- a/Code/qtiplot/MantidQt/MantidWidgets/inc/MWDiag.h
+++ b/Code/qtiplot/MantidQt/MantidWidgets/inc/MWDiag.h
@@ -9,7 +9,6 @@
 #include <QSettings>
 #include <QStringList>
 #include <QComboBox>
-#include "boost/shared_ptr.hpp"
 
 namespace MantidQt
 {
diff --git a/Code/qtiplot/MantidQt/MantidWidgets/inc/SaveWorkspaces.h b/Code/qtiplot/MantidQt/MantidWidgets/inc/SaveWorkspaces.h
index 0304d3af107..fccbf329c9f 100644
--- a/Code/qtiplot/MantidQt/MantidWidgets/inc/SaveWorkspaces.h
+++ b/Code/qtiplot/MantidQt/MantidWidgets/inc/SaveWorkspaces.h
@@ -1,7 +1,7 @@
 #ifndef MANTIDQTMANTIDWIDGETS_SAVEWORKSPACES_H_
 #define MANTIDQTMANTIDWIDGETS_SAVEWORKSPACES_H_
 
-#include "MantidQtAPI/MantidQtDialog.h"
+#include "MantidQtAPI/MantidDialog.h"
 #include "WidgetDllOption.h"
 #include <QHash>
 #include <QSignalMapper>
@@ -42,7 +42,7 @@ namespace MantidQt
     File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>
     Code Documentation is available at: <http://doxygen.mantidproject.org>    
     */
-    class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS SaveWorkspaces : public API::MantidQtDialog
+    class EXPORT_OPT_MANTIDQT_MANTIDWIDGETS SaveWorkspaces : public API::MantidDialog
     {
       Q_OBJECT
 
diff --git a/Code/qtiplot/MantidQt/MantidWidgets/src/DiagResults.cpp b/Code/qtiplot/MantidQt/MantidWidgets/src/DiagResults.cpp
index 4bec534875b..10d76735a5e 100644
--- a/Code/qtiplot/MantidQt/MantidWidgets/src/DiagResults.cpp
+++ b/Code/qtiplot/MantidQt/MantidWidgets/src/DiagResults.cpp
@@ -66,7 +66,7 @@ const QString DiagResults::TESTS[DiagResults::NUMTESTS] =
 // Public member functions
 //----------------------
 ///Constructor
-DiagResults::DiagResults(QWidget *parent): MantidQtDialog(parent),
+DiagResults::DiagResults(QWidget *parent): MantidDialog(parent),
   m_Grid(new QGridLayout), m_ListMapper(new QSignalMapper(this)),
   m_ViewMapper(new QSignalMapper(this))
 {
diff --git a/Code/qtiplot/MantidQt/MantidWidgets/src/SaveWorkspaces.cpp b/Code/qtiplot/MantidQt/MantidWidgets/src/SaveWorkspaces.cpp
index 66ee73c0561..cb7da36bc92 100644
--- a/Code/qtiplot/MantidQt/MantidWidgets/src/SaveWorkspaces.cpp
+++ b/Code/qtiplot/MantidQt/MantidWidgets/src/SaveWorkspaces.cpp
@@ -34,7 +34,7 @@ using namespace Mantid::API;
  *  @param defSavs sets which boxes are ticked
  */
 SaveWorkspaces::SaveWorkspaces(QWidget *parent, const QString & suggFname, QHash<const QCheckBox * const, QString> & defSavs) :
-  API::MantidQtDialog(parent)
+  API::MantidDialog(parent)
 {
   setWindowTitle("Save Workspaces");
 
diff --git a/Code/qtiplot/qtiplot/src/Mantid/AlgorithmHistoryWindow.cpp b/Code/qtiplot/qtiplot/src/Mantid/AlgorithmHistoryWindow.cpp
index 08673bc8ddb..c73eb98d9f5 100644
--- a/Code/qtiplot/qtiplot/src/Mantid/AlgorithmHistoryWindow.cpp
+++ b/Code/qtiplot/qtiplot/src/Mantid/AlgorithmHistoryWindow.cpp
@@ -170,7 +170,7 @@ AlgHistScriptButton::~AlgHistScriptButton()
 }
 
 AlgorithmHistoryWindow::AlgorithmHistoryWindow(ApplicationWindow *w,const std::vector<AlgorithmHistory> &algHist,const EnvironmentHistory& envHist):
-MantidQtDialog(w),m_algHist(algHist),m_histPropWindow(NULL),m_execSumGrpBox(NULL),m_envHistGrpBox(NULL),m_algName(""),m_nVersion(0)
+MantidDialog(w),m_algHist(algHist),m_histPropWindow(NULL),m_execSumGrpBox(NULL),m_envHistGrpBox(NULL),m_algName(""),m_nVersion(0)
 {
     setWindowTitle(tr("Algorithm History"));
 	setMinimumHeight(400);
diff --git a/Code/qtiplot/qtiplot/src/Mantid/AlgorithmHistoryWindow.h b/Code/qtiplot/qtiplot/src/Mantid/AlgorithmHistoryWindow.h
index 6b3ba5b1fd2..c90f58a337a 100644
--- a/Code/qtiplot/qtiplot/src/Mantid/AlgorithmHistoryWindow.h
+++ b/Code/qtiplot/qtiplot/src/Mantid/AlgorithmHistoryWindow.h
@@ -28,7 +28,7 @@
 #include "MantidAPI/AlgorithmManager.h"
 #include "MantidKernel/Property.h"
 #include "MantidQtAPI/AlgorithmInputHistory.h"
-#include "MantidQtAPI/MantidQtDialog.h"
+#include "MantidQtAPI/MantidDialog.h"
 #include "../ApplicationWindow.h"
 #include "MantidKernel/Logger.h"
 #include "QMessageBox"
@@ -111,13 +111,13 @@ public:
 };
 
 class AlgHistoryProperties;
-class AlgorithmHistoryWindow: public MantidQt::API::MantidQtDialog //QDialog 
+class AlgorithmHistoryWindow: public MantidQt::API::MantidDialog
 {
 	Q_OBJECT
 signals:
 	void updateAlgorithmHistoryWindow(QString algName);
 public:
-	AlgorithmHistoryWindow(QWidget*w) : MantidQt::API::MantidQtDialog(w){}
+  AlgorithmHistoryWindow(QWidget*w) : MantidQt::API::MantidDialog(w){}
 	AlgorithmHistoryWindow(ApplicationWindow *w,const std::vector<Mantid::API::AlgorithmHistory>&alghist,
 	                       const Mantid::Kernel::EnvironmentHistory&);
   ~AlgorithmHistoryWindow();
diff --git a/Code/qtiplot/qtiplot/src/Mantid/MantidAbout.cpp b/Code/qtiplot/qtiplot/src/Mantid/MantidAbout.cpp
index 6d63f53160e..ff938b1ea0d 100644
--- a/Code/qtiplot/qtiplot/src/Mantid/MantidAbout.cpp
+++ b/Code/qtiplot/qtiplot/src/Mantid/MantidAbout.cpp
@@ -1,7 +1,7 @@
 #include "MantidAbout.h"
 #include "MantidPlotReleaseDate.h"
 //#include "../globals.h"
-
+
 extern const int maj_version ;
 extern const int min_version ;
 extern const int patch_version ;
@@ -9,40 +9,40 @@ const int maj_version = 0;
 const int min_version = 9;
 const int patch_version = 5;
 extern const char * extra_version;
-extern const char * copyright_string;
-extern const char * release_date;
-
+extern const char * copyright_string;
+extern const char * release_date;
+
 /**
  * Constructor
  * @param parent The parent widget
- */
-
-MantidAbout::MantidAbout(QWidget *parent) : MantidQt::API::MantidQtDialog(parent)
-{
-	m_uiForm.setupUi(this);
-
-	QLabel* releasedate=m_uiForm.release_datevalue;
-	QString temp (MANTIDPLOT_RELEASE_DATE);
-	QStringList releaseDate=temp.split("(");
-	releasedate->setText(releaseDate[0]);
-	
-	QString version(MANTIDPLOT_RELEASE_VERSION);
-	QLabel* releaseversion=m_uiForm.release_versionvalue;
-	releaseversion->setText(version);
-	
-	QLabel* builtusing_labelvalue=m_uiForm.builtusing_labelvalue;
+ */
+
+MantidAbout::MantidAbout(QWidget *parent) : MantidQt::API::MantidDialog(parent)
+{
+	m_uiForm.setupUi(this);
+
+	QLabel* releasedate=m_uiForm.release_datevalue;
+	QString temp (MANTIDPLOT_RELEASE_DATE);
+	QStringList releaseDate=temp.split("(");
+	releasedate->setText(releaseDate[0]);
+	
+	QString version(MANTIDPLOT_RELEASE_VERSION);
+	QLabel* releaseversion=m_uiForm.release_versionvalue;
+	releaseversion->setText(version);
+	
+	QLabel* builtusing_labelvalue=m_uiForm.builtusing_labelvalue;
 	QString builtusing="QtiPlot "+QString::number(maj_version) + "." +
 		QString::number(min_version) + "." + QString::number(patch_version) + extra_version + "  ";
     builtusing += "Released: " + QString(release_date) + "<br>";
-    builtusing += QString(copyright_string);
-	builtusing_labelvalue->setText(builtusing);
-
-	QString mantidurl="<p><a href = http://www.mantidproject.org/Main_Page>http://www.mantidproject.org</a></p>";
-	QLabel* url=m_uiForm.mantidurl;
-	url->setText(mantidurl);
-	url->setOpenExternalLinks(true);
-
-
-	
-}
+    builtusing += QString(copyright_string);
+	builtusing_labelvalue->setText(builtusing);
+
+	QString mantidurl="<p><a href = http://www.mantidproject.org/Main_Page>http://www.mantidproject.org</a></p>";
+	QLabel* url=m_uiForm.mantidurl;
+	url->setText(mantidurl);
+	url->setOpenExternalLinks(true);
+
+
+	
+}
 
diff --git a/Code/qtiplot/qtiplot/src/Mantid/MantidAbout.h b/Code/qtiplot/qtiplot/src/Mantid/MantidAbout.h
index 85aac2970d1..b3d394e1dfc 100644
--- a/Code/qtiplot/qtiplot/src/Mantid/MantidAbout.h
+++ b/Code/qtiplot/qtiplot/src/Mantid/MantidAbout.h
@@ -5,8 +5,7 @@
 // Includes
 //----------------------
 #include "ui_MantidAbout.h"
-#include <MantidQtAPI/MantidQtDialog.h>
-#include <qdialog.h>
+#include <MantidQtAPI/MantidDialog.h>
 
 	/** 
     This class implements About MantidPlot dialog for mnatid help menu.
@@ -35,7 +34,7 @@
     Code Documentation is available at: <http://doxygen.mantidproject.org>    
 */
 
-class MantidAbout : public MantidQt::API::MantidQtDialog
+class MantidAbout : public MantidQt::API::MantidDialog
 	{
 
 	Q_OBJECT
diff --git a/Code/qtiplot/qtiplot/src/Mantid/MantidApplication.cpp b/Code/qtiplot/qtiplot/src/Mantid/MantidApplication.cpp
index d985e848353..c9ab8fe259c 100644
--- a/Code/qtiplot/qtiplot/src/Mantid/MantidApplication.cpp
+++ b/Code/qtiplot/qtiplot/src/Mantid/MantidApplication.cpp
@@ -2,7 +2,7 @@
 //MantidApplciation definitions
 //==============================
 #include "MantidApplication.h"
-#include "MantidQtAPI/MantidQtDialog.h"
+#include "MantidQtAPI/MantidDialog.h"
 
 #include <QMessageBox>
 #include <QPushButton>
@@ -25,7 +25,7 @@ bool MantidApplication::notify( QObject * receiver, QEvent * event )
   catch(std::exception& e) 
   {
 
-      if (MantidQt::API::MantidQtDialog::handle(receiver,e))
+      if (MantidQt::API::MantidDialog::handle(receiver,e))
           return true; // stops event propagation
 
     g_log.fatal()<<"Unexpected exception: "<<e.what()<<"\n";
-- 
GitLab