Commit 2f227018 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

MainWindow: Correctly handle undocked widget states.

Fixes #59
parent eee4398b
......@@ -42,23 +42,26 @@ DockWidgetManager::~DockWidgetManager()
qDeleteAll( m_dockWidgets );
}
void DockWidgetManager::setMainWindow( MainWindow *mainWin )
void
DockWidgetManager::setMainWindow( MainWindow *mainWin )
{
m_mainWin = mainWin;
}
QDockWidget* DockWidgetManager::addDockedWidget( QWidget *widget,
QDockWidget*
DockWidgetManager::addDockedWidget( QWidget *widget,
const char *qs_name,
Qt::DockWidgetAreas areas,
QDockWidget::DockWidgetFeature features,
Qt::DockWidgetArea startArea)
{
if ( m_dockWidgets.contains( qs_name ) )
return 0;
return NULL;
QDockWidget* dock = new QDockWidget( tr( qs_name ), m_mainWin );
QDockWidget* dock = new QDockWidget( tr( qs_name ), m_mainWin );
m_dockWidgets.insert( qs_name, dock );
dock->setObjectName( QString( "docked_" ) + qs_name );
dock->setWidget( widget );
dock->setAllowedAreas( areas );
dock->setFeatures( features );
......@@ -68,7 +71,8 @@ QDockWidget* DockWidgetManager::addDockedWidget( QWidget *widget,
return dock;
}
void DockWidgetManager::retranslateUi()
void
DockWidgetManager::retranslateUi()
{
QMapIterator<const char*, QDockWidget*> i( m_dockWidgets );
......
......@@ -145,14 +145,6 @@ MainWindow::MainWindow( QWidget *parent ) :
MainWindow::~MainWindow()
{
QSettings s;
// Save the current geometry
s.setValue( "MainWindowGeometry", saveGeometry() );
// Save the current layout
s.setValue( "MainWindowState", saveState() );
s.setValue( "CleanQuit", true );
s.sync();
if ( m_fileRenderer )
delete m_fileRenderer;
delete m_importController;
......@@ -476,7 +468,8 @@ MainWindow::setupDockedWidgets()
Qt::TopDockWidgetArea );
dockManager->addDockedWidget( m_effectsList,
QT_TRANSLATE_NOOP( "DockWidgetManager", "Effects List" ),
Qt::AllDockWidgetAreas, QDockWidget::AllDockWidgetFeatures,
Qt::AllDockWidgetAreas,
QDockWidget::AllDockWidgetFeatures,
Qt::LeftDockWidgetArea );
dockManager->addDockedWidget( UndoStack::getInstance( this ),
QT_TRANSLATE_NOOP( "DockWidgetManager", "History" ),
......@@ -745,7 +738,17 @@ MainWindow::closeEvent( QCloseEvent* e )
if ( pm->askForSaveIfModified() )
e->accept();
else
{
e->ignore();
return ;
}
QSettings s;
// Save the current geometry
s.setValue( "MainWindowGeometry", saveGeometry() );
// Save the current layout
s.setValue( "MainWindowState", saveState() );
s.setValue( "CleanQuit", true );
s.sync();
}
void
......
......@@ -17,9 +17,6 @@
<iconset resource="../../../resources.qrc">
<normaloff>:/images/vlmc</normaloff>:/images/vlmc</iconset>
</property>
<property name="dockNestingEnabled">
<bool>true</bool>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
......@@ -27,7 +24,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>27</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuEdit">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment