-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// File : HelpBrowser.cxx
// Author : Vadim SANDLER, OpenCASCADE S.A.S. (vadim.sandler@opencascade.com)
// Maxim GLIBIN, OpenCASCADE S.A.S. (maxim.glibin@opencascade.com)
#include <iostream>
+#ifdef WIN32
+#include <windows.h>
+#endif
+
+
namespace
{
void printHelp()
std::cout << std::endl;
std::cout << "SALOME Help Browser" << std::endl;
std::cout << std::endl;
- std::cout << "usage: " << qPrintable( fi.fileName() ) << " [options] file" << std::endl;
+ std::cout << "usage: " << qUtf8Printable( fi.fileName() ) << " [options] file" << std::endl;
std::cout << " file is a help file to be opened" << std::endl;
std::cout << std::endl;
std::cout << "Options:" << std::endl;
}
void load( const QString& url )
{
- QtxWebBrowser::load( url );
- RaiseWindowHelper* helper = new RaiseWindowHelper( this );
+ if( ! url.startsWith("--remove") ) {
+ QtxWebBrowser::load( url );
+ RaiseWindowHelper* helper = new RaiseWindowHelper( this );
+ }
}
};
int main( int argc, char **argv )
{
// Set application name (for preferences)
- HelpBrowser_Application::setApplicationName( "salome" );
+ HelpBrowser_Application::setApplicationName("salome");
// Specify application identifier via its name
QFileInfo fi( argv[0] );
}
}
+#if defined(WIN32) && defined(UNICODE)
+ LPWSTR *szArglist = NULL;
+ int nArgs;
+ szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
+ helpfile = QString::fromWCharArray(szArglist[nArgs-1]);
+ // Free memory allocated for CommandLineToArgvW arguments.
+ LocalFree(szArglist);
+#endif
+
// Show help and exit if '--help' or '-h' option has been specified via command line
if ( showHelp )
{
// Load file specified via command line
if ( helpfile.isEmpty() ) {
- QString docdir = qgetenv( "DOCUMENTATION_ROOT_DIR" );
+ QString docdir = Qtx::getenv( "DOCUMENTATION_ROOT_DIR" );
if ( !docdir.isEmpty() )
helpfile = QDir::toNativeSeparators( QString( "%1/index.html" ).arg( docdir ) );
}