X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_Wizard.cxx;h=fd393ae53870eab2bcc655a17e83c4ed76a3e878;hb=a53349567d67f4df0ef737798a25c24d9dc8f08e;hp=8acc5641fbba099e2ad46ea6f6bf95fa790e7e47;hpb=cc6e0c0f0c273dce8decc92a2e931f28067042a5;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_Wizard.cxx b/src/HYDROGUI/HYDROGUI_Wizard.cxx index 8acc5641..fd393ae5 100644 --- a/src/HYDROGUI/HYDROGUI_Wizard.cxx +++ b/src/HYDROGUI/HYDROGUI_Wizard.cxx @@ -1,12 +1,8 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// Copyright (C) 2014-2015 EDF-R&D // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -81,28 +77,30 @@ int HYDROGUI_Wizard::addPage( QWizardPage* thePage ) void HYDROGUI_Wizard::onNext() { - if ( myWizard->count() > 0 ) + if ( !acceptCurrent() ) + return; + + if ( myWizard->count() <= 0 ) + return; + + myBack->setEnabled( true ); + int aCurIdx = myWizard->currentIndex(); + if ( aCurIdx == ( myWizard->count() - 2 ) ) { - myBack->setEnabled( true ); - int aCurIdx = myWizard->currentIndex(); - if ( aCurIdx == ( myWizard->count() - 2 ) ) - { - // Go to the last page - myNext->setVisible( false ); - myFinish->setVisible( true ); - } - myWizard->setCurrentIndex( aCurIdx + 1 ); + // Go to the last page + myNext->setVisible( false ); + myFinish->setVisible( true ); } + myWizard->setCurrentIndex( aCurIdx + 1 ); + + emit Next( myWizard->currentIndex() ); } void HYDROGUI_Wizard::onBack() { - int aCurIdx = myWizard->currentIndex(); - if ( aCurIdx <= 1 ) - { - // Disable back if go to the first page - myBack->setEnabled( false ); - } + if ( myWizard->count() <= 0 ) + return; + if ( myWizard->count() > 1 ) { myNext->setVisible( true ); @@ -114,7 +112,34 @@ void HYDROGUI_Wizard::onBack() myNext->setVisible( false ); myFinish->setVisible( true ); } + + int aCurIdx = myWizard->currentIndex(); myWizard->setCurrentIndex( aCurIdx - 1 ); + + aCurIdx = myWizard->currentIndex(); + if ( aCurIdx <= 0 ) + { + // Disable back if go to the first page + myBack->setEnabled( false ); + } + + emit Back( aCurIdx ); +} + +void HYDROGUI_Wizard::onFirstPage() +{ + if ( myWizard->count() > 1 ) { + myNext->setVisible( true ); + myFinish->setVisible( false ); + myWizard->setCurrentIndex( 0 ); + myBack->setEnabled( false ); + emit Back( myWizard->currentIndex() ); + } +} + +bool HYDROGUI_Wizard::acceptCurrent() const +{ + return true; } QAbstractButton* HYDROGUI_Wizard::button( QWizard::WizardButton theBtnId ) const