Add a placeholder label to indicate database is still loading. (#5469)

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2025-01-14 15:19:32 +01:00 committed by GitHub
parent 8462b6e906
commit f6c1253e84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View file

@ -47,12 +47,24 @@ VisualDeckStorageWidget::VisualDeckStorageWidget(QWidget *parent) : QWidget(pare
connect(CardDatabaseManager::getInstance(), &CardDatabase::cardDatabaseLoadingFinished, this,
&VisualDeckStorageWidget::refreshBannerCards);
databaseLoadIndicator = new QLabel(this);
databaseLoadIndicator->setAlignment(Qt::AlignCenter);
retranslateUi();
// Don't waste time processing the cards if they're going to get refreshed anyway once the db finishes loading
if (CardDatabaseManager::getInstance()->getLoadStatus() == LoadStatus::Ok) {
refreshBannerCards();
} else {
flowWidget->addWidget(databaseLoadIndicator);
}
}
void VisualDeckStorageWidget::retranslateUi()
{
databaseLoadIndicator->setText(tr("Loading database ..."));
}
void VisualDeckStorageWidget::updateSortOrder()
{
refreshBannerCards(); // Refresh the banner cards with the new sort order

View file

@ -41,6 +41,7 @@ private:
QHBoxLayout *searchAndSortLayout;
FlowWidget *flowWidget;
DeckListModel *deckListModel;
QLabel *databaseLoadIndicator;
VisualDeckStorageSortWidget *sortWidget;
VisualDeckStorageSearchWidget *searchWidget;