ProcessVoidEvent( new TEvent( name, value, autoValue ) );
}
+/*!
+ SalomePyQt::addBoolSetting
+ Adds an boolean setting to the application preferences
+ <autoValue> parameter is obsolete parameter and currently not used. To be removed lately.
+ This function is obsolete. Use addSetting() instead.
+*/
+void SalomePyQt::addBoolSetting( const QString& name, const bool value, bool autoValue )
+{
+ class TEvent: public SALOME_Event {
+ QString myName;
+ bool myValue;
+ bool myAutoValue;
+ public:
+ TEvent( const QString& name, const bool value, bool autoValue )
+ : myName( name ), myValue( value ), myAutoValue( autoValue ) {}
+ virtual void Execute() {
+ if ( SUIT_Session::session() ) {
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ QStringList sl = QStringList::split( ":", myName );
+ QString _sec = sl.count() > 1 ? sl[ 0 ].stripWhiteSpace() : QString( DEFAULT_SECTION );
+ QString _nam = sl.count() > 1 ? sl[ 1 ].stripWhiteSpace() : sl.count() > 0 ? sl[ 0 ].stripWhiteSpace() : QString( "" );
+ if ( !_sec.isEmpty() && !_nam.isEmpty() )
+ resMgr->setValue( _sec, _nam, myValue );
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent( name, value, autoValue ) );
+}
+
/*!
SalomePyQt::removeSettings
Removes a setting from the application preferences
ProcessVoidEvent( new TEvent( section, name, value ) );
}
+/*!
+ SalomePyQt::addSetting
+ Adds a boolean setting to the application preferences
+ (note: the last "dumb" parameter is used in order to avoid
+ sip compilation error because of conflicting int and bool types)
+*/
+void SalomePyQt::addSetting( const QString& section, const QString& name, const bool value, const int )
+{
+ class TEvent: public SALOME_Event {
+ QString mySection;
+ QString myName;
+ bool myValue;
+ public:
+ TEvent( const QString& section, const QString& name, bool value )
+ : mySection( section ), myName( name ), myValue( value ) {}
+ virtual void Execute() {
+ if ( SUIT_Session::session() ) {
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ if ( !mySection.isEmpty() && !myName.isEmpty() )
+ resMgr->setValue( mySection, myName, myValue );
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent( section, name, value ) );
+}
+
/*!
SalomePyQt::addSetting
Adds a string setting to the application preferences
/*!
\return an double setting from the application preferences
*/
-double SalomePyQt::doubleSetting( const QString& section, const QString& name, const int def )
+double SalomePyQt::doubleSetting( const QString& section, const QString& name, const double def )
{
return ProcessEvent( new TGetDblSettingEvent( section, name, def ) );
}
static void addSetting ( const QString&, const QString&, const double );
static void addSetting ( const QString&, const QString&, const int );
+ static void addSetting ( const QString&, const QString&, const bool, const int );
static void addSetting ( const QString&, const QString&, const QString& );
static void addSetting ( const QString&, const QString&, const QColor& );
static int integerSetting( const QString&, const QString&, const int = 0 );
- static double doubleSetting ( const QString&, const QString&, const int = 0 );
+ static double doubleSetting ( const QString&, const QString&, const double = 0 );
static bool boolSetting ( const QString&, const QString&, const bool = 0 );
static QString stringSetting ( const QString&, const QString&, const QString& = QString("") );
static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() );
// obsolete
static void addStringSetting( const QString&, const QString&, bool = true );
static void addIntSetting ( const QString&, const int, bool = true );
+ static void addBoolSetting ( const QString&, const bool, bool = true );
static void addDoubleSetting( const QString&, const double, bool = true );
static void removeSettings ( const QString& );
static QString getSetting ( const QString& );
static void addSetting ( const QString&, const QString&, const double );
static void addSetting ( const QString&, const QString&, const int /Constrained/ );
+ static void addSetting ( const QString&, const QString&, const bool, const int );
static void addSetting ( const QString&, const QString&, const QString& );
static void addSetting ( const QString&, const QString&, const QColor& );
static int integerSetting( const QString&, const QString&, int = 0 );
- static double doubleSetting ( const QString&, const QString&, int = 0 );
+ static double doubleSetting ( const QString&, const QString&, double = 0 );
static bool boolSetting ( const QString&, const QString&, bool = false );
static QString stringSetting ( const QString&, const QString&, const QString& = QString("") );
static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() );
static void addStringSetting( const QString&, const QString&, bool = true );
static void addIntSetting ( const QString&, const int, bool = true );
static void addDoubleSetting( const QString&, const double, bool = true );
+ static void addBoolSetting ( const QString&, const bool, bool = true );
static void removeSettings ( const QString& );
static QString getSetting ( const QString& );
static void addSetting ( const QString&, const QString&, const double ) /ReleaseGIL/ ;
static void addSetting ( const QString&, const QString&, const int /Constrained/ ) /ReleaseGIL/ ;
+ static void addSetting ( const QString&, const QString&, const bool, const int ) /ReleaseGIL/ ;
static void addSetting ( const QString&, const QString&, const QString& ) /ReleaseGIL/ ;
static void addSetting ( const QString&, const QString&, const QColor& ) /ReleaseGIL/ ;
static int integerSetting( const QString&, const QString&, const int = 0 ) /ReleaseGIL/ ;
- static double doubleSetting ( const QString&, const QString&, const int = 0 ) /ReleaseGIL/ ;
+ static double doubleSetting ( const QString&, const QString&, const double = 0 ) /ReleaseGIL/ ;
static bool boolSetting ( const QString&, const QString&, const bool = false ) /ReleaseGIL/ ;
static QString stringSetting ( const QString&, const QString&, const QString& = QString("") ) /ReleaseGIL/ ;
static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() ) /ReleaseGIL/ ;
static void addStringSetting( const QString&, const QString&, bool = true ) /ReleaseGIL/ ;
static void addIntSetting ( const QString&, const int, bool = true ) /ReleaseGIL/ ;
static void addDoubleSetting( const QString&, const double, bool = true ) /ReleaseGIL/ ;
+ static void addBoolSetting ( const QString&, const bool, bool = true ) /ReleaseGIL/ ;
static void removeSettings ( const QString& ) /ReleaseGIL/ ;
static QString getSetting ( const QString& ) /ReleaseGIL/ ;