Don't display the device list if no APK is available
This commit is contained in:
@@ -53,8 +53,7 @@ QCoro::Task<> apk_installer::doRefreshLatestVersion()
|
||||
m_apkUrl = QUrl{};
|
||||
|
||||
busyChanged(m_busy = true);
|
||||
if (m_latestVersion != "")
|
||||
latestVersionChanged(m_latestVersion = "");
|
||||
latestVersionChanged(m_latestVersion = "");
|
||||
|
||||
std::unique_ptr<QNetworkReply> reply{co_await manager.get(QNetworkRequest{QUrl{"https://api.github.com/repos/WiVRn/WiVRn/releases/latest"}})};
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,6 @@ Kirigami.ScrollablePage {
|
||||
columns: 3
|
||||
|
||||
Controls.Label {
|
||||
// TextInput {
|
||||
Layout.fillWidth: true
|
||||
Layout.column: 0
|
||||
Layout.row: 0
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user