From 41066adfd7f646fd298f33aff74335bd175fc990 Mon Sep 17 00:00:00 2001 From: Simon Sobisch Date: Mon, 30 Oct 2023 20:56:36 +0000 Subject: [PATCH] run hotspot without GUI for any command-line only option follow-up to 1d1d27814abd210666d99612226004b8613de3b2 --- src/main.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ea3a4aa9d..70767693f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,10 +59,18 @@ void Q_DECL_UNUSED initRCCIconTheme() std::unique_ptr createApplication(int& argc, char* argv[]) { - for (int i = 1; i < argc; ++i) { - if (!qstrcmp(argv[i], "--exportTo")) + std::vector args(argv, argv + argc); + + const std::vector nonGUIOptions = {"--version", "-v", "--help", "-h", "--help-all", "--exportTo"}; + + // create command line app if one of the command-line only options are used + for (const std::string& arg : args) { + if (std::find(nonGUIOptions.begin(), nonGUIOptions.end(), arg) != nonGUIOptions.end()) { return std::make_unique(argc, argv); + } } + + // otherwise create full GUI QT app return std::make_unique(argc, argv); }