diff --git a/MantidPlot/src/ApplicationWindow.cpp b/MantidPlot/src/ApplicationWindow.cpp index 0f7eab59f5e806b449f66e56eb6d0fbc5d435b8e..70b7e943dd670ca97bf156fcbb605d5e401bd049 100644 --- a/MantidPlot/src/ApplicationWindow.cpp +++ b/MantidPlot/src/ApplicationWindow.cpp @@ -363,7 +363,7 @@ void ApplicationWindow::init(bool factorySettings, const QStringList &args) { addDockWidget(Qt::TopDockWidgetArea, logWindow); using MantidQt::MantidWidgets::MessageDisplay; - using MantidQt::API::Message; + using MantidQt::MantidWidgets::Message; qRegisterMetaType<Message>("Message"); // Required to use it in signals-slots resultsLog = new MessageDisplay(MessageDisplay::EnableLogLevelControl, logWindow); @@ -4704,7 +4704,7 @@ bool ApplicationWindow::setScriptingLanguage(const QString &lang) { return true; if (m_bad_script_envs.contains(lang)) { - using MantidQt::API::Message; + using MantidQt::MantidWidgets::Message; writeToLogWindow( Message("Previous initialization of " + lang + " failed, cannot retry.", Message::Priority::PRIO_ERROR)); @@ -7976,7 +7976,7 @@ void ApplicationWindow::showResults(bool ok) { text = currentFolder()->logInfo(); else text = "Sorry, there are no results to display!"; - using MantidQt::API::Message; + using MantidQt::MantidWidgets::Message; resultsLog->replace(Message(text, Message::Priority::PRIO_INFORMATION)); } logWindow->setVisible(ok); @@ -7986,7 +7986,7 @@ void ApplicationWindow::showResults(const QString &s, bool ok) { currentFolder()->appendLogInfo(s); QString logInfo = currentFolder()->logInfo(); if (!logInfo.isEmpty()) { - using MantidQt::API::Message; + using MantidQt::MantidWidgets::Message; resultsLog->replace(Message(logInfo, Message::Priority::PRIO_INFORMATION)); } showResults(ok); @@ -16052,7 +16052,8 @@ void ApplicationWindow::setGeometry(MdiSubWindow *usr_win, * @param message :: A string containing the message * @param error :: A boolean indicating if this is an error */ -void ApplicationWindow::writeToLogWindow(const MantidQt::API::Message &msg) { +void ApplicationWindow::writeToLogWindow( + const MantidQt::MantidWidgets::Message &msg) { resultsLog->append(msg); } diff --git a/MantidPlot/src/ApplicationWindow.h b/MantidPlot/src/ApplicationWindow.h index 76e98843135eb2dde441b187d67e83fe5e455bf0..42b07ab063afa88b93ac3d0a98bdc2655ca237c8 100644 --- a/MantidPlot/src/ApplicationWindow.h +++ b/MantidPlot/src/ApplicationWindow.h @@ -102,11 +102,9 @@ class TiledWindow; #endif namespace MantidQt { -namespace API { -class Message; -} namespace MantidWidgets { class FitPropertyBrowser; +class Message; class MessageDisplay; } } @@ -1066,7 +1064,7 @@ public slots: void savetoNexusFile(); // Slot for writing to log window - void writeToLogWindow(const MantidQt::API::Message &message); + void writeToLogWindow(const MantidQt::MantidWidgets::Message &message); /// Activate a subwindow (docked or floating) other than current active one void activateNewWindow(); diff --git a/MantidPlot/src/Mantid/MantidUI.h b/MantidPlot/src/Mantid/MantidUI.h index 00b9aed5554ac1509fe3e42d244167e6772b97fb..e89c8b615380373c36d6fb4301f2eb6415afd09c 100644 --- a/MantidPlot/src/Mantid/MantidUI.h +++ b/MantidPlot/src/Mantid/MantidUI.h @@ -52,11 +52,9 @@ class AlgorithmMonitor; class InstrumentWindow; namespace MantidQt { -namespace API { -class Message; -} namespace MantidWidgets { class FitPropertyBrowser; +class Message; class QWorkspaceDockView; } namespace SliceViewer { diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/Message.h b/qt/widgets/common/inc/MantidQtWidgets/Common/Message.h index 50b4c96a26002a9d2b3828a1c532c14796b11c4a..2b22c374a34dd8c5d4cabd0c97f04f7998a2db03 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/Message.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/Message.h @@ -16,7 +16,7 @@ //---------------------------------------------------------- namespace MantidQt { -namespace API { +namespace MantidWidgets { /** @class Message * Provides a simple binding of a text message with a priority */ @@ -54,6 +54,6 @@ private: } /// Required to operate in signals/slots -Q_DECLARE_METATYPE(MantidQt::API::Message) +Q_DECLARE_METATYPE(MantidQt::MantidWidgets::Message) #endif // MESSAGE_H_ diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/MessageDisplay.h b/qt/widgets/common/inc/MantidQtWidgets/Common/MessageDisplay.h index d9d1f94ecf0eaa76eb05baaec43259baa850b563..a98b337bb9cf168bae076409eb6f54e0327d351c 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/MessageDisplay.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/MessageDisplay.h @@ -9,7 +9,7 @@ #include "MantidQtWidgets/Common/Message.h" #include "MantidQtWidgets/Common/QtSignalChannel.h" -#include <QMap> +#include <QHash> #include <QTextCharFormat> #include <QTextCursor> #include <QWidget> @@ -26,10 +26,6 @@ class QPlainTextEdit; namespace MantidQt { namespace MantidWidgets { -using API::Message; // So that the slots work - //---------------------------------------------------------- - // Forward declarations - //---------------------------------------------------------- /** @class MessageDisplay * Provides a widget for display messages in a text box @@ -109,26 +105,25 @@ private: /// Set the properties of the text display void setupTextArea(); /// Return format for given log level - QTextCharFormat format(const API::Message::Priority priority) const; + QTextCharFormat format(const Message::Priority priority) const; /// Are we allowed to affect the log level LogLevelControl m_logLevelControl; /// A reference to the log channel - API::QtSignalChannel *m_logChannel; + QtSignalChannel *m_logChannel; /// A reference to the log channel Poco::FilterChannel *m_filterChannel; /// The actual widget holding the text QPlainTextEdit *m_textDisplay; /// Map priority to text formatting - QMap<API::Message::Priority, QTextCharFormat> m_formats; + QHash<Message::Priority, QTextCharFormat> m_formats; /// Mutually exclusive log actions QActionGroup *m_loglevels; /// Map action signal to log level parameter QSignalMapper *m_logLevelMapping; /// Log level actions QAction *m_error, *m_warning, *m_notice, *m_information, *m_debug; - - // the name of the fliter channel + // Name of the channel when registered with Poco const std::string m_FilterChannelName = "MessageDisplayPriority"; }; } diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/QtSignalChannel.h b/qt/widgets/common/inc/MantidQtWidgets/Common/QtSignalChannel.h index e09756dfed143d0d89758fef7aa9459363220254..5b90b34a6cbb49d039baa3224691939acfbee513 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/QtSignalChannel.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/QtSignalChannel.h @@ -7,7 +7,7 @@ #include <Poco/Channel.h> namespace MantidQt { -namespace API { +namespace MantidWidgets { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- diff --git a/qt/widgets/common/src/Message.cpp b/qt/widgets/common/src/Message.cpp index baa19939df284aeefb125f2a973331f063ef41ea..4b86a3584512f3dbef82e67463b0be8d41c53295 100644 --- a/qt/widgets/common/src/Message.cpp +++ b/qt/widgets/common/src/Message.cpp @@ -4,7 +4,7 @@ #include "MantidQtWidgets/Common/Message.h" namespace MantidQt { -namespace API { +namespace MantidWidgets { //----------------------------------------------------------------------------------- // Public member functions //----------------------------------------------------------------------------------- diff --git a/qt/widgets/common/src/MessageDisplay.cpp b/qt/widgets/common/src/MessageDisplay.cpp index 61f35e6a67cb75cff9bb0fea19126a8fd0208904..0de032513f95517908c24abfc63838b1ccc75a5b 100644 --- a/qt/widgets/common/src/MessageDisplay.cpp +++ b/qt/widgets/common/src/MessageDisplay.cpp @@ -22,7 +22,6 @@ namespace MantidQt { namespace MantidWidgets { -using API::Message; //------------------------------------------- // Public member functions @@ -33,7 +32,7 @@ using API::Message; */ MessageDisplay::MessageDisplay(QWidget *parent) : QWidget(parent), m_logLevelControl(DisableLogLevelControl), - m_logChannel(new API::QtSignalChannel), + m_logChannel(new QtSignalChannel), m_filterChannel(new Poco::FilterChannel), m_textDisplay(new QPlainTextEdit(this)), m_formats(), m_loglevels(new QActionGroup(this)), @@ -56,7 +55,7 @@ MessageDisplay::MessageDisplay(QWidget *parent) */ MessageDisplay::MessageDisplay(LogLevelControl logLevelControl, QWidget *parent) : QWidget(parent), m_logLevelControl(logLevelControl), - m_logChannel(new API::QtSignalChannel), + m_logChannel(new QtSignalChannel), m_filterChannel(new Poco::FilterChannel), m_textDisplay(new QPlainTextEdit(this)), m_loglevels(new QActionGroup(this)), @@ -378,8 +377,7 @@ void MessageDisplay::setupTextArea() { * @param priority An enumeration for the log level * @return format for given log level */ -QTextCharFormat -MessageDisplay::format(const API::Message::Priority priority) const { +QTextCharFormat MessageDisplay::format(const Message::Priority priority) const { return m_formats.value(priority, QTextCharFormat()); } } diff --git a/qt/widgets/common/src/QtSignalChannel.cpp b/qt/widgets/common/src/QtSignalChannel.cpp index 1a5b49dceffd79eb89a18e976c869f80ef9ab441..cdde046ae98ff3923e8215fea431fdbab8c9b6db 100644 --- a/qt/widgets/common/src/QtSignalChannel.cpp +++ b/qt/widgets/common/src/QtSignalChannel.cpp @@ -5,7 +5,7 @@ #include <Poco/Message.h> namespace MantidQt { -namespace API { +namespace MantidWidgets { /** * Creates a QtSignalChannel. This channel receives @@ -36,7 +36,7 @@ void QtSignalChannel::setSource(const QString &source) { m_source = source; } */ void QtSignalChannel::log(const Poco::Message &msg) { if (m_source.isEmpty() || this->source() == msg.getSource().c_str()) { - emit messageReceived(API::Message( + emit messageReceived(Message( QString::fromStdString(msg.getText() + "\n"), msg.getPriority())); } }