| 1 |
import QtQuick 2.2 |
| 2 |
import QtQuick.Controls 1.1 |
| 3 |
import QtQuick.Dialogs 1.1 |
| 4 |
import QtQuick.Layouts 1.1 |
| 5 |
import QtQuick.Window 2.0 |
| 6 |
import "UI" 1.0 |
| 7 |
|
| 8 |
Item { |
| 9 |
id: main |
| 10 |
property string newLine: i.newLine |
| 11 |
property string details: "" |
| 12 |
property string lasterror: "\n" |
| 13 |
onNewLineChanged: details += i.newLine |
| 14 |
visible: i.device !== null && i.completed && !i.loginBlock && !i.wrongPass |
| 15 |
anchors.fill: parent |
| 16 |
|
| 17 |
Button { |
| 18 |
visible: i.dgProgress >= 0 && !installWin.visible |
| 19 |
anchors {bottom: parent.bottom; bottomMargin: 10; horizontalCenter: parent.horizontalCenter } |
| 20 |
text: qsTr("View Install (%1)").arg(i.dgProgress) + translator.lang |
| 21 |
onClicked: installWin.visible = true |
| 22 |
} |
| 23 |
Window { |
| 24 |
visible: i.extractInstallZip |
| 25 |
color: "lightgray" |
| 26 |
width: patientText.width + 20 |
| 27 |
height: patientText.height + 20 |
| 28 |
onVisibleChanged: if (visible) { |
| 29 |
x = window.x + (window.width - width) / 2 |
| 30 |
y = window.y + (window.height - height) / 2 |
| 31 |
} |
| 32 |
Label { |
| 33 |
id: patientText |
| 34 |
text: qsTr("Please be patient while the installation zip is extracted.") + translator.lang |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
Window { |
| 39 |
id: installWin |
| 40 |
visible: i.dgProgress >= 0 |
| 41 |
width: parent.width / 3; height: Math.min(parent.height / 2, width + 20); |
| 42 |
onVisibleChanged: if (visible) { |
| 43 |
x = window.x + (window.width - width) / 2 |
| 44 |
y = window.y + (window.height - height) / 2 |
| 45 |
} |
| 46 |
color: "lightgray" |
| 47 |
title: (i.firmwareUpdate ? qsTr("Firmware Update") : qsTr("Install")) + translator.lang |
| 48 |
|
| 49 |
CircleProgress { |
| 50 |
width: parent.width |
| 51 |
height: parent.height |
| 52 |
anchors.bottom: parent.bottom |
| 53 |
currentValue: i.curDGProgress |
| 54 |
overallValue: i.dgProgress |
| 55 |
curId: i.dgPos + 1 |
| 56 |
maxId: i.dgMaxPos |
| 57 |
statusText: ((i.curDGProgress != 100) ? ( i.curDGProgress < 50 ? qsTr("Sending") : qsTr("Installing")) : qsTr("Sent")) + translator.lang |
| 58 |
text: i.curInstallName |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
DropArea { |
| 63 |
id: dragArea |
| 64 |
anchors.fill: parent |
| 65 |
onDropped: { |
| 66 |
if (drop.hasUrls) { |
| 67 |
i.install(drop.urls); |
| 68 |
tabs.currentIndex = 1 |
| 69 |
} |
| 70 |
} |
| 71 |
} |
| 72 |
Rectangle { |
| 73 |
anchors.fill: parent |
| 74 |
color: dragArea.containsDrag ? Qt.rgba(0.2,0.2,0.6,0.1) : Qt.rgba(0.0,0.0,0.0,0.0) |
| 75 |
} |
| 76 |
|
| 77 |
ColumnLayout { |
| 78 |
anchors {fill: parent; margins: 15 } |
| 79 |
Label { |
| 80 |
Layout.fillWidth: true |
| 81 |
text: qsTr("To install <b>.bar</b> files such as applications or firmware, you can just <b>Drag and Drop</b> to this page. Otherwise, select the options below:") + translator.lang |
| 82 |
wrapMode: Text.Wrap |
| 83 |
font.pointSize: 12 |
| 84 |
} |
| 85 |
Row { |
| 86 |
spacing: 15 |
| 87 |
FileDialog { |
| 88 |
id: install_files |
| 89 |
title: qsTr("Install applications to device") + translator.lang |
| 90 |
folder: settings.installFolder |
| 91 |
onAccepted: { |
| 92 |
i.install(fileUrls) |
| 93 |
tabs.currentIndex = 1 |
| 94 |
settings.installFolder = folder; |
| 95 |
} |
| 96 |
|
| 97 |
selectMultiple: true |
| 98 |
nameFilters: [ qsTr("Blackberry Installable (*.bar)") + translator.lang ] |
| 99 |
} |
| 100 |
Button { |
| 101 |
text: qsTr("Install Folder") + translator.lang |
| 102 |
onClicked: { |
| 103 |
if (i.installing) |
| 104 |
details += qsTr("Error: Your device can only process one task at a time. Please wait for previous install to complete.<br>") + translator.lang |
| 105 |
else if (i.backing || i.restoring) |
| 106 |
details += qsTr("Error: Your device can only process one task at a time. Please wait for backup/restore process to complete.<br>") + translator.lang |
| 107 |
else { |
| 108 |
install_files.title = qsTr("Select Folder") + translator.lang |
| 109 |
install_files.selectFolder = true; |
| 110 |
install_files.open(); |
| 111 |
} |
| 112 |
} |
| 113 |
} |
| 114 |
Button { |
| 115 |
text: qsTr("Install Files") + translator.lang |
| 116 |
onClicked: { |
| 117 |
if (i.installing) |
| 118 |
details += qsTr("Error: Your device can only process one task at a time. Please wait for previous install to complete.<br>") + translator.lang |
| 119 |
else if (i.backing || i.restoring) |
| 120 |
details += qsTr("Error: Your device can only process one task at a time. Please wait for backup/restore process to complete.<br>") + translator.lang |
| 121 |
else { |
| 122 |
install_files.title = qsTr("Select Files") + translator.lang |
| 123 |
install_files.selectFolder = false; |
| 124 |
install_files.selectMultiple = true; |
| 125 |
install_files.open(); |
| 126 |
} |
| 127 |
} |
| 128 |
} |
| 129 |
CheckBox { |
| 130 |
checked: !i.allowDowngrades |
| 131 |
onCheckedChanged: i.allowDowngrades = !checked |
| 132 |
text: qsTr("Only install newer apps") + translator.lang |
| 133 |
anchors.verticalCenter: parent.verticalCenter |
| 134 |
} |
| 135 |
} |
| 136 |
TabView { |
| 137 |
id: tabs |
| 138 |
Layout.alignment: Qt.AlignBottom |
| 139 |
Layout.fillHeight: true |
| 140 |
Layout.fillWidth: true |
| 141 |
|
| 142 |
Button { |
| 143 |
id: list_files |
| 144 |
anchors { top: parent.top; topMargin:-height; right: parent.right } |
| 145 |
enabled: i.device !== null && i.device.setupComplete |
| 146 |
text: qsTr("Refresh") + translator.lang |
| 147 |
onClicked: i.scanProps(); |
| 148 |
} |
| 149 |
|
| 150 |
// Applications |
| 151 |
Tab { |
| 152 |
title: qsTr("Your Applications") + translator.lang |
| 153 |
id: app_tab |
| 154 |
Item { |
| 155 |
Image { |
| 156 |
id: uninstall_notifier |
| 157 |
visible: uninstalling |
| 158 |
property bool uninstalling: false |
| 159 |
anchors {centerIn: parent; verticalCenterOffset: -parent.height / 4} |
| 160 |
source: "trash.png" |
| 161 |
width: 75; height: 75 |
| 162 |
opacity: 0.8 |
| 163 |
BusyIndicator { |
| 164 |
anchors.fill: parent |
| 165 |
} |
| 166 |
} |
| 167 |
Text { |
| 168 |
visible: appView.count == 0 |
| 169 |
anchors.centerIn: parent |
| 170 |
font.pointSize: 14 |
| 171 |
text: ((i.device === null) ? qsTr("Device disconnected") : (i.device.setupComplete ? qsTr("Use 'Refresh' to update list") : qsTr("Your device has not completed setup"))) + translator.lang |
| 172 |
} |
| 173 |
ScrollView { |
| 174 |
anchors.fill: parent |
| 175 |
ListView { |
| 176 |
id: appView |
| 177 |
anchors.fill: parent |
| 178 |
spacing: 3 |
| 179 |
clip: true |
| 180 |
model: i.appList |
| 181 |
Menu { |
| 182 |
id: apps_menu |
| 183 |
visible: appView.count > 0 |
| 184 |
title: qsTr("Options") + translator.lang |
| 185 |
MenuItem { |
| 186 |
text: qsTr("Uninstall Marked") + translator.lang |
| 187 |
iconSource: "trash.png" |
| 188 |
enabled: !i.installing |
| 189 |
onEnabledChanged: if (enabled && uninstall_notifier.uninstalling) { uninstall_notifier.uninstalling = false; } |
| 190 |
onTriggered: { if (i.uninstallMarked()) uninstall_notifier.uninstalling = true; } |
| 191 |
} |
| 192 |
MenuItem { |
| 193 |
text: qsTr("Show Installed Apps") + translator.lang |
| 194 |
iconSource: "text.png" |
| 195 |
onTriggered: i.exportInstalled(); |
| 196 |
} |
| 197 |
} |
| 198 |
|
| 199 |
MouseArea { |
| 200 |
enabled: appView.count > 0 |
| 201 |
acceptedButtons: Qt.RightButton |
| 202 |
onClicked: apps_menu.popup() |
| 203 |
anchors.fill: parent |
| 204 |
} |
| 205 |
delegate: Item { |
| 206 |
visible: type !== ""; |
| 207 |
width: parent.width - 3 |
| 208 |
height: type === "" ? 0 : 26 |
| 209 |
Rectangle { |
| 210 |
anchors.fill: parent |
| 211 |
color: { switch(type) { |
| 212 |
case "os": return "red"; |
| 213 |
case "radio": return "purple"; |
| 214 |
case "application": if (friendlyName.indexOf("sys.data") === 0) return "lightblue"; else return "steelblue"; |
| 215 |
default: return "transparent"; |
| 216 |
} |
| 217 |
} |
| 218 |
opacity: 0.2 |
| 219 |
} |
| 220 |
CheckBox { |
| 221 |
text: friendlyName |
| 222 |
width: Math.min(implicitWidth, parent.width - versionText.width) |
| 223 |
clip: true |
| 224 |
checked: isMarked |
| 225 |
onCheckedChanged: isMarked = checked; |
| 226 |
} |
| 227 |
Label { |
| 228 |
id: versionText |
| 229 |
anchors.right: parent.right |
| 230 |
text: version |
| 231 |
font.pointSize: 12; |
| 232 |
} |
| 233 |
} |
| 234 |
} |
| 235 |
} |
| 236 |
} |
| 237 |
} |
| 238 |
// Log |
| 239 |
Tab { |
| 240 |
title: qsTr("Log") + translator.lang |
| 241 |
Item { |
| 242 |
id: log_tab |
| 243 |
TextArea { |
| 244 |
id: updateMessage |
| 245 |
width: tabs.width; height: tabs.height |
| 246 |
textFormat: TextEdit.RichText |
| 247 |
selectByKeyboard: true |
| 248 |
wrapMode: TextEdit.WrapAnywhere |
| 249 |
readOnly: true |
| 250 |
text: details |
| 251 |
} |
| 252 |
} |
| 253 |
} |
| 254 |
} |
| 255 |
} |
| 256 |
} |