diff options
author | saturneric <[email protected]> | 2024-07-29 19:29:56 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-07-29 19:29:56 +0000 |
commit | fa90ec4b5315b9e70a44a9625c143ce253f0e885 (patch) | |
tree | 8ffa82e33522de03974d6d0289aa831b4fd6ebdf /src/main.cpp | |
parent | fix: correct urls at appdata.xml (diff) | |
parent | Merge branch 'develop' of github.com:saturneric/GpgFrontend into develop (diff) | |
download | GpgFrontend-fa90ec4b5315b9e70a44a9625c143ce253f0e885.tar.gz GpgFrontend-fa90ec4b5315b9e70a44a9625c143ce253f0e885.zip |
Merge branch 'develop'
Diffstat (limited to '')
-rw-r--r-- | src/main.cpp | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/main.cpp b/src/main.cpp index a99f3e30..e2690f4f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -30,14 +30,18 @@ * \mainpage GpgFrontend Develop Document Main Page */ +#include <qcommandlineparser.h> +#include <qloggingcategory.h> + +// #include "GpgFrontendContext.h" +#include "core/utils/MemoryUtils.h" + +// #include "app.h" #include "cmd.h" #include "init.h" -// -#include "core/utils/MemoryUtils.h" - /** * * @param argc @@ -45,15 +49,31 @@ * @return */ auto main(int argc, char* argv[]) -> int { + // initialize qt resources + Q_INIT_RESOURCE(gpgfrontend); + GpgFrontend::GFCxtSPtr const ctx = GpgFrontend::SecureCreateSharedObject<GpgFrontend::GpgFrontendContext>( argc, argv); ctx->InitApplication(); - auto rtn = 0; +#ifdef RELEASE + QLoggingCategory::setFilterRules("*.debug=false\n*.info=false\n"); + qSetMessagePattern( + "[%{time yyyyMMdd h:mm:ss.zzz}] [%{category}] " + "[%{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-" + "critical}C%{endif}%{if-fatal}F%{endif}] [%{threadid}] - " + "%{message}"); +#else + QLoggingCategory::setFilterRules("*.debug=false"); + qSetMessagePattern( + "[%{time yyyyMMdd h:mm:ss.zzz}] [%{category}] " + "[%{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-" + "critical}C%{endif}%{if-fatal}F%{endif}] [%{threadid}] %{file}:%{line} - " + "%{message}"); +#endif - // initialize qt resources - Q_INIT_RESOURCE(gpgfrontend); + auto rtn = 0; QCommandLineParser parser; parser.addHelpOption(); @@ -67,14 +87,12 @@ auto main(int argc, char* argv[]) -> int { parser.process(*ctx->GetApp()); - ctx->log_level = spdlog::level::info; - if (parser.isSet("v")) { return GpgFrontend::PrintVersion(); } if (parser.isSet("l")) { - ctx->log_level = GpgFrontend::ParseLogLevel(parser.value("l")); + GpgFrontend::ParseLogLevel(parser.value("l")); } if (parser.isSet("t")) { |