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
  • Loading branch information
GitMensch authored Oct 30, 2023
1 parent b13a606 commit dddb208
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,17 @@ 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"))
// skip full QT initalisation if command-line only options are used
std::vector<std::string> args(argv, argv + argc);

const std::vector<std::string> nonGUIOptions = {"--version", "-v", "--help", "-h", "--help-all", "--exportTo"};

for (const std::string& arg : args) {
if (std::find(nonGUIOptions.begin(), nonGUIOptions.end(), arg) != nonGUIOptions.end()) {
return std::make_unique<QCoreApplication>(argc, argv);
}
}

return std::make_unique<QApplication>(argc, argv);
}

Expand Down

0 comments on commit dddb208

Please sign in to comment.