1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 // File: LightApp_Preferences.cxx
20 // Author: Sergey TELKOV
22 #include "LightApp_Preferences.h"
24 #include <QtxListResourceEdit.h>
29 Constructor.Initialize by resource manager and parent QWidget.
31 LightApp_Preferences::LightApp_Preferences( QtxResourceMgr* resMgr, QWidget* parent )
32 : QtxListResourceEdit( resMgr, parent )
39 LightApp_Preferences::~LightApp_Preferences()
46 int LightApp_Preferences::addPreference( const QString& label, const int pId, const int type,
47 const QString& section, const QString& param )
49 return addItem( label, pId, type, section, param );
55 int LightApp_Preferences::addPreference( const QString& mod, const QString& label, const int pId,
56 const int type, const QString& section, const QString& param )
58 int id = addItem( label, pId, type, section, param );
59 if ( id != -1 && !mod.isEmpty() )
60 myPrefMod.insert( id, mod );
65 Checks: is preferences has module with name \a mod.
67 bool LightApp_Preferences::hasModule( const QString& mod ) const
70 for ( PrefModuleMap::ConstIterator it = myPrefMod.begin(); it != myPrefMod.end() && !res; ++it )
71 res = it.data() == mod;
76 void LightApp_Preferences::onHelp()
80 /*!Store preferences on apply.*/
81 void LightApp_Preferences::onApply()
86 /*!Emit preference changed.*/
87 void LightApp_Preferences::changedResources( const QMap<Item*, QString>& map )
89 for ( QMap<Item*, QString>::ConstIterator it = map.begin(); it != map.end(); ++it )
92 it.key()->resource( sec, param );
93 QString mod = module( it.key()->id() );
94 emit preferenceChanged( mod, sec, param );
98 /*!Gets module name by \a id, if exist.*/
99 QString LightApp_Preferences::module( const int id ) const
102 if ( myPrefMod.contains( id ) )