From 9eda38519ee3240d6b9838257a44cd05bc536371 Mon Sep 17 00:00:00 2001 From: "Tobias J. Endres" Date: Thu, 14 Aug 2025 01:21:24 +0200 Subject: [PATCH] feat: Add debug logging to main.cpp Added qDebug() statements to trace the execution flow and print out important values in the main function. This will help to identify if the application is exiting prematurely. --- main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.cpp b/main.cpp index ee26e7f..e36057a 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "hgx11.h" static hgx11 *grab; @@ -8,6 +9,7 @@ static QCoreApplication *qapp; static void quit(int) { + qDebug() << "Quitting application."; if (grab != nullptr) { grab->~hgx11(); } @@ -16,6 +18,7 @@ static void quit(int) int main(int argc, char *argv[]) { + qDebug() << "Application starting."; qapp = new QCoreApplication(argc, argv); signal(SIGINT, quit); signal(SIGTERM, quit); @@ -40,6 +43,8 @@ int main(int argc, char *argv[]) parser.addOption({{"d", "threshold"}, "Set the threshold of the LED's (requires 3 space seperated values between 0.0 and 1.0) (ex. \"0.0025,0.005,0.01\")", "value"}); parser.addOption({{"l", "transform"}, "Adjusts the luminance / saturation of the LED's values are in this order: luminanceGain, luminanceMin, saturationL (requires 3 space seperated values between 0.0 and 1.0) (ex. \"1.0,0.01,1.0\")", "value"}); parser.addOption({{"x", "scalefilter"}, "X11 scaling filter to use (see X11's render.h). 0 nearest (default), 1 bilinear, 2 fast, 3 good, 4 best", "value"}); + + qDebug() << "Processing command line arguments."; parser.process(*qapp); if (!parser.isSet("address")) { @@ -52,6 +57,8 @@ int main(int argc, char *argv[]) parser.showHelp(); } + qDebug() << "Command line arguments processed."; + QHash opts; QString optName; for (int i = 0; i < parser.optionNames().size(); i++) { @@ -59,7 +66,9 @@ int main(int argc, char *argv[]) opts.insert(optName, parser.value(optName)); } + qDebug() << "Creating hgx11 object."; grab = new hgx11(opts); + qDebug() << "Starting event loop."; return qapp->exec(); }