#include "SalomeApp_Module.h"
+#include "SalomeApp_Study.h"
#include "SalomeApp_DataModel.h"
#include "SalomeApp_Application.h"
-#include "SalomeApp_Study.h"
+#include "SalomeApp_Preferences.h"
#include <OB_Browser.h>
resMgr->raiseTranslators( name() );
}
-void SalomeApp_Module::activateModule( SUIT_Study* study )
+bool SalomeApp_Module::activateModule( SUIT_Study* study )
{
- CAM_Module::activateModule( study );
+ bool res = CAM_Module::activateModule( study );
- if ( application() && application()->resourceMgr() )
+ if ( res && application() && application()->resourceMgr() )
application()->resourceMgr()->raiseTranslators( name() );
+
+ return res;
}
-void SalomeApp_Module::deactivateModule( SUIT_Study* )
+bool SalomeApp_Module::deactivateModule( SUIT_Study* )
{
+ return true;
}
void SalomeApp_Module::selectionChanged()
{
}
-QString SalomeApp_Module::engineIOR() const
+void SalomeApp_Module::createPreferences()
+{
+}
+
+void SalomeApp_Module::preferencesChanged( const QString&, const QString& )
{
- // Return an empty string by default, to avoid any "default behavior".
- // It means that SALOMEDS persistence is not used by a module by default.
- // Each module can override this method to return either its actual engine's IOR,
- // or simple the result returned by SalomeApp_Application::defaultEngineIOR()
- return QString( "" );
}
SalomeApp_Application* SalomeApp_Module::getApp() const
return myPopupMgr;
}
+SalomeApp_Preferences* SalomeApp_Module::preferences() const
+{
+ SalomeApp_Preferences* pref = 0;
+ if ( getApp() )
+ pref = getApp()->preferences();
+ return pref;
+}
+
CAM_DataModel* SalomeApp_Module::createDataModel()
{
return new SalomeApp_DataModel(this);
getApp()->objectBrowser()->updateTree( root );
}
-void SalomeApp_Module::contextMenuPopup( const QString& client, QPopupMenu* menu )
+void SalomeApp_Module::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& /*title*/ )
{
SalomeApp_Selection* sel = createSelection();
sel->init( client, getApp()->selectionMgr() );
{
return new SalomeApp_Selection();
}
+
+int SalomeApp_Module::addPreference( const QString& label )
+{
+ SalomeApp_Preferences* pref = preferences();
+ if ( !pref )
+ return -1;
+
+ int catId = pref->addPreference( moduleName(), -1 );
+ if ( catId == -1 )
+ return -1;
+
+ return pref->addPreference( label, catId );
+}
+
+int SalomeApp_Module::addPreference( const QString& label, const int pId, const int type,
+ const QString& section, const QString& param )
+{
+ SalomeApp_Preferences* pref = preferences();
+ if ( !pref )
+ return -1;
+
+ return pref->addPreference( moduleName(), label, pId, type, section, param );
+}
+
+QVariant SalomeApp_Module::preferenceProperty( const int id, const QString& prop ) const
+{
+ QVariant var;
+ SalomeApp_Preferences* pref = preferences();
+ if ( pref )
+ var = pref->property( id, prop );
+ return var;
+}
+
+void SalomeApp_Module::setPreferenceProperty( const int id, const QString& prop, const QVariant& var )
+{
+ SalomeApp_Preferences* pref = preferences();
+ if ( pref )
+ pref->setProperty( id, prop, var );
+}