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:
		@@ -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;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user