aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commandline.cpp12
-rw-r--r--src/commandline.h2
-rw-r--r--src/main.cpp20
3 files changed, 2 insertions, 32 deletions
diff --git a/src/commandline.cpp b/src/commandline.cpp
index bb636f2..f5e479c 100644
--- a/src/commandline.cpp
+++ b/src/commandline.cpp
@@ -88,18 +88,6 @@ void CommandLine::parseCommandLine(const QCoreApplication &app)
if(isSet(buildOption)) {
printBuild();
}
-
- // create a list of unknown QCommandLineOption's
- // parser.addOptions() takes a list, so this is a QList
-
- for(const QString &opt : unknownOptionNames()) {
- QCommandLineOption o(opt, "dummy desc", "dummy value");
- unknownOptions.append(o);
- }
-
- // add list and reparse to set the new options
- addOptions(unknownOptions);
- parse(app.arguments());
}
void CommandLine::printHelp(int exitCode)
diff --git a/src/commandline.h b/src/commandline.h
index 4229ac4..cb2f334 100644
--- a/src/commandline.h
+++ b/src/commandline.h
@@ -31,8 +31,6 @@ public:
const QCommandLineOption socketOption;
const QCommandLineOption newWindowOption;
- QList<QCommandLineOption> unknownOptions;
-
private:
QCoreApplication *application;
};
diff --git a/src/main.cpp b/src/main.cpp
index 1b4d26f..52df7ac 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -25,24 +25,8 @@ int main(int argc, char **argv)
std::shared_ptr<Configuration> config = std::make_shared<Configuration>();
config->read(parser.value(parser.configOption));
- // parse command-line overrides
- // we assume the users knows what they're doing, so we only pass the unknown options to program_options
- // passing any unknown options though will cause it to fail, so we need to filter out the regular options
- // unfortunately, QCommandLineParser will only give us the unknown option
- // names, so we need to build a list, add them as options, reparse, and then
- // we get their values
- if(!parser.unknownOptions.isEmpty()) {
- int _argc = parser.unknownOptions.length() + 1;
- const char *_argv[_argc];
-
- // program_options requires 0 to be the program name, otherwise it seems to fail
- _argv[0] = qUtf8Printable(app.arguments().at(0));
-
- for(int i = 1; i < _argc; ++i) {
- _argv[i] = qUtf8Printable(QString("--%1=%2").arg(parser.unknownOptions[i - 1].names().at(0), parser.value(parser.unknownOptions[i - 1])));
- }
-
- config->parse(_argc, _argv);
+ if(!parser.unknownOptionNames().isEmpty()) {
+ qDebug("config->parse: %s", config->parse(argc, argv) ? "true" : "false");
}
app.setConfiguration(config);