1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 19:31:02 +01:00

Make sure to hide the mainwindow on startup if it was hidden last time. Also fix the logic to ensure either the tray icon or the window is visible.

This commit is contained in:
David Sansome 2010-03-31 03:07:11 +00:00
parent b8be261700
commit a5412cc274

View File

@ -342,20 +342,17 @@ MainWindow::MainWindow(QNetworkAccessManager* network, QWidget *parent)
library_->SetGroupBy(g); library_->SetGroupBy(g);
UpdateGroupBySelection(g); UpdateGroupBySelection(g);
if (!settings_.value("hidden", false).toBool()) { bool hidden = settings_.value("hidden", false).toBool();
show(); bool show_tray = settings_.value("showtray", true).toBool();
} setVisible(!hidden);
if (settings_.value("showtray", true).toBool()) { if (show_tray)
tray_icon_->show(); tray_icon_->show();
} else
else {
ui_.action_hide_tray_icon->setText(tr("&Show tray icon")); ui_.action_hide_tray_icon->setText(tr("&Show tray icon"));
}
// Force the window to show in case somehow the config has tray and window set to hide // Force the window to show in case somehow the config has tray and window set to hide
// Why doesn't .toBool() work? This might be the case for any combinations with .toBool(); use .toInt() if (hidden && !show_tray) {
if (!settings_.value("hidden", true).toInt() && !settings_.value("showtray", false).toInt()) {
settings_.setValue("hidden", false); settings_.setValue("hidden", false);
show(); show();
} }