Skip to content

Enhancement add q command line parser #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions src/webots/gui/WbGuiApplication.cpp
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@
#include <QtCore/QStringList>
#include <QtCore/QTimer>
#include <QtCore/QUrl>
#include <QtCore/QCommandLineParser>
#include <QtGui/QFontDatabase>
#include <QtGui/QScreen>

@@ -185,9 +186,26 @@ void WbGuiApplication::parseStreamArguments(const QString &streamArguments) {

void WbGuiApplication::parseArguments() {
// faster when copied according to Qt's doc
QStringList args = arguments();
bool logPerformanceMode = false, batch = false;
mStream = false;

// Integration of QCommandLineParser
QCommandLineParser parser;
parser.setOptionsAfterPositionalArgumentsMode(QCommandLineParser::ParseAsOptions);
// parser.addPositionalArgument("subcommands", "minimize"); -> add all the subcommands later
parser.parse(QCoreApplication::arguments());
const QStringList args = parser.positionalArguments();

/* example of handling a subcommand
if (!parserArgs.isEmpty()) {
const QString subCommand = parserArgs.first();
if (subCommand == "minimize") {
parserArgs.pop_front();
subProgram(parserArgs);
}
} */

// QStringList args = arguments(); ->Line should be removed, now fetching the arguments is done with the parser
bool logPerformanceMode = false;
bool batch = false, mstream = false;

const int size = args.size();
for (int i = 1; i < size; ++i) {