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;
property Action configureSettings;
property bool findingSettings;
signal showTooltip(Item item, point location, string text);
signal hideTooltip();
property Action configureSettings
property bool findingSettings
property bool showingAllSettings
signal showTooltip(Item item, point location, string text)
signal hideTooltip()
Item
{
@ -153,7 +154,26 @@ Item
}
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
@ -216,6 +236,22 @@ Item
if(findingSettings != lastFindingSettings)
{
if(findingSettings)
{
showingAllSettings = false;
}
updateDefinitionModel();
lastFindingSettings = findingSettings;
}
}
Keys.onEscapePressed:
{
filter.text = "";
}
function updateDefinitionModel()
{
if(findingSettings || base.showingAllSettings)
{
expandedCategories = definitionsModel.expanded.slice();
definitionsModel.expanded = ["*"];
@ -228,13 +264,6 @@ Item
definitionsModel.showAncestors = false;
definitionsModel.showAll = false;
}
lastFindingSettings = findingSettings;
}
}
Keys.onEscapePressed:
{
filter.text = "";
}
}
@ -258,7 +287,7 @@ Item
anchors.verticalCenter: parent.verticalCenter
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")
hoverColor: UM.Theme.getColor("setting_control_button_hover")