Skip to content

Commit 2b288d7

Browse files
author
nephros
committed
Merge branch 'master' into recover-failures
2 parents d73aa6e + 500f5c7 commit 2b288d7

File tree

4 files changed

+172
-98
lines changed

4 files changed

+172
-98
lines changed

src/qml/PatchManagerPage.qml

Lines changed: 65 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,18 @@ Page {
188188
value: false
189189
}
190190
}
191-
192191
SilicaListView {
193192
id: view
194193
anchors.fill: parent
195194

196195
readonly property int topmostY: -view.headerItem.height
197196
readonly property int bottommostY: view.contentHeight - view.height - view.headerItem.height
198197

198+
Behavior on opacity { FadeAnimation { duration: 800 } }
199+
199200
PullDownMenu {
200201
busy: view.busy
201-
enabled: !busy
202+
enabled: !busy && background.drag && (background.drag.target === null)
202203

203204
/*
204205
Disabled due to discussion at https://github.com/sailfishos-patches/patchmanager/pull/272#issuecomment-1047685536
@@ -524,23 +525,79 @@ Page {
524525
duration: 200
525526
}
526527

527-
Switch {
528+
GlassItem {
529+
id: glass
530+
width: Theme.itemSizeLarge
531+
height: Theme.itemSizeLarge
532+
anchors.horizontalCenter: parent.left
533+
anchors.verticalCenter: nameLabel.verticalCenter
534+
radius: 0.14
535+
falloffRadius: 0.13
536+
visible: (down || busy || patchObject.details.patched)
537+
color: (down || busy || patchObject.details.patched)
538+
? Theme.rgba(Theme.primaryColor, Theme.opacityLow)
539+
: Theme.rgba(Theme.secondaryColor, Theme.opacityLow)
540+
Behavior on color { FadeAnimation {} }
541+
}
542+
543+
IconButton {
528544
id: appliedSwitch
529545
anchors.verticalCenter: parent.verticalCenter
530-
automaticCheck: false
531-
checked: patchObject.details.patched
546+
x: Theme.paddingLarge
547+
property string fallbackSource : fallbackIcon[patchObject.details.category]
548+
readonly property var fallbackIcon: {
549+
"browser": "image://theme/icon-m-website",
550+
"camera": "image://theme/icon-m-camera",
551+
"calendar": "image://theme/icon-m-date",
552+
"clock": "image://theme/icon-m-clock",
553+
"contacts": "image://theme/icon-m-users",
554+
"email": "image://theme/icon-m-mail",
555+
"gallery": "image://theme/icon-m-image",
556+
"homescreen": "image://theme/icon-m-device",
557+
"media": "image://theme/icon-m-media-playlists",
558+
"messages": "image://theme/icon-m-message",
559+
"phone": "image://theme/icon-m-call",
560+
"silica": "image://theme/icon-m-sailfish",
561+
"settings": "image://theme/icon-m-setting",
562+
"keyboard": "image://theme/icon-m-keyboard",
563+
"other": "image://theme/icon-m-patchmanager2",
564+
}
565+
icon.source: "image://theme/icon-m-patchmanager2"
566+
Component.onCompleted:{
567+
var patchSource = PatchManager.iconForPatch(patchObject.details.patch, Theme.colorScheme ? (Theme.colorScheme == Theme.LightOnDark) : true)
568+
if (patchSource.length > 0) {
569+
icon.source = patchSource
570+
} else if (fallbackSource) {
571+
icon.source = fallbackSource
572+
}
573+
}
574+
icon.sourceSize.height: Theme.iconSizeSmallPlus
575+
icon.sourceSize.width: Theme.iconSizeSmallPlus
576+
icon.height: Theme.iconSizeSmallPlus
577+
icon.width: Theme.iconSizeSmallPlus
578+
579+
palette.primaryColor: Theme.secondaryColor
580+
palette.highlightColor: Theme.primaryColor
581+
highlighted: down || patchObject.details.patched || busy
582+
583+
property bool busy: patchObject.busy
584+
enabled: !busy
532585
onClicked: background.doPatch()
533-
enabled: !busy && PatchManager.loaded
534-
busy: patchObject.busy
586+
587+
Behavior on icon.opacity { PropertyAnimation {
588+
duration: 1200; alwaysRunToEnd : true; easing.type: Easing.OutBack
589+
}}
535590
}
536591

537592
Column {
538593
id: nameLabel
539594
anchors.left: appliedSwitch.right
540-
anchors.right: patchIcon.status == Image.Ready ? patchIcon.left : parent.right
595+
//anchors.right: patchIcon.status == Image.Ready ? patchIcon.left : parent.right
596+
anchors.right: appliedSwitch.status == Image.Ready ? appliedSwitch.left : parent.right
541597
anchors.margins: Theme.paddingMedium
542598
anchors.verticalCenter: parent.verticalCenter
543599
Label {
600+
width: parent.width
544601
text: name
545602
color: patchObject.details.isCompatible ? background.down ? Theme.highlightColor : ( patchObject.details.patched ? Theme.primaryColor : Theme.secondaryColor )
546603
: background.down ? Theme.highlightBackgroundFromColor(Theme.errorColor, Theme.colorScheme) : ( patchObject.details.patched ? Theme.errorColor : Theme.secondaryHighlightFromColor(Theme.errorColor, Theme.colorScheme) )
@@ -563,16 +620,6 @@ Page {
563620
}
564621
}
565622
}
566-
567-
Image {
568-
id: patchIcon
569-
anchors.right: parent.right
570-
anchors.verticalCenter: parent.verticalCenter
571-
width: Theme.itemSizeExtraSmall
572-
height: Theme.itemSizeExtraSmall
573-
visible: status == Image.Ready
574-
source: PatchManager.iconForPatch(patchObject.details.patch, Theme.colorScheme ? (Theme.colorScheme == Theme.LightOnDark) : true)
575-
}
576623
}
577624

578625
Component {

src/qml/RestartServicesDialog.qml

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,48 @@ Dialog {
8080
width: parent.width - Theme.horizontalPageMargin * 2
8181
Repeater {
8282
model: PatchManager.appsToRestart
83-
delegate: Component { TextSwitch {
84-
text: qsTranslate("Sections", modelData)
85-
automaticCheck: false
86-
checked: true
87-
enabled: true
88-
description: {
89-
if ((modelData == "homescreen")
90-
|| (modelData == "silica"))
91-
{ return qsTranslate("","Note that this will close all apps."); }
92-
else if (modelData == "settings") { return qsTranslate("","Note that this will close %1.").arg(qsTranslate("", "Patchmanager")); }
93-
else if (modelData == "keyboard") { return "" }
94-
else if (modelData == "other") { return "" }
95-
else { return qsTranslate("","Note that this will close the %1 app.").arg(text); }
83+
delegate: Component { Row {
84+
spacing: Theme.paddingLarge
85+
Icon { id: catIcon
86+
source : iconList[modelData] || "image://theme/icon-m-setting"
87+
readonly property var iconList: {
88+
"browser": "image://theme/icon-m-website",
89+
"camera": "image://theme/icon-m-camera",
90+
"calendar": "image://theme/icon-m-date",
91+
"clock": "image://theme/icon-m-clock",
92+
"contacts": "image://theme/icon-m-users",
93+
"email": "image://theme/icon-m-mail",
94+
"gallery": "image://theme/icon-m-image",
95+
"homescreen": "image://theme/icon-m-device",
96+
"media": "image://theme/icon-m-media-playlists",
97+
"messages": "image://theme/icon-m-message",
98+
"phone": "image://theme/icon-m-call",
99+
"silica": "image://theme/icon-m-sailfish",
100+
"homescreen": "image://theme/icon-m-device",
101+
"settings": "image://theme/icon-m-setting",
102+
"keyboard": "image://theme/icon-m-keyboard",
103+
"other": "image://theme/icon-m-patchmanager2",
104+
}
96105
}
97-
TouchBlocker { anchors.fill: parent}
98-
}
99-
}
106+
Column {
107+
Label {
108+
text: qsTranslate("Sections", modelData)
109+
}
110+
Label {
111+
font.pixelSize: Theme.fontSizeSmall
112+
color: Theme.secondaryColor
113+
text: {
114+
if ((modelData == "homescreen")
115+
|| (modelData == "silica"))
116+
{ return qsTranslate("","Note that this will close all apps."); }
117+
else if (modelData == "settings") { return qsTranslate("","Note that this will close %1.").arg(qsTranslate("", "Patchmanager")); }
118+
else if (modelData == "keyboard") { return "" }
119+
else if (modelData == "other") { return "" }
120+
else { return qsTranslate("","Note that this will close the %1 app.").arg(text); }
121+
}
122+
}
123+
}
124+
}}
100125
}
101126
}
102127
}

src/qml/UnifiedPatchPage.qml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ Page {
204204
anchors.left: parent.left
205205
anchors.right: parent.right
206206
anchors.margins: Theme.horizontalPageMargin
207-
horizontalAlignment: Text.AlignJustify
208207
wrapMode: Text.WordWrap
209208
text: modelData.description
210209
}
@@ -266,8 +265,6 @@ Page {
266265
}
267266
Label {
268267
anchors.verticalCenter: parent.verticalCenter
269-
color: Theme.secondaryHighlightColor
270-
linkColor: Theme.highlightColor
271268
text: linktext
272269
}
273270
}

src/qml/WebPatchPage.qml

Lines changed: 66 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,36 @@ Page {
107107
*/
108108
property bool fetching: true
109109

110+
onPatchDataChanged: linksmodel.populate()
111+
ListModel {
112+
id: linksmodel
113+
// simply defining the ListItems does not work, errors with "cannot assign a script item"
114+
// so we append them when we're ready
115+
function populate() {
116+
if (patchData.discussion) {
117+
linksmodel.append({
118+
"link": patchData.discussion,
119+
"linktext": qsTranslate("", "Discussion"),
120+
"iconname": "icon-s-chat"
121+
})
122+
}
123+
if (patchData.sources) {
124+
linksmodel.append({
125+
"link": patchData.sources,
126+
"linktext": qsTranslate("", "Sources"),
127+
"iconname": "icon-s-developer"
128+
})
129+
}
130+
if (patchData.donations) {
131+
linksmodel.append({
132+
"link": patchData.donations,
133+
"linktext": qsTranslate("", "Donations"),
134+
"iconname": "icon-s-invitation"
135+
})
136+
}
137+
}
138+
}
139+
110140
onStatusChanged: {
111141
if (status == PageStatus.Active) {
112142
voteAction = PatchManager.checkVote(modelData.name)
@@ -257,8 +287,12 @@ Page {
257287
}
258288
}
259289

290+
SectionHeader {
291+
text: qsTranslate("", "Description")
292+
}
293+
260294
Label {
261-
color: Theme.highlightColor
295+
color: Theme.secondaryHighlightColor
262296
anchors {
263297
left: parent.left
264298
right: parent.right
@@ -270,69 +304,40 @@ Page {
270304

271305
SectionHeader {
272306
text: qsTranslate("", "Links")
273-
visible: !!patchData && (!!patchData.discussion || !!patchData.donations || !!patchData.sources)
274-
}
275-
276-
BackgroundItem {
277-
width: parent.width
278-
height: Theme.itemSizeExtraSmall
279-
visible: !!patchData && !!patchData.discussion
280-
281-
onClicked: {
282-
Qt.openUrlExternally(patchData.discussion)
283-
}
284-
285-
Label {
286-
color: Theme.highlightColor
287-
anchors {
288-
left: parent.left
289-
right: parent.right
290-
margins: Theme.horizontalPageMargin
291-
verticalCenter: parent.verticalCenter
292-
}
293-
text: !!patchData && patchData.discussion ? qsTranslate("", "Open discussion link") : ""
294-
}
295-
}
296-
297-
BackgroundItem {
298-
width: parent.width
299-
height: Theme.itemSizeExtraSmall
300-
visible: !!patchData && !!patchData.donations
301-
302-
onClicked: {
303-
Qt.openUrlExternally(patchData.donations)
304-
}
305-
306-
Label {
307-
color: Theme.highlightColor
308-
anchors {
309-
left: parent.left
310-
right: parent.right
311-
margins: Theme.horizontalPageMargin
312-
verticalCenter: parent.verticalCenter
313-
}
314-
text: !!patchData && patchData.donations ? qsTranslate("", "Donate") : ""
315-
}
307+
visible: (linksmodel.count > 0)
316308
}
317309

318-
BackgroundItem {
319-
width: parent.width
320-
height: Theme.itemSizeExtraSmall
321-
visible: !!patchData && patchData.sources
322-
323-
onClicked: {
324-
Qt.openUrlExternally(patchData.value.sources)
325-
}
326-
327-
Label {
328-
color: Theme.highlightColor
329-
anchors {
330-
left: parent.left
331-
right: parent.right
332-
margins: Theme.horizontalPageMargin
333-
verticalCenter: parent.verticalCenter
310+
Column {
311+
id: links
312+
visible: linksmodel.count > 0
313+
anchors.left: parent.left
314+
anchors.right: parent.right
315+
anchors.margins: Theme.horizontalPageMargin
316+
spacing: Theme.paddingSmall
317+
Repeater {
318+
model: linksmodel
319+
delegate: Component {
320+
ListItem {
321+
contentHeight: Theme.itemSizeExtraSmall
322+
width: parent.width
323+
Row {
324+
width: parent.width
325+
anchors.verticalCenter: parent.verticalCenter
326+
spacing: Theme.paddingMedium
327+
Icon {
328+
anchors.verticalCenter: parent.verticalCenter
329+
source: "image://theme/" + iconname
330+
sourceSize.width: Theme.iconSizeMedium
331+
sourceSize.height: sourceSize.width
332+
}
333+
Label {
334+
anchors.verticalCenter: parent.verticalCenter
335+
text: linktext
336+
}
337+
}
338+
onClicked: Qt.openUrlExternally(link)
339+
}
334340
}
335-
text: !!patchData && patchData.sources ? qsTranslate("", "Sources") : ""
336341
}
337342
}
338343

0 commit comments

Comments
 (0)