Added app restart confirmation modal

This commit is contained in:
Andrei Smirnov 2021-09-02 12:57:32 +03:00 committed by Iuri Matias
parent 979fea1cee
commit 6b3ba88556
3 changed files with 63 additions and 8 deletions

View File

@ -183,21 +183,37 @@ ScrollView {
StatusSlider {
id: zoomSlider
readonly property int initialValue: {
let scaleFactorStr = utilsModel.readTextFile(uiScaleFilePath)
if (scaleFactorStr === "") {
return 100
}
let scaleFactor = parseFloat(scaleFactorStr)
if (isNaN(scaleFactor)) {
return 100
}
return scaleFactor * 100
}
anchors.top: labelZoom.bottom
anchors.topMargin: Style.current.padding
width: parent.width
minimumValue: 50
maximumValue: 200
stepSize: 50
value: {
let scaleFactorStr = utilsModel.readTextFile(uiScaleFilePath)
if (scaleFactorStr === "") {
return 100
}
return parseFloat(scaleFactorStr) * 100
}
value: initialValue
onValueChanged: {
utilsModel.writeTextFile(uiScaleFilePath, value / 100.0)
if (value !== initialValue) {
utilsModel.writeTextFile(uiScaleFilePath, value / 100.0)
}
}
onPressedChanged: {
if (!pressed && value !== initialValue) {
confirmAppRestartModal.open()
}
}
ConfirmAppRestartModal {
id: confirmAppRestartModal
}
}

View File

@ -0,0 +1,38 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import "../../../../imports"
import "../../../../shared"
import "../../../../shared/status"
ModalPopup {
height: 237
width: 400
property Popup parentPopup
title: qsTr("Application Restart")
StyledText {
text: qsTr("Status app will be closed. Please restart it for the changes to take into effect.")
font.pixelSize: 15
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
}
footer: Item {
id: footerContainer
width: parent.width
height: children[0].height
StatusButton {
anchors.right: parent.right
anchors.rightMargin: Style.current.smallPadding
type: "warn"
text: qsTr("Proceed")
anchors.bottom: parent.bottom
onClicked: Qt.quit()
}
}
}

View File

@ -10,3 +10,4 @@ HelpContainer 1.0 HelpContainer.qml
AboutContainer 1.0 AboutContainer.qml
BackupSeedModal 1.0 BackupSeedModal.qml
LanguageModal 1.0 LanguageModal.qml
ConfirmAppRestartModal 1.0 ConfirmAppRestartModal.qml