From afb6de66d28aef4e50405dfb7a331ef57f206f10 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Sun, 17 Apr 2022 19:52:42 +0200 Subject: [PATCH] WIP: Show default kit in drawer button TODO: - Make prettier - Refresh on name changes --- qml/DrawerButton.qml | 34 +++++++++++++++++++++++++--------- qml/MobileUIDrawer.qml | 1 + 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/qml/DrawerButton.qml b/qml/DrawerButton.qml index 7dc64c35..ff405f69 100644 --- a/qml/DrawerButton.qml +++ b/qml/DrawerButton.qml @@ -6,6 +6,7 @@ import Firebird.UIComponents 1.0 Rectangle { property alias icon: image.source property alias title: label.text + property alias subtitle: subtitleLabel.text property alias borderTopVisible: borderTop.visible property alias borderBottomVisible: borderBottom.visible property bool disabled: false @@ -76,19 +77,34 @@ Rectangle { fillMode: Image.PreserveAspectFit } - FBLabel { - id: label - - color: "black" - - x: image.x + image.width + spacing - + ColumnLayout { anchors { + margins: spacing + left: image.right top: parent.top bottom: parent.bottom + right: parent.right } - font.pixelSize: TextMetrics.title2Size - verticalAlignment: Text.AlignVCenter + FBLabel { + id: label + + color: "black" + + font.pixelSize: TextMetrics.title2Size + verticalAlignment: Text.AlignVCenter + Layout.fillWidth: true + Layout.fillHeight: true + } + + FBLabel { + id: subtitleLabel + elide: "ElideRight" + + font.pixelSize: TextMetrics.normalSize * 0.8 + Layout.fillWidth: true + Layout.fillHeight: true + visible: text !== "" + } } } diff --git a/qml/MobileUIDrawer.qml b/qml/MobileUIDrawer.qml index bde2437c..85ad7982 100644 --- a/qml/MobileUIDrawer.qml +++ b/qml/MobileUIDrawer.qml @@ -40,6 +40,7 @@ Rectangle { id: restartButton title: qsTr("Start") + subtitle: qsTr("Kit: ") + Emu.kits.getDataRow(Emu.kitIndexForID(Emu.defaultKit), KitModel.NameRole) icon: "qrc:/icons/resources/icons/edit-bomb.png" onClicked: {