mainapplication: fix --minimized option

remove useless isFullscreen (visibility already stores this and
it's not possible to go from fullscreen to minimized anyway).
Also --minimized was ignored

GitLab: #413
Change-Id: I610f17ce7ae5b2852aae5b40dc504174fa657c2d
This commit is contained in:
Sébastien Blin
2021-12-23 14:22:08 -05:00
parent 6a7a8d0bc5
commit cab0ccc792
3 changed files with 16 additions and 16 deletions

View File

@@ -47,10 +47,13 @@ ApplicationWindow {
}
property ApplicationWindow appWindow : root
property bool isFullScreen: false
function toggleFullScreen() {
isFullScreen = !isFullScreen
if (visibility !== Window.FullScreen) {
showFullScreen()
} else {
showNormal()
}
}
function checkLoadedSource() {
@@ -86,11 +89,6 @@ ApplicationWindow {
hide()
}
visibility: !visible ?
Window.Hidden : (isFullScreen ?
Window.FullScreen :
Window.Windowed)
title: JamiStrings.appTitle
width: {
@@ -150,6 +148,9 @@ ApplicationWindow {
}
onLoaded: {
if (UtilsAdapter.getAppValue(Settings.StartMinimized)) {
showMinimized()
}
// Quiet check for updates on start if set to.
if (UtilsAdapter.getAppValue(Settings.AutoUpdate)) {
UpdateManager.checkForUpdates(true)
@@ -163,21 +164,16 @@ ApplicationWindow {
function onRestoreAppRequested() {
requestActivate()
if (isFullScreen)
showFullScreen()
else
if (visibility === Window.Hidden || visibility === Window.Minimized) {
showNormal()
}
}
function onNotificationClicked() {
requestActivate()
raise()
if (visibility === Window.Hidden ||
visibility === Window.Minimized) {
if (isFullScreen)
showFullScreen()
else
showNormal()
if (visibility === Window.Hidden || visibility === Window.Minimized) {
showNormal()
}
}
}

View File

@@ -43,6 +43,7 @@ const QString defaultDownloadPath = QStandardPaths::writableLocation(
X(DisplayHyperlinkPreviews, true) \
X(EnableDarkTheme, false) \
X(AutoUpdate, true) \
X(StartMinimized, false) \
X(NeverShowMeAgain, false)
/*

View File

@@ -247,6 +247,9 @@ MainApplication::init()
lrcInstance_->accountModel().autoTransferSizeThreshold = acceptTransferBelow;
initQmlLayer();
settingsManager_->setValue(Settings::Key::StartMinimized, results[opts::STARTMINIMIZED].toBool());
initSystray();
return true;