diff --git a/Code/qtiplot/MantidQt/API/API.pro b/Code/qtiplot/MantidQt/API/API.pro index c9a8d676d8bfdc082c0b5e587e496f6a64e7ba40..1c17102e0001c377cfe1363b27b03291ac5d78aa 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 767b4e555b424923ff57d4dfa2c018b435b3b944..1e7fa8ebaf30dd133dc24ec51fbaae1e68163675 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 2d102cb75fe4f9ce466302a37cdccccb11c7b1ab..99cee151d21b5ff076311ad64e362ae40c0bbf77 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 0000000000000000000000000000000000000000..1270ba0bef2d767918713060bff5c93e89878bd7 --- /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 35ea1d0599c85265964894a57e8ac211ab059947..0000000000000000000000000000000000000000 --- 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 aad18c411c75028117101c63bd2ee7c56eef60c7..752b81d25c26ffcf671a46a23bea9f95ac9d7a2d 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 3465318554401aeebbf995981314f76bdc90b6cd..5938794caa85df38c45d6722a40f3954623dffd3 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 9b6f056d66aebfac1daf6d8ccd5fd2a8ef79a114..bdaeec621a94bb57d4c219bb36184b53925fc78c 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 a150b539ec797d3133e3aed02967e45eb68f772b..088f6de67b997c66c628e1d063745cdfcd76a8c9 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 f2b0b0de6809bb538f6a6ce1a59a6c1ea93dc3c3..cfcba4446b52dd3c5cc6a6cb06ee263d3338004e 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 ece20dcd3a813a8b35d257aeb5e4b26c0bb60a6c..949a3f603b72454f8293428878999c3b0165e228 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 2224852ee17c6cc9fbb748372a0b1d169c173754..e37f7959ce87aebe7ca89bb06c7cf730f4ea4809 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 0304d3af107399eca54b3874090f1e6cf68e787a..fccbf329c9f3598edc7c48b5e16172ba7c9f76c4 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 4bec534875b2accb66ad3ca5bbc44ebca9919cc5..10d76735a5e0b7f1e0dff81f72823f3d9dc22360 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 66ee73c0561ae0f9226b508cdef7db1c6075ea74..cb7da36bc92be1f6e6c2add0e363840de3d6c604 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 08673bc8ddbe5d2cc0d4e57d6aa6c67dc7170035..c73eb98d9f5f256ea98bdf8a9527fbaa5d6c1102 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 6b3ba5b1fd2e378e105581a1b1624e6bb13ec6e5..c90f58a337a0399051ffc2e96cffee514f7d4507 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 6d63f53160e374d4641a7871eaba80aa71c1ab4a..ff938b1ea0da46efd0ab1aefa1d2843ea6aaa039 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 85aac2970d1954dc381e60212e68081f0d552046..b3d394e1dfc35b5d92c22eec5d85098b6214cf89 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 d985e848353634bc46dbb74f34d8560d583f6746..c9ab8fe259cd789db7929f258da1fd5ecdbb7ffd 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";