fix: core not starting if gui started minimized, remove firstShown and use open instead
fixes #8641
This commit is contained in:
parent
d01a023a8b
commit
d5910d77ec
2 changed files with 26 additions and 47 deletions
|
|
@ -278,8 +278,6 @@ void MainWindow::connectSlots()
|
|||
{
|
||||
connect(&Logger::instance(), &Logger::newLine, this, &MainWindow::handleLogLine);
|
||||
|
||||
connect(this, &MainWindow::shown, this, &MainWindow::firstShown, Qt::QueuedConnection);
|
||||
|
||||
connect(Settings::instance(), &Settings::serverSettingsChanged, this, &MainWindow::serverConfigSaving);
|
||||
connect(Settings::instance(), &Settings::settingsChanged, this, &MainWindow::settingsChanged);
|
||||
|
||||
|
|
@ -360,39 +358,6 @@ void MainWindow::toggleLogVisible(bool visible)
|
|||
QTimer::singleShot(15, this, &MainWindow::updateSize);
|
||||
}
|
||||
|
||||
void MainWindow::firstShown()
|
||||
{
|
||||
// if a critical error was shown just before the main window (i.e. on app
|
||||
// load), it will be hidden behind the main window. therefore we need to raise
|
||||
// it up in front of the main window.
|
||||
// HACK: because the `onShown` event happens just as the window is shown, the
|
||||
// message box has a chance of being raised under the main window. to solve
|
||||
// this we delay the error dialog raise by a split second. this seems a bit
|
||||
// hacky and fragile, so maybe there's a better approach.
|
||||
const auto kCriticalDialogDelay = 100;
|
||||
QTimer::singleShot(kCriticalDialogDelay, this, &messages::raiseCriticalDialog);
|
||||
|
||||
if (!Settings::value(Settings::Gui::AutoUpdateCheck).isValid()) {
|
||||
showAndActivate();
|
||||
Settings::setValue(Settings::Gui::AutoUpdateCheck, messages::showUpdateCheckOption(this));
|
||||
}
|
||||
|
||||
if (Settings::value(Settings::Gui::AutoUpdateCheck).toBool()) {
|
||||
m_versionChecker.checkLatest();
|
||||
} else {
|
||||
qDebug() << "update check disabled";
|
||||
}
|
||||
|
||||
if (Settings::value(Settings::Core::StartedBefore).toBool()) {
|
||||
if (ui->rbModeClient->isChecked() && ui->lineHostname->text().isEmpty())
|
||||
return;
|
||||
m_coreProcess.start();
|
||||
}
|
||||
|
||||
// Do not call firstshow for any more show events
|
||||
disconnect(this, &MainWindow::shown, this, &MainWindow::firstShown);
|
||||
}
|
||||
|
||||
void MainWindow::settingsChanged(const QString &key)
|
||||
{
|
||||
if (key == Settings::Log::Level) {
|
||||
|
|
@ -635,6 +600,32 @@ void MainWindow::serverConnectionConfigureClient(const QString &clientName)
|
|||
void MainWindow::open()
|
||||
{
|
||||
Settings::value(Settings::Gui::Autohide).toBool() ? hide() : showAndActivate();
|
||||
|
||||
// if a critical error was shown just before the main window (i.e. on app
|
||||
// load), it will be hidden behind the main window. therefore we need to raise
|
||||
// it up in front of the main window.
|
||||
// HACK: because the `onShown` event happens just as the window is shown, the
|
||||
// message box has a chance of being raised under the main window. to solve
|
||||
// this we delay the error dialog raise by a split second. this seems a bit
|
||||
// hacky and fragile, so maybe there's a better approach.
|
||||
const auto kCriticalDialogDelay = 100;
|
||||
QTimer::singleShot(kCriticalDialogDelay, this, &messages::raiseCriticalDialog);
|
||||
|
||||
if (!Settings::value(Settings::Gui::AutoUpdateCheck).isValid()) {
|
||||
Settings::setValue(Settings::Gui::AutoUpdateCheck, messages::showUpdateCheckOption(this));
|
||||
}
|
||||
|
||||
if (Settings::value(Settings::Gui::AutoUpdateCheck).toBool()) {
|
||||
m_versionChecker.checkLatest();
|
||||
} else {
|
||||
qDebug() << "update check disabled";
|
||||
}
|
||||
|
||||
if (Settings::value(Settings::Core::StartedBefore).toBool()) {
|
||||
if (ui->rbModeClient->isChecked() && ui->lineHostname->text().isEmpty())
|
||||
return;
|
||||
m_coreProcess.start();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::coreProcessStarting()
|
||||
|
|
@ -830,12 +821,6 @@ QString MainWindow::getTimeStamp() const
|
|||
return QStringLiteral("[%1]").arg(QDateTime::currentDateTime().toString(Qt::ISODate));
|
||||
}
|
||||
|
||||
void MainWindow::showEvent(QShowEvent *event)
|
||||
{
|
||||
QMainWindow::showEvent(event);
|
||||
Q_EMIT shown();
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if (Settings::value(Settings::Gui::CloseToTray).toBool() && event->spontaneous()) {
|
||||
|
|
|
|||
|
|
@ -88,14 +88,9 @@ public:
|
|||
|
||||
void hide();
|
||||
|
||||
Q_SIGNALS:
|
||||
void shown();
|
||||
|
||||
private:
|
||||
void toggleLogVisible(bool visible);
|
||||
|
||||
void firstShown();
|
||||
|
||||
void settingsChanged(const QString &key = QString());
|
||||
void serverConfigSaving();
|
||||
void coreProcessStarting();
|
||||
|
|
@ -135,7 +130,6 @@ private:
|
|||
void checkConnected(const QString &line);
|
||||
void checkFingerprint(const QString &line);
|
||||
[[nodiscard]] QString getTimeStamp() const;
|
||||
void showEvent(QShowEvent *) override;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void secureSocket(bool secureSocket);
|
||||
void connectSlots();
|
||||
|
|
|
|||
Loading…
Reference in a new issue