From 2cacbfe27fd06502c1cbc8f66c44aa207c56c66c Mon Sep 17 00:00:00 2001 From: mrbesen Date: Sat, 2 Sep 2023 11:52:18 +0200 Subject: [PATCH] add --access flag for debugging --- include/arg.h | 1 + src/arg.cpp | 1 + src/main.cpp | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/include/arg.h b/include/arg.h index b0a0cff..4f7c031 100644 --- a/include/arg.h +++ b/include/arg.h @@ -2,6 +2,7 @@ struct Args { int debugLog = 0; // cast to bool later + int access = 0; }; Args parseArgs(int argc, char** argv); diff --git a/src/arg.cpp b/src/arg.cpp index 69bd0f6..cc49a04 100644 --- a/src/arg.cpp +++ b/src/arg.cpp @@ -9,6 +9,7 @@ Args parseArgs(int argc, char** argv) { while (1) { static struct option long_options[] = { {"debug-log", no_argument, &a.debugLog, 1}, + {"access", no_argument, &a.access, 1}, {0, 0, 0, 0} }; /* getopt_long stores the option index here. */ diff --git a/src/main.cpp b/src/main.cpp index 5ca7e02..ddd0877 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,6 +32,12 @@ int main(int argc, char** argv) { qInfo() << "Hello, World!"; qInfo() << "Using Locale: " << QLocale().name(); + if(args.access) { + auto access = ClientAccess::find(); + qInfo() << "Access: port=" << access->getPort() << " basicAuth=" << access->getBasicAuth(); + return 0; + } + QApplication app(argc, argv); QTranslator translator; if(translator.load(QLocale().name(), ":/i18n")) {