Merge pull request #490 from amiga-500/patch-1

Fixed "--hide" and added "--nosplash" command-line option
This commit is contained in:
Oguzhan Inan
2022-07-25 12:07:47 +03:00
committed by GitHub

View File

@@ -59,27 +59,42 @@ int main(int argc, char *argv[])
qApp->setWindowIcon(QIcon(":/static/logo.png"));
{
QCommandLineOption hideOption("hide", "Hide Stacer while launching.");
QCommandLineOption noSplashOption("nosplash", "Hide splash screen while launching.");
QCommandLineParser parser;
parser.addVersionOption();
parser.addHelpOption();
parser.addOption(hideOption);
parser.addOption(noSplashOption);
parser.process(app);
}
bool isHide = false;
bool isNoSplash = false;
QLatin1String hideOption("--hide");
QLatin1String noSplashOption("--nosplash");
for (size_t i = 1; i < argc; ++i) {
if (QString(argv[i]) == hideOption)
isHide = true;
else if (QString(argv[i]) == noSplashOption)
isNoSplash = true;
}
QFontDatabase::addApplicationFont(":/static/font/Ubuntu-R.ttf");
QPixmap pixSplash(":/static/splashscreen.png");
QSplashScreen *splash = new QSplashScreen(pixSplash);
splash->show();
if (!isNoSplash) splash->show();
app.processEvents();
App w;
QLatin1String hideOption("--hide");
if (argc < 2 || QString(argv[1]) != hideOption) {
if (argc < 2 || !isHide) {
w.show();
}