#include <Style_Model.h>
#include <QtxSplash.h>
+#include <SUIT_LicenseDlg.h>
#ifdef SUIT_ENABLE_PYTHON
#include <Python.h>
#endif
#include <stdlib.h>
+#ifdef WIN32
+#include <UserEnv.h>
+#endif
+
static QString salomeVersion()
{
QString path( ::getenv( "GUI_ROOT_DIR" ) );
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" ) )
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 );
CONFIG += qt thread debug dll shared
win32:DEFINES += WIN32
+DEFINES += DISABLE_TESTRECORDER
HEADERS = *.h
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";
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 );
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
}
/*!
#ifndef SUITAPP_APPLICATION_H
#define SUITAPP_APPLICATION_H
-#include <QApplication>
+#ifndef DISABLE_TESTRECORDER
+ #include <TestApplication.h>
+#else
+ #include <QApplication>
+#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