controlcenter: appearance pane async loader
This commit is contained in:
parent
76029cd8a0
commit
59c906d650
4 changed files with 171 additions and 150 deletions
|
|
@ -22,7 +22,7 @@ Item {
|
||||||
|
|
||||||
function onClicked(): void {
|
function onClicked(): void {
|
||||||
WindowFactory.create(null, {
|
WindowFactory.create(null, {
|
||||||
active: "appearance"
|
active: "network"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ Item {
|
||||||
|
|
||||||
function onClicked(): void {
|
function onClicked(): void {
|
||||||
WindowFactory.create(null, {
|
WindowFactory.create(null, {
|
||||||
active: "appearance"
|
active: "network"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -538,65 +538,72 @@ RowLayout {
|
||||||
title: qsTr("Material font family")
|
title: qsTr("Material font family")
|
||||||
expanded: true
|
expanded: true
|
||||||
|
|
||||||
StyledListView {
|
Loader {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: Math.min(contentHeight, 300)
|
Layout.preferredHeight: item ? Math.min(item.contentHeight, 300) : 0
|
||||||
|
asynchronous: true
|
||||||
clip: true
|
active: materialFontSection.expanded
|
||||||
spacing: Appearance.spacing.small / 2
|
|
||||||
model: Qt.fontFamilies()
|
|
||||||
|
|
||||||
delegate: StyledRect {
|
sourceComponent: StyledListView {
|
||||||
required property string modelData
|
id: materialFontList
|
||||||
required property int index
|
property alias contentHeight: materialFontList.contentHeight
|
||||||
|
|
||||||
width: ListView.view.width
|
clip: true
|
||||||
|
spacing: Appearance.spacing.small / 2
|
||||||
|
model: Qt.fontFamilies()
|
||||||
|
|
||||||
readonly property bool isCurrent: modelData === rootPane.fontFamilyMaterial
|
delegate: StyledRect {
|
||||||
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
required property string modelData
|
||||||
radius: Appearance.rounding.normal
|
required property int index
|
||||||
border.width: isCurrent ? 1 : 0
|
|
||||||
border.color: Colours.palette.m3primary
|
|
||||||
|
|
||||||
StateLayer {
|
width: ListView.view.width
|
||||||
function onClicked(): void {
|
|
||||||
rootPane.fontFamilyMaterial = modelData;
|
|
||||||
rootPane.saveConfig();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
readonly property bool isCurrent: modelData === rootPane.fontFamilyMaterial
|
||||||
id: fontFamilyMaterialRow
|
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
||||||
|
radius: Appearance.rounding.normal
|
||||||
|
border.width: isCurrent ? 1 : 0
|
||||||
|
border.color: Colours.palette.m3primary
|
||||||
|
|
||||||
anchors.left: parent.left
|
StateLayer {
|
||||||
anchors.right: parent.right
|
function onClicked(): void {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
rootPane.fontFamilyMaterial = modelData;
|
||||||
anchors.margins: Appearance.padding.normal
|
rootPane.saveConfig();
|
||||||
|
|
||||||
spacing: Appearance.spacing.normal
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: modelData
|
|
||||||
font.pointSize: Appearance.font.size.normal
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
active: isCurrent
|
|
||||||
asynchronous: true
|
|
||||||
|
|
||||||
sourceComponent: MaterialIcon {
|
|
||||||
text: "check"
|
|
||||||
color: Colours.palette.m3onSurfaceVariant
|
|
||||||
font.pointSize: Appearance.font.size.large
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
implicitHeight: fontFamilyMaterialRow.implicitHeight + Appearance.padding.normal * 2
|
RowLayout {
|
||||||
|
id: fontFamilyMaterialRow
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.margins: Appearance.padding.normal
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: modelData
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: isCurrent
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
|
sourceComponent: MaterialIcon {
|
||||||
|
text: "check"
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.font.size.large
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitHeight: fontFamilyMaterialRow.implicitHeight + Appearance.padding.normal * 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -606,65 +613,72 @@ RowLayout {
|
||||||
title: qsTr("Monospace font family")
|
title: qsTr("Monospace font family")
|
||||||
expanded: false
|
expanded: false
|
||||||
|
|
||||||
StyledListView {
|
Loader {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: Math.min(contentHeight, 300)
|
Layout.preferredHeight: item ? Math.min(item.contentHeight, 300) : 0
|
||||||
|
asynchronous: true
|
||||||
clip: true
|
active: monoFontSection.expanded
|
||||||
spacing: Appearance.spacing.small / 2
|
|
||||||
model: Qt.fontFamilies()
|
|
||||||
|
|
||||||
delegate: StyledRect {
|
sourceComponent: StyledListView {
|
||||||
required property string modelData
|
id: monoFontList
|
||||||
required property int index
|
property alias contentHeight: monoFontList.contentHeight
|
||||||
|
|
||||||
width: ListView.view.width
|
clip: true
|
||||||
|
spacing: Appearance.spacing.small / 2
|
||||||
|
model: Qt.fontFamilies()
|
||||||
|
|
||||||
readonly property bool isCurrent: modelData === rootPane.fontFamilyMono
|
delegate: StyledRect {
|
||||||
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
required property string modelData
|
||||||
radius: Appearance.rounding.normal
|
required property int index
|
||||||
border.width: isCurrent ? 1 : 0
|
|
||||||
border.color: Colours.palette.m3primary
|
|
||||||
|
|
||||||
StateLayer {
|
width: ListView.view.width
|
||||||
function onClicked(): void {
|
|
||||||
rootPane.fontFamilyMono = modelData;
|
|
||||||
rootPane.saveConfig();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
readonly property bool isCurrent: modelData === rootPane.fontFamilyMono
|
||||||
id: fontFamilyMonoRow
|
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
||||||
|
radius: Appearance.rounding.normal
|
||||||
|
border.width: isCurrent ? 1 : 0
|
||||||
|
border.color: Colours.palette.m3primary
|
||||||
|
|
||||||
anchors.left: parent.left
|
StateLayer {
|
||||||
anchors.right: parent.right
|
function onClicked(): void {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
rootPane.fontFamilyMono = modelData;
|
||||||
anchors.margins: Appearance.padding.normal
|
rootPane.saveConfig();
|
||||||
|
|
||||||
spacing: Appearance.spacing.normal
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: modelData
|
|
||||||
font.pointSize: Appearance.font.size.normal
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
active: isCurrent
|
|
||||||
asynchronous: true
|
|
||||||
|
|
||||||
sourceComponent: MaterialIcon {
|
|
||||||
text: "check"
|
|
||||||
color: Colours.palette.m3onSurfaceVariant
|
|
||||||
font.pointSize: Appearance.font.size.large
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
implicitHeight: fontFamilyMonoRow.implicitHeight + Appearance.padding.normal * 2
|
RowLayout {
|
||||||
|
id: fontFamilyMonoRow
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.margins: Appearance.padding.normal
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: modelData
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: isCurrent
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
|
sourceComponent: MaterialIcon {
|
||||||
|
text: "check"
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.font.size.large
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitHeight: fontFamilyMonoRow.implicitHeight + Appearance.padding.normal * 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -674,65 +688,72 @@ RowLayout {
|
||||||
title: qsTr("Sans-serif font family")
|
title: qsTr("Sans-serif font family")
|
||||||
expanded: false
|
expanded: false
|
||||||
|
|
||||||
StyledListView {
|
Loader {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: Math.min(contentHeight, 300)
|
Layout.preferredHeight: item ? Math.min(item.contentHeight, 300) : 0
|
||||||
|
asynchronous: true
|
||||||
clip: true
|
active: sansFontSection.expanded
|
||||||
spacing: Appearance.spacing.small / 2
|
|
||||||
model: Qt.fontFamilies()
|
|
||||||
|
|
||||||
delegate: StyledRect {
|
sourceComponent: StyledListView {
|
||||||
required property string modelData
|
id: sansFontList
|
||||||
required property int index
|
property alias contentHeight: sansFontList.contentHeight
|
||||||
|
|
||||||
width: ListView.view.width
|
clip: true
|
||||||
|
spacing: Appearance.spacing.small / 2
|
||||||
|
model: Qt.fontFamilies()
|
||||||
|
|
||||||
readonly property bool isCurrent: modelData === rootPane.fontFamilySans
|
delegate: StyledRect {
|
||||||
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
required property string modelData
|
||||||
radius: Appearance.rounding.normal
|
required property int index
|
||||||
border.width: isCurrent ? 1 : 0
|
|
||||||
border.color: Colours.palette.m3primary
|
|
||||||
|
|
||||||
StateLayer {
|
width: ListView.view.width
|
||||||
function onClicked(): void {
|
|
||||||
rootPane.fontFamilySans = modelData;
|
|
||||||
rootPane.saveConfig();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
readonly property bool isCurrent: modelData === rootPane.fontFamilySans
|
||||||
id: fontFamilySansRow
|
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isCurrent ? Colours.tPalette.m3surfaceContainer.a : 0)
|
||||||
|
radius: Appearance.rounding.normal
|
||||||
|
border.width: isCurrent ? 1 : 0
|
||||||
|
border.color: Colours.palette.m3primary
|
||||||
|
|
||||||
anchors.left: parent.left
|
StateLayer {
|
||||||
anchors.right: parent.right
|
function onClicked(): void {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
rootPane.fontFamilySans = modelData;
|
||||||
anchors.margins: Appearance.padding.normal
|
rootPane.saveConfig();
|
||||||
|
|
||||||
spacing: Appearance.spacing.normal
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: modelData
|
|
||||||
font.pointSize: Appearance.font.size.normal
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
active: isCurrent
|
|
||||||
asynchronous: true
|
|
||||||
|
|
||||||
sourceComponent: MaterialIcon {
|
|
||||||
text: "check"
|
|
||||||
color: Colours.palette.m3onSurfaceVariant
|
|
||||||
font.pointSize: Appearance.font.size.large
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
implicitHeight: fontFamilySansRow.implicitHeight + Appearance.padding.normal * 2
|
RowLayout {
|
||||||
|
id: fontFamilySansRow
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.margins: Appearance.padding.normal
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: modelData
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: isCurrent
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
|
sourceComponent: MaterialIcon {
|
||||||
|
text: "check"
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.font.size.large
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitHeight: fontFamilySansRow.implicitHeight + Appearance.padding.normal * 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ StyledRect {
|
||||||
toggle: false
|
toggle: false
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.visibilities.utilities = false;
|
root.visibilities.utilities = false;
|
||||||
root.popouts.detach("appearance");
|
root.popouts.detach("network");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue