Use UM Dialog for AddMachineWizard

This commit is contained in:
Arjen Hiemstra 2015-04-29 17:42:09 +02:00
parent 2b2c624e4e
commit 06c5419054

View File

@ -5,69 +5,59 @@ import QtQuick.Window 2.1
import UM 1.0 as UM import UM 1.0 as UM
Window { UM.Dialog {
id: base id: base
width: 640
height: 480
//: Add Printer dialog title //: Add Printer dialog title
title: qsTr("Add Printer"); title: qsTr("Add Printer");
Rectangle { ColumnLayout {
anchors.fill: parent; anchors.fill: parent;
color: palette.window; anchors.margins: UM.Styles.defaultMargin;
ColumnLayout { Label {
anchors.fill: parent; text: qsTr("Add Printer");
anchors.margins: UM.Styles.defaultMargin; font.pointSize: 18;
}
Label { Label {
text: qsTr("Please select the type of printer:"); text: qsTr("Please select the type of printer:");
} }
ScrollView { ScrollView {
Layout.fillWidth: true; Layout.fillWidth: true;
ListView { ListView {
id: machineList; id: machineList;
model: UM.Models.availableMachinesModel model: UM.Models.availableMachinesModel
delegate: RadioButton { exclusiveGroup: printerGroup; text: model.name; onClicked: ListView.view.currentIndex = index; } delegate: RadioButton { exclusiveGroup: printerGroup; text: model.name; onClicked: ListView.view.currentIndex = index; }
}
}
Label {
text: qsTr("Printer Name:");
}
TextField { id: machineName; Layout.fillWidth: true; text: machineList.model.getItem(machineList.currentIndex).name }
Item { Layout.fillWidth: true; Layout.fillHeight: true; }
ExclusiveGroup { id: printerGroup; }
RowLayout {
Layout.fillWidth: true
Item { Layout.fillWidth: true; }
Button {
text: qsTr("Next");
onClicked: {
if(machineList.currentIndex != -1) {
UM.Models.availableMachinesModel.createMachine(machineList.currentIndex, machineName.text)
base.visible = false
}
}
}
Button {
text: qsTr("Cancel");
onClicked: base.visible = false;
}
} }
} }
Label {
text: qsTr("Printer Name:");
}
TextField { id: machineName; Layout.fillWidth: true; text: machineList.model.getItem(machineList.currentIndex).name }
Item { Layout.fillWidth: true; Layout.fillHeight: true; }
ExclusiveGroup { id: printerGroup; }
} }
SystemPalette { id: palette; colorGroup: SystemPalette.Active } rightButtons: [
Button {
text: qsTr("Next");
onClicked: {
if(machineList.currentIndex != -1) {
UM.Models.availableMachinesModel.createMachine(machineList.currentIndex, machineName.text)
base.visible = false
}
}
},
Button {
text: qsTr("Cancel");
onClicked: base.visible = false;
}
]
} }