|
@@ -29,80 +29,12 @@ Item
|
|
anchors.centerIn: parent
|
|
anchors.centerIn: parent
|
|
height: parent.height
|
|
height: parent.height
|
|
|
|
|
|
- Cura.ExpandableComponent
|
|
|
|
|
|
+ Cura.ViewsSelector
|
|
{
|
|
{
|
|
- id: viewSelector
|
|
|
|
- iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
|
|
|
|
|
+ id: viewsSelector
|
|
height: parent.height
|
|
height: parent.height
|
|
width: UM.Theme.getSize("views_selector").width
|
|
width: UM.Theme.getSize("views_selector").width
|
|
headerCornerSide: Cura.RoundedRectangle.Direction.Left
|
|
headerCornerSide: Cura.RoundedRectangle.Direction.Left
|
|
-
|
|
|
|
- property var viewModel: UM.ViewModel { }
|
|
|
|
-
|
|
|
|
- property var activeView:
|
|
|
|
- {
|
|
|
|
- for (var i = 0; i < viewModel.rowCount(); i++)
|
|
|
|
- {
|
|
|
|
- if (viewModel.items[i].active)
|
|
|
|
- {
|
|
|
|
- return viewModel.items[i]
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return null
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Component.onCompleted:
|
|
|
|
- {
|
|
|
|
- // Nothing was active, so just return the first one (the list is sorted by priority, so the most
|
|
|
|
- // important one should be returned)
|
|
|
|
- if (activeView == null)
|
|
|
|
- {
|
|
|
|
- UM.Controller.setActiveView(viewModel.getItem(0).id)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- headerItem: Label
|
|
|
|
- {
|
|
|
|
- text: viewSelector.activeView ? viewSelector.activeView.name : ""
|
|
|
|
- verticalAlignment: Text.AlignVCenter
|
|
|
|
- height: parent.height
|
|
|
|
- elide: Text.ElideRight
|
|
|
|
- font: UM.Theme.getFont("default")
|
|
|
|
- color: UM.Theme.getColor("text")
|
|
|
|
- renderType: Text.NativeRendering
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- popupItem: Column
|
|
|
|
- {
|
|
|
|
- id: viewSelectorPopup
|
|
|
|
- width: viewSelector.width - 2 * UM.Theme.getSize("default_margin").width
|
|
|
|
-
|
|
|
|
- // For some reason the height/width of the column gets set to 0 if this is not set...
|
|
|
|
- Component.onCompleted:
|
|
|
|
- {
|
|
|
|
- height = implicitHeight
|
|
|
|
- width = viewSelector.width - 2 * UM.Theme.getSize("default_margin").width
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Repeater
|
|
|
|
- {
|
|
|
|
- id: viewsList
|
|
|
|
- model: viewSelector.viewModel
|
|
|
|
- RoundButton
|
|
|
|
- {
|
|
|
|
- text: name
|
|
|
|
- radius: UM.Theme.getSize("default_radius").width
|
|
|
|
- checkable: true
|
|
|
|
- checked: viewSelector.activeView != null ? viewSelector.activeView.id == id : false
|
|
|
|
- onClicked:
|
|
|
|
- {
|
|
|
|
- viewSelector.togglePopup()
|
|
|
|
- UM.Controller.setActiveView(id)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// Separator line
|
|
// Separator line
|