X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FLightApp%2FLightApp_Preferences.cxx;h=7b7cfb790f8be8f80bbc1505f4162e76da216a2a;hb=cefbc12b9fc2e08b4b0583b031347ef8f113a387;hp=36ba84c9606c35a92568b76a01acea5fa641c5b5;hpb=aa05f2a1b23a54321ea7248ae9ac3463652c734e;p=modules%2Fgui.git diff --git a/src/LightApp/LightApp_Preferences.cxx b/src/LightApp/LightApp_Preferences.cxx index 36ba84c96..7b7cfb790 100644 --- a/src/LightApp/LightApp_Preferences.cxx +++ b/src/LightApp/LightApp_Preferences.cxx @@ -1,35 +1,35 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// +// 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 +// // 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 +// License as published by the Free Software Foundation; either // version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File: LightApp_Preferences.cxx // Author: Sergey TELKOV - +// #include "LightApp_Preferences.h" -#include - -#include - /*! Constructor.Initialize by resource manager and parent QWidget. */ LightApp_Preferences::LightApp_Preferences( QtxResourceMgr* resMgr, QWidget* parent ) -: QtxListResourceEdit( resMgr, parent ) +: SUIT_PreferenceMgr( resMgr, parent ) { } @@ -46,7 +46,7 @@ LightApp_Preferences::~LightApp_Preferences() int LightApp_Preferences::addPreference( const QString& label, const int pId, const int type, const QString& section, const QString& param ) { - return addItem( label, pId, type, section, param ); + return addItem( label, pId, (SUIT_PreferenceMgr::PrefItemType)type, section, param ); } /*! @@ -55,7 +55,7 @@ int LightApp_Preferences::addPreference( const QString& label, const int pId, co int LightApp_Preferences::addPreference( const QString& mod, const QString& label, const int pId, const int type, const QString& section, const QString& param ) { - int id = addItem( label, pId, type, section, param ); + int id = addItem( label, pId, (SUIT_PreferenceMgr::PrefItemType)type, section, param ); if ( id != -1 && !mod.isEmpty() ) myPrefMod.insert( id, mod ); return id; @@ -68,10 +68,21 @@ bool LightApp_Preferences::hasModule( const QString& mod ) const { bool res = false; for ( PrefModuleMap::ConstIterator it = myPrefMod.begin(); it != myPrefMod.end() && !res; ++it ) - res = it.data() == mod; + res = it.value() == mod; return res; } +void LightApp_Preferences::activateItem( const QString& mod ) const +{ + QtxPreferenceItem* item = findItem( mod, true ); + + if ( !item ) + return; + + item->ensureVisible(); + item->activate(); +} + /*!Do nothing.*/ void LightApp_Preferences::onHelp() { @@ -84,9 +95,10 @@ void LightApp_Preferences::onApply() } /*!Emit preference changed.*/ -void LightApp_Preferences::changedResources( const QMap& map ) +void LightApp_Preferences::changedResources( const ResourceMap& map ) { - for ( QMap::ConstIterator it = map.begin(); it != map.end(); ++it ) + for ( ResourceMap::ConstIterator it = map.begin(); + it != map.end(); ++it ) { QString sec, param; it.key()->resource( sec, param );