mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 21:44:01 -06:00
Added missing file
This commit is contained in:
parent
e6aec0c64b
commit
8046e72a10
1 changed files with 167 additions and 0 deletions
167
resources/qml/Preferences/SettingVisibilityPage.qml
Normal file
167
resources/qml/Preferences/SettingVisibilityPage.qml
Normal file
|
@ -0,0 +1,167 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Uranium is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
UM.PreferencesPage
|
||||
{
|
||||
title: catalog.i18nc("@title:tab", "Setting Visibility");
|
||||
|
||||
property int scrollToIndex: 0
|
||||
|
||||
signal scrollToSection( string key )
|
||||
onScrollToSection:
|
||||
{
|
||||
settingsListView.positionViewAtIndex(definitionsModel.getIndex(key), ListView.Beginning)
|
||||
}
|
||||
|
||||
function reset()
|
||||
{
|
||||
UM.Preferences.resetPreference("general/visible_settings")
|
||||
}
|
||||
resetEnabled: true;
|
||||
|
||||
Item
|
||||
{
|
||||
id: base;
|
||||
anchors.fill: parent;
|
||||
|
||||
CheckBox
|
||||
{
|
||||
id: toggleVisibleSettings
|
||||
anchors
|
||||
{
|
||||
verticalCenter: filter.verticalCenter;
|
||||
left: parent.left;
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
text: catalog.i18nc("@label:textbox", "Check all")
|
||||
checkedState:
|
||||
{
|
||||
if(definitionsModel.visibleCount == definitionsModel.categoryCount)
|
||||
{
|
||||
return Qt.Unchecked
|
||||
}
|
||||
else if(definitionsModel.visibleCount == definitionsModel.rowCount(null))
|
||||
{
|
||||
return Qt.Checked
|
||||
}
|
||||
else
|
||||
{
|
||||
return Qt.PartiallyChecked
|
||||
}
|
||||
}
|
||||
partiallyCheckedEnabled: true
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent;
|
||||
onClicked:
|
||||
{
|
||||
if(parent.checkedState == Qt.Unchecked || parent.checkedState == Qt.PartiallyChecked)
|
||||
{
|
||||
definitionsModel.setAllVisible(true)
|
||||
}
|
||||
else
|
||||
{
|
||||
definitionsModel.setAllVisible(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
id: filter;
|
||||
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
left: toggleVisibleSettings.right
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
placeholderText: catalog.i18nc("@label:textbox", "Filter...")
|
||||
|
||||
onTextChanged: definitionsModel.filter = {"label": "*" + text}
|
||||
}
|
||||
|
||||
ScrollView
|
||||
{
|
||||
id: scrollView
|
||||
|
||||
frameVisible: true
|
||||
|
||||
anchors
|
||||
{
|
||||
top: filter.bottom;
|
||||
topMargin: UM.Theme.getSize("default_margin").height
|
||||
left: parent.left;
|
||||
right: parent.right;
|
||||
bottom: parent.bottom;
|
||||
}
|
||||
ListView
|
||||
{
|
||||
id: settingsListView
|
||||
|
||||
model: UM.SettingDefinitionsModel
|
||||
{
|
||||
id: definitionsModel
|
||||
containerId: Cura.MachineManager.activeDefinitionId
|
||||
showAll: true
|
||||
exclude: ["machine_settings"]
|
||||
expanded: ["*"]
|
||||
visibilityHandler: UM.SettingPreferenceVisibilityHandler { }
|
||||
}
|
||||
|
||||
delegate: Loader
|
||||
{
|
||||
id: loader
|
||||
|
||||
width: parent.width
|
||||
height: model.type != undefined ? UM.Theme.getSize("section").height : 0
|
||||
|
||||
property var definition: model
|
||||
property var settingDefinitionsModel: definitionsModel
|
||||
|
||||
asynchronous: true
|
||||
active: model.type != undefined
|
||||
sourceComponent:
|
||||
{
|
||||
switch(model.type)
|
||||
{
|
||||
case "category":
|
||||
return settingVisibilityCategory
|
||||
default:
|
||||
return settingVisibilityItem
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UM.I18nCatalog { name: "cura"; }
|
||||
SystemPalette { id: palette; }
|
||||
|
||||
Component
|
||||
{
|
||||
id: settingVisibilityCategory;
|
||||
|
||||
UM.SettingVisibilityCategory { }
|
||||
}
|
||||
|
||||
Component
|
||||
{
|
||||
id: settingVisibilityItem;
|
||||
|
||||
UM.SettingVisibilityItem { }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue