Don't display the device list if no APK is available

This commit is contained in:
Guillaume Meunier
2025-02-02 23:46:50 +01:00
parent 146a8a4926
commit 97cffc755d
5 changed files with 185 additions and 151 deletions
+21 -2
View File
@@ -13,8 +13,10 @@ Kirigami.ScrollablePage {
flickable.interactive: false
Component.onCompleted: ApkInstaller.refreshLatestVersion()
Kirigami.CardsListView {
model: Adb
model: ApkInstaller.apkAvailable ? Adb : []
delegate: DeviceCard {
id: device_card
required property string serial
@@ -34,7 +36,24 @@ Kirigami.ScrollablePage {
visible: parent.count == 0
text: Adb.adbInstalled ? i18n("Connect a headset and make sure developper mode is enabled.") : i18n("ADB is not installed.")
text: {
if (ApkInstaller.busy && !ApkInstaller.apkAvailable)
return i18n("Checking latest release...");
else if (!ApkInstaller.apkAvailable)
return i18n("No precompiled APK is available for this version.");
else if (!Adb.adbInstalled)
return i18n("ADB is not installed.");
else
return i18n("Connect a headset and make sure developper mode is enabled.");
}
explanation: {
if (!ApkInstaller.busy && !ApkInstaller.apkAvailable)
return i18n("Follow the instructions in the <a href=\"https://github.com/WiVRn/WiVRn/blob/master/docs/building.md#client-headset\">documentation</a> to build your own client.");
else
return "";
}
onLinkActivated: (link) => Qt.openUrlExternally(link)
}
}
-1
View File
@@ -70,7 +70,6 @@ Kirigami.ScrollablePage {
columns: 3
Controls.Label {
// TextInput {
Layout.fillWidth: true
Layout.column: 0
Layout.row: 0
+16 -5
View File
@@ -189,15 +189,27 @@ Kirigami.ScrollablePage {
BetterLabel {
Layout.fillWidth: true
text: i18n("No precompiled APK is available for this version. Follow the instructions in the <a href=\"https://github.com/WiVRn/WiVRn/blob/master/docs/building.md#client-headset\">documentation</a> to build your own client.")
visible: !ApkInstaller.apkAvailable
text: i18n("Checking latest release...")
visible: ApkInstaller.busy && !ApkInstaller.apkAvailable
}
BetterLabel {
Layout.fillWidth: true
text: i18n("No precompiled APK is available for this version.")
visible: !ApkInstaller.busy && !ApkInstaller.apkAvailable
}
BetterLabel {
Layout.fillWidth: true
text: i18n("Follow the instructions in the <a href=\"https://github.com/WiVRn/WiVRn/blob/master/docs/building.md#client-headset\">documentation</a> to build your own client.")
visible: !ApkInstaller.busy && !ApkInstaller.apkAvailable
}
Controls.Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: i18n("ADB is not installed")
visible: device_list.count == 0 && !Adb.adbInstalled
visible: device_list.count == 0 && !Adb.adbInstalled && ApkInstaller.apkAvailable
}
// TODO link to adb/udev rules depending on the distribution
@@ -216,7 +228,7 @@ Kirigami.ScrollablePage {
Repeater {
id: device_list
model: Adb
model: ApkInstaller.apkAvailable ? Adb : []
delegate: DeviceCard {
id: device_card
required property string serial
@@ -228,7 +240,6 @@ Kirigami.ScrollablePage {
serial_number: device_card.serial
is_wivrn_installed: device_card.isWivrnInstalled
}
visible: ApkInstaller.apkAvailable
}
Item {