Skip to content

Commit

Permalink
Merge branch 'master' into recover-failures
Browse files Browse the repository at this point in the history
  • Loading branch information
nephros committed May 6, 2024
2 parents d73aa6e + 500f5c7 commit 2b288d7
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 98 deletions.
83 changes: 65 additions & 18 deletions src/qml/PatchManagerPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,18 @@ Page {
value: false
}
}

SilicaListView {
id: view
anchors.fill: parent

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

Behavior on opacity { FadeAnimation { duration: 800 } }

PullDownMenu {
busy: view.busy
enabled: !busy
enabled: !busy && background.drag && (background.drag.target === null)

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

Switch {
GlassItem {
id: glass
width: Theme.itemSizeLarge
height: Theme.itemSizeLarge
anchors.horizontalCenter: parent.left
anchors.verticalCenter: nameLabel.verticalCenter
radius: 0.14
falloffRadius: 0.13
visible: (down || busy || patchObject.details.patched)
color: (down || busy || patchObject.details.patched)
? Theme.rgba(Theme.primaryColor, Theme.opacityLow)
: Theme.rgba(Theme.secondaryColor, Theme.opacityLow)
Behavior on color { FadeAnimation {} }
}

IconButton {
id: appliedSwitch
anchors.verticalCenter: parent.verticalCenter
automaticCheck: false
checked: patchObject.details.patched
x: Theme.paddingLarge
property string fallbackSource : fallbackIcon[patchObject.details.category]
readonly property var fallbackIcon: {
"browser": "image://theme/icon-m-website",
"camera": "image://theme/icon-m-camera",
"calendar": "image://theme/icon-m-date",
"clock": "image://theme/icon-m-clock",
"contacts": "image://theme/icon-m-users",
"email": "image://theme/icon-m-mail",
"gallery": "image://theme/icon-m-image",
"homescreen": "image://theme/icon-m-device",
"media": "image://theme/icon-m-media-playlists",
"messages": "image://theme/icon-m-message",
"phone": "image://theme/icon-m-call",
"silica": "image://theme/icon-m-sailfish",
"settings": "image://theme/icon-m-setting",
"keyboard": "image://theme/icon-m-keyboard",
"other": "image://theme/icon-m-patchmanager2",
}
icon.source: "image://theme/icon-m-patchmanager2"
Component.onCompleted:{
var patchSource = PatchManager.iconForPatch(patchObject.details.patch, Theme.colorScheme ? (Theme.colorScheme == Theme.LightOnDark) : true)
if (patchSource.length > 0) {
icon.source = patchSource
} else if (fallbackSource) {
icon.source = fallbackSource
}
}
icon.sourceSize.height: Theme.iconSizeSmallPlus
icon.sourceSize.width: Theme.iconSizeSmallPlus
icon.height: Theme.iconSizeSmallPlus
icon.width: Theme.iconSizeSmallPlus

palette.primaryColor: Theme.secondaryColor
palette.highlightColor: Theme.primaryColor
highlighted: down || patchObject.details.patched || busy

property bool busy: patchObject.busy
enabled: !busy
onClicked: background.doPatch()
enabled: !busy && PatchManager.loaded
busy: patchObject.busy

Behavior on icon.opacity { PropertyAnimation {
duration: 1200; alwaysRunToEnd : true; easing.type: Easing.OutBack
}}
}

Column {
id: nameLabel
anchors.left: appliedSwitch.right
anchors.right: patchIcon.status == Image.Ready ? patchIcon.left : parent.right
//anchors.right: patchIcon.status == Image.Ready ? patchIcon.left : parent.right
anchors.right: appliedSwitch.status == Image.Ready ? appliedSwitch.left : parent.right
anchors.margins: Theme.paddingMedium
anchors.verticalCenter: parent.verticalCenter
Label {
width: parent.width
text: name
color: patchObject.details.isCompatible ? background.down ? Theme.highlightColor : ( patchObject.details.patched ? Theme.primaryColor : Theme.secondaryColor )
: background.down ? Theme.highlightBackgroundFromColor(Theme.errorColor, Theme.colorScheme) : ( patchObject.details.patched ? Theme.errorColor : Theme.secondaryHighlightFromColor(Theme.errorColor, Theme.colorScheme) )
Expand All @@ -563,16 +620,6 @@ Page {
}
}
}

Image {
id: patchIcon
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
width: Theme.itemSizeExtraSmall
height: Theme.itemSizeExtraSmall
visible: status == Image.Ready
source: PatchManager.iconForPatch(patchObject.details.patch, Theme.colorScheme ? (Theme.colorScheme == Theme.LightOnDark) : true)
}
}

Component {
Expand Down
57 changes: 41 additions & 16 deletions src/qml/RestartServicesDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,48 @@ Dialog {
width: parent.width - Theme.horizontalPageMargin * 2
Repeater {
model: PatchManager.appsToRestart
delegate: Component { TextSwitch {
text: qsTranslate("Sections", modelData)
automaticCheck: false
checked: true
enabled: true
description: {
if ((modelData == "homescreen")
|| (modelData == "silica"))
{ return qsTranslate("","Note that this will close all apps."); }
else if (modelData == "settings") { return qsTranslate("","Note that this will close %1.").arg(qsTranslate("", "Patchmanager")); }
else if (modelData == "keyboard") { return "" }
else if (modelData == "other") { return "" }
else { return qsTranslate("","Note that this will close the %1 app.").arg(text); }
delegate: Component { Row {
spacing: Theme.paddingLarge
Icon { id: catIcon
source : iconList[modelData] || "image://theme/icon-m-setting"
readonly property var iconList: {
"browser": "image://theme/icon-m-website",
"camera": "image://theme/icon-m-camera",
"calendar": "image://theme/icon-m-date",
"clock": "image://theme/icon-m-clock",
"contacts": "image://theme/icon-m-users",
"email": "image://theme/icon-m-mail",
"gallery": "image://theme/icon-m-image",
"homescreen": "image://theme/icon-m-device",
"media": "image://theme/icon-m-media-playlists",
"messages": "image://theme/icon-m-message",
"phone": "image://theme/icon-m-call",
"silica": "image://theme/icon-m-sailfish",
"homescreen": "image://theme/icon-m-device",
"settings": "image://theme/icon-m-setting",
"keyboard": "image://theme/icon-m-keyboard",
"other": "image://theme/icon-m-patchmanager2",
}
}
TouchBlocker { anchors.fill: parent}
}
}
Column {
Label {
text: qsTranslate("Sections", modelData)
}
Label {
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryColor
text: {
if ((modelData == "homescreen")
|| (modelData == "silica"))
{ return qsTranslate("","Note that this will close all apps."); }
else if (modelData == "settings") { return qsTranslate("","Note that this will close %1.").arg(qsTranslate("", "Patchmanager")); }
else if (modelData == "keyboard") { return "" }
else if (modelData == "other") { return "" }
else { return qsTranslate("","Note that this will close the %1 app.").arg(text); }
}
}
}
}}
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/qml/UnifiedPatchPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ Page {
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: Theme.horizontalPageMargin
horizontalAlignment: Text.AlignJustify
wrapMode: Text.WordWrap
text: modelData.description
}
Expand Down Expand Up @@ -266,8 +265,6 @@ Page {
}
Label {
anchors.verticalCenter: parent.verticalCenter
color: Theme.secondaryHighlightColor
linkColor: Theme.highlightColor
text: linktext
}
}
Expand Down
127 changes: 66 additions & 61 deletions src/qml/WebPatchPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,36 @@ Page {
*/
property bool fetching: true

onPatchDataChanged: linksmodel.populate()
ListModel {
id: linksmodel
// simply defining the ListItems does not work, errors with "cannot assign a script item"
// so we append them when we're ready
function populate() {
if (patchData.discussion) {
linksmodel.append({
"link": patchData.discussion,
"linktext": qsTranslate("", "Discussion"),
"iconname": "icon-s-chat"
})
}
if (patchData.sources) {
linksmodel.append({
"link": patchData.sources,
"linktext": qsTranslate("", "Sources"),
"iconname": "icon-s-developer"
})
}
if (patchData.donations) {
linksmodel.append({
"link": patchData.donations,
"linktext": qsTranslate("", "Donations"),
"iconname": "icon-s-invitation"
})
}
}
}

onStatusChanged: {
if (status == PageStatus.Active) {
voteAction = PatchManager.checkVote(modelData.name)
Expand Down Expand Up @@ -257,8 +287,12 @@ Page {
}
}

SectionHeader {
text: qsTranslate("", "Description")
}

Label {
color: Theme.highlightColor
color: Theme.secondaryHighlightColor
anchors {
left: parent.left
right: parent.right
Expand All @@ -270,69 +304,40 @@ Page {

SectionHeader {
text: qsTranslate("", "Links")
visible: !!patchData && (!!patchData.discussion || !!patchData.donations || !!patchData.sources)
}

BackgroundItem {
width: parent.width
height: Theme.itemSizeExtraSmall
visible: !!patchData && !!patchData.discussion

onClicked: {
Qt.openUrlExternally(patchData.discussion)
}

Label {
color: Theme.highlightColor
anchors {
left: parent.left
right: parent.right
margins: Theme.horizontalPageMargin
verticalCenter: parent.verticalCenter
}
text: !!patchData && patchData.discussion ? qsTranslate("", "Open discussion link") : ""
}
}

BackgroundItem {
width: parent.width
height: Theme.itemSizeExtraSmall
visible: !!patchData && !!patchData.donations

onClicked: {
Qt.openUrlExternally(patchData.donations)
}

Label {
color: Theme.highlightColor
anchors {
left: parent.left
right: parent.right
margins: Theme.horizontalPageMargin
verticalCenter: parent.verticalCenter
}
text: !!patchData && patchData.donations ? qsTranslate("", "Donate") : ""
}
visible: (linksmodel.count > 0)
}

BackgroundItem {
width: parent.width
height: Theme.itemSizeExtraSmall
visible: !!patchData && patchData.sources

onClicked: {
Qt.openUrlExternally(patchData.value.sources)
}

Label {
color: Theme.highlightColor
anchors {
left: parent.left
right: parent.right
margins: Theme.horizontalPageMargin
verticalCenter: parent.verticalCenter
Column {
id: links
visible: linksmodel.count > 0
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: Theme.horizontalPageMargin
spacing: Theme.paddingSmall
Repeater {
model: linksmodel
delegate: Component {
ListItem {
contentHeight: Theme.itemSizeExtraSmall
width: parent.width
Row {
width: parent.width
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.paddingMedium
Icon {
anchors.verticalCenter: parent.verticalCenter
source: "image://theme/" + iconname
sourceSize.width: Theme.iconSizeMedium
sourceSize.height: sourceSize.width
}
Label {
anchors.verticalCenter: parent.verticalCenter
text: linktext
}
}
onClicked: Qt.openUrlExternally(link)
}
}
text: !!patchData && patchData.sources ? qsTranslate("", "Sources") : ""
}
}

Expand Down

0 comments on commit 2b288d7

Please sign in to comment.