-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathPackagePage.qml
148 lines (134 loc) · 5.57 KB
/
PackagePage.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import QtQuick 2.0
import Sailfish.Silica 1.0
import org.nemomobile.lipstick 0.1 as Lipstick
import org.chum 1.0
import "../components"
Page {
property ChumPackage pkg
id: page
allowedOrientations: Orientation.All
SilicaFlickable {
anchors.fill: parent
contentHeight: content.height + Theme.paddingLarge
PullDownMenu {
busy: Chum.busy
MenuItem {
enabled: !Chum.busy
//% "Remove"
text: qsTrId("chum-uninstall")
visible: pkg.installed
//% "Removing"
onClicked: remorse.execute(qsTrId("chum-uninstalling"),
function() { Chum.uninstallPackage(pkg.id) } )
}
MenuItem {
//% "Source code"
text: qsTrId("chum-package-project-repo")
onClicked: Qt.openUrlExternally(pkg.repo)
visible: pkg.repo
}
MenuItem {
//% "Issue tracker"
text: qsTrId("chum-package-file-issue")
onClicked: Qt.openUrlExternally(pkg.urlIssues)
visible: pkg.urlIssues
}
MenuItem {
//% "Discussion forum"
text: qsTrId("chum-package-discussion-forum")
onClicked: Qt.openUrlExternally(pkg.urlForum)
visible: pkg.urlForum
}
MenuItem {
//% "Start application"
text: qsTrId("chum-launch")
visible: pkg.installed && pkg.desktopFile.length > 0
onClicked: {
launcher.filePath = pkg.desktopFile
console.debug("Application info:" ,JSON.stringify(launcher,null,2))
if (launcher.isValid && !launcher.isLaunching && !launcher.isUpdating) {
launcher.launchApplication()
}
}
Lipstick.LauncherItem{ id: launcher }
}
MenuItem {
enabled: !Chum.busy
text: pkg.installed
//% "Update"
? qsTrId("chum-update")
//% "Install"
: qsTrId("chum-install")
visible: !pkg.installed || pkg.updateAvailable
onClicked: pkg.installed
? Chum.updatePackage(pkg.id)
: Chum.installPackage(pkg.id)
}
}
RemorsePopup { id: remorse }
Column {
id: content
width: parent.width
spacing: Theme.paddingLarge
FancyPageHeader {
id: header
title: pkg.name
author: pkg.packager ? pkg.packager : pkg.developer
description: pkg.summary
iconSource: pkg.icon
packagerShown: pkg.packager
}
AppSummary {
pkg: page.pkg
}
AppInformation {
pkg: page.pkg
developerShown: header.packagerShown
shrunkHeight: Math.max(page.height/4, page.height - (y - content.y + content.spacing +
(screenshots.visible ? (screenshots.height+content.spacing) : 0) +
(btnReleases.visible ? btnReleases.implicitHeight : 0) +
(btnIssues.visible ? btnIssues.implicitHeight : 0) +
(btnReleases.visible || btnIssues.visible ? content.spacing : 0) +
(btnDonate.visible ? (btnDonate.height+content.spacing) : 0)))
enableExpansion: screenshots.visible || btnDonate.visible || btnReleases.visible || btnIssues.visible
}
ScreenshotsBox {
id: screenshots
screenshots: pkg.screenshots
}
Column {
width: parent.width
MoreButton {
id: btnReleases
visible: pkg.releasesCount > 0
//% "Releases (%1)"
text: qsTrId("chum-releases-number").arg(pkg.releasesCount)
onClicked: pageStack.push(Qt.resolvedUrl("../pages/ReleasesListPage.qml"), {
pkg: pkg,
releases: pkg.releases()
})
}
MoreButton {
id: btnIssues
visible: pkg.issuesCount > 0
//% "Issues (%1)"
text: qsTrId("chum-issues-number").arg(pkg.issuesCount)
onClicked: pageStack.push(Qt.resolvedUrl("../pages/IssuesListPage.qml"), {
pkg: pkg,
issues: pkg.issues()
})
}
}
Button {
id: btnDonate
anchors.horizontalCenter: parent.horizontalCenter
//% "Donate"
text: qsTrId("chum-package-donation")
visible: pkg.donation
onClicked: {
Qt.openUrlExternally(pkg.donation)
}
}
}
}
}