#include "SalomeApp_Study.h"
#include "SalomeApp_Module.h"
+#include "SalomeApp_OBFilter.h"
+#include "SalomeApp_EventFilter.h"
+#include "SalomeApp_WidgetContainer.h"
+
+#include "SalomeApp_AboutDlg.h"
+#include "SalomeApp_ModuleDlg.h"
+
#include "SalomeApp_GLSelector.h"
#include "SalomeApp_OBSelector.h"
#include "SalomeApp_OCCSelector.h"
#include "SalomeApp_VTKSelector.h"
-#include "SalomeApp_EventFilter.h"
#include "SalomeApp_SelectionMgr.h"
-#include "SalomeApp_EventFilter.h"
-#include "SalomeApp_WidgetContainer.h"
-#include "SalomeApp_ModuleDlg.h"
#include <LogWindow.h>
#include <SALOME_ModuleCatalog_impl.hxx>
#include <qmap.h>
+#include <qdir.h>
#include <qlabel.h>
#include <qimage.h>
#include <qaction.h>
QString SalomeApp_Application::applicationName() const
{
- return "SalomeApp";
+ return tr( "APP_NAME" );
+}
+
+QString SalomeApp_Application::applicationVersion() const
+{
+ static QString _app_version;
+
+ if ( _app_version.isEmpty() )
+ {
+ QString path( ::getenv( "GUI_ROOT_DIR" ) );
+ if ( !path.isEmpty() )
+ path += QDir::separator();
+ path += QString( "bin/salome/VERSION" );
+
+ QFile vf( path );
+ if ( vf.open( IO_ReadOnly ) )
+ {
+ QString line;
+ vf.readLine( line, 1024 );
+ vf.close();
+
+ if ( !line.isEmpty() )
+ {
+ while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) )
+ line.remove( line.length() - 1, 1 );
+
+ int idx = line.findRev( ":" );
+ if ( idx != -1 )
+ _app_version = line.mid( idx + 1 ).stripWhiteSpace();
+ }
+ }
+ }
+
+ return _app_version;
}
CAM_Module* SalomeApp_Application::loadModule( const QString& name )
int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
createMenu( separator(), windowMenu, -1, 1 );
+ QMap<int, int> accelMap;
+ accelMap[NewGLViewId] = ALT+Key_G;
+ accelMap[NewPlot2dId] = ALT+Key_P;
+ accelMap[NewOCCViewId] = ALT+Key_O;
+ accelMap[NewVTKViewId] = ALT+Key_K;
+
for ( int id = NewGLViewId; id <= NewVTKViewId; id++ )
{
QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ), QIconSet(),
- tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
- tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
- 0, desk, false, this, SLOT( onNewWindow() ) );
+ tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
+ tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
+ accelMap.contains( id ) ? accelMap[id] : 0, desk, false, this, SLOT( onNewWindow() ) );
createMenu( a, newWinMenu, -1 );
}
//=======================================================================
void SalomeApp_Application::onHelpAbout()
{
- //QAD_MessageBox::info1( myDesktop, tr( "ABOUT" ), tr( "APP_NAME_LONG" ).arg( APP_VERSION ), tr( "BUT_OK" ) );
-
- QMessageBox aDlg( desktop(), "AboutDlg" );
-
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- QPixmap aPixmap = aResMgr->loadPixmap( "SalomeApp", tr( "ABOUT_ICO" ) );
-
- QFontMetrics m( aDlg.font() );
- QImage anImage = aPixmap.convertToImage();
- int w = m.height() * 3;
- anImage = anImage.scale( w, w );
- aPixmap.convertFromImage( anImage );
-
- aDlg.setCaption( tr( "ABOUT" ) );
- aDlg.setText( tr( "APP_NAME_LONG" ).arg( APP_VERSION ) );
- aDlg.setIconPixmap( aPixmap );
- aDlg.exec();
+ SalomeApp_AboutDlg* dlg = new SalomeApp_AboutDlg( applicationName(), applicationVersion(), desktop() );
+ dlg->exec();
+ delete dlg;
}
QWidget* SalomeApp_Application::window( const int flag, const int studyId ) const
sId = activeStudy()->id();
}
+ QWidget* wid = myWindows[flag]->widget( sId );
myWindows[flag]->remove( sId );
+ delete wid;
setWindowShown( flag, !myWindows[flag]->isEmpty() );
}
emit studyClosed();
activateModule( "" );
- if ( objectBrowser() != 0 )
- objectBrowser()->setRootObject( 0 );
saveWindowsGeometry();
}
removeWindow( itr.key(), s->id() );
}
-void SalomeApp_Application::afterCloseDoc()
-{
- updateWindows();
-
- CAM_Application::afterCloseDoc();
-}
-
void SalomeApp_Application::updateActions()
{
updateCommandsStatus();
if ( flag == WT_ObjectBrowser )
{
OB_Browser* ob = new OB_Browser( desktop() );
-
+ ob->setAutoUpdate( true );
+ ob->setAutoOpenLevel( 1 );
ob->setCaption( tr( "OBJECT_BROWSER" ) );
ob->resize( OBJECT_BROWSER_WIDTH, ob->height() );
- ob->setAutoUpdate( true );
+ ob->setFilter( new SalomeApp_OBFilter( selectionMgr() ) );
// Create OBSelector
new SalomeApp_OBSelector( ob, mySelMgr );
{
aMap.insert( WT_ObjectBrowser, Qt::DockLeft );
aMap.insert( WT_PyConsole, Qt::DockBottom );
+ aMap.insert( WT_LogWindow, Qt::DockBottom );
}
void SalomeApp_Application::defaultViewManagers( QStringList& ) const
{
}
+void SalomeApp_Application::afterCloseDoc()
+{
+ updateWindows();
+
+ CAM_Application::afterCloseDoc();
+}
+
CORBA::ORB_var SalomeApp_Application::orb()
{
ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
if ( !modName.isEmpty() )
section += QString( "." ) + modName;
-
dockMgr->loadGeometry( resourceMgr(), section, false );
dockMgr->restoreGeometry();
}