Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Dec 6, 2011
1 parent a459bb1 commit e8a67fe
Showing 1 changed file with 185 additions and 185 deletions.
370 changes: 185 additions & 185 deletions src/app/main.cpp
Expand Up @@ -234,193 +234,193 @@ QgsDebugMsg( QString( "Starting qgis main" ) );
QString configpath;

#ifndef ANDROID
#ifndef WIN32
if ( !bundleclicked( argc, argv ) )
{
////////////////////////////////////////////////////////////////
// USe the GNU Getopts utility to parse cli arguments
// Invokes ctor `GetOpt (int argc, char **argv, char *optstring);'
///////////////////////////////////////////////////////////////
int optionChar;
while ( 1 )
{
static struct option long_options[] =
{
/* These options set a flag. */
{"help", no_argument, 0, '?'},
{"nologo", no_argument, 0, 'n'},
{"noplugins", no_argument, 0, 'P'},
{"nocustomization", no_argument, 0, 'C'},
/* These options don't set a flag.
* We distinguish them by their indices. */
{"snapshot", required_argument, 0, 's'},
{"width", required_argument, 0, 'w'},
{"height", required_argument, 0, 'h'},
{"lang", required_argument, 0, 'l'},
{"project", required_argument, 0, 'p'},
{"extent", required_argument, 0, 'e'},
{"optionspath", required_argument, 0, 'o'},
{"configpath", required_argument, 0, 'c'},
{"android", required_argument, 0, 'a'},
{0, 0, 0, 0}
};
/* getopt_long stores the option index here. */
int option_index = 0;
optionChar = getopt_long( argc, argv, "swhlpeoc",
long_options, &option_index );
#ifndef WIN32
if ( !bundleclicked( argc, argv ) )
{

////////////////////////////////////////////////////////////////
// USe the GNU Getopts utility to parse cli arguments
// Invokes ctor `GetOpt (int argc, char **argv, char *optstring);'
///////////////////////////////////////////////////////////////
int optionChar;
while ( 1 )
{
static struct option long_options[] =
{
/* These options set a flag. */
{"help", no_argument, 0, '?'},
{"nologo", no_argument, 0, 'n'},
{"noplugins", no_argument, 0, 'P'},
{"nocustomization", no_argument, 0, 'C'},
/* These options don't set a flag.
* We distinguish them by their indices. */
{"snapshot", required_argument, 0, 's'},
{"width", required_argument, 0, 'w'},
{"height", required_argument, 0, 'h'},
{"lang", required_argument, 0, 'l'},
{"project", required_argument, 0, 'p'},
{"extent", required_argument, 0, 'e'},
{"optionspath", required_argument, 0, 'o'},
{"configpath", required_argument, 0, 'c'},
{"android", required_argument, 0, 'a'},
{0, 0, 0, 0}
};

/* getopt_long stores the option index here. */
int option_index = 0;

optionChar = getopt_long( argc, argv, "swhlpeoc",
long_options, &option_index );
QgsDebugMsg( QString( "Qgis main Debug" ) + optionChar );
/* Detect the end of the options. */
if ( optionChar == -1 )
break;
switch ( optionChar )
{
case 0:
/* If this option set a flag, do nothing else now. */
if ( long_options[option_index].flag != 0 )
break;
printf( "option %s", long_options[option_index].name );
if ( optarg )
printf( " with arg %s", optarg );
printf( "\n" );
break;
case 's':
mySnapshotFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( optarg ) ).absoluteFilePath() );
break;
case 'w':
mySnapshotWidth = QString( optarg ).toInt();
break;
case 'h':
mySnapshotHeight = QString( optarg ).toInt();
break;
case 'n':
myHideSplash = true;
break;
case 'l':
myTranslationCode = optarg;
break;
case 'p':
myProjectFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( optarg ) ).absoluteFilePath() );
break;
case 'P':
myRestorePlugins = false;
break;
case 'C':
myCustomization = false;
break;
case 'e':
myInitialExtent = optarg;
break;
case 'o':
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, optarg );
break;
case 'c':
configpath = optarg;
break;
case '?':
usage( argv[0] );
return 2; // XXX need standard exit codes
break;
default:
QgsDebugMsg( QString( "%1: getopt returned character code %2" ).arg( argv[0] ).arg( optionChar ) );
return 1; // XXX need standard exit codes
}
}
// Add any remaining args to the file list - we will attempt to load them
// as layers in the map view further down....
QgsDebugMsg( QString( "Files specified on command line: %1" ).arg( optind ) );
if ( optind < argc )
{
while ( optind < argc )
{
#ifdef QGISDEBUG
int idx = optind;
QgsDebugMsg( QString( "%1: %2" ).arg( idx ).arg( argv[idx] ) );
#endif
myFileList.append( QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[optind++] ) ).absoluteFilePath() ) );
}
}
}
#else
for ( int i = 1; i < argc; i++ )
{
QString arg = argv[i];
if ( arg == "--help" || arg == "-?" )
{
usage( argv[0] );
return 2;
}
else if ( arg == "-nologo" || arg == "-n" )
{
myHideSplash = true;
}
else if ( arg == "--noplugins" || arg == "-P" )
{
myRestorePlugins = false;
}
else if ( arg == "--nocustomization" || arg == "-C" )
{
myCustomization = false;
}
else if ( i + 1 < argc && ( arg == "--snapshot" || arg == "-s" ) )
{
mySnapshotFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
}
else if ( i + 1 < argc && ( arg == "--width" || arg == "-w" ) )
{
mySnapshotWidth = QString( argv[++i] ).toInt();
}
else if ( i + 1 < argc && ( arg == "--height" || arg == "-h" ) )
{
mySnapshotHeight = QString( argv[++i] ).toInt();
}
else if ( i + 1 < argc && ( arg == "--lang" || arg == "-l" ) )
{
myTranslationCode = argv[++i];
}
else if ( i + 1 < argc && ( arg == "--project" || arg == "-p" ) )
{
myProjectFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
}
else if ( i + 1 < argQgsDebugMsgc && ( arg == "--extent" || arg == "-e" ) )
{
myInitialExtent = argv[++i];
}
else if ( i + 1 < argc && ( arg == "--optionspath" || arg == "-o" ) )
{
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, argv[++i] );
}
else if ( i + 1 < argc && ( arg == "--configpath" || arg == "-c" ) )
{
configpath = argv[++i];
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, configpath );
}
else
{
myFileList.append( QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() ) );
}
}
#endif //WIN32
/* Detect the end of the options. */
if ( optionChar == -1 )
break;

