Commit d016f481 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(src/app/App): do not parse args twice

parent 42a84298
...@@ -73,7 +73,8 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true) { ...@@ -73,7 +73,8 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true) {
setApplicationVersion(LINPHONE_QT_GIT_VERSION); setApplicationVersion(LINPHONE_QT_GIT_VERSION);
setWindowIcon(QIcon(WINDOW_ICON_PATH)); setWindowIcon(QIcon(WINDOW_ICON_PATH));
parseArgs(); createParser();
mParser->process(*this);
// Initialize logger. (Do not do this before this point because the // Initialize logger. (Do not do this before this point because the
// application has to be created for the logs to be put in the correct // application has to be created for the logs to be put in the correct
...@@ -91,7 +92,7 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true) { ...@@ -91,7 +92,7 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true) {
initLocale(); initLocale();
if (mParser->isSet("help")) { if (mParser->isSet("help")) {
parseArgs(); createParser();
mParser->showHelp(); mParser->showHelp();
} }
...@@ -272,7 +273,7 @@ bool App::hasFocus () const { ...@@ -272,7 +273,7 @@ bool App::hasFocus () const {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void App::parseArgs () { void App::createParser () {
if (mParser) if (mParser)
delete mParser; delete mParser;
...@@ -290,8 +291,6 @@ void App::parseArgs () { ...@@ -290,8 +291,6 @@ void App::parseArgs () {
{ { "V", "verbose" }, tr("commandLineOptionVerbose") }, { { "V", "verbose" }, tr("commandLineOptionVerbose") },
{ { "c", "cmd" }, tr("commandLineOptionCmd"), tr("commandLineOptionCmdArg") } { { "c", "cmd" }, tr("commandLineOptionCmd"), tr("commandLineOptionCmdArg") }
}); });
mParser->process(*this);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -87,7 +87,7 @@ signals: ...@@ -87,7 +87,7 @@ signals:
void configLocaleChanged (const QString &locale); void configLocaleChanged (const QString &locale);
private: private:
void parseArgs (); void createParser ();
void registerTypes (); void registerTypes ();
void registerSharedTypes (); void registerSharedTypes ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment