Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make time UI responsive for vertical or horizontal screen orientation #92

Merged
merged 1 commit into from
Oct 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
75 changes: 47 additions & 28 deletions ui/time.qml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,57 @@ import org.kde.kirigami 2.4 as Kirigami
import Mycroft 1.0 as Mycroft

Mycroft.Delegate {
id: timeRoot

ColumnLayout {
id: grid
Layout.fillWidth: true
anchors.centerIn: parent
spacing: 0
Label {
id: hour
Layout.alignment: Qt.AlignRight
font.capitalization: Font.AllUppercase
font.family: "Noto Sans"
font.bold: true
font.weight: Font.Bold
font.pixelSize: 300
color: "white"
lineHeight: 0.6
text: sessionData.time_string.split(":")[0]
}
anchors.fill: parent
spacing: Kirigami.Units.largeSpacing

Item {
height: Kirigami.Units.largeSpacing * 5
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
Layout.fillHeight: true
Layout.margins: Kirigami.Units.smallSpacing

Label {
id: hour
width: parent.width
height: parent.height
font.capitalization: Font.AllUppercase
font.family: "Noto Sans"
font.bold: true
font.weight: Font.Bold
font.pixelSize: height
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: sessionData.time_string.split(":")[0]
color: "white"
renderType: height > 40 ? Text.QtRendering : (Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering)
}
}
Label {
id: minute
Layout.alignment: Qt.AlignRight
font.pixelSize: 300
wrapMode: Text.WordWrap
font.family: "Noto Sans"
font.bold: false
font.weight: Font.Normal
lineHeight: 0.6
font.capitalization: Font.AllUppercase
text: sessionData.time_string.split(":")[1]
color: "#22A7F0"

Item {
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
Layout.fillHeight: true
Layout.margins: Kirigami.Units.smallSpacing

Label {
id: minute
width: parent.width
height: parent.height
font.capitalization: Font.AllUppercase
font.family: "Noto Sans"
font.bold: false
font.weight: Font.Normal
font.pixelSize: height
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: sessionData.time_string.split(":")[1]
color: "#22A7F0"
renderType: height > 40 ? Text.QtRendering : (Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering)
}
}
}
}