diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 9377748201..3b4ac39bfa 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -969,6 +969,13 @@ void RiaGuiApplication::createMainWindow() m_mainWindow->setDefaultToolbarVisibility(); m_mainWindow->loadWinGeoAndDockToolBarLayout(); m_mainWindow->showWindow(); + + // if there is an existing logger, reconnect to it + auto logger = dynamic_cast( RiaLogging::loggerInstance() ); + if ( logger ) + { + logger->addMessagePanel( m_mainWindow->messagePanel() ); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index ef5c2886c0..15dc699382 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -2105,3 +2105,11 @@ QStringList RiuMainWindow::defaultDockStateNames() RiuDockWidgetTools::dockStateHideAll3DWindowName() }; return retList; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QAction* RiuMainWindow::tileSubWindowsAction() +{ + return caf::CmdFeatureManager::instance()->action( "RicTileWindowsFeature" ); +} diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index 00828a1098..317d0ea708 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -140,6 +140,7 @@ public: protected: void closeEvent( QCloseEvent* event ) override; QStringList defaultDockStateNames() override; + QAction* tileSubWindowsAction() override; private: void createActions(); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index 1185c1c4f7..ed719b4673 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -753,7 +753,7 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu() QAction* closeAllSubWindowsAction = new QAction( "Close All Windows", this ); connect( closeAllSubWindowsAction, SIGNAL( triggered() ), m_mdiArea, SLOT( closeAllSubWindows() ) ); - m_windowMenu->addAction( caf::CmdFeatureManager::instance()->action( "RicTilePlotWindowsFeature" ) ); + m_windowMenu->addAction( tileSubWindowsAction() ); m_windowMenu->addAction( cascadeWindowsAction ); m_windowMenu->addAction( closeAllSubWindowsAction ); } diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index f0797d71ac..63ee1858b8 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -39,6 +39,7 @@ class PdmUiTreeView; class PdmUiItem; } // namespace caf +class QAction; class QMdiArea; class QMdiSubWindow; class QUndoView; @@ -113,6 +114,8 @@ protected: virtual QStringList defaultDockStateNames() = 0; + virtual QAction* tileSubWindowsAction() = 0; + protected slots: void slotDockWidgetToggleViewActionTriggered(); void slotRefreshHelpActions(); diff --git a/ApplicationLibCode/UserInterface/RiuMessagePanel.cpp b/ApplicationLibCode/UserInterface/RiuMessagePanel.cpp index a6597c744d..07a8ec4407 100644 --- a/ApplicationLibCode/UserInterface/RiuMessagePanel.cpp +++ b/ApplicationLibCode/UserInterface/RiuMessagePanel.cpp @@ -151,7 +151,10 @@ RiuMessagePanelLogger::RiuMessagePanelLogger() //-------------------------------------------------------------------------------------------------- void RiuMessagePanelLogger::addMessagePanel( RiuMessagePanel* messagePanel ) { - m_messagePanel.push_back( messagePanel ); + // get rid of any unused entries (qpointers are null) + m_messagePanels.erase( std::remove( m_messagePanels.begin(), m_messagePanels.end(), nullptr ), m_messagePanels.end() ); + + m_messagePanels.push_back( messagePanel ); } //-------------------------------------------------------------------------------------------------- @@ -212,7 +215,7 @@ void RiuMessagePanelLogger::writeToMessagePanel( RILogLevel messageLevel, const return; } - for ( auto& panel : m_messagePanel ) + for ( auto& panel : m_messagePanels ) { if ( panel ) { diff --git a/ApplicationLibCode/UserInterface/RiuMessagePanel.h b/ApplicationLibCode/UserInterface/RiuMessagePanel.h index 2103eab6cd..483e89a3f4 100644 --- a/ApplicationLibCode/UserInterface/RiuMessagePanel.h +++ b/ApplicationLibCode/UserInterface/RiuMessagePanel.h @@ -72,6 +72,6 @@ private: void writeToMessagePanel( RILogLevel messageLevel, const char* message ); private: - std::vector> m_messagePanel; + std::vector> m_messagePanels; int m_logLevel; }; diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 7813716ebd..1064b135f5 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -1210,3 +1210,11 @@ void RiuPlotMainWindow::slotToggleSelectionLink() { m_selection3DLinkEnabled = !m_selection3DLinkEnabled; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QAction* RiuPlotMainWindow::tileSubWindowsAction() +{ + return caf::CmdFeatureManager::instance()->action( "RicTilePlotWindowsFeature" ); +} diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 3395fc2e98..5883b7af49 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -106,6 +106,7 @@ protected: void dropEvent( QDropEvent* event ) override; QStringList defaultDockStateNames() override; + QAction* tileSubWindowsAction() override; private: void setPdmRoot( caf::PdmObject* pdmRoot );