Skip to content

Commit

Permalink
run hotspot without GUI for any command-line only option
Browse files Browse the repository at this point in the history
follow-up to 1d1d278
  • Loading branch information
GitMensch committed Oct 30, 2023
1 parent b13a606 commit 41066ad
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,18 @@ void Q_DECL_UNUSED initRCCIconTheme()

std::unique_ptr<QCoreApplication> createApplication(int& argc, char* argv[])
{
for (int i = 1; i < argc; ++i) {
if (!qstrcmp(argv[i], "--exportTo"))
std::vector<std::string> args(argv, argv + argc);

const std::vector<std::string> 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<QCoreApplication>(argc, argv);
}
}

// otherwise create full GUI QT app
return std::make_unique<QApplication>(argc, argv);
}

Expand Down

0 comments on commit 41066ad

Please sign in to comment.