diff --git a/harbour-batterybuddy.pro b/harbour-batterybuddy.pro index 94b3ecf..a1778f5 100644 --- a/harbour-batterybuddy.pro +++ b/harbour-batterybuddy.pro @@ -20,8 +20,11 @@ REL = 2 VERSION = $${VER}-$${REL} $$system(bash update-spec-version.sh $$TARGET $$VER $$REL) DEFINES += APP_VERSION=\"\\\"$$VERSION\\\"\" +DEFINES += APP_NAME=\"\\\"$$TARGET\\\"\" -# Do not set this! Use "--verbose" and "--debug" instead. +# Do not define QT_NO_DEBUG_OUTPUT! +# Use "--verbose" and "--debug" at runtime instead. +# See main() for details. #DEFINES += QT_NO_DEBUG_OUTPUT HEADERS += \ diff --git a/src/harbour-batterybuddy.cpp b/src/harbour-batterybuddy.cpp index e89debe..e79e8d4 100644 --- a/src/harbour-batterybuddy.cpp +++ b/src/harbour-batterybuddy.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include "battery.h" #include "settings.h" @@ -47,13 +46,21 @@ int main(int argc, char *argv[]) const char* logEnvVar = "QT_LOGGING_RULES"; for(int i = 1; i < argc; i++) { if(!strcmp(argv[i],"-v")) { - std::cout << "Battery Buddy " << APP_VERSION << std::endl << std::flush; + printf("%s %s\n", APP_NAME, APP_VERSION); return 0; } else if(!strcmp(argv[i],"--verbose")) qputenv(logEnvVar, "*.info=true;*.debug=false"); else if(!strcmp(argv[i],"--debug")) qputenv(logEnvVar, "*.info=true"); + else if(!strcmp(argv[i],"--help")) { + printf("%s %s\n", APP_NAME, APP_VERSION); + printf("Usage:\n"); + printf(" --verbose Enable informational messages\n"); + printf(" --debug Enable informational and debugging messages\n"); + printf(" --help Print version string and exit\n"); + return 0; + } } if(!qEnvironmentVariableIsSet(logEnvVar)) qputenv(logEnvVar, "*.info=false;*.debug=false");