# include "HelpWindow.hxx"
# include "IntervalWindow.hxx"
+static QString addSlash( const QString& path );
+
typedef int PIXELS;
RegWidget* RegWidget::myRegWidgetPtr = 0;
_tabWidget(0), _refresh(0), _interval(0),
myInfoWindow(0), myHelpWindow(0), myIntervalWindow(0)
{
- char* dir = getenv( "CSF_ResourcesDefaults" );
+
QString path( "" );
- if ( dir ) {
- QDir qDir( dir );
- path = qDir.filePath( "default.png" );
+ QString dir;
+ char* cenv;
+ cenv = getenv( "KERNEL_ROOT_DIR" );
+ if ( cenv ) {
+ dir.sprintf( "%s", cenv );
+ if ( !dir.isEmpty() ) {
+ dir = addSlash(dir) ;
+ dir = dir + "share" ;
+ dir = addSlash(dir) ;
+ dir = dir + "salome" ;
+ dir = addSlash(dir) ;
+ dir = dir + "resources" ;
+ dir = addSlash(dir) ;
+ QDir qDir( dir );
+ path = qDir.filePath( "default.png" );
+ }
}
+// char* dir = getenv( "CSF_ResourcesDefaults" );
+// QString path( "" );
+// if ( dir ) {
+// QDir qDir( dir );
+// path = qDir.filePath( "default.png" );
+// }
QPixmap pm ( path );
if ( !pm.isNull() )
setIcon( pm );
{
myTextView->setText( text );
}
+
+QString addSlash( const QString& path )
+{
+ if (!path.isNull()) {
+#ifdef WNT
+ QChar slash ('\\');
+#else
+ QChar slash ('/');
+#endif
+ if ( path.at(path.length()-1) != slash )
+ return path + slash;
+ }
+ return path;
+}
QString dir;
char* cenv;
+ // Try ${KERNEL_ROOT_DIR}/share/salome/resources directory
+ cenv = getenv( "KERNEL_ROOT_DIR" );
+ if ( cenv ) {
+ dir.sprintf( "%s", cenv );
+ if ( !dir.isEmpty() ) {
+ dir = addSlash(dir) ;
+ dir = dir + "share" ;
+ dir = addSlash(dir) ;
+ dir = dir + "salome" ;
+ dir = addSlash(dir) ;
+ dir = dir + "resources" ;
+ dir = addSlash(dir) ;
+ QFileInfo fileInfo( dir + filename );
+ if ( fileInfo.isFile() && fileInfo.exists() )
+ return fileInfo.filePath();
+ }
+ }
// Try CSF_ResourcesDefaults env.var directory ( or directory list )
cenv = getenv( "CSF_ResourcesDefaults" );
if ( cenv ) {