1 // File: LightApp_Preferences.cxx
2 // Author: Sergey TELKOV
4 #include "LightApp_Preferences.h"
6 #include <QtxListResourceEdit.h>
11 Constructor.Initialize by resource manager and parent QWidget.
13 LightApp_Preferences::LightApp_Preferences( QtxResourceMgr* resMgr, QWidget* parent )
14 : QtxListResourceEdit( resMgr, parent )
21 LightApp_Preferences::~LightApp_Preferences()
28 int LightApp_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 LightApp_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 LightApp_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 LightApp_Preferences::onHelp()
62 /*!Store preferences on apply.*/
63 void LightApp_Preferences::onApply()
68 /*!Emit preference changed.*/
69 void LightApp_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 LightApp_Preferences::module( const int id ) const
84 if ( myPrefMod.contains( id ) )