[Pkg-privacy-commits] [tails-installer] 24/27: Clean up the states in DownloadDialog
Intrigeri
intrigeri at moszumanska.debian.org
Wed May 24 15:27:00 UTC 2017
This is an automated email from the git hooks/post-receive script.
intrigeri pushed a commit to tag 3.91.0
in repository tails-installer.
commit 4895aba973a1271e8b34949c1f95d8786cffda34
Author: Martin Briza <mbriza at redhat.com>
Date: Tue Mar 15 17:47:54 2016 +0100
Clean up the states in DownloadDialog
---
liveusb/components/DownloadDialog.qml | 97 ++++++++---------------------------
1 file changed, 22 insertions(+), 75 deletions(-)
diff --git a/liveusb/components/DownloadDialog.qml b/liveusb/components/DownloadDialog.qml
index de31db3..9327958 100644
--- a/liveusb/components/DownloadDialog.qml
+++ b/liveusb/components/DownloadDialog.qml
@@ -14,9 +14,8 @@ Dialog {
width: $(640)
function reset() {
- writeImmediately.confirmed = false
- acceptButton.pressedOnce = false
writeArrow.color = "black"
+ writeImmediately.checked = false
}
onVisibleChanged: reset()
@@ -28,6 +27,23 @@ Dialog {
}
}
+ Connections {
+ id: downloadWait
+ target: liveUSBData.currentImage
+ onReadyToWriteChanged: {
+ if (liveUSBData.currentImage.readyToWrite && writeImmediately.checked) {
+ liveUSBData.currentImage.write()
+ }
+ }
+ }
+
+ Connections {
+ target: liveUSBData.currentImage.writer
+ onFinishedChanged: {
+ writeImmediately.checked = false
+ }
+ }
+
contentItem: Rectangle {
id: contentWrapper
anchors.fill: parent
@@ -189,16 +205,8 @@ Dialog {
AdwaitaCheckBox {
id: writeImmediately
enabled: driveCombo.count && opacity > 0.0
- opacity: liveUSBData.currentImage.download.running && liveUSBData.currentImage.download.progress / liveUSBData.currentImage.download.maxProgress < 0.95 ? 1.0 : 0.0
- property bool confirmed: false
+ opacity: !checked && liveUSBData.currentImage.download.running && liveUSBData.currentImage.download.progress / liveUSBData.currentImage.download.maxProgress < 0.95 ? 1.0 : 0.0
text: qsTranslate("", "Write the image immediately when the download is finished")
- onCheckedChanged: {
- liveUSBData.currentImage.writer.finished = true
- if (checked)
- acceptButton.pressedOnce = true
- else
- acceptButton.pressedOnce = false
- }
}
}
@@ -252,7 +260,6 @@ Dialog {
model: liveUSBData.usbDriveNames
currentIndex: liveUSBData.currentDrive
onCurrentIndexChanged: {
- acceptButton.pressedOnce = false
liveUSBData.currentImage.writer.finished = false
liveUSBData.currentDrive = currentIndex
}
@@ -311,7 +318,6 @@ Dialog {
liveUSBData.currentImage.writer.cancel()
liveUSBData.currentImage.writer.finished = false
writeImmediately.checked = false
- acceptButton.pressedOnce = false
root.close()
}
}
@@ -322,80 +328,21 @@ Dialog {
top: parent.top
bottom: parent.bottom
}
- property bool pressedOnce: false
color: liveUSBData.currentImage.writer.finished ? "#628fcf" : "red"
textColor: enabled ? "white" : palette.text
transformOrigin: Item.Center
- enabled: pressedOnce || (liveUSBData.currentImage.readyToWrite && !liveUSBData.currentImage.writer.running && liveUSBData.usbDrives.length > 0)
- text: liveUSBData.currentImage.writer.finished ? qsTranslate("", "Close") : pressedOnce ? qsTranslate("", "Are you sure?") : qsTranslate("", "Write to disk")
+ enabled: (liveUSBData.currentImage.readyToWrite && !liveUSBData.currentImage.writer.running && liveUSBData.usbDrives.length > 0)
+ text: liveUSBData.currentImage.writer.finished ? qsTranslate("", "Close") : qsTranslate("", "Write to disk")
onClicked: {
if (liveUSBData.currentImage.writer.finished) {
liveUSBData.currentImage.download.cancel()
liveUSBData.currentImage.writer.cancel()
liveUSBData.currentImage.writer.finished = false
writeImmediately.checked = false
- acceptButton.pressedOnce = false
root.close()
}
- else if(pressedOnce || !liveUSBData.currentImage.warning || liveUSBData.currentImage.warning.length == 0) {
- if (!liveUSBData.currentImage.readyToWrite) {
- writeImmediately.confirmed = true
- }
- else {
- liveUSBData.currentImage.write()
- }
- pressedOnce = false
- }
else {
- pressedOnce = true
- }
- }
- Connections {
- id: downloadWait
- target: liveUSBData.currentImage
- onReadyToWriteChanged: {
- if (liveUSBData.currentImage.readyToWrite && writeImmediately.confirmed) {
- liveUSBData.currentImage.write()
- }
- }
- }
-
- onPressedOnceChanged: {
- if (pressedOnce)
- acceptButtonBounce.start()
- }
- SequentialAnimation {
- id: acceptButtonBounce
- ParallelAnimation {
- ColorAnimation {
- duration: 80
- target: acceptButton
- property: "color"
- from: "red"
- to: Qt.tint("white", "red")
- }
- NumberAnimation {
- target: acceptButton
- property: "scale"
- duration: 80
- from: 1
- to: 1.2
- }
- }
- ParallelAnimation {
- ColorAnimation {
- duration: 80
- target: acceptButton
- property: "color"
- from: Qt.tint("white", "red")
- to: "red"
- }
- NumberAnimation {
- target: acceptButton
- property: "scale"
- duration: 40
- to: 1.0
- }
+ liveUSBData.currentImage.write()
}
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/tails-installer.git
More information about the Pkg-privacy-commits
mailing list