diff --git a/ApplicationExeCode/Resources/HideTabs.svg b/ApplicationExeCode/Resources/HideTabs.svg new file mode 100644 index 0000000000..1650192834 --- /dev/null +++ b/ApplicationExeCode/Resources/HideTabs.svg @@ -0,0 +1,21 @@ + + + + + + + diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index a5680729e1..7f225fafa1 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -76,6 +76,7 @@ GridModels.png HelpCircle.svg WhatsNew.svg + HideTabs.svg Histogram16x16.png Histograms16x16.png HoloLensConnect24x24.png diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index c792ce8eff..e3430a39a7 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -89,8 +89,10 @@ #include "cvfTimer.h" +#include "DockAreaTitleBar.h" #include "DockAreaWidget.h" #include "DockManager.h" +#include "DockWidget.h" #include #include @@ -100,6 +102,7 @@ #include #include #include +#include #include #include #include @@ -112,6 +115,7 @@ #include #include #include +#include #include @@ -424,6 +428,11 @@ void RiuMainWindow::createActions() connect( m_viewFromBelow, SIGNAL( triggered() ), SLOT( slotViewFromBelow() ) ); connect( m_viewFullScreen, SIGNAL( toggled( bool ) ), SLOT( slotViewFullScreen( bool ) ) ); + m_hideTabsAction = new QAction( QIcon( ":/HideTabs.svg" ), "Show/Hide Tabs", this ); + m_hideTabsAction->setToolTip( "Show/Hide Tabs in Main Views" ); + m_hideTabsAction->setCheckable( true ); + connect( m_hideTabsAction, SIGNAL( toggled( bool ) ), SLOT( slotHideTabs( bool ) ) ); + // Debug actions m_newPropertyView = new QAction( "New Project and Property View", this ); connect( m_newPropertyView, SIGNAL( triggered() ), SLOT( slotNewObjectPropertyView() ) ); @@ -528,6 +537,7 @@ void RiuMainWindow::createMenus() QMenu* viewMenu = RiuMenuBarBuildTools::createDefaultViewMenu( menuBar() ); viewMenu->addSeparator(); viewMenu->addAction( m_viewFullScreen ); + viewMenu->addAction( m_hideTabsAction ); viewMenu->addSeparator(); viewMenu->addAction( m_viewFromSouth ); viewMenu->addAction( m_viewFromNorth ); @@ -642,6 +652,7 @@ void RiuMainWindow::createToolBars() toolbar->addAction( cmdFeatureMgr->action( "RicTogglePerspectiveViewFeature" ) ); toolbar->addAction( cmdFeatureMgr->action( "RicViewZoomAllFeature" ) ); toolbar->addAction( m_viewFullScreen ); + toolbar->addAction( m_hideTabsAction ); toolbar->addAction( m_viewFromNorth ); toolbar->addAction( m_viewFromSouth ); toolbar->addAction( m_viewFromEast ); @@ -2082,3 +2093,17 @@ void RiuMainWindow::dropEvent( QDropEvent* event ) event->acceptProposedAction(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindow::slotHideTabs( bool hideTabs ) +{ + // TODO - go through all 3d view dock widgets and collect the unique dock areas that only contains 3d viewsand hide those. + auto central = dockManager()->centralWidget()->dockAreaWidget()->titleBar(); + + if ( hideTabs ) + central->hide(); + else + central->show(); +} diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index 2d0ffd81d6..f2e746bac3 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -154,6 +154,7 @@ private: QAction* m_viewFromAbove; QAction* m_viewFromBelow; QAction* m_viewFullScreen; + QAction* m_hideTabsAction; // Mock actions QAction* m_mockModelAction; @@ -224,6 +225,8 @@ private slots: void slotAnimationSliderMoved( int newValue ); void slotAnimationControlFrameChanged( int newValue ); + void slotHideTabs( bool hideTabs ); + // Debug slots void slotSnapshotAllViewsToFile(); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index f4ed1e5d47..6e36f15f11 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -96,26 +96,10 @@ RiuPlotMainWindow::RiuPlotMainWindow() , m_autoUpdateEnabled( false ) , m_autoUpdateTimerId( -1 ) { - m_toggleSelectionLinkAction = new QAction( QIcon( ":/Link3DandPlots.png" ), tr( "Link With Selection in 3D" ), this ); - m_toggleSelectionLinkAction->setToolTip( "Update wells used in plots from well selections in 3D view." ); - m_toggleSelectionLinkAction->setCheckable( true ); - m_toggleSelectionLinkAction->setChecked( m_selection3DLinkEnabled ); - connect( m_toggleSelectionLinkAction, SIGNAL( triggered() ), SLOT( slotToggleSelectionLink() ) ); - - m_toggleAutoUpdateAction = new QAction( QIcon( ":/TimedRefresh.png" ), tr( "Auto-update plots." ), this ); - m_toggleAutoUpdateAction->setToolTip( "Reload cases at interval specified in Automation Settings." ); - m_toggleAutoUpdateAction->setCheckable( true ); - m_toggleAutoUpdateAction->setChecked( m_autoUpdateEnabled ); - connect( m_toggleAutoUpdateAction, SIGNAL( triggered() ), SLOT( slotToggleAutoUpdate() ) ); - - m_reloadSelectedCasesAction = new QAction( QIcon( ":/Refresh.svg" ), tr( "Reload Selected Cases" ), this ); - m_reloadSelectedCasesAction->setToolTip( "Reload selected summary and/or ensemble cases." ); - m_reloadSelectedCasesAction->setCheckable( false ); - connect( m_reloadSelectedCasesAction, SIGNAL( triggered() ), SLOT( slotReloadSelectedCases() ) ); - setAttribute( Qt::WA_DeleteOnClose ); setUpCentralDockWidget(); + createActions(); createMenus(); createToolBars(); createDockPanels(); @@ -308,6 +292,35 @@ void RiuPlotMainWindow::keyPressEvent( QKeyEvent* keyEvent ) RiuMainWindowBase::keyPressEvent( keyEvent ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotMainWindow::createActions() +{ + m_toggleSelectionLinkAction = new QAction( QIcon( ":/Link3DandPlots.png" ), tr( "Link With Selection in 3D" ), this ); + m_toggleSelectionLinkAction->setToolTip( "Update wells used in plots from well selections in 3D view." ); + m_toggleSelectionLinkAction->setCheckable( true ); + m_toggleSelectionLinkAction->setChecked( m_selection3DLinkEnabled ); + connect( m_toggleSelectionLinkAction, SIGNAL( triggered() ), SLOT( slotToggleSelectionLink() ) ); + + m_toggleAutoUpdateAction = new QAction( QIcon( ":/TimedRefresh.png" ), tr( "Auto-update plots." ), this ); + m_toggleAutoUpdateAction->setToolTip( "Reload cases at interval specified in Automation Settings." ); + m_toggleAutoUpdateAction->setCheckable( true ); + m_toggleAutoUpdateAction->setChecked( m_autoUpdateEnabled ); + connect( m_toggleAutoUpdateAction, SIGNAL( triggered() ), SLOT( slotToggleAutoUpdate() ) ); + + m_reloadSelectedCasesAction = new QAction( QIcon( ":/Refresh.svg" ), tr( "Reload Selected Cases" ), this ); + m_reloadSelectedCasesAction->setToolTip( "Reload selected summary and/or ensemble cases." ); + m_reloadSelectedCasesAction->setCheckable( false ); + connect( m_reloadSelectedCasesAction, SIGNAL( triggered() ), SLOT( slotReloadSelectedCases() ) ); + + m_viewFullScreenAction = new QAction( QIcon( ":/Fullscreen.png" ), "Full Screen", this ); + m_viewFullScreenAction->setToolTip( "Full Screen (Ctrl+Alt+F)" ); + m_viewFullScreenAction->setCheckable( true ); + caf::CmdFeature::applyShortcutWithHintToAction( m_viewFullScreenAction, QKeySequence( tr( "Ctrl+Alt+F" ) ) ); + connect( m_viewFullScreenAction, SIGNAL( toggled( bool ) ), SLOT( slotViewFullScreen( bool ) ) ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -355,7 +368,9 @@ void RiuPlotMainWindow::createMenus() connect( editMenu, SIGNAL( aboutToShow() ), SLOT( slotRefreshUndoRedoActions() ) ); // View menu - RiuMenuBarBuildTools::createDefaultViewMenu( menuBar() ); + QMenu* viewMenu = RiuMenuBarBuildTools::createDefaultViewMenu( menuBar() ); + viewMenu->addSeparator(); + viewMenu->addAction( m_viewFullScreenAction ); // Windows menu m_windowMenu = menuBar()->addMenu( "&Windows" ); @@ -435,6 +450,7 @@ void RiuPlotMainWindow::createToolBars() } if ( toolbarName == "View" ) { + toolbar->addAction( m_viewFullScreenAction ); toolbar->addAction( m_toggleSelectionLinkAction ); toolbar->addAction( m_reloadSelectedCasesAction ); toolbar->addAction( m_toggleAutoUpdateAction ); @@ -1043,3 +1059,48 @@ void RiuPlotMainWindow::timerEvent( QTimerEvent* event ) RicReloadSummaryCaseFeature::reloadTaggedSummaryCasesAndUpdate(); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotMainWindow::slotViewFullScreen( bool showFullScreen ) +{ + if ( showFullScreen ) + { + m_lastDockState = dockManager()->saveState( DOCKSTATE_VERSION ); + + QString activeViewerName; + if ( auto activeViewer = RiaGuiApplication::instance()->activePlotWindow() ) + { + activeViewerName = activeViewer->dockWindowName(); + } + + dockManager()->restoreState( RiuDockWidgetTools::hideAllDockingPlotState(), DOCKSTATE_VERSION ); + + if ( !activeViewerName.isEmpty() ) + { + if ( auto dw = dockManager()->findDockWidget( activeViewerName ) ) + { + dockManager()->addDockWidget( ads::DockWidgetArea::CenterDockWidgetArea, dw, dockManager()->centralWidget()->dockAreaWidget() ); + } + } + } + else + { + QString activeViewerName; + if ( auto activeViewer = RiaGuiApplication::instance()->activePlotWindow() ) + { + activeViewerName = activeViewer->dockWindowName(); + } + + dockManager()->restoreState( m_lastDockState, DOCKSTATE_VERSION ); + + if ( !activeViewerName.isEmpty() ) + { + if ( auto dw = dockManager()->findDockWidget( activeViewerName ) ) + { + dw->setAsCurrentTab(); + } + } + } +} diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 2d21071f53..92913471ea 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -97,6 +97,7 @@ protected: private: void setPdmRoot( caf::PdmObject* pdmRoot ); + void createActions(); void createMenus(); void createToolBars(); void createDockPanels(); @@ -111,6 +112,7 @@ private slots: void slotToggleSelectionLink(); void slotToggleAutoUpdate(); void slotReloadSelectedCases(); + void slotViewFullScreen( bool ); void slotBuildWindowActions(); @@ -139,4 +141,5 @@ private: bool m_autoUpdateEnabled; int m_autoUpdateTimerId; QAction* m_reloadSelectedCasesAction; + QAction* m_viewFullScreenAction; };