Janitor : Hide undo stack behind environmentvariable DEVEL

Move geomech tab after scripting
This commit is contained in:
Magne Sjaastad 2021-06-10 14:03:31 +02:00
parent 40c44983f4
commit ea9e3f7a52
4 changed files with 32 additions and 15 deletions

View File

@ -457,12 +457,6 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
m_summaryPreferences()->uiOrdering( uiConfigName, *group ); m_summaryPreferences()->uiOrdering( uiConfigName, *group );
} }
} }
#ifdef USE_ODB_API
else if ( uiConfigName == RiaPreferences::tabNameGeomech() )
{
m_geoMechPreferences()->appendItems( uiOrdering );
}
#endif
else if ( uiConfigName == RiaPreferences::tabNamePlotting() ) else if ( uiConfigName == RiaPreferences::tabNamePlotting() )
{ {
uiOrdering.add( &m_dateFormat ); uiOrdering.add( &m_dateFormat );
@ -510,6 +504,12 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
scriptGroup->add( &scriptDirectories ); scriptGroup->add( &scriptDirectories );
scriptGroup->add( &scriptEditorExecutable ); scriptGroup->add( &scriptEditorExecutable );
} }
#ifdef USE_ODB_API
else if ( uiConfigName == RiaPreferences::tabNameGeomech() )
{
m_geoMechPreferences()->appendItems( uiOrdering );
}
#endif
else if ( uiConfigName == RiaPreferences::tabNameExport() ) else if ( uiConfigName == RiaPreferences::tabNameExport() )
{ {
uiOrdering.add( &csvTextExportFieldSeparator ); uiOrdering.add( &csvTextExportFieldSeparator );

View File

@ -133,7 +133,10 @@ RiuMainWindow::RiuMainWindow()
m_dragDropInterface = std::unique_ptr<caf::PdmUiDragDropInterface>( new RiuDragDrop() ); m_dragDropInterface = std::unique_ptr<caf::PdmUiDragDropInterface>( new RiuDragDrop() );
if ( m_undoView )
{
m_undoView->setStack( caf::CmdExecCommandManager::instance()->undoStack() ); m_undoView->setStack( caf::CmdExecCommandManager::instance()->undoStack() );
}
connect( caf::CmdExecCommandManager::instance()->undoStack(), connect( caf::CmdExecCommandManager::instance()->undoStack(),
SIGNAL( indexChanged( int ) ), SIGNAL( indexChanged( int ) ),
SLOT( slotRefreshUndoRedoActions() ) ); SLOT( slotRefreshUndoRedoActions() ) );
@ -836,7 +839,7 @@ void RiuMainWindow::createDockPanels()
dockWidget->hide(); dockWidget->hide();
} }
if ( RiaPreferences::current()->useUndoRedo() ) if ( m_undoView && RiaPreferences::current()->useUndoRedo() )
{ {
QDockWidget* dockWidget = new QDockWidget( "Undo Stack", this ); QDockWidget* dockWidget = new QDockWidget( "Undo Stack", this );
dockWidget->setObjectName( RiuDockWidgetTools::undoStackName() ); dockWidget->setObjectName( RiuDockWidgetTools::undoStackName() );

View File

@ -18,6 +18,8 @@
#include "RiuMainWindowBase.h" #include "RiuMainWindowBase.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RiaVersionInfo.h" #include "RiaVersionInfo.h"
#include "RiuDockWidgetTools.h" #include "RiuDockWidgetTools.h"
@ -51,7 +53,14 @@ RiuMainWindowBase::RiuMainWindowBase()
{ {
setDockNestingEnabled( true ); setDockNestingEnabled( true );
if ( RiaPreferences::current()->useUndoRedo() && RiaApplication::enableDevelopmentFeatures() )
{
m_undoView = new QUndoView( this ); m_undoView = new QUndoView( this );
}
else
{
m_undoView = nullptr;
}
m_undoAction = new QAction( QIcon( ":/undo.png" ), tr( "Undo" ), this ); m_undoAction = new QAction( QIcon( ":/undo.png" ), tr( "Undo" ), this );
m_undoAction->setShortcut( QKeySequence::Undo ); m_undoAction->setShortcut( QKeySequence::Undo );
@ -69,8 +78,8 @@ QMdiSubWindow* RiuMainWindowBase::createViewWindow()
{ {
RiuMdiSubWindow* subWin = RiuMdiSubWindow* subWin =
new RiuMdiSubWindow( nullptr, Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint ); new RiuMdiSubWindow( nullptr, Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint );
subWin->setAttribute( Qt::WA_DeleteOnClose ); // Make sure the contained widget is destroyed when the MDI window is subWin->setAttribute( Qt::WA_DeleteOnClose ); // Make sure the contained widget is destroyed when the MDI window
// closed // is closed
return subWin; return subWin;
} }
@ -430,7 +439,7 @@ void RiuMainWindowBase::slotRefreshHelpActions()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuMainWindowBase::slotRedo() void RiuMainWindowBase::slotRedo()
{ {
if ( m_undoView->stack() && m_undoView->stack()->canRedo() ) if ( m_undoView && m_undoView->stack() && m_undoView->stack()->canRedo() )
{ {
m_undoView->stack()->redo(); m_undoView->stack()->redo();
} }
@ -441,7 +450,7 @@ void RiuMainWindowBase::slotRedo()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuMainWindowBase::slotUndo() void RiuMainWindowBase::slotUndo()
{ {
if ( m_undoView->stack() && m_undoView->stack()->canUndo() ) if ( m_undoView && m_undoView->stack() && m_undoView->stack()->canUndo() )
{ {
m_undoView->stack()->undo(); m_undoView->stack()->undo();
} }
@ -452,6 +461,8 @@ void RiuMainWindowBase::slotUndo()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuMainWindowBase::slotRefreshUndoRedoActions() void RiuMainWindowBase::slotRefreshUndoRedoActions()
{ {
if ( !m_undoView ) return;
m_redoAction->setDisabled( !m_undoView->stack()->canRedo() ); m_redoAction->setDisabled( !m_undoView->stack()->canRedo() );
m_undoAction->setDisabled( !m_undoView->stack()->canUndo() ); m_undoAction->setDisabled( !m_undoView->stack()->canUndo() );
} }

View File

@ -90,7 +90,10 @@ RiuPlotMainWindow::RiuPlotMainWindow()
m_dragDropInterface = std::unique_ptr<caf::PdmUiDragDropInterface>( new RiuDragDrop() ); m_dragDropInterface = std::unique_ptr<caf::PdmUiDragDropInterface>( new RiuDragDrop() );
if ( m_undoView )
{
m_undoView->setStack( caf::CmdExecCommandManager::instance()->undoStack() ); m_undoView->setStack( caf::CmdExecCommandManager::instance()->undoStack() );
}
connect( caf::CmdExecCommandManager::instance()->undoStack(), connect( caf::CmdExecCommandManager::instance()->undoStack(),
SIGNAL( indexChanged( int ) ), SIGNAL( indexChanged( int ) ),
SLOT( slotRefreshUndoRedoActions() ) ); SLOT( slotRefreshUndoRedoActions() ) );
@ -494,7 +497,7 @@ void RiuPlotMainWindow::createDockPanels()
dockWidget->hide(); dockWidget->hide();
} }
if ( RiaPreferences::current()->useUndoRedo() ) if ( m_undoView && RiaPreferences::current()->useUndoRedo() )
{ {
QDockWidget* dockWidget = new QDockWidget( "Undo Stack", this ); QDockWidget* dockWidget = new QDockWidget( "Undo Stack", this );
dockWidget->setObjectName( RiuDockWidgetTools::plotMainWindowUndoStackName() ); dockWidget->setObjectName( RiuDockWidgetTools::plotMainWindowUndoStackName() );