Skip to content

Commit

Permalink
feat: hide the main window on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Mythologyli committed Feb 14, 2025
1 parent d603562 commit 071b633
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,30 @@

#include "mainwindow.h"

int main(int argc, char *argv[])
int main(int argc, char* argv[])
{
SingleApplication app(argc, argv);
QApplication::setApplicationName("ZJU Connect for Windows");
QApplication::setApplicationVersion("1.1.3");

QApplication::setFont(QFont("Microsoft YaHei UI", 9));

QCommandLineParser parser;
parser.setApplicationDescription("ZJU Connect for Windows");
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption slientOption("s", "Hide the main window");
parser.addOption(slientOption);
parser.process(app);

MainWindow mainWindow;

QObject::connect(&app, &SingleApplication::aboutToQuit, &mainWindow, &MainWindow::cleanUpWhenQuit);

mainWindow.show();
if (!parser.isSet(slientOption))
{
mainWindow.show();
}

return QApplication::exec();
}
2 changes: 1 addition & 1 deletion settingwindow/settingwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ SettingWindow::SettingWindow(QWidget *parent, QSettings *inputSettings) :
);
autoStartSettings.setValue(
"ZjuConnectForWindows",
QCoreApplication::applicationFilePath().replace('/', '\\')
"\"" + QCoreApplication::applicationFilePath().replace('/', '\\') + "\" -s"
);
}
else
Expand Down

0 comments on commit 071b633

Please sign in to comment.