#include <VTKViewer_ViewModel.h>
#endif
-#ifndef DISABLE_SUPERVGRAPHVIEWER
- #include <SUPERVGraph_ViewModel.h>
- #include <SUPERVGraph_ViewFrame.h>
- #include <SUPERVGraph_ViewManager.h>
-#endif
+//#ifndef DISABLE_SUPERVGRAPHVIEWER
+// #include <SUPERVGraph_ViewModel.h>
+// #include <SUPERVGraph_ViewFrame.h>
+// #include <SUPERVGraph_ViewManager.h>
+//#endif
#include <QtxWorkstack.h>
#include <qcombobox.h>
#include <qinputdialog.h>
#include <qmessagebox.h>
+#include <qfontdatabase.h>
#define FIRST_HELP_ID 1000000
int LightApp_Application::lastStudyId = 0;
+/*!
+ \return last global id of study
+*/
int LightApp_Application::studyId()
{
return LightApp_Application::lastStudyId;
return new LightApp_Application();
}
+/*! \var global preferences of LightApp */
LightApp_Preferences* LightApp_Application::_prefs_ = 0;
-/*
- Class : LightApp_Application
- Description : Application containing LightApp module
+/*!
+ \class LightApp_Application
+ Application containing LightApp module
*/
/*!Constructor.*/
#endif
connect( mySelMgr, SIGNAL( selectionChanged() ), this, SLOT( onSelection() ) );
+
+ // Set existing font for the python console in resources
+ if( !aResMgr->hasValue( "PyConsole", "font" ) )
+ return;
+
+ QFont f = aResMgr->fontValue( "PyConsole", "font" );
+ QFontDatabase fdb;
+ QStringList famdb = fdb.families();
+
+ if ( famdb.contains(f.family()) || !aResMgr->hasValue( "PyConsole", "additional_families" ) )
+ return;
+
+ QStringList anAddFamilies = QStringList::split( ";", aResMgr->stringValue( "PyConsole", "additional_families" ) );
+ QString aFamily;
+ for ( QStringList::Iterator it = anAddFamilies.begin(); it != anAddFamilies.end(); ++it )
+ {
+ aFamily = *it;
+ if ( famdb.contains(aFamily) )
+ {
+ f.setFamily( aFamily );
+ aResMgr->setValue( "PyConsole", "font", f );
+ break;
+ }
+ }
}
/*!Destructor.
return true;
}
+/*!
+ Opens other study into active Study. If Study is empty - creates it.
+ \param theName - name of study
+*/
bool LightApp_Application::useStudy(const QString& theName)
{
createEmptyStudy();
for ( it = modList.begin(); it != modList.end(); ++it )
{
if ( !isLibExists( *it ) )
+ {
+ qDebug( QString( "Library '%1' cannot be found" ).arg( *it ) );
continue;
+ }
QString iconName;
if ( iconMap.contains( *it ) )
createViewManager( type );
}
-//=======================================================================
-// name : onNewDoc
-/*! Purpose : SLOT. Create new document*/
-//=======================================================================
+/*!
+ SLOT: Creates new document
+*/
void LightApp_Application::onNewDoc()
{
SUIT_Study* study = activeStudy();
}
}
-//=======================================================================
-// name : onOpenDoc
-/*! Purpose : SLOT. Open new document*/
-//=======================================================================
+/*!
+ SLOT: Opens new document
+*/
void LightApp_Application::onOpenDoc()
{
SUIT_Study* study = activeStudy();
}
#include "SUIT_MessageBox.h"
-/*! Purpose : SLOT. Open new document with \a aName.*/
+
+/*!
+ SLOT: Opens new document.
+ \param aName - name of file
+*/
bool LightApp_Application::onOpenDoc( const QString& aName )
{
bool isAlreadyOpen = false;
return res;
}
-//=======================================================================
-// name : onHelpAbout
-/*! Purpose : SLOT. Display "About" message box*/
-//=======================================================================
+/*!
+ SLOT: Displays "About" message box
+*/
void LightApp_Application::onHelpAbout()
{
LightApp_AboutDlg* dlg = new LightApp_AboutDlg( applicationName(), applicationVersion(), desktop() );
delete dlg;
}
-/*!SLOT. Load document with \a aName.*/
+/*!
+ SLOT: Loads document
+ \param aName - name of document
+*/
bool LightApp_Application::onLoadDoc( const QString& aName )
{
bool res = CAM_Application::onLoadDoc( aName );
return res;
}
-/*!Private SLOT. Selection.*/
+/*!
+ Private SLOT: Called on selection is changed
+ Dispatchs active module that selection is changed
+*/
void LightApp_Application::onSelection()
{
onSelectionChanged();
((LightApp_Module*)activeModule())->selectionChanged();
}
-/*!Set active study.
- *\param study - SUIT_Study.
- */
+/*!
+ Sets active study.
+ \param study - SUIT_Study.
+*/
void LightApp_Application::setActiveStudy( SUIT_Study* study )
{
CAM_Application::setActiveStudy( study );
activateWindows();
}
-//=======================================================================
-// name : updateCommandsStatus
-/*! Purpose : Enable/Disable menu items and toolbar buttons. Rebuild menu*/
-//=======================================================================
+/*!
+ Enables/Disables menu items and toolbar buttons. Rebuild menu
+*/
void LightApp_Application::updateCommandsStatus()
{
CAM_Application::updateCommandsStatus();
#endif
}
-// Helps to execute command
+/*!
+ \class RunBrowser
+ Runs system command in separate thread
+*/
class RunBrowser: public QThread {
public:
- RunBrowser(QString theApp, QString theParams, QString theHelpFile, QString theContext=NULL):
+ RunBrowser( LightApp_Application* app, QString theApp, QString theParams, QString theHelpFile, QString theContext=NULL):
myApp(theApp), myParams(theParams),
#ifdef WIN32
myHelpFile("file://" + theHelpFile + theContext),
#else
myHelpFile("file:" + theHelpFile + theContext),
#endif
- myStatus(0) {};
+ myStatus(0),
+ myLApp( app )
+{
+};
virtual void run()
{
myStatus = system(aCommand);
if(myStatus != 0)
{
- QCustomEvent* ce2000 = new QCustomEvent (2000);
- postEvent (qApp, ce2000);
+ QCustomEvent* ce2000 = new QCustomEvent( 2000 );
+ QString* msg = new QString( QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").arg(myApp).arg(myHelpFile) );
+ ce2000->setData( msg );
+ postEvent( myLApp, ce2000 );
}
}
- if( myStatus != 0)
- {
- qApp->lock();
- SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
- QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").arg(myApp).arg(myHelpFile),
- QObject::tr("BUT_OK"));
- qApp->unlock();
- }
}
private:
QString myParams;
QString myHelpFile;
int myStatus;
-
+ LightApp_Application* myLApp;
};
-//=======================================================================
-// name : onHelpContentsModule
-/*! Purpose : SLOT. Display help contents for choosen module*/
-//=======================================================================
+/*!
+ SLOT: Displays help contents for choosen module
+*/
void LightApp_Application::onHelpContentsModule()
{
const QAction* obj = (QAction*) sender();
QString aParams = resMgr->stringValue("ExternalBrowser", "parameters");
if (!anApp.isEmpty()) {
- RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile);
+ RunBrowser* rs = new RunBrowser( this, anApp, aParams, helpFile );
+ rs->start();
+ }
+ else {
+ if( SUIT_MessageBox::warn2(desktop(), tr("WRN_WARNING"),
+ tr("DEFINE_EXTERNAL_BROWSER"),
+ tr("BUT_OK"),tr("BUT_CANCEL"),0,1,0 )==0 )
+ onPreferences();
+ }
+}
+
+/*!
+ SLOT: Displays help contents for choosen dialog
+*/
+void LightApp_Application::onHelpContextModule(const QString& theComponentName, const QString& theFileName)
+{
+ QCString dir = getenv( theComponentName + "_ROOT_DIR");
+ QString homeDir = Qtx::addSlash(Qtx::addSlash(dir)+Qtx::addSlash("doc")+Qtx::addSlash("salome")+Qtx::addSlash("gui")+Qtx::addSlash(theComponentName));
+
+ QString helpFile = QFileInfo( homeDir + theFileName ).absFilePath();
+ SUIT_ResourceMgr* resMgr = resourceMgr();
+ QString anApp = resMgr->stringValue("ExternalBrowser", "application");
+ QString aParams = resMgr->stringValue("ExternalBrowser", "parameters");
+
+ if (!anApp.isEmpty()) {
+ RunBrowser* rs = new RunBrowser( this, anApp, aParams, helpFile );
rs->start();
}
else {
- SUIT_MessageBox::warn1(desktop(), tr("WRN_WARNING"),
+ if( SUIT_MessageBox::warn2(desktop(), tr("WRN_WARNING"),
tr("DEFINE_EXTERNAL_BROWSER"),
- tr("BUT_OK"));
+ tr("BUT_OK"), tr("BUT_CANCEL"),0,1,0)==0 )
+ onPreferences();
}
}
-/*!Sets enable or disable some actions on selection changed.*/
+/*!
+ Sets enable or disable some actions on selection changed.
+*/
void LightApp_Application::onSelectionChanged()
{
}
-/*!Return window.
- *\param flag - key for window
- *\param studyId - study id
- * Flag used how identificator of window in windows list.
- */
+/*!
+ \return window by key
+ \param flag - key for window
+ \param studyId - study id
+ Flag used how identificator of window in windows list.
+*/
QWidget* LightApp_Application::window( const int flag, const int studyId ) const
{
QWidget* wid = 0;
return wid;
}
-/*!Adds window to application.
- *\param wid - QWidget
- *\param flag - key wor window
- *\param studyId - study id
- * Flag used how identificator of window in windows list.
- */
+/*!
+ Adds window to application.
+ \param wid - QWidget
+ \param flag - key for window
+ \param studyId - study id
+ Flag used how identificator of window in windows list.
+*/
void LightApp_Application::addWindow( QWidget* wid, const int flag, const int studyId )
{
if ( !wid )
LightApp_WidgetContainer* newWC = new LightApp_WidgetContainer( flag, desktop() );
connect( newWC, SIGNAL( destroyed ( QObject* ) ), this, SLOT( onWCDestroyed( QObject* ) ) );
+ // asv: connecting a slot for storing visibility flag of a window
+ connect( newWC, SIGNAL( visibilityChanged ( bool ) ), SLOT( onVisibilityChanged( bool ) ) );
myWindows.insert( flag, newWC );
if ( winMap.contains( flag ) )
desktop()->moveDockWindow( myWindows[flag], (Dock)winMap[flag] );
if( resourceMgr()->hasValue( "PyConsole", "font" ) )
f = resourceMgr()->fontValue( "PyConsole", "font" );
else
- {
- f = ( ( PythonConsole* )wid )->font();
- resourceMgr()->setValue( "PyConsole", "font", f );
- }
+ {
+ f = ( ( PythonConsole* )wid )->font();
+ resourceMgr()->setValue( "PyConsole", "font", f );
+ }
}
else
#endif
setWindowShown( flag, !myWindows[flag]->isEmpty() );
}
-/*!Remove window from application.
- *\param flag - key wor window
- *\param studyId - study id
- * Flag used how identificator of window in windows list.
- */
+/*!
+ Removes window from application.
+ \param flag - key for window
+ \param studyId - study id
+ Flag used how identificator of window in windows list.
+*/
void LightApp_Application::removeWindow( const int flag, const int studyId )
{
if ( !myWindows.contains( flag ) )
setWindowShown( flag, !myWindows[flag]->isEmpty() );
}
-/*!Gets window.
- *\param flag - key wor window
- *\param studyId - study id
- * Flag used how identificator of window in windows list.
- */
+/*!
+ Gets window.
+ \param flag - key for window
+ \param studyId - study id
+ Flag used how identificator of window in windows list.
+*/
QWidget* LightApp_Application::getWindow( const int flag, const int studyId )
{
QWidget* wid = window( flag, studyId );
return wid;
}
-/*!Check is window visible?(with identificator \a type)*/
+/*!
+ \return is window visible
+ \param type - flag of window
+*/
bool LightApp_Application::isWindowVisible( const int type ) const
{
bool res = false;
return res;
}
-/*!Sets window show or hide.
- *\param type - window identificator.
- *\param on - true/false (window show/hide)
- */
+/*!
+ Sets window show or hide.
+ \param type - window identificator.
+ \param on - true/false (window show/hide)
+*/
void LightApp_Application::setWindowShown( const int type, const bool on )
{
if ( !desktop() || !myWindows.contains( type ) )
QDockWindow* dw = myWindows[type];
desktop()->setAppropriate( dw, on );
- on ? dw->show() : dw->hide();
+ if( on )
+ dw->show();
+ else if( dw->isShown() )
+ {
+ dw->hide();
+ myWindowsVisible[ type ] = true;
+ }
}
-/*!Gets "ObjectBrowser".*/
+/*!
+ \return Object Browser
+*/
OB_Browser* LightApp_Application::objectBrowser()
{
OB_Browser* ob = 0;
return ob;
}
-/*!Gets "LogWindow".*/
+/*!
+ \return Log Window
+*/
LogWindow* LightApp_Application::logWindow()
{
LogWindow* lw = 0;
}
#ifndef DISABLE_PYCONSOLE
-/*!Get "PythonConsole"*/
+/*!
+ \return Python Console
+*/
PythonConsole* LightApp_Application::pythonConsole()
{
PythonConsole* console = 0;
}
#endif
-/*!Update obect browser*/
+/*!
+ Updates object browser and maybe data models
+ \param updateModels - if it is true, then data models are updated
+*/
void LightApp_Application::updateObjectBrowser( const bool updateModels )
{
// update existing data models
if ( updateModels )
{
+ const bool isAutoUpdate = objectBrowser() ? objectBrowser()->isAutoUpdate() : true;
+ if( objectBrowser() )
+ objectBrowser()->setAutoUpdate( false );
+
LightApp_Study* study = dynamic_cast<LightApp_Study*>(activeStudy());
if ( study ) {
CAM_Study::ModelList dm_list;
((LightApp_DataModel*)camDM)->update();
}
}
+
+ if( objectBrowser() )
+ objectBrowser()->setAutoUpdate( isAutoUpdate );
}
if ( objectBrowser() )
{
}
}
-/*!Gets preferences.*/
+/*!
+ \return preferences
+*/
LightApp_Preferences* LightApp_Application::preferences() const
{
return preferences( false );
}
-/*!Gets view manager*/
+/*!
+ \return first view manager of some type
+ \param vmType - type of view manager
+ \param create - is it necessary to create view manager in case, when there is no manager of such type
+*/
SUIT_ViewManager* LightApp_Application::getViewManager( const QString& vmType, const bool create )
{
SUIT_ViewManager* aVM = viewManager( vmType );
return aVM;
}
-/*!Create view manager.*/
+/*!
+ Creates view manager of some type
+ \param vmType - type of view manager
+*/
SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType )
{
SUIT_ResourceMgr* resMgr = resourceMgr();
}
}
#endif
-#ifndef DISABLE_SUPERVGRAPHVIEWER
- if( vmType == SUPERVGraph_Viewer::Type() )
- {
- viewMgr = new SUPERVGraph_ViewManager( activeStudy(), desktop() );
- SUPERVGraph_Viewer* vm = new SUPERVGraph_Viewer();
- SUPERVGraph_ViewFrame* view = dynamic_cast<SUPERVGraph_ViewFrame*>( vm->getViewManager()->getActiveView() );
- if( view )
- view->setBackgroundColor( resMgr->colorValue( "SUPERVGraph", "Background", view->backgroundColor() ) );
- }
-#endif
+ //#ifndef DISABLE_SUPERVGRAPHVIEWER
+ // if( vmType == SUPERVGraph_Viewer::Type() )
+ // {
+ // viewMgr = new SUPERVGraph_ViewManager( activeStudy(), desktop(), new SUPERVGraph_Viewer() );
+ // }
+ //#endif
#ifndef DISABLE_OCCVIEWER
if( vmType == OCCViewer_Viewer::Type() )
{
if ( viewWin && desktop() )
viewWin->resize( (int)( desktop()->width() * 0.6 ), (int)( desktop()->height() * 0.6 ) );
- connect( viewMgr, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
- this, SLOT( onCloseView( SUIT_ViewManager* ) ) );
-
return viewMgr;
}
-//=======================================================================
-// name : onCloseView
-/*! Purpose : SLOT. Remove view manager from application*/
-//=======================================================================
+/*!
+ SLOT: Removes view manager from application
+*/
void LightApp_Application::onCloseView( SUIT_ViewManager* theVM )
{
removeViewManager( theVM );
}
-/*!Protected SLOT. On study created.*/
+/*!
+ Protected SLOT: On study created.
+ \param theStudy - just created study
+*/
void LightApp_Application::onStudyCreated( SUIT_Study* theStudy )
{
SUIT_DataObject* aRoot = 0;
activateWindows();
}
-/*!Protected SLOT. On study opened.*/
+/*!
+ Protected SLOT: On study opened.
+ \param theStudy - just opened study
+*/
void LightApp_Application::onStudyOpened( SUIT_Study* theStudy )
{
SUIT_DataObject* aRoot = 0;
return "(*.hdf)";
}
-/*! Gets file name*/
+/*!
+ Shows file dialog and return user selected file name
+*/
QString LightApp_Application::getFileName( bool open, const QString& initial, const QString& filters,
const QString& caption, QWidget* parent )
{
updateCommandsStatus();
}
-//=======================================================================
-// name : createNewStudy
-/*! Purpose : Create new study*/
-//=======================================================================
+/*!
+ Creates new study
+*/
SUIT_Study* LightApp_Application::createNewStudy()
{
LightApp_Application::lastStudyId++;
return aStudy;
}
-/*!Create window.*/
+/*!
+ Creates window by flag.
+ \param flag - identificator of window type
+*/
QWidget* LightApp_Application::createWindow( const int flag )
{
QWidget* wid = 0;
return wid;
}
-/*!Default windows(Object Browser, Python Console).
- * Adds to map \a aMap.
+/*!
+ \return default windows( Object Browser, Python Console )
+ Adds to map \a aMap.
*/
void LightApp_Application::defaultWindows( QMap<int, int>& aMap ) const
{
// aMap.insert( WT_LogWindow, Qt::DockBottom );
}
-/*!Default view manager.*/
+/*!Default view managers*/
void LightApp_Application::defaultViewManagers( QStringList& ) const
{
/*!Do nothing.*/
}
-/*!Gets preferences.
- * Create preferences, if \a crt = true.
- */
+/*!
+ \return preferences.
+ Create preferences, if \a crt = true.
+*/
LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const
{
if ( myPrefs )
return myPrefs;
}
-/*!Add new module to application.*/
+/*!
+ Adds new module to application
+*/
void LightApp_Application::moduleAdded( CAM_Module* mod )
{
CAM_Application::moduleAdded( mod );
}
}
-/*!Create preferences.*/
+/*!
+ Create preferences
+*/
void LightApp_Application::createPreferences( LightApp_Preferences* pref )
{
if ( !pref )
pref->addPreference( tr( "PREF_MULTI_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "multi_file" );
pref->addPreference( tr( "PREF_ASCII_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "ascii_file" );
- int undoPref = pref->addPreference( tr( "PREF_UNDO_LEVEL" ), studyGroup, LightApp_Preferences::IntSpin, "Study", "undo_level" );
- pref->setItemProperty( undoPref, "min", 1 );
- pref->setItemProperty( undoPref, "max", 100 );
pref->addPreference( tr( "PREF_STORE_POS" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_positions" );
int extgroup = pref->addPreference( tr( "PREF_GROUP_EXT_BROWSER" ), genTab );
LightApp_Preferences::Color, "OCCViewer", "background" );
pref->setItemProperty( occTS, "min", 1 );
- pref->setItemProperty( occTS, "max", 150 );
+ pref->setItemProperty( occTS, "max", 1000 );
int isoU = pref->addPreference( tr( "PREF_ISOS_U" ), occGroup,
LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_u" );
"ObjectBrowser", "auto_size" );
}
-/*!Changed preferences */
+/*!
+ Changes appearance of application according to changed preferences
+ \param sec - section
+ \param param - name of changed parameter
+*/
void LightApp_Application::preferencesChanged( const QString& sec, const QString& param )
{
SUIT_ResourceMgr* resMgr = resourceMgr();
autoSizeFirst = resMgr->booleanValue( "ObjectBrowser", "auto_size_first", true );
ob->setWidthMode( autoSize ? QListView::Maximum : QListView::Manual );
ob->listView()->setColumnWidthMode( 0, autoSizeFirst ? QListView::Maximum : QListView::Manual );
+ if( autoSize )
+ for( int i=1; i<ob->listView()->columns(); i++ )
+ if( ob->listView()->columnWidth( i )>0 )
+ ob->listView()->adjustColumn( i );
updateObjectBrowser( false );
}
}
#endif
}
-/*!Save preferences */
+/*!
+ Saves preferences
+*/
void LightApp_Application::savePreferences()
{
saveWindowsGeometry();
}
}
-/*!Update desktop title.*/
+/*!
+ Updates desktop title
+*/
void LightApp_Application::updateDesktopTitle() {
QString aTitle = applicationName();
QString aVer = applicationVersion();
desktop()->setCaption( aTitle );
}
-/*!Update windows after close document.*/
+/*!
+ Updates windows after close document
+*/
void LightApp_Application::afterCloseDoc()
{
updateWindows();
CAM_Application::afterCloseDoc();
}
-/*!Update module action.*/
+/*!
+ Updates actions of active module
+*/
void LightApp_Application::updateModuleActions()
{
QString modName;
myActions[modName]->setOn( true );
}
-/*!Gets current windows.
- *\param winMap - output current windows map.
- */
+/*!
+ Gets current windows.
+ \param winMap - output current windows map.
+*/
void LightApp_Application::currentWindows( QMap<int, int>& winMap ) const
{
winMap.clear();
defaultWindows( winMap );
}
-/*!Gets current view managers.
- *\param lst - output current view managers list.
- */
+/*!
+ Gets current view managers.
+ \param lst - output current view managers list.
+*/
void LightApp_Application::currentViewManagers( QStringList& lst ) const
{
lst.clear();
defaultViewManagers( lst );
}
-/*!Update windows.*/
+/*!
+ Updates windows
+*/
void LightApp_Application::updateWindows()
{
QMap<int, int> winMap;
// setWindowShown should be done even if no study is active (open). in this case all open windows
// will be hidden, which is neccessary in this case.
- for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr )
+ for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr ) {
+
+ if ( myWindowsVisible.contains( itr.key() ) &&
+ !myWindowsVisible[ itr.key() ] )
+ continue;
+
setWindowShown( itr.key(), !itr.data()->isEmpty() && winMap.contains( itr.key() ) );
+ }
}
-/*!Update view managers.*/
+/*!
+ Updates view managers
+*/
void LightApp_Application::updateViewManagers()
{
QStringList lst;
getViewManager( *it, true );
}
-/*!Load windows geometry.*/
+/*!
+ Loads windows geometry
+*/
void LightApp_Application::loadWindowsGeometry()
{
bool store = resourceMgr()->booleanValue( "Study", "store_positions", true );
dockMgr->restoreGeometry();
}
-/*!Save windows geometry.*/
+/*!
+ Saves windows geometry
+*/
void LightApp_Application::saveWindowsGeometry()
{
bool store = resourceMgr()->booleanValue( "Study", "store_positions", true );
dockMgr->saveGeometry( resourceMgr(), section, false );
}
-/*!Activate windows.*/
+/*!
+ Activates windows
+*/
void LightApp_Application::activateWindows()
{
if ( activeStudy() )
}
}
-/*!Adds icon names for modules.*/
+/*!
+ Adds icon names for modules
+*/
void LightApp_Application::moduleIconNames( QMap<QString, QString>& iconMap ) const
{
iconMap.clear();
}
}
-/*!Insert items in popup, which necessary for current application*/
+/*!
+ Inserts items in popup, which necessary for current application
+*/
void LightApp_Application::contextMenuPopup( const QString& type, QPopupMenu* thePopup, QString& title )
{
CAM_Application::contextMenuPopup( type, thePopup, title );
thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) );
}
-/*!Create empty study.*/
+/*!
+ Create empty study
+*/
void LightApp_Application::createEmptyStudy()
{
CAM_Application::createEmptyStudy();
objectBrowser()->updateTree();
}
-/*!Activate module \a mod.*/
+/*!
+ Activates module
+ \param mod - module to be activated
+*/
bool LightApp_Application::activateModule( CAM_Module* mod )
{
bool res = CAM_Application::activateModule( mod );
return res;
}
-/*!return keyborad accelerators manager object */
+/*!
+ \return keyborad accelerators manager object
+*/
SUIT_Accel* LightApp_Application::accel() const
{
return myAccel;
}
-/*! remove dead widget container from map */
+/*!
+ Removes dead widget container from map
+*/
void LightApp_Application::onWCDestroyed( QObject* ob )
{
// remove destroyed widget container from windows map
}
}
-/*! redefined to remove view manager from memory */
+/*!
+ Connects just added view manager
+*/
+void LightApp_Application::addViewManager( SUIT_ViewManager* vm )
+{
+ connect( vm, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
+ this, SLOT( onCloseView( SUIT_ViewManager* ) ) );
+ STD_Application::addViewManager( vm );
+}
+
+/*!
+ Remove view manager from memory
+*/
void LightApp_Application::removeViewManager( SUIT_ViewManager* vm )
{
disconnect( vm, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
delete vm;
}
-/*! rename active window of desktop */
+/*!
+ Renames active window of desktop
+*/
void LightApp_Application::onRenameWindow()
{
if( !desktop() )
w->setCaption( name );
}
+/*!
+ \return if the library of module exists
+ \param moduleTitle - title of module
+*/
bool LightApp_Application::isLibExists( const QString& moduleTitle ) const
{
if( moduleTitle.isEmpty() )
return false;
}
-/*! default name for an active study */
+/*!
+ \return default name for an active study
+*/
void LightApp_Application::setDefaultStudyName( const QString& theName )
{
QStringList anInfoList;
updateDesktopTitle();
}
}
+
+/*! slot, called on show/hide of a dock window */
+void LightApp_Application::onVisibilityChanged( bool visible )
+{
+ const QObject* win = sender();
+
+ for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr )
+ if ( itr.data() == win )
+ {
+ myWindowsVisible[ itr.key() ] = visible;
+ return;
+ }
+}
+
+/*!
+ Custom event handler
+*/
+bool LightApp_Application::event( QEvent* e )
+{
+ if( e && e->type()==2000 )
+ {
+ QCustomEvent* ce = ( QCustomEvent* )e;
+ QString* d = ( QString* )ce->data();
+ if( SUIT_MessageBox::warn2(0, tr("WRN_WARNING"),
+ d ? *d : "",
+ tr("BUT_OK"), tr("BUT_CANCEL"), 0, 1, 0 )==0 )
+ onPreferences();
+ if( d )
+ delete d;
+ return true;
+ }
+ return CAM_Application::event( e );
+}