}
}
+/*!Set desktop:*/
+void LightApp_Application::setDesktop( SUIT_Desktop* desk )
+{
+ SUIT_Desktop* prev = desktop();
+
+ CAM_Application::setDesktop( desk );
+
+ if ( desk ) {
+ connect( desk, SIGNAL( message( const QString& ) ),
+ this, SLOT( onDesktopMessage( const QString& ) ), Qt::UniqueConnection );
+ }
+}
+
/*!
Activates module
\param mod - module to be activated
bool LightApp_Application::renameObject( const QString& entry, const QString& ) {
return false;
}
+
+/*! Process standard messages from desktop */
+void LightApp_Application::onDesktopMessage( const QString& message )
+{
+ const QString sectionSeparator = "/";
+
+ if ( message.toLower() == "updateobjectbrowser" ||
+ message.toLower() == "updateobjbrowser" ) {
+ // update object browser
+ updateObjectBrowser();
+ }
+ else {
+ QStringList data = message.split( sectionSeparator );
+ if ( data.count() > 1 ) {
+ QString msgType = data[0].trimmed();
+ LightApp_Module* sMod = 0;
+ CAM_Module* mod = module( msgType );
+ if ( !mod )
+ mod = module( moduleTitle( msgType ) );
+ if ( mod && mod->inherits( "LightApp_Module" ) )
+ sMod = (LightApp_Module*)mod;
+
+ if ( msgType.toLower() == "preferences" ) {
+ // requested preferences change: should be given as "preferences/<section>/<name>/<value>"
+ // for example "preferences/Study/multi_file_dump/true"
+ if ( data.count() > 3 ) {
+ QString section = data[1].trimmed();
+ QString param = data[2].trimmed();
+ QString value = QStringList( data.mid(3) ).join( sectionSeparator );
+ resourceMgr()->setValue( section, param, value );
+ }
+ }
+ else if ( sMod ) {
+ // received message for the module
+ QString msg = QStringList( data.mid(1) ).join( sectionSeparator );
+ sMod->message( msg );
+ }
+ }
+ }
+}
SalomeApp_Application::SalomeApp_Application()
: LightApp_Application()
{
- connect( desktop(), SIGNAL( message( const QString& ) ),
- this, SLOT( onDesktopMessage( const QString& ) ) );
connect( desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
- this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
+ this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ), Qt::UniqueConnection );
setNoteBook(0);
}
void SalomeApp_Application::setDesktop( SUIT_Desktop* desk )
{
SUIT_Desktop* prev = desktop();
- if ( prev == desk )
- return;
LightApp_Application::setDesktop( desk );
- if ( desk != 0 ) {
- connect( desk, SIGNAL( message( const QString& ) ),
- this, SLOT( onDesktopMessage( const QString& ) ), Qt::UniqueConnection);
-
+ if ( desk ) {
connect( desk, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ), Qt::UniqueConnection );
}
return false;
}
-/*! Process standard messages from desktop */
-void SalomeApp_Application::onDesktopMessage( const QString& message )
-{
- if ( message.toLower() == "updateobjectbrowser" ||
- message.toLower() == "updateobjbrowser" ) {
- // update object browser
- updateObjectBrowser();
- }
- if ( message.toLower().startsWith( "preferences" ) ) {
- // preferences changed: should be given as "preferences:<section>:<name>:<value>",
- // for example "preferences:Study:multi_file_dump:true"
- QStringList data = message.split( ":" );
- if ( data.count() > 3 ) {
- resourceMgr()->setValue( data[1], data[2], data[3] );
- }
- }
-}
-
/*!
Opens other study into active Study. If Study is empty - creates it.
\param theName - name of study
/*!
* Called when window activated
*/
-void SalomeApp_Application::onWindowActivated( SUIT_ViewWindow* theViewWindow ) {
+void SalomeApp_Application::onWindowActivated( SUIT_ViewWindow* theViewWindow )
+{
SUIT_DataBrowser* anOB = objectBrowser();
if( !anOB )
return;
Update visibility state of given objects
*/
void SalomeApp_Application::updateVisibilityState( DataObjectList& theList,
- SUIT_ViewModel* theViewModel ) {
+ SUIT_ViewModel* theViewModel )
+{
LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>(activeStudy());
if(!theViewModel)
/*!
Called then view manager removed
*/
-void SalomeApp_Application::onViewManagerRemoved( SUIT_ViewManager* ) {
+void SalomeApp_Application::onViewManagerRemoved( SUIT_ViewManager* )
+{
ViewManagerList lst;
viewManagers(lst);
if( lst.count() == 1) { // in case if closed last view window
\param entry entry of the object
\brief Return \c true if object can be renamed
*/
-bool SalomeApp_Application::renameAllowed( const QString& entry) const {
+bool SalomeApp_Application::renameAllowed( const QString& entry) const
+{
return entry.startsWith( tr( "SAVE_POINT_DEF_NAME") );
}
\param name new name of the object
\brief Return \c true if rename operation finished successfully, \c false otherwise.
*/
-bool SalomeApp_Application::renameObject( const QString& entry, const QString& name ) {
-
+bool SalomeApp_Application::renameObject( const QString& entry, const QString& name )
+{
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
int savePoint = ::getSelectedSavePoint( selectionMgr() );