From: abd Date: Fri, 3 Feb 2006 11:22:08 +0000 (+0000) Subject: Added interface for ignore local user resources X-Git-Tag: T_merge_to_HEAD_20060207~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c1446dfb8ae4bacbbee1bb73bfbea14d19653143;p=modules%2Fgui.git Added interface for ignore local user resources --- diff --git a/src/Qtx/QtxResourceMgr.cxx b/src/Qtx/QtxResourceMgr.cxx index 1e4e6223f..d5376b7e0 100644 --- a/src/Qtx/QtxResourceMgr.cxx +++ b/src/Qtx/QtxResourceMgr.cxx @@ -663,11 +663,14 @@ bool QtxResourceMgr::Format::save( Resources* res ) function userFileName(). Any resource looking firstly in the user home resources then resource directories used in the specified order. All setted resources always stored into the resource file at the user home. Only user home resource file is saved. + If you want to ignore of loading of Local User Preferences, you needs setup setIngoreUserValues() + as true. */ QtxResourceMgr::QtxResourceMgr( const QString& appName, const QString& resVarTemplate ) : myAppName( appName ), myCheckExist( true ), - myIsPixmapCached( true ) + myIsPixmapCached( true ), + myIsIgnoreUserValues( false ) { QString envVar = !resVarTemplate.isEmpty() ? resVarTemplate : QString( "%1Resources" ); if ( envVar.contains( "%1" ) ) @@ -784,6 +787,16 @@ void QtxResourceMgr::clear() it.current()->clear(); } +void QtxResourceMgr::setIgnoreUserValues( const bool val ) +{ + myIsIgnoreUserValues = val; +} + +bool QtxResourceMgr::ignoreUserValues() const +{ + return myIsIgnoreUserValues; +} + /*! \brief Get the resource value as integer. Returns 'true' if it successfull otherwise returns 'false'. @@ -948,7 +961,12 @@ bool QtxResourceMgr::value( const QString& sect, const QString& name, QString& v initialize(); bool ok = false; - for ( ResListIterator it( myResources ); it.current() && !ok; ++it ) + + ResListIterator it( myResources ); + if ( ignoreUserValues() ) + ++it; + + for ( ; it.current() && !ok; ++it ) { ok = it.current()->hasValue( sect, name ); if ( ok ) diff --git a/src/Qtx/QtxResourceMgr.h b/src/Qtx/QtxResourceMgr.h index 9d7b8b26c..f75345425 100644 --- a/src/Qtx/QtxResourceMgr.h +++ b/src/Qtx/QtxResourceMgr.h @@ -73,6 +73,9 @@ public: void clear(); + void setIgnoreUserValues( const bool = true ); + bool ignoreUserValues() const; + bool value( const QString&, const QString&, int& ) const; bool value( const QString&, const QString&, double& ) const; bool value( const QString&, const QString&, bool& ) const; @@ -169,6 +172,8 @@ private: TransListMap myTranslator; QPixmap myDefaultPix; bool myIsPixmapCached; + + bool myIsIgnoreUserValues; }; /*!