Add a combo box and menu entries to select the current machine variant

This commit is contained in:
Arjen Hiemstra 2015-08-11 17:36:05 +02:00
parent 255caf8693
commit 900e733839
2 changed files with 41 additions and 1 deletions

View file

@ -135,6 +135,23 @@ UM.MainWindow {
MenuSeparator { }
Instantiator {
model: UM.MachineVariantsModel { }
MenuItem {
text: model.name;
checkable: true;
checked: model.active;
exclusiveGroup: machineVariantsGroup;
onTriggered: UM.MachineManager.setActiveMachineVariant(model.name)
}
onObjectAdded: machineMenu.insertItem(index, object)
onObjectRemoved: machineMenu.removeItem(object)
}
ExclusiveGroup { id: machineVariantsGroup; }
MenuSeparator { visible: UM.MachineManager.hasVariants; }
MenuItem { action: actions.addMachine; }
MenuItem { action: actions.configureMachines; }
}

View file

@ -6,7 +6,7 @@ import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import UM 1.0 as UM
import UM 1.1 as UM
Rectangle {
id: base;
@ -60,6 +60,28 @@ Rectangle {
onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex);
}
Item {
Layout.fillWidth: true;
implicitHeight: UM.Theme.sizes.setting.height;
visible: UM.MachineManager.hasVariants;
Row {
spacing: UM.Theme.sizes.default_margin.width;
Label {
anchors.verticalCenter: parent.verticalCenter;
text: "Variant";
}
ComboBox {
anchors.verticalCenter: parent.verticalCenter;
model: UM.MachineVariantsModel { }
textRole: "name"
onActivated: UM.MachineManager.setActiveMachineVariant(model.getItem(index).name);
}
}
}
Item {
Layout.fillWidth: true;
implicitHeight: UM.Theme.sizes.setting.height;
@ -83,6 +105,7 @@ Rectangle {
}
}
}
Loader {
id: sidebarContents;