diff --git a/source/app/SubWindowHandle.cpp b/source/app/SubWindowHandle.cpp index 5771969..bd85f40 100644 --- a/source/app/SubWindowHandle.cpp +++ b/source/app/SubWindowHandle.cpp @@ -310,6 +310,11 @@ QSize SubWindowHandle::sizeHint() const return maxSize; } +Bool SubWindowHandle::mayClose() +{ + return true; +} + void SubWindowHandle::closeEvent( QCloseEvent *event ) { event->accept(); diff --git a/source/app/SubWindowHandle.h b/source/app/SubWindowHandle.h index c9ee0f3..4d7630b 100644 --- a/source/app/SubWindowHandle.h +++ b/source/app/SubWindowHandle.h @@ -63,6 +63,7 @@ public: SubWindowHandle( QWidget * parent = 0 ); ~SubWindowHandle(); + Bool mayClose(); Bool loadFile( const QString &fileName ); Bool save(); diff --git a/source/app/plaYUVerApp.cpp b/source/app/plaYUVerApp.cpp index d92266b..c21e992 100644 --- a/source/app/plaYUVerApp.cpp +++ b/source/app/plaYUVerApp.cpp @@ -82,11 +82,14 @@ plaYUVerApp::plaYUVerApp() Void plaYUVerApp::closeEvent( QCloseEvent *event ) { + Int mayCloseAll=true; Int msgBoxCloseRet = QMessageBox::Yes; + SubWindowHandle *imageInterface; + if( mdiArea->subWindowList().size() >= 1 ) { QMessageBox msgBoxClose; - msgBoxClose.setText( "There are sub windows opened." ); + msgBoxClose.setText( "There are open files." ); msgBoxClose.setInformativeText( "Close all?" ); msgBoxClose.setStandardButtons( QMessageBox::Yes | QMessageBox::No ); msgBoxClose.setDefaultButton( QMessageBox::No ); @@ -95,8 +98,17 @@ Void plaYUVerApp::closeEvent( QCloseEvent *event ) switch( msgBoxCloseRet ) { case QMessageBox::Yes: + closeAll(); - if( mdiArea->subWindowList().isEmpty() ) + + mayCloseAll=true; + for( Int i=0 ; isubWindowList().size() ; i++ ) + { + imageInterface = qobject_cast(mdiArea->subWindowList().at(i)); + mayCloseAll &= imageInterface->mayClose(); + } + + if( mayCloseAll ) { writeSettings(); event->accept();