Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/PreviewStage/PreviewMenu.qml')
-rw-r--r--plugins/PreviewStage/PreviewMenu.qml189
1 files changed, 91 insertions, 98 deletions
diff --git a/plugins/PreviewStage/PreviewMenu.qml b/plugins/PreviewStage/PreviewMenu.qml
index b331ff69c5..d660db549b 100644
--- a/plugins/PreviewStage/PreviewMenu.qml
+++ b/plugins/PreviewStage/PreviewMenu.qml
@@ -2,8 +2,7 @@
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
-
-import QtQuick.Controls 2.4
+import QtQuick.Controls 2.3
import UM 1.3 as UM
import Cura 1.1 as Cura
@@ -23,130 +22,124 @@ Item
name: "cura"
}
- Rectangle
- {
- anchors.fill: stageMenu
- anchors.leftMargin: -radius
- radius: UM.Theme.getSize("default_radius").width
- color: UM.Theme.getColor("toolbar_background")
- }
- Item
+ Row
{
- id: stageMenu
+ id: stageMenuRow
+ anchors.centerIn: parent
height: parent.height
- width: stageMenuRow.width + UM.Theme.getSize("default_margin").width
- anchors.horizontalCenter: parent.horizontalCenter
- Row
+
+ Cura.ExpandableComponent
{
- id: stageMenuRow
- anchors.centerIn: parent
+ id: viewSelector
+ iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
height: parent.height
+ width: UM.Theme.getSize("views_selector").width
+ headerCornerSide: Cura.RoundedRectangle.Direction.Left
- Cura.ExpandableComponent
- {
- id: viewSelector
- iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
- height: parent.height
-
- property var viewModel: UM.ViewModel { }
+ property var viewModel: UM.ViewModel { }
- property var activeView:
+ property var activeView:
+ {
+ for (var i = 0; i < viewModel.rowCount(); i++)
{
- for (var i = 0; i < viewModel.rowCount(); i++)
+ if (viewModel.items[i].active)
{
- if (viewModel.getItem(i).active)
- {
- return viewModel.getItem(i)
- }
+ return viewModel.items[i]
}
- // Nothing was active, so just return the first one (the list is sorted by priority, so the most
- // important one should be returned)
- return viewModel.getItem(0)
}
+ return null
+ }
- // Ensure that the controller is synced with whatever happend here.
- onActiveViewChanged: UM.Controller.setActiveView(activeView.id)
-
- headerItem: Label
+ 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)
{
- text: viewSelector.activeView.name
- verticalAlignment: Text.AlignVCenter
- height: parent.height
- elide: Text.ElideRight
- font: UM.Theme.getFont("default")
- color: UM.Theme.getColor("text")
+ UM.Controller.setActiveView(viewModel.getItem(0).id)
}
+ }
- popupItem: Column
- {
- id: viewSelectorPopup
- width: viewSelector.width - 2 * UM.Theme.getSize("default_margin").width
+ 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
+ }
- // 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
- }
+ 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
+ Repeater
+ {
+ id: viewsList
+ model: viewSelector.viewModel
+ RoundButton
{
- 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:
{
- text: name
- radius: UM.Theme.getSize("default_radius").width
- checkable: true
- checked: active
- onClicked:
- {
- viewSelector.togglePopup()
- UM.Controller.setActiveView(id)
- }
+ viewSelector.togglePopup()
+ UM.Controller.setActiveView(id)
}
}
-
}
+
}
+ }
- // Separator line
- Rectangle
- {
- height: parent.height
- // If there is no viewPanel, we only need a single spacer, so hide this one.
- visible: viewPanel.source != ""
- width: visible ? UM.Theme.getSize("default_lining").width : 0
+ // Separator line
+ Rectangle
+ {
+ height: parent.height
+ // If there is no viewPanel, we only need a single spacer, so hide this one.
+ visible: viewPanel.source != ""
+ width: visible ? UM.Theme.getSize("default_lining").width : 0
- color: UM.Theme.getColor("lining")
- }
+ color: UM.Theme.getColor("lining")
+ }
- Loader
- {
- id: viewPanel
- height: parent.height
- width: childrenRect.width
- source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : ""
- }
+ Loader
+ {
+ id: viewPanel
+ height: parent.height
+ width: childrenRect.width
+ source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : ""
+ }
- // Separator line
- Rectangle
- {
- height: parent.height
- width: UM.Theme.getSize("default_lining").width
- color: UM.Theme.getColor("lining")
- }
+ // Separator line
+ Rectangle
+ {
+ height: parent.height
+ width: UM.Theme.getSize("default_lining").width
+ color: UM.Theme.getColor("lining")
+ }
- Item
- {
- id: printSetupSelectorItem
- // This is a work around to prevent the printSetupSelector from having to be re-loaded every time
- // a stage switch is done.
- children: [printSetupSelector]
- height: childrenRect.height
- width: childrenRect.width
- }
+ Item
+ {
+ id: printSetupSelectorItem
+ // This is a work around to prevent the printSetupSelector from having to be re-loaded every time
+ // a stage switch is done.
+ children: [printSetupSelector]
+ height: childrenRect.height
+ width: childrenRect.width
}
}
}