Add Icon and PullDownMenu *WIP*

master
kirbylife 2021-05-16 14:59:28 -05:00
parent e28f6b731c
commit b049d5eed1
5 changed files with 105 additions and 37 deletions

File diff suppressed because one or more lines are too long

BIN
icon.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

48
qml/About.qml 100644
View File

@ -0,0 +1,48 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
PageHeader {
id: header
title: "About"
}
Label {
anchors.top: header.bottom
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
text: "this application was created by\nkirbylife\nunder the GPL V2.0 license,\nanyone is free to view\nthe code and modify it."
truncationMode: TruncationMode.Elide
}
Button {
id: btnCode
anchors.bottom: btnTwitter.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: 50
text: "Code"
onClicked: {
Qt.openUrlExternally("https://gitlab.com/kirbylife/harbour-muchkin")
}
}
Button {
id: btnTwitter
anchors.bottom: btnDonate.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: 50
text: "Twitter"
onClicked: {
Qt.openUrlExternally("https://twitter.com/kirbylife")
}
}
Button {
id: btnDonate
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: 50
text: "Donate"
onClicked: {
Qt.openUrlExternally("https://www.paypal.com/paypalme/kirbylife")
}
}
}

View File

@ -62,7 +62,6 @@ Page {
anchors.top: header.bottom anchors.top: header.bottom
width: parent.width width: parent.width
height: width height: width
// source: attrs.Icon
} }
Button { Button {
@ -75,7 +74,9 @@ Page {
py.importModule("main", function(){ py.importModule("main", function(){
py.call("main.save_icon", [iconEditor.attrs], function(result){ py.call("main.save_icon", [iconEditor.attrs], function(result){
if(result){ if(result){
pageStack.navigateBack(PageStackAction.Animated) pageStack.pop()
pageStack.completeAnimation()
pageStack.currentPage.mainList.reload()
} }
}) })
}) })

View File

@ -3,55 +3,74 @@ import Sailfish.Silica 1.0
import io.thp.pyotherside 1.3 import io.thp.pyotherside 1.3
Page { Page {
id: mainList SilicaFlickable {
id: mainList
anchors.fill: parent
PageHeader { PullDownMenu {
id: header MenuItem {
width: parent.width text: "About"
title: "Select the webapp to unify" onClicked: pageStack.push(Qt.resolvedUrl("About.qml"))
} }
SilicaGridView {
anchors.top: header.bottom
width: parent.width
height: parent.height
cellWidth: width / 4
cellHeight: cellWidth
model: ListModel {
id: appsList
} }
delegate: GridItem { PageHeader {
menu: Component { id: header
ContextMenu { width: parent.width
MenuItem { title: "Select the webapp to unify"
text: attrs.Name }
SilicaGridView {
anchors.top: header.bottom
width: parent.width
height: parent.height
cellWidth: width / 4
cellHeight: cellWidth
model: ListModel {
id: appsList
}
delegate: GridItem {
menu: Component {
ContextMenu {
MenuItem {
text: attrs.Name
}
} }
} }
}
Image { Image {
anchors.centerIn: parent anchors.centerIn: parent
source: attrs.Icon source: attrs.Icon
} }
onClicked: { onClicked: {
pageStack.push(Qt.resolvedUrl("Icon.qml"), {attrs: attrs}); pageStack.push(Qt.resolvedUrl("Icon.qml"), {attrs: attrs});
}
} }
} }
}
Python { function reload(){
id: py appsList.clear()
Component.onCompleted: { py.addImportPath(Qt.resolvedUrl("../src"))
py.addImportPath(Qt.resolvedUrl("../src"));
py.importModule("main", function(){ py.importModule("main", function(){
py.call("main.get_web_icons", [], function(apps){ py.call("main.get_web_icons", [], function(apps){
for(var i=0; i < apps.length; i++){ for(var i=0; i < apps.length; i++){
appsList.append({attrs: apps[i]}); appsList.append({attrs: apps[i]})
} }
}) })
}) })
} }
Python {
id: py
Component.onCompleted: {
mainList.reload()
}
}
} }
} }