Changes to USB printer manager so its usable by other qml files

This commit is contained in:
Jaime van Kessel 2015-08-18 14:12:48 +02:00
parent c20b3bc2d5
commit c95cf5263b
4 changed files with 69 additions and 26 deletions

View file

@ -13,13 +13,12 @@ Column
id: wizardPage
property string title
anchors.fill: parent;
Label
{
text: parent.title
font.pointSize: 18;
}
Component.onCompleted: console.log(UM.USBPrinterManager.connectedPrinterList.count)
Label
{
//: Add Printer wizard page description
@ -33,14 +32,26 @@ Column
ListView
{
id: machineList;
model: UM.Models.availableMachinesModel
delegate: RadioButton
model: UM.USBPrinterManager.connectedPrinterList
delegate:Row
{
exclusiveGroup: printerGroup;
text: model.name;
onClicked:
id: derp
Text
{
ListView.view.currentIndex = index;
id: text_area
text: model.name
}
Button
{
text: "Update";
onClicked:
{
if(!UM.USBPrinterManager.updateFirmwareBySerial(text_area.text))
{
status_text.text = "ERROR"
}
}
}
}
}
@ -48,15 +59,10 @@ Column
Label
{
//: Add Printer wizard field label
text: qsTr("Printer Name:");
id: status_text
text: ""
}
TextField
{
id: machineName; Layout.fillWidth: true; text: machineList.model.getItem(machineList.currentIndex).name
}
Item
{
@ -64,8 +70,5 @@ Column
Layout.fillHeight: true;
}
ExclusiveGroup
{
id: printerGroup;
}
}