Add initial menu stub

This commit is contained in:
fieldOfView 2017-10-26 00:00:07 +02:00
parent 4bb67fbd82
commit 078fd074e5
2 changed files with 100 additions and 16 deletions

View file

@ -0,0 +1,55 @@
// Copyright (c) 2017 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Controls 1.1
import UM 1.2 as UM
import Cura 1.0 as Cura
Menu
{
id: menu
title: "Visible Settings"
property bool showingSearchResults
property bool showingAllSettings
signal showAllSettings()
signal showSettingVisibilityProfile()
MenuItem
{
text: catalog.i18nc("@action:inmenu", "Normal Set")
checkable: true
checked: !showingSearchResults && !showingAllSettings
exclusiveGroup: group
onTriggered: showAllSettings()
}
MenuSeparator {}
MenuItem
{
text: catalog.i18nc("@action:inmenu", "Search Results")
checkable: true
visible: showingSearchResults
checked: showingSearchResults
exclusiveGroup: group
}
MenuItem
{
text: catalog.i18nc("@action:inmenu", "All Settings")
checkable: true
checked: showingAllSettings
exclusiveGroup: group
onTriggered: showAllSettings()
}
MenuSeparator {}
MenuItem
{
text: catalog.i18nc("@action:inmenu", "Manage Visibility Profiles...")
iconName: "configure"
onTriggered: Cura.Actions.configureSettingVisibility.trigger()
}
ExclusiveGroup { id: group }
}

View file

@ -15,10 +15,11 @@ Item
{ {
id: base; id: base;
property Action configureSettings; property Action configureSettings
property bool findingSettings; property bool findingSettings
signal showTooltip(Item item, point location, string text); property bool showingAllSettings
signal hideTooltip(); signal showTooltip(Item item, point location, string text)
signal hideTooltip()
Item Item
{ {
@ -153,7 +154,26 @@ Item
} }
label: Label{} label: Label{}
} }
menu: Menu {} menu: SettingVisibilityProfilesMenu
{
showingSearchResults: findingSettings
showingAllSettings: showingAllSettings
onShowAllSettings:
{
base.showingAllSettings = true;
base.findingSettings = false;
filter.text = "";
filter.updateDefinitionModel();
}
onShowSettingVisibilityProfile:
{
base.showingAllSettings = false;
base.findingSettings = false;
filter.text = "";
filter.updateDefinitionModel();
}
}
} }
Rectangle Rectangle
@ -217,17 +237,9 @@ Item
{ {
if(findingSettings) if(findingSettings)
{ {
expandedCategories = definitionsModel.expanded.slice(); showingAllSettings = false;
definitionsModel.expanded = ["*"];
definitionsModel.showAncestors = true;
definitionsModel.showAll = true;
}
else
{
definitionsModel.expanded = expandedCategories;
definitionsModel.showAncestors = false;
definitionsModel.showAll = false;
} }
updateDefinitionModel();
lastFindingSettings = findingSettings; lastFindingSettings = findingSettings;
} }
} }
@ -236,6 +248,23 @@ Item
{ {
filter.text = ""; filter.text = "";
} }
function updateDefinitionModel()
{
if(findingSettings || base.showingAllSettings)
{
expandedCategories = definitionsModel.expanded.slice();
definitionsModel.expanded = ["*"];
definitionsModel.showAncestors = true;
definitionsModel.showAll = true;
}
else
{
definitionsModel.expanded = expandedCategories;
definitionsModel.showAncestors = false;
definitionsModel.showAll = false;
}
}
} }
MouseArea MouseArea
@ -258,7 +287,7 @@ Item
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width anchors.rightMargin: UM.Theme.getSize("default_margin").width
color: UM.Theme.getColor("setting_control_button") color: UM.Theme.getColor("setting_control_button")
hoverColor: UM.Theme.getColor("setting_control_button_hover") hoverColor: UM.Theme.getColor("setting_control_button_hover")