From 0c4f091e74a5c6d1e0b5f4cf47670bd1c3e1e3e6 Mon Sep 17 00:00:00 2001 From: Gökçen Eraslan Date: Tue, 12 Jan 2016 21:38:22 +0100 Subject: Port Quackle to Qt 5.5 --- quackleio/froggetopt.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'quackleio/froggetopt.cpp') diff --git a/quackleio/froggetopt.cpp b/quackleio/froggetopt.cpp index 68f20fe..24d9d2c 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,12 @@ GetOpt::GetOpt( int argc, char *argv[] ) init( 0, 0 ); } +void GetOpt::init( const QStringList &argv, int offset ) +{ + for ( int i = offset; i < argv.size(); ++i ) + args.append( argv[i] ); +} + /** \internal */ -- cgit v1.2.3 From b51e0cc94aafa21ed74bb8e530b969dac73018d5 Mon Sep 17 00:00:00 2001 From: Gökçen Eraslan Date: Tue, 12 Jan 2016 22:33:19 +0100 Subject: Fix startup crash bug. --- quackleio/froggetopt.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'quackleio/froggetopt.cpp') diff --git a/quackleio/froggetopt.cpp b/quackleio/froggetopt.cpp index 24d9d2c..9131ecc 100644 --- a/quackleio/froggetopt.cpp +++ b/quackleio/froggetopt.cpp @@ -180,6 +180,12 @@ GetOpt::GetOpt( int argc, char *argv[] ) 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] ); } -- cgit v1.2.3