From: nds Date: Mon, 6 Oct 2008 10:44:36 +0000 (+0000) Subject: Merging from the BR_V5_DEV branch. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2adc8d9fb6d9d431dfa0c7f1086701e6e333c292;p=modules%2Fgui.git Merging from the BR_V5_DEV branch. --- diff --git a/src/SUITApp/SUITApp.cxx b/src/SUITApp/SUITApp.cxx index 3e0f483d6..bbac91a30 100644 --- a/src/SUITApp/SUITApp.cxx +++ b/src/SUITApp/SUITApp.cxx @@ -32,6 +32,7 @@ #include #include +#include #ifdef SUIT_ENABLE_PYTHON #include #endif @@ -44,6 +45,10 @@ #include +#ifdef WIN32 +#include +#endif + static QString salomeVersion() { QString path( ::getenv( "GUI_ROOT_DIR" ) ); @@ -161,12 +166,13 @@ int main( int args, char* argv[] ) PySys_SetArgv( args, argv ); #endif - qInstallMsgHandler( MessageOutput ); + //qInstallMsgHandler( MessageOutput ); QStringList argList; bool noExceptHandling = false; bool iniFormat = false; bool noSplash = false; + bool useLicense = false; for ( int i = 1; i < args /*&& !noExceptHandling*/; i++ ) { if ( !strcmp( argv[i], "--noexcepthandling" ) ) @@ -175,13 +181,41 @@ int main( int args, char* argv[] ) iniFormat = true; else if ( !strcmp( argv[i], "--nosplash") ) noSplash = true; - else + else if ( !strcmp( argv[i], "--uselicense" ) ) + useLicense = true; + else argList.append( QString( argv[i] ) ); } SUITApp_Application app( args, argv ); int result = -1; + + if ( useLicense ) { + QString env; + +#ifdef WIN32 + DWORD aLen=1024; + char aStr[1024]; + HANDLE aToken=0; + HANDLE hProcess = GetCurrentProcess(); + OpenProcessToken(hProcess,TOKEN_QUERY,&aToken); + if( GetUserProfileDirectory( aToken, aStr, &aLen ) ) + env = aStr; + +#else + if ( ::getenv( "HOME" ) ) + env = ::getenv( "HOME" ); +#endif + + QFile file( env + "/ReadLicense.log" ); // Read the text from a file + if( !file.exists() ) { + SUIT_LicenseDlg aLicense; + if ( aLicense.exec() != QDialog::Accepted ) + return result; + } + } + if ( !argList.isEmpty() ) { SUITApp_Session* aSession = new SUITApp_Session( iniFormat ); diff --git a/src/SUITApp/SUITApp.pro b/src/SUITApp/SUITApp.pro index 97654e140..54330b5b3 100644 --- a/src/SUITApp/SUITApp.pro +++ b/src/SUITApp/SUITApp.pro @@ -11,6 +11,7 @@ CONFIG -= debug release debug_and_release CONFIG += qt thread debug dll shared win32:DEFINES += WIN32 +DEFINES += DISABLE_TESTRECORDER HEADERS = *.h diff --git a/src/SUITApp/SUITApp_Application.cxx b/src/SUITApp/SUITApp_Application.cxx index 7027184df..df551d580 100644 --- a/src/SUITApp/SUITApp_Application.cxx +++ b/src/SUITApp/SUITApp_Application.cxx @@ -35,7 +35,11 @@ Constructor */ SUITApp_Application::SUITApp_Application( int& argc, char** argv, SUIT_ExceptionHandler* hand ) -: QApplication( argc, argv ), +#ifndef DISABLE_TESTRECORDER + : TestApplication( argc, argv ), +#else + : QApplication( argc, argv ), +#endif myExceptHandler( hand ) { QString path = SUIT_Tools::dir( argv[0] ) + QDir::separator() + "../../resources"; @@ -52,7 +56,11 @@ myExceptHandler( hand ) Constructor */ SUITApp_Application::SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* hand ) -: QApplication( argc, argv, type ), +#ifndef DISABLE_TESTRECORDER + : TestApplication( argc, argv ), +#else + : QApplication( argc, argv, type ), +#endif myExceptHandler( hand ) { QTranslator* strTbl = new QTranslator( 0 ); @@ -69,7 +77,11 @@ myExceptHandler( hand ) bool SUITApp_Application::notify( QObject* receiver, QEvent* e ) { return myExceptHandler ? myExceptHandler->handle( receiver, e ) : +#ifndef DISABLE_TESTRECORDER + TestApplication::notify( receiver, e ); +#else QApplication::notify( receiver, e ); +#endif } /*! diff --git a/src/SUITApp/SUITApp_Application.h b/src/SUITApp/SUITApp_Application.h index 808e464cc..bb27322b5 100644 --- a/src/SUITApp/SUITApp_Application.h +++ b/src/SUITApp/SUITApp_Application.h @@ -19,11 +19,19 @@ #ifndef SUITAPP_APPLICATION_H #define SUITAPP_APPLICATION_H -#include +#ifndef DISABLE_TESTRECORDER + #include +#else + #include +#endif class SUIT_ExceptionHandler; -class SUITApp_Application : public QApplication +#ifndef DISABLE_TESTRECORDER + class SUITApp_Application : public TestApplication +#else + class SUITApp_Application : public QApplication +#endif { Q_OBJECT