From e8b0ee874ff23e331e151fce715a8aca6edac13e Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Wed, 7 May 2025 11:24:53 +0300 Subject: [PATCH] Launcher: Reload cells after a short delay (#8478) --- apps/launcher/datafilespage.cpp | 14 +++++++++++++- apps/launcher/datafilespage.hpp | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index 9f92e8ed0f..5463432d15 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -202,8 +203,14 @@ Launcher::DataFilesPage::DataFilesPage(const Files::ConfigurationManager& cfg, C // the addons and don't want to get signals of the system doing it during startup. connect(mSelector, &ContentSelectorView::ContentSelector::signalAddonDataChanged, this, &DataFilesPage::slotAddonDataChanged); + + mReloadCellsTimer = new QTimer(this); + mReloadCellsTimer->setSingleShot(true); + mReloadCellsTimer->setInterval(200); + connect(mReloadCellsTimer, &QTimer::timeout, this, &DataFilesPage::onReloadCellsTimerTimeout); + // Call manually to indicate all changes to addon data during startup. - slotAddonDataChanged(); + onReloadCellsTimerTimeout(); } Launcher::DataFilesPage::~DataFilesPage() @@ -1000,6 +1007,11 @@ bool Launcher::DataFilesPage::showDeleteMessageBox(const QString& text) } void Launcher::DataFilesPage::slotAddonDataChanged() +{ + mReloadCellsTimer->start(); +} + +void Launcher::DataFilesPage::onReloadCellsTimerTimeout() { const ContentSelectorModel::ContentFileList items = mSelector->selectedFiles(); QStringList selectedFiles; diff --git a/apps/launcher/datafilespage.hpp b/apps/launcher/datafilespage.hpp index ac98743dab..ca40bd1319 100644 --- a/apps/launcher/datafilespage.hpp +++ b/apps/launcher/datafilespage.hpp @@ -17,6 +17,7 @@ class QSortFilterProxyModel; class QAbstractItemModel; class QMenu; +class QTimer; namespace Files { @@ -137,6 +138,7 @@ namespace Launcher std::mutex mReloadCellsMutex; std::condition_variable mStartReloadCells; std::thread mReloadCellsThread; + QTimer* mReloadCellsTimer; void addArchive(const QString& name, Qt::CheckState selected, int row = -1); void addArchivesFromDir(const QString& dir); @@ -151,6 +153,7 @@ namespace Launcher void addProfile(const QString& profile, bool setAsCurrent); void checkForDefaultProfile(); void populateFileViews(const QString& contentModelName); + void onReloadCellsTimerTimeout(); void reloadCells(); void refreshDataFilesView(); void updateNavMeshProgress(int minDataSize);