mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Qt: update UI after loading every 25 grid items, keep grid from mixing up content from multiple playlists if the user switches to a new one before one is finished loading
This commit is contained in:
parent
03e0510fc4
commit
8c6bc4a678
@ -2999,6 +2999,7 @@ void MainWindow::addPlaylistItemsToGrid(const QString &pathString)
|
||||
QVector<QHash<QString, QString> > items = getPlaylistItems(pathString);
|
||||
QScreen *screen = qApp->primaryScreen();
|
||||
QSize screenSize = screen->size();
|
||||
QListWidgetItem *currentItem = m_listWidget->currentItem();
|
||||
settings_t *settings = config_get_ptr();
|
||||
int i = 0;
|
||||
int zoomValue = m_zoomSlider->value();
|
||||
@ -3006,7 +3007,7 @@ void MainWindow::addPlaylistItemsToGrid(const QString &pathString)
|
||||
for (i = 0; i < items.count(); i++)
|
||||
{
|
||||
const QHash<QString, QString> &hash = items.at(i);
|
||||
QPointer<GridItem> item (new GridItem());
|
||||
QPointer<GridItem> item;
|
||||
QPointer<ThumbnailLabel> label;
|
||||
QString thumbnailFileNameNoExt;
|
||||
QLabel *newLabel = NULL;
|
||||
@ -3016,6 +3017,14 @@ void MainWindow::addPlaylistItemsToGrid(const QString &pathString)
|
||||
QString imagePath;
|
||||
int lastIndex = -1;
|
||||
|
||||
if (m_listWidget->currentItem() != currentItem)
|
||||
{
|
||||
/* user changed the current playlist before we finished loading... abort */
|
||||
break;
|
||||
}
|
||||
|
||||
item = new GridItem();
|
||||
|
||||
lastIndex = hash["path"].lastIndexOf('.');
|
||||
|
||||
if (lastIndex >= 0)
|
||||
@ -3065,6 +3074,9 @@ void MainWindow::addPlaylistItemsToGrid(const QString &pathString)
|
||||
m_gridItems.append(item);
|
||||
|
||||
loadImageDeferred(item, imagePath);
|
||||
|
||||
if (i % 25 == 0)
|
||||
qApp->processEvents();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user