#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" ) );
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 );