switch ( optionChar )
{
case 0:
/* If this option set a flag, do nothing else now. */
if ( long_options[option_index].flag != 0 )
break;
printf( "option %s", long_options[option_index].name );
if ( optarg )
printf( " with arg %s", optarg );
printf( "\n" );
break;

case 's':
mySnapshotFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( optarg ) ).absoluteFilePath() );
break;

case 'w':
mySnapshotWidth = QString( optarg ).toInt();
break;

case 'h':
mySnapshotHeight = QString( optarg ).toInt();
break;

case 'n':
myHideSplash = true;
break;

case 'l':
myTranslationCode = optarg;
break;

case 'p':
myProjectFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( optarg ) ).absoluteFilePath() );
break;

case 'P':
myRestorePlugins = false;
break;

case 'C':
myCustomization = false;
break;

case 'e':
myInitialExtent = optarg;
break;

case 'o':
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, optarg );
break;

case 'c':
configpath = optarg;
break;

case '?':
usage( argv[0] );
return 2; // XXX need standard exit codes
break;

default:
QgsDebugMsg( QString( "%1: getopt returned character code %2" ).arg( argv[0] ).arg( optionChar ) );
return 1; // XXX need standard exit codes
}
}

// Add any remaining args to the file list - we will attempt to load them
// as layers in the map view further down....
QgsDebugMsg( QString( "Files specified on command line: %1" ).arg( optind ) );
if ( optind < argc )
{
while ( optind < argc )
{
#ifdef QGISDEBUG
int idx = optind;
QgsDebugMsg( QString( "%1: %2" ).arg( idx ).arg( argv[idx] ) );
#endif
myFileList.append( QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[optind++] ) ).absoluteFilePath() ) );
}
}
}
#else
for ( int i = 1; i < argc; i++ )
{
QString arg = argv[i];

if ( arg == "--help" || arg == "-?" )
{
usage( argv[0] );
return 2;
}
else if ( arg == "-nologo" || arg == "-n" )
{
myHideSplash = true;
}
else if ( arg == "--noplugins" || arg == "-P" )
{
myRestorePlugins = false;
}
else if ( arg == "--nocustomization" || arg == "-C" )
{
myCustomization = false;
}
else if ( i + 1 < argc && ( arg == "--snapshot" || arg == "-s" ) )
{
mySnapshotFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
}
else if ( i + 1 < argc && ( arg == "--width" || arg == "-w" ) )
{
mySnapshotWidth = QString( argv[++i] ).toInt();
}
else if ( i + 1 < argc && ( arg == "--height" || arg == "-h" ) )
{
mySnapshotHeight = QString( argv[++i] ).toInt();
}
else if ( i + 1 < argc && ( arg == "--lang" || arg == "-l" ) )
{
myTranslationCode = argv[++i];
}
else if ( i + 1 < argc && ( arg == "--project" || arg == "-p" ) )
{
myProjectFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
}
else if ( i + 1 < argc && ( arg == "--extent" || arg == "-e" ) )
{
myInitialExtent = argv[++i];
}
else if ( i + 1 < argc && ( arg == "--optionspath" || arg == "-o" ) )
{
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, argv[++i] );
}
else if ( i + 1 < argc && ( arg == "--configpath" || arg == "-c" ) )
{
configpath = argv[++i];
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, configpath );
}
else
{
myFileList.append( QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() ) );
}
}
#endif //WIN32
#else //ANDROID
QgsDebugMsg( QString( "Android: All params stripped"));// Param %1" ).arg( argv[0] ) );
QgsDebugMsg( QString( "Android: All params stripped"));// Param %1" ).arg( argv[0] ) );
#endif //ANDROID


Expand Down

0 comments on commit e8a67fe

Please sign in to comment.