fix: show invalid version even when there's none

Having a blank instead of _anything_ is bad UX. Instead, even when
there's not a valid version (most likely disabled redistribution), we
show a message in the UI, to differentiate from the loading state.

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-06-24 09:26:35 -03:00
parent 64776d6bac
commit 145da82cd8
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -157,6 +157,10 @@ void FlamePage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
if (!listModel->setData(curr, current_updated, Qt::UserRole)) if (!listModel->setData(curr, current_updated, Qt::UserRole))
qWarning() << "Failed to cache versions for the current pack!"; qWarning() << "Failed to cache versions for the current pack!";
// TODO: Check whether it's a connection issue or the project disabled 3rd-party distribution.
if (current.versionsLoaded && ui->versionSelectionBox->count() < 1) {
ui->versionSelectionBox->addItem(tr("No version is available!"), -1);
}
suggestCurrent(); suggestCurrent();
}); });
QObject::connect(netJob, &NetJob::finished, this, [response, netJob] { QObject::connect(netJob, &NetJob::finished, this, [response, netJob] {
@ -172,6 +176,11 @@ void FlamePage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
suggestCurrent(); suggestCurrent();
} }
// TODO: Check whether it's a connection issue or the project disabled 3rd-party distribution.
if (current.versionsLoaded && ui->versionSelectionBox->count() < 1) {
ui->versionSelectionBox->addItem(tr("No version is available!"), -1);
}
updateUi(); updateUi();
} }
@ -181,7 +190,7 @@ void FlamePage::suggestCurrent()
return; return;
} }
if (selectedVersion.isEmpty()) { if (selectedVersion.isEmpty() || selectedVersion == "-1") {
dialog->setSuggestedPack(); dialog->setSuggestedPack();
return; return;
} }