2
import QtQuick.Layouts 1.0
3
import QtQuick.Controls 1.0 as Controls
5
import Ubuntu.Components 1.0
6
import Ubuntu.Components.ListItems 1.0 as ListItem
7
import Ubuntu.DevicesModel 0.1
8
import Ubuntu.Components.Popups 1.0
10
import "../Components"
18
anchors.topMargin: units.gu(2)
19
anchors.bottomMargin: units.gu(2)
20
anchors.leftMargin: units.gu(2)
21
anchors.rightMargin: units.gu(4)
22
visible: devicesModel.busy
24
//anchors.centerIn: parent
26
anchors.left: parent.left
27
anchors.top: parent.top
28
anchors.right: parent.right
31
height: childrenRect.height * 2
34
anchors.verticalCenter: parent.verticalCenter
35
running: devicesModel.busy
38
Layout.fillWidth: true
39
anchors.verticalCenter: parent.verticalCenter
40
text: i18n.tr("There is currently a process running in the background, please check the logs for details")
44
visible: devicesModel.cancellable
45
anchors.verticalCenter: parent.verticalCenter
46
color: UbuntuColors.warmGrey
48
onClicked: devicesModel.cancel()
53
anchors.left: parent.left
54
anchors.top: busyIndicator.bottom
55
anchors.right: parent.right
56
anchors.bottom: parent.bottom
59
textFormat: TextEdit.AutoText
60
Component.onCompleted: {
61
deviceMode.appendText.connect(appendToLog);
64
function appendToLog (txt) {
71
if(!devicesModel.busy)
79
orientation: Qt.Horizontal
81
visible: !devicesModel.busy
83
orientation: Qt.Vertical
85
Layout.minimumWidth: 200
86
Layout.maximumWidth: 400
89
Layout.fillHeight: true
92
objectName: "devicesList"
95
delegate: ListItem.Standard {
98
selected: devicesList.currentIndex == index
99
onClicked: devicesList.currentIndex = index
100
property alias editor: editor
107
property bool changed: false
108
Keys.onEscapePressed: {
113
devicesList.incrementCurrentIndex();
115
Keys.onReturnPressed: {
119
onActiveFocusChanged: {
147
enabled: parent.visible
150
acceptedButtons: Qt.AllButtons
151
onPressed: parent.close()
156
target: delegate.__mouseArea
163
onCurrentIndexChanged: deviceMode.deviceSelected(currentIndex)
167
Layout.fillWidth: true
168
Layout.minimumHeight: units.gu(5)
169
Layout.maximumHeight: units.gu(5)
173
Controls.ToolButton {
174
text: i18n.tr("Refresh devices")
176
iconSource: "qrc:/ubuntu/images/reload.svg"
177
onClicked: devicesModel.refresh()
179
Controls.ToolButton {
180
text: i18n.tr("Add Emulator")
182
iconSource: "qrc:/ubuntu/images/list-add.svg"
184
if(!devicesModel.emulatorInstalled){
185
PopupUtils.open(resourceRoot+"/EmulatorNotInstalled.qml",devicePage);
188
PopupUtils.open(resourceRoot+"/NewEmulatorDialog.qml",devicePage);
194
onOpenAddEmulatorDialog: PopupUtils.open(resourceRoot+"/NewEmulatorDialog.qml",devicePage);
202
Layout.minimumWidth: 400
203
Layout.fillWidth: true
206
property int currentIndex: devicesList.currentIndex
211
property bool deviceConnected: connectionState === DeviceConnectionState.ReadyToUse || connectionState === DeviceConnectionState.Connected
212
property bool deviceBusy: (detectionState != DeviceDetectionState.Done && detectionState != DeviceDetectionState.NotStarted)
213
property bool deviceBooting: detectionState === DeviceDetectionState.Booting || detectionState === DeviceDetectionState.WaitForEmulator
214
property bool detectionError: detectionState === DeviceDetectionState.Error
217
color: Qt.rgba(0.0, 0.0, 0.0, 0.01)
218
visible: index == devicesList.currentIndex
223
height: visible ? units.gu(5) : 0
224
anchors.left: parent.left
225
anchors.right: parent.right
226
anchors.top: parent.top
230
Controls.ToolButton {
231
text: i18n.tr("Run Emulator")
233
iconSource: "qrc:/projectexplorer/images/run.png"
234
onClicked: devicesModel.startEmulator(emulatorImageName)
235
visible: connectionState === DeviceConnectionState.Disconnected && machineType === DeviceMachineType.Emulator
237
Controls.ToolButton {
238
text: i18n.tr("Stop Emulator")
240
iconSource: "qrc:/projectexplorer/images/stop.png"
241
onClicked: devicesModel.stopEmulator(emulatorImageName)
242
visible: connectionState !== DeviceConnectionState.Disconnected && machineType === DeviceMachineType.Emulator
244
Controls.ToolButton {
245
text: i18n.tr("Delete")
247
iconSource: "qrc:/core/images/clear.png"
249
if(machineType === DeviceMachineType.Emulator)
250
PopupUtils.open(resourceRoot+"/DeleteDeviceDialog.qml",devicePage, {"emulatorImageName": emulatorImageName,"deviceId": -1 });
252
PopupUtils.open(resourceRoot+"/DeleteDeviceDialog.qml",devicePage, {"deviceId": deviceId});
254
enabled: connectionState === DeviceConnectionState.Disconnected
261
anchors.left: parent.left
262
anchors.right: parent.right
263
anchors.top: emulatorToolBar.bottom
264
anchors.bottom: parent.bottom
269
divider.visible: false
270
visible: detectionError
271
height: errorText.contentHeight + units.gu(4)
274
anchors.rightMargin: units.gu(4)
277
source: "qrc:/ubuntu/images/security-alert.svg"
278
fillMode: Image.PreserveAspectFit
279
Layout.maximumHeight: errorContainer.height
283
text: i18n.tr("There was a error in the device detection, check the log for details.")
286
Layout.fillWidth: true
289
id: deviceRedetectButton
291
onClicked: devicesModel.triggerRedetect(deviceId)
297
divider.visible: false
298
visible: deviceItemView.deviceBooting
301
anchors.leftMargin: units.gu(2)
302
anchors.rightMargin: units.gu(4)
304
running: deviceItemView.deviceBooting
305
height:parent.height - units.gu(2)
309
text: i18n.tr("The device is currently booting, if this text is still shown after the device has booted, press the refresh button.")
312
Layout.fillWidth: true
316
onClicked: devicesModel.triggerRedetect(deviceId)
322
title: deviceItemView.deviceConnected ? "Device Status: "+detectionStateString : "Device Status: Disconnected"
326
anchors.left: parent.left
327
anchors.right: parent.right
329
ListItem.SingleValue {
330
visible: deviceItemView.deviceConnected || machineType !== DeviceMachineType.Emulator
331
text:i18n.tr("Serial ID")
334
ListItem.SingleValue {
335
text: i18n.tr("Ubuntu version")
336
value: emuUbuntuVersion
337
visible: machineType === DeviceMachineType.Emulator
339
ListItem.SingleValue {
340
text: i18n.tr("Device version")
341
value: emuDeviceVersion
342
visible: machineType === DeviceMachineType.Emulator
344
ListItem.SingleValue {
345
text: i18n.tr("Image version")
346
value: emuImageVersion
347
visible: machineType === DeviceMachineType.Emulator
350
//show this listitem only when device is not connected
351
visible: machineType === DeviceMachineType.Emulator && !deviceItemView.deviceConnected
353
control: Controls.ComboBox {
354
id: emulatorScaleComboBox
355
model: ["1.0", "0.9", "0.8", "0.7", "0.6","0.5", "0.4", "0.3", "0.2","0.1"]
357
var idx = find(emulatorScaleFactor);
358
return idx >= 0 ? idx : 0;
361
emulatorScaleFactor = textAt(index);
367
//show this listitem only when device is not connected
368
visible: machineType === DeviceMachineType.Emulator && !deviceItemView.deviceConnected
370
control: Controls.ComboBox {
371
id: emulatorMemoryComboBox
372
model: ["512", "768", "1024"]
375
var idx = find(emulatorMemorySetting);
376
return idx >= 0 ? idx : 0;
379
emulatorMemorySetting = textAt(index);
383
ListItem.SingleValue {
384
text:i18n.tr("Device")
386
visible: deviceItemView.deviceConnected
388
ListItem.SingleValue {
389
text:i18n.tr("Model")
391
visible: deviceItemView.deviceConnected
393
ListItem.SingleValue {
394
text:i18n.tr("Product")
396
visible: deviceItemView.deviceConnected
400
text: "Has network connection"
401
input: hasNetworkConnection
402
inputRole: "hasNetworkConnection"
403
checkable: hasNetworkConnection == FeatureState.NotAvailable && !deviceItemView.deviceBusy && !deviceItemView.detectionError
404
visible: deviceItemView.deviceConnected
407
text: "Has developer mode enabled"
408
input: developerModeEnabled
409
inputRole: "developerModeEnabled"
410
checkable: !deviceItemView.deviceBusy && !deviceItemView.detectionError
411
visible: deviceItemView.deviceConnected
415
text: "Has writeable image"
416
input: hasWriteableImage
417
inputRole: "hasWriteableImage"
419
visible: deviceItemView.deviceConnected
430
anchors.left: parent.left
431
anchors.right: parent.right
435
delegate: ListItem.Standard {
436
text: modelData.displayName
437
Layout.fillWidth: true
440
enabled: !deviceItemView.deviceBusy
441
onClicked: devicesModel.triggerKitRemove(deviceId,modelData.id)
448
visible: kits.length === 0
449
height: label.contentHeight + units.gu(15)
453
anchors.centerIn: parent
454
anchors.bottom: button.top
456
text: "There is currently no Kit defined for your device.\n In order to use the device in your Projects,\n you can either add a existing Kit "
457
+"\nor let Qt Creator autocreate one for you."
461
anchors.left: label.left
462
anchors.right: label.right
463
anchors.top: label.bottom
464
anchors.bottom: parent.bottom
465
anchors.topMargin: units.gu(2)
467
enabled: !deviceItemView.deviceBusy
468
onClicked: devicesModel.triggerKitAutocreate(deviceId)
478
visible: deviceItemView.deviceConnected
481
anchors.left: parent.left
482
anchors.right: parent.right
485
text:"Clone time config from Host to Device"
488
enabled: !deviceItemView.deviceBusy && !deviceItemView.detectionError
489
onClicked: devicesModel.triggerCloneTimeConfig(deviceId)
493
text:"Enable port forwarding"
496
enabled: !deviceItemView.deviceBusy && !deviceItemView.detectionError
497
onClicked: devicesModel.triggerPortForwarding(deviceId)
501
text:"Setup public key authentication"
504
enabled: !deviceItemView.deviceBusy && !deviceItemView.detectionError
505
onClicked: devicesModel.triggerSSHSetup(deviceId)
509
text:"Open SSH connection to the device"
512
enabled: !deviceItemView.deviceBusy && !deviceItemView.detectionError
513
onClicked: devicesModel.triggerSSHConnection(deviceId)
520
enabled: !deviceItemView.deviceBusy && !deviceItemView.detectionError
521
onClicked: devicesModel.triggerReboot(deviceId)
525
text:"Restart to bootloader"
528
enabled: !deviceItemView.deviceBusy && !deviceItemView.detectionError
529
onClicked: devicesModel.triggerRebootBootloader(deviceId)
533
text:"Restart to recovery"
536
enabled: !deviceItemView.deviceBusy && !deviceItemView.detectionError
537
onClicked: devicesModel.triggerRebootRecovery(deviceId)
544
enabled: !deviceItemView.deviceBusy && !deviceItemView.detectionError
545
onClicked: devicesModel.triggerShutdown(deviceId)
554
anchors.left: parent.left
555
anchors.right: parent.right
559
anchors.left: parent.left
560
anchors.right: parent.right
566
textFormat: TextEdit.AutoText