diff --git a/ApplicationCode/Application/RiaGuiApplication.cpp b/ApplicationCode/Application/RiaGuiApplication.cpp index 1449eb509e..a6aa365275 100644 --- a/ApplicationCode/Application/RiaGuiApplication.cpp +++ b/ApplicationCode/Application/RiaGuiApplication.cpp @@ -424,8 +424,13 @@ void RiaGuiApplication::initialize() RiuPlotMainWindow* plotMainWindow = getOrCreateMainPlotWindow(); plotMainWindow->hideAllDockWidgets(); - RiaLogging::setLoggerInstance( new RiuMessagePanelLogger( m_mainWindow->messagePanel() ) ); - RiaLogging::loggerInstance()->setLevel( RI_LL_DEBUG ); + { + auto logger = new RiuMessagePanelLogger; + logger->addMessagePanel( m_mainWindow->messagePanel() ); + logger->addMessagePanel( m_mainPlotWindow->messagePanel() ); + RiaLogging::setLoggerInstance( logger ); + RiaLogging::loggerInstance()->setLevel( RI_LL_DEBUG ); + } m_socketServer = new RiaSocketServer( this ); } @@ -1643,7 +1648,7 @@ int RiaGuiApplication::applicationResolution() //-------------------------------------------------------------------------------------------------- void RiaGuiApplication::startMonitoringWorkProgress( caf::UiProcess* uiProcess ) { - m_mainWindow->processMonitor()->startMonitorWorkProcess( m_workerProcess ); + m_mainWindow->processMonitor()->startMonitorWorkProcess( uiProcess ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationCode/UserInterface/RiuDockWidgetTools.cpp index 6817819a77..5d127c9f50 100644 --- a/ApplicationCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationCode/UserInterface/RiuDockWidgetTools.cpp @@ -108,6 +108,14 @@ QString RiuDockWidgetTools::plotMainWindowPropertyEditorName() return "plotMainWindow_dockPropertyEditor"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::plotMainWindowMessagesName() +{ + return "plotMainWindow_dockMessages"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuDockWidgetTools.h b/ApplicationCode/UserInterface/RiuDockWidgetTools.h index e1332bd32f..afe95186f6 100644 --- a/ApplicationCode/UserInterface/RiuDockWidgetTools.h +++ b/ApplicationCode/UserInterface/RiuDockWidgetTools.h @@ -48,6 +48,7 @@ public: static QString plotMainWindowProjectTreeName(); static QString plotMainWindowPropertyEditorName(); + static QString plotMainWindowMessagesName(); static QAction* toggleActionForWidget( const QObject* parent, const QString& dockWidgetName ); diff --git a/ApplicationCode/UserInterface/RiuMessagePanel.cpp b/ApplicationCode/UserInterface/RiuMessagePanel.cpp index b4e272d576..579edbd96d 100644 --- a/ApplicationCode/UserInterface/RiuMessagePanel.cpp +++ b/ApplicationCode/UserInterface/RiuMessagePanel.cpp @@ -137,12 +137,19 @@ void RiuMessagePanel::slotClearMessages() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuMessagePanelLogger::RiuMessagePanelLogger( RiuMessagePanel* messagePanel ) - : m_messagePanel( messagePanel ) - , m_logLevel( RI_LL_WARNING ) +RiuMessagePanelLogger::RiuMessagePanelLogger() + : m_logLevel( RI_LL_WARNING ) { } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMessagePanelLogger::addMessagePanel( RiuMessagePanel* messagePanel ) +{ + m_messagePanel.push_back( messagePanel ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -201,8 +208,11 @@ void RiuMessagePanelLogger::writeToMessagePanel( RILogLevel messageLevel, const return; } - if ( m_messagePanel ) + for ( auto panel : m_messagePanel ) { - m_messagePanel->addMessage( messageLevel, message ); + if ( panel ) + { + panel->addMessage( messageLevel, message ); + } } } diff --git a/ApplicationCode/UserInterface/RiuMessagePanel.h b/ApplicationCode/UserInterface/RiuMessagePanel.h index e7db39e2d1..53264fd3e6 100644 --- a/ApplicationCode/UserInterface/RiuMessagePanel.h +++ b/ApplicationCode/UserInterface/RiuMessagePanel.h @@ -57,7 +57,9 @@ private: class RiuMessagePanelLogger : public RiaLogger { public: - explicit RiuMessagePanelLogger( RiuMessagePanel* messagePanel ); + explicit RiuMessagePanelLogger(); + + void addMessagePanel( RiuMessagePanel* messagePanel ); int level() const override; void setLevel( int logLevel ) override; @@ -71,6 +73,6 @@ private: void writeToMessagePanel( RILogLevel messageLevel, const char* message ); private: - QPointer m_messagePanel; - int m_logLevel; + std::vector> m_messagePanel; + int m_logLevel; }; diff --git a/ApplicationCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationCode/UserInterface/RiuPlotMainWindow.cpp index b24d76094f..b96c47364d 100644 --- a/ApplicationCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuPlotMainWindow.cpp @@ -44,6 +44,7 @@ #include "RiuDockWidgetTools.h" #include "RiuDragDrop.h" #include "RiuMdiSubWindow.h" +#include "RiuMessagePanel.h" #include "RiuMultiPlotPage.h" #include "RiuToolTipMenu.h" #include "RiuTreeViewEventFilter.h" @@ -463,6 +464,15 @@ void RiuPlotMainWindow::createDockPanels() addDockWidget( Qt::LeftDockWidgetArea, dockWidget ); } + { + QDockWidget* dockWidget = new QDockWidget( "Messages", this ); + dockWidget->setObjectName( RiuDockWidgetTools::plotMainWindowMessagesName() ); + m_messagePanel = new RiuMessagePanel( dockWidget ); + dockWidget->setWidget( m_messagePanel ); + addDockWidget( Qt::BottomDockWidgetArea, dockWidget ); + dockWidget->hide(); + } + setCorner( Qt::BottomLeftCorner, Qt::LeftDockWidgetArea ); setCorner( Qt::BottomRightCorner, Qt::BottomDockWidgetArea ); @@ -675,6 +685,14 @@ RicSummaryCurveCalculatorDialog* RiuPlotMainWindow::summaryCurveCalculatorDialog return m_summaryCurveCalculatorDialog; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuMessagePanel* RiuPlotMainWindow::messagePanel() +{ + return m_messagePanel; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuPlotMainWindow.h b/ApplicationCode/UserInterface/RiuPlotMainWindow.h index f27f148cf3..a6b0ac3637 100644 --- a/ApplicationCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationCode/UserInterface/RiuPlotMainWindow.h @@ -28,14 +28,14 @@ #include -class QMdiSubWindow; - -class RiuViewer; - struct RimMdiWindowGeometry; + +class QMdiSubWindow; +class RiuViewer; class RimViewWindow; class RicSummaryPlotEditorDialog; class RicSummaryCurveCalculatorDialog; +class RiuMessagePanel; namespace caf { @@ -91,6 +91,8 @@ public: RicSummaryPlotEditorDialog* summaryCurveCreatorDialog(); RicSummaryCurveCalculatorDialog* summaryCurveCalculatorDialog(); + RiuMessagePanel* messagePanel(); + protected: void closeEvent( QCloseEvent* event ) override; void keyPressEvent( QKeyEvent* ) override; @@ -124,6 +126,7 @@ private: RiuMdiArea* m_mdiArea; caf::PdmPointer m_activePlotViewWindow; + QPointer m_messagePanel; QMenu* m_windowMenu; diff --git a/ApplicationCode/UserInterface/RiuProcessMonitor.cpp b/ApplicationCode/UserInterface/RiuProcessMonitor.cpp index ea39231735..d192094b98 100644 --- a/ApplicationCode/UserInterface/RiuProcessMonitor.cpp +++ b/ApplicationCode/UserInterface/RiuProcessMonitor.cpp @@ -17,7 +17,10 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiaApplication.h" +#include "RiaGuiApplication.h" +#include "RiuMessagePanel.h" +#include "RiuPlotMainWindow.h" #include "RiuProcessMonitor.h" #include "cafUiProcess.h" @@ -149,6 +152,12 @@ void RiuProcessMonitor::addStringToLog( const QString& sTxt ) m_textEdit->insertPlainText( sTxt ); m_textEdit->ensureCursorVisible(); + + RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); + if ( mainPlotWindow && mainPlotWindow->messagePanel() ) + { + mainPlotWindow->messagePanel()->addMessage( RI_LL_INFO, sTxt ); + } } //--------------------------------------------------------------------------------------------------