Skip to content

Commit

Permalink
Show results on error. Refs #6202
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Apr 9, 2013
1 parent 37842da commit 4dcb51c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ void ApplicationWindow::init(bool factorySettings, const QStringList& args)
qRegisterMetaType<Message>("Message"); // Required to use it in signals-slots
resultsLog = new MantidQt::API::MessageDisplay(MessageDisplay::EnableLogLevelControl, logWindow);
logWindow->setWidget(resultsLog);
connect(resultsLog, SIGNAL(errorReceived(const QString &)), logWindow, SLOT(show()));

// Start Mantid
// Set the Paraview path BEFORE libaries are loaded. Doing it here prevents
Expand Down
6 changes: 5 additions & 1 deletion Code/Mantid/MantidQt/API/inc/MantidQtAPI/MessageDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace MantidQt
/// Controls whether the display is allowed to set the log levels
enum LogLevelControl {
EnableLogLevelControl = 0,
DisableLogLevelControl = 1
DisableLogLevelControl
};

/// Default constructor
Expand All @@ -52,6 +52,10 @@ namespace MantidQt
// Setup logging framework connections
void attachLoggingChannel();

signals:
/// Indicate that a message of error or higher has been received.
void errorReceived(const QString & text);

public slots:
/// Convenience method for appending message at fatal level
void appendFatal(const QString & text);
Expand Down
4 changes: 3 additions & 1 deletion Code/Mantid/MantidQt/API/src/MessageDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,16 @@ namespace MantidQt
appendText(msg.text());
//set the colour back to the default (black) for historical reasons
setTextColor(Message::Priority::PRIO_INFORMATION);
if(msg.priority() <= Message::Priority::PRIO_ERROR ) emit errorReceived(msg.text());
}

/**
* @param msg Replace the current contents with this message
*/
void MessageDisplay::replace(const Message & msg)
{
m_textDisplay->setText(msg.text());
clear();
append(msg.text());
}

/**
Expand Down

0 comments on commit 4dcb51c

Please sign in to comment.