1 // File: SalomeApp_Preferences.cxx
2 // Author: Sergey TELKOV
4 #include "SalomeApp_Preferences.h"
6 #include <QtxListResourceEdit.h>
11 Constructor.Initialize by resource manager and parent QWidget.
13 SalomeApp_Preferences::SalomeApp_Preferences( QtxResourceMgr* resMgr, QWidget* parent )
14 : QtxListResourceEdit( resMgr, parent )
21 SalomeApp_Preferences::~SalomeApp_Preferences()
28 int SalomeApp_Preferences::addPreference( const QString& label, const int pId, const int type,
29 const QString& section, const QString& param )
31 return addItem( label, pId, type, section, param );
37 int SalomeApp_Preferences::addPreference( const QString& mod, const QString& label, const int pId,
38 const int type, const QString& section, const QString& param )
40 int id = addItem( label, pId, type, section, param );
41 if ( id != -1 && !mod.isEmpty() )
42 myPrefMod.insert( id, mod );
47 Checks: is preferences has module with name \a mod.
49 bool SalomeApp_Preferences::hasModule( const QString& mod ) const
52 for ( PrefModuleMap::ConstIterator it = myPrefMod.begin(); it != myPrefMod.end() && !res; ++it )
53 res = it.data() == mod;
58 void SalomeApp_Preferences::onHelp()
62 /*!Store preferences on apply.*/
63 void SalomeApp_Preferences::onApply()
68 /*!Emit preference changed.*/
69 void SalomeApp_Preferences::changedResources( const QMap<Item*, QString>& map )
71 for ( QMap<Item*, QString>::ConstIterator it = map.begin(); it != map.end(); ++it )
74 it.key()->resource( sec, param );
75 QString mod = module( it.key()->id() );
76 emit preferenceChanged( mod, sec, param );
80 /*!Gets module name by \a id, if exist.*/
81 QString SalomeApp_Preferences::module( const int id ) const
84 if ( myPrefMod.contains( id ) )