diff options
Diffstat (limited to 'quackleio/froggetopt.cpp')
-rw-r--r-- | quackleio/froggetopt.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/quackleio/froggetopt.cpp b/quackleio/froggetopt.cpp index 68f20fe..9131ecc 100644 --- a/quackleio/froggetopt.cpp +++ b/quackleio/froggetopt.cpp @@ -130,7 +130,7 @@ GetOpt::GetOpt() if ( !QCoreApplication::instance() ) qFatal( "GetOpt: requires a QApplication instance to be constructed first" ); - init( QCoreApplication::instance()->argc(), QCoreApplication::instance()->argv(), 1 ); + init( QCoreApplication::instance()->arguments(), 1 ); } /** @@ -141,7 +141,7 @@ GetOpt::GetOpt( int offset ) if ( !QCoreApplication::instance() ) qFatal( "GetOpt: requires a QApplication instance to be constructed first" ); - init( QCoreApplication::instance()->argc(), QCoreApplication::instance()->argv(), offset ); + init( QCoreApplication::instance()->arguments(), offset ); } /** @@ -178,6 +178,18 @@ GetOpt::GetOpt( int argc, char *argv[] ) init( 0, 0 ); } +void GetOpt::init( const QStringList &argv, int offset ) +{ + numReqArgs = numOptArgs = 0; + currArg = 1; // appname is not part of the arguments + + // application name + aname = QFileInfo( argv[0] ).fileName(); + + for ( int i = offset; i < argv.size(); ++i ) + args.append( argv[i] ); +} + /** \internal */ |