]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
no message
authorstv <stv@opencascade.com>
Wed, 14 Feb 2007 18:10:57 +0000 (18:10 +0000)
committerstv <stv@opencascade.com>
Wed, 14 Feb 2007 18:10:57 +0000 (18:10 +0000)
src/SUITApp/Makefile.in [deleted file]
src/SUITApp/SUITApp.cxx
src/SUITApp/SUITApp.pro [new file with mode: 0644]
src/SUITApp/SUITApp_Application.cxx
src/SUITApp/SUITApp_Application.h
src/SUITApp/resources/SUITApp_msg_en.po [deleted file]

diff --git a/src/SUITApp/Makefile.in b/src/SUITApp/Makefile.in
deleted file mode 100644 (file)
index 4166f23..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#  Copyright (C) 2005  CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-#  File   : Makefile.in
-#  Author : Vladimir Klyachin (OCN)
-#  Module : suitApp
-#  $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@srcdir@/resources
-
-
-@COMMENCE@
-
-# header files 
-EXPORT_HEADERS= SUITApp_Application.h
-
-# .po files to transform in .qm
-PO_FILES = SUITApp_msg_en.po
-
-LIB_SRC= SUITApp.cxx \
-        SUITApp_Application.cxx 
-
-LIB_MOC = SUITApp_Application.h
-
-# Libraries targets
-LIB = libSUITApp.la
-
-# Executables targets
-BIN = SUITApp
-BIN_SRC = 
-
-CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES)
-
-LDFLAGS+=$(QT_MT_LIBS) 
-
-ifneq ($(DISABLE_PYCONSOLE),yes)
-LIBS+= -Xlinker -export-dynamic $(PYTHON_LIBS)
-endif
-LIBS+= -lsuit -lqtx
-LIBSFORBIN+= -lsuit -lqtx
-
-PLUGINDIR = $(top_builddir)/bin/salome/styles
-MYPLUGINDIR = styles
-
-$(MYPLUGINDIR): $(PLUGINDIR)
-       -$(RM) $@
-       ln -sf $< $@
-
-$(PLUGINDIR):
-       mkdir -p $@
-
-bin: $(MYPLUGINDIR)
-
-@CONCLUDE@
-
-
index f343c435e623ee1ae8cd0645b645bddb7653c33c..c21abb44122a8728a449067bdc22fec95cc98bdc 100644 (file)
@@ -16,7 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-#if defined WNT
+#if defined WIN32
 
 #undef SUIT_ENABLE_PYTHON
 //#else
 #include <SUIT_Desktop.h>
 #include <SUIT_ResourceMgr.h>
 
-#include <QtxSplash.h>
+// TODO
+//#include <QtxSplash.h>
 
 #ifdef SUIT_ENABLE_PYTHON
 #include <Python.h>
 #endif
 
-#include <qdir.h>
-#include <qfile.h>
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qregexp.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qregexp.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
 
 #include <stdlib.h>
 
@@ -52,11 +53,10 @@ QString salomeVersion()
   path += QString( "bin/salome/VERSION" );
 
   QFile vf( path );
-  if ( !vf.open( IO_ReadOnly ) )
+  if ( !vf.open( QFile::ReadOnly ) )
     return QString::null;
 
-  QString line;
-  vf.readLine( line, 1024 );
+  QString line = vf.readLine( 1024 );
   vf.close();
 
   if ( line.isEmpty() )
@@ -66,9 +66,9 @@ QString salomeVersion()
     line.remove( line.length() - 1, 1 );
 
   QString ver;
-  int idx = line.findRev( ":" );
+  int idx = line.lastIndexOf( ":" );
   if ( idx != -1 )
-    ver = line.mid( idx + 1 ).stripWhiteSpace();
+    ver = line.mid( idx + 1 ).trimmed();
 
   return ver;
 }
@@ -160,69 +160,80 @@ int main( int args, char* argv[] )
   if ( !argList.isEmpty() )
   {
     SUITApp_Session* aSession = new SUITApp_Session( iniFormat );
+    // TODO
+/*
     QtxSplash* splash = 0;
-    if ( !noSplash ) {
+    if ( !noSplash )
+    {
       SUIT_ResourceMgr* resMgr = aSession->createResourceMgr( argList.first() );
-      if ( resMgr ) {
-       resMgr->loadLanguage();
-       QString splashIcon, splashInfo, splashTextColors;
-       resMgr->value( "splash", "image",       splashIcon );
-       resMgr->value( "splash", "info",        splashInfo, false );
-       resMgr->value( "splash", "text_colors", splashTextColors );
-       QString appName    = QObject::tr( "APP_NAME" ).stripWhiteSpace();
-       QString appVersion = QObject::tr( "APP_VERSION" ).stripWhiteSpace();
-       if ( appVersion == "APP_VERSION" ) {
-         if ( appName == "APP_NAME" || appName.lower() == "salome" )
-           appVersion = salomeVersion();
-         else
-           appVersion = "";
-       }
-       QPixmap px( splashIcon );
-       if ( !px.isNull() ) {
-         splash = QtxSplash::splash( px );
-         if ( !splashTextColors.isEmpty() ) {
-           QStringList colors = QStringList::split( "|", splashTextColors );
-           QColor c1, c2;
-           if ( colors.count() > 0 ) c1 = QColor( colors[0] );
-           if ( colors.count() > 1 ) c2 = QColor( colors[1] );
-           splash->setTextColors( c1, c2 );
-         }
-         else {
-           splash->setTextColors( Qt::white, Qt::black );
-         }
+      if ( resMgr )
+      {
+             resMgr->loadLanguage();
+             QString splashIcon, splashInfo, splashTextColors;
+             resMgr->value( "splash", "image",       splashIcon );
+             resMgr->value( "splash", "info",        splashInfo, false );
+             resMgr->value( "splash", "text_colors", splashTextColors );
+             QString appName    = QObject::tr( "APP_NAME" ).stripWhiteSpace();
+             QString appVersion = QObject::tr( "APP_VERSION" ).stripWhiteSpace();
+             if ( appVersion == "APP_VERSION" )
+        {
+               if ( appName == "APP_NAME" || appName.toLower() == "salome" )
+                 appVersion = salomeVersion();
+               else
+                 appVersion = "";
+             }
+             QPixmap px( splashIcon );
+             if ( !px.isNull() )
+        {
+               splash = QtxSplash::splash( px );
+               if ( !splashTextColors.isEmpty() )
+          {
+                 QStringList colors = QStringList::split( "|", splashTextColors );
+                 QColor c1, c2;
+                 if ( colors.count() > 0 )
+              c1 = QColor( colors[0] );
+                 if ( colors.count() > 1 )
+              c2 = QColor( colors[1] );
+                 splash->setTextColors( c1, c2 );
+               }
+               else
+          {
+                 splash->setTextColors( Qt::white, Qt::black );
+               }
 #ifdef _DEBUG_
-         splash->setHideOnClick( true );
+               splash->setHideOnClick( true );
 #endif
-         QFont f = splash->font();
-         f.setBold( true );
-         splash->setFont( f );
-         if ( !splashInfo.isEmpty() ) {
-           splashInfo.replace( QRegExp( "%A" ),  appName );
-           splashInfo.replace( QRegExp( "%V" ),  QObject::tr( "ABOUT_VERSION" ).arg( appVersion ) );
-           splashInfo.replace( QRegExp( "%L" ),  QObject::tr( "ABOUT_LICENSE" ) );
-           splashInfo.replace( QRegExp( "%C" ),  QObject::tr( "ABOUT_COPYRIGHT" ) );
-           splashInfo.replace( QRegExp( "\\\\n" ), "\n" );
-           splash->message( splashInfo );
-         }
-         splash->show();
-         qApp->processEvents();
-       }
+               QFont f = splash->font();
+               f.setBold( true );
+               splash->setFont( f );
+               if ( !splashInfo.isEmpty() )
+          {
+                 splashInfo.replace( QRegExp( "%A" ),  appName );
+                 splashInfo.replace( QRegExp( "%V" ),  QObject::tr( "ABOUT_VERSION" ).arg( appVersion ) );
+                 splashInfo.replace( QRegExp( "%L" ),  QObject::tr( "ABOUT_LICENSE" ) );
+                 splashInfo.replace( QRegExp( "%C" ),  QObject::tr( "ABOUT_COPYRIGHT" ) );
+                 splashInfo.replace( QRegExp( "\\\\n" ), "\n" );
+                 splash->message( splashInfo );
+               }
+               splash->show();
+          QApplication::instance()->processEvents();
+             }
       }
     }
+*/
     SUIT_Application* theApp = aSession->startApplication( argList.first() );
     if ( theApp )
     {
       if ( !noExceptHandling )
         app.setHandler( aSession->handler() );
 
-//      if ( !app.mainWidget() )
-//        app.setMainWidget( theApp->desktop() );
-      if ( splash )
-       splash->finish( theApp->desktop() );
+// TODO
+//      if ( splash )
+//           splash->finish( theApp->desktop() );
 
       result = app.exec();
-      if ( splash )
-       delete splash;
+// TODO
+//      delete splash;
     }
     delete aSession;
   }
diff --git a/src/SUITApp/SUITApp.pro b/src/SUITApp/SUITApp.pro
new file mode 100644 (file)
index 0000000..c088c85
--- /dev/null
@@ -0,0 +1,16 @@
+TEMPLATE = app
+DESTDIR = ../../bin
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../obj/$$TARGET
+
+INCLUDEPATH = ../../include
+LIBS += -L../../lib -lSUIT -lQtx
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+
+HEADERS = *.h
+
+SOURCES = *.cxx
index bf32979dea0b74650c171d9529389c82b1573c04..0255b452885c9f72f34edfd4c58c7cc9df420960 100644 (file)
 //
 #include "SUITApp_Application.h"
 
-#include "SUIT_Session.h"
-#include "SUIT_MessageBox.h"
-#include "SUIT_ExceptionHandler.h"
+#include <SUIT_Tools.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_ExceptionHandler.h>
 
-#include <qdir.h>
-#include <qfileinfo.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qtranslator.h>
 
 #ifdef WIN32
 #include <windows.h>
@@ -39,7 +40,7 @@ SUITApp_Application::SUITApp_Application( int& argc, char** argv, SUIT_Exception
 : QApplication( argc, argv ),
 myExceptHandler( hand )
 {
-  QString path = QFileInfo( argv[0] ).dirPath() + QDir::separator() + "../../resources";
+  QString path = SUIT_Tools::dir( argv[0] ) + QDir::separator() + "../../resources";
   path = QDir::convertSeparators( QDir( path ).canonicalPath() );
 
   QTranslator* strTbl = new QTranslator( 0 );
@@ -69,20 +70,6 @@ myExceptHandler( hand )
 */
 bool SUITApp_Application::notify( QObject* receiver, QEvent* e )
 {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) < 0x060101
-  // Disable GUI user actions while python command is executed
-  if (SUIT_Session::IsPythonExecuted()) {
-    // Disable mouse and keyboard events
-    QEvent::Type aType = e->type();
-    if (aType == QEvent::MouseButtonPress || aType == QEvent::MouseButtonRelease ||
-        aType == QEvent::MouseButtonDblClick || aType == QEvent::MouseMove ||
-        aType == QEvent::Wheel || aType == QEvent::ContextMenu ||
-        aType == QEvent::KeyPress || aType == QEvent::KeyRelease ||
-        aType == QEvent::Accel || aType == QEvent::AccelOverride)
-      return false;
-  }
-#endif
-
   return myExceptHandler ? myExceptHandler->handle( receiver, e ) :
                            QApplication::notify( receiver, e );
 }
index 479f07a20fffae6b3ebca33091c1d58053aa914b..1edbd79fe3ea1632342baf5eb5d13af282fdc441 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef SUITAPP_APPLICATION_H
 #define SUITAPP_APPLICATION_H
 
-#include <qapplication.h>
+#include <QtGui/qapplication.h>
 
 class SUIT_ExceptionHandler;
 
diff --git a/src/SUITApp/resources/SUITApp_msg_en.po b/src/SUITApp/resources/SUITApp_msg_en.po
deleted file mode 100644 (file)
index 3e268b6..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#  Copyright (C) 2005  CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-msgid "APP_ERROR"
-msgstr "Error"
-
-msgid "APP_OK"
-msgstr "Ok"
-
-msgid "APP_UNK_EXCEPTION"
-msgstr "Unknown exception"