Merge pull request #2044 from demmm/calamares

[keyboardq] Move to using a Drawer
This commit is contained in:
Adriaan de Groot 2022-08-25 00:19:42 +02:00 committed by GitHub
commit 842b0925fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 219 additions and 157 deletions

View File

@ -0,0 +1,15 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<svg height="16" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" version="1.1" width="16" xmlns="http://www.w3.org/2000/svg" enable-background="new">
<metadata id="metadata90"/>
<defs id="defs7386">
<linearGradient id="linearGradient5606" osb:paint="solid">
<stop id="stop5608"/>
</linearGradient>
<filter inkscape:collect="always" color-interpolation-filters="sRGB" id="filter7554">
<feBlend inkscape:collect="always" id="feBlend7556" in2="BackgroundImage" mode="darken"/>
</filter>
</defs>
<g inkscape:groupmode="layer" id="layer12" inkscape:label="actions" transform="translate(-445.0002,-129)">
<path inkscape:connector-curvature="0" d="m 451.0002,142 5,-5 -5,-5 z" id="path6412" sodipodi:nodetypes="cccc" fill="#555555"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 896 B

View File

@ -12,7 +12,7 @@ import io.calamares.ui 1.0
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Window 2.14 import QtQuick.Window 2.15
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import org.kde.kirigami 2.7 as Kirigami import org.kde.kirigami 2.7 as Kirigami
@ -52,6 +52,7 @@ Item {
Rectangle { Rectangle {
id: backgroundItem id: backgroundItem
anchors.fill: parent anchors.fill: parent
width: 800
color: backgroundColor color: backgroundColor
Label { Label {
@ -62,51 +63,104 @@ Item {
font.bold: true font.bold: true
} }
Drawer {
id: drawer
width: 0.4 * backgroundItem.width
height: backgroundItem.height
edge: Qt.RightEdge
ScrollView {
id: scroll1
anchors.fill: parent
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ListView {
id: models
focus: true
clip: true
boundsBehavior: Flickable.StopAtBounds
width: parent.width
model: config.keyboardModelsModel
Component.onCompleted: positionViewAtIndex(model.currentIndex, ListView.Center)
currentIndex: model.currentIndex
delegate: ItemDelegate {
property variant currentModel: model
hoverEnabled: true
width: 0.4 * backgroundItem.width
implicitHeight: 24
highlighted: ListView.isCurrentItem
Label { Label {
id: intro Layout.fillHeight: true
anchors.horizontalCenter: parent.horizontalCenter Layout.fillWidth: true
anchors.top: header.bottom
color: textColor
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
width: parent.width / 1.2 width: parent.width
wrapMode: Text.WordWrap height: 24
text: ( config.prettyStatus) color: highlighted ? "#eff0f1" : "#1F1F1F"
text: model.label
background: Rectangle {
color: highlighted || hovered ? "#3498DB" : "#ffffff"
opacity: highlighted || hovered ? 0.5 : 0.9
} }
RowLayout { MouseArea {
id: models hoverEnabled: true
anchors.top: intro.bottom anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
models.currentIndex = index
drawer.close()
}
}
}
}
onCurrentItemChanged: { config.keyboardModels = model[currentIndex] } /* This works because model is a stringlist */
}
}
}
Rectangle {
id: modelLabel
anchors.top: header.bottom
anchors.topMargin: 10 anchors.topMargin: 10
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: parent.width / 1.5 width: parent.width / 1.5
spacing: 10 height: 36
color: mouseBar.containsMouse ? "#eff0f1" : "transparent";
Label { MouseArea {
Layout.alignment: Qt.AlignCenter id: mouseBar
text: qsTr("Keyboard Model:") anchors.fill: parent;
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onClicked: {
drawer.open()
}
Text {
anchors.centerIn: parent
text: qsTr("<b>Keyboard Model:&nbsp;&nbsp;</b>") + models.currentItem.currentModel.label
color: textColor color: textColor
font.bold: true
} }
Image {
ComboBox { source: "data/pan-end-symbolic.svg"
Layout.fillWidth: true anchors.centerIn: parent
textRole: "label" anchors.horizontalCenterOffset : parent.width / 2.5
model: config.keyboardModelsModel fillMode: Image.PreserveAspectFit
currentIndex: model.currentIndex height: 22
onCurrentIndexChanged: config.keyboardModels = currentIndex }
} }
} }
StackView { RowLayout {
id: stack id: stack
anchors.top: models.bottom anchors.top: modelLabel.bottom
anchors.topMargin: 10 anchors.topMargin: 10
anchors.left: parent.left anchors.horizontalCenter: parent.horizontalCenter
anchors.right: parent.right width: parent.width / 1.1
anchors.bottom: parent.bottom spacing: 10
clip: true
initialItem: Item {
ListView { ListView {
id: layouts id: layouts
@ -115,13 +169,25 @@ Item {
active: true active: true
} }
width: parent.width / 2 Layout.preferredWidth: parent.width / 2
height: 200 height: 220
anchors.horizontalCenter: parent.horizontalCenter
focus: true focus: true
clip: true clip: true
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
spacing: 2 spacing: 2
headerPositioning: ListView.OverlayHeader
header: Rectangle{
height: 24
width: parent.width
z: 2
color:backgroundColor
Text {
text: qsTr("Layout")
anchors.centerIn: parent
color: textColor
font.bold: true
}
}
Rectangle { Rectangle {
z: parent.z - 1 z: parent.z - 1
@ -137,7 +203,7 @@ Item {
hoverEnabled: true hoverEnabled: true
width: parent.width width: parent.width
height: 18 implicitHeight: 24
highlighted: ListView.isCurrentItem highlighted: ListView.isCurrentItem
RowLayout { RowLayout {
@ -146,11 +212,11 @@ Item {
Label { Label {
id: label1 id: label1
text: model.label text: model.label
horizontalAlignment: Text.AlignHCenter
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
padding: 10
width: parent.width width: parent.width
height: 32 height: 24
color: highlighted ? highlightedTextColor : textColor color: highlighted ? highlightedTextColor : textColor
background: Rectangle { background: Rectangle {
@ -164,28 +230,10 @@ Item {
layouts.model.currentIndex = index layouts.model.currentIndex = index
keyIndex = label1.text.substring(0,6) keyIndex = label1.text.substring(0,6)
stack.push(variantsList)
layouts.positionViewAtIndex(index, ListView.Center) layouts.positionViewAtIndex(index, ListView.Center)
} }
} }
} }
Button {
Layout.fillWidth: true
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -parent.height / 3.5
anchors.left: parent.left
anchors.leftMargin: parent.width / 15
icon.name: "go-next"
text: qsTr("Variants")
onClicked: stack.push(variantsList)
}
}
Component {
id: variantsList
Item {
ListView { ListView {
id: variants id: variants
@ -194,14 +242,25 @@ Item {
active: true active: true
} }
width: parent.width / 2 Layout.preferredWidth: parent.width / 2
height: 200 height: 220
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 10
focus: true focus: true
clip: true clip: true
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
spacing: 2 spacing: 2
headerPositioning: ListView.OverlayHeader
header: Rectangle{
height: 24
width: parent.width
z: 2
color:backgroundColor
Text {
text: qsTr("Variant")
anchors.centerIn: parent
color: textColor
font.bold: true
}
}
Rectangle { Rectangle {
z: parent.z - 1 z: parent.z - 1
@ -217,7 +276,7 @@ Item {
delegate: ItemDelegate { delegate: ItemDelegate {
hoverEnabled: true hoverEnabled: true
width: parent.width width: parent.width
height: 18 implicitHeight: 24
highlighted: ListView.isCurrentItem highlighted: ListView.isCurrentItem
RowLayout { RowLayout {
@ -225,11 +284,11 @@ Item {
Label { Label {
text: model.label text: model.label
horizontalAlignment: Text.AlignHCenter
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
padding: 10
width: parent.width width: parent.width
height: 30 height: 24
color: highlighted ? highlightedTextColor : textColor color: highlighted ? highlightedTextColor : textColor
background: Rectangle { background: Rectangle {
@ -245,26 +304,13 @@ Item {
} }
} }
} }
Button {
Layout.fillWidth: true
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -parent.height / 3.5
anchors.left: parent.left
anchors.leftMargin: parent.width / 15
icon.name: "go-previous"
text: qsTr("Layouts")
onClicked: stack.pop()
}
}
}
} }
TextField { TextField {
id: textInput id: textInput
placeholderText: qsTr("Type here to test your keyboard") placeholderText: qsTr("Type here to test your keyboard")
height: 36 height: 36
width: parent.width / 1.5 width: parent.width / 1.6
horizontalAlignment: TextInput.AlignHCenter horizontalAlignment: TextInput.AlignHCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: keyboard.top anchors.bottom: keyboard.top

View File

@ -24,5 +24,6 @@
<file>data/button_bkg_center.png</file> <file>data/button_bkg_center.png</file>
<file>data/button_bkg_left.png</file> <file>data/button_bkg_left.png</file>
<file>data/button_bkg_right.png</file> <file>data/button_bkg_right.png</file>
<file>data/pan-end-symbolic.svg</file>
</qresource> </qresource>
</RCC> </RCC>