Skip to content

Commit 79a2735

Browse files
committed
Merge branch 'datachanged' into 'master'
Launcher: Reload cells after a short delay (#8478) See merge request OpenMW/openmw!4664
2 parents 65155a6 + e8b0ee8 commit 79a2735

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

apps/launcher/datafilespage.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <QPair>
1111
#include <QProgressDialog>
1212
#include <QPushButton>
13+
#include <QTimer>
1314

1415
#include <algorithm>
1516
#include <mutex>
@@ -202,8 +203,14 @@ Launcher::DataFilesPage::DataFilesPage(const Files::ConfigurationManager& cfg, C
202203
// the addons and don't want to get signals of the system doing it during startup.
203204
connect(mSelector, &ContentSelectorView::ContentSelector::signalAddonDataChanged, this,
204205
&DataFilesPage::slotAddonDataChanged);
206+
207+
mReloadCellsTimer = new QTimer(this);
208+
mReloadCellsTimer->setSingleShot(true);
209+
mReloadCellsTimer->setInterval(200);
210+
connect(mReloadCellsTimer, &QTimer::timeout, this, &DataFilesPage::onReloadCellsTimerTimeout);
211+
205212
// Call manually to indicate all changes to addon data during startup.
206-
slotAddonDataChanged();
213+
onReloadCellsTimerTimeout();
207214
}
208215

209216
Launcher::DataFilesPage::~DataFilesPage()
@@ -1001,6 +1008,11 @@ bool Launcher::DataFilesPage::showDeleteMessageBox(const QString& text)
10011008
}
10021009

10031010
void Launcher::DataFilesPage::slotAddonDataChanged()
1011+
{
1012+
mReloadCellsTimer->start();
1013+
}
1014+
1015+
void Launcher::DataFilesPage::onReloadCellsTimerTimeout()
10041016
{
10051017
const ContentSelectorModel::ContentFileList items = mSelector->selectedFiles();
10061018
QStringList selectedFiles;

apps/launcher/datafilespage.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
class QSortFilterProxyModel;
1818
class QAbstractItemModel;
1919
class QMenu;
20+
class QTimer;
2021

2122
namespace Files
2223
{
@@ -137,6 +138,7 @@ namespace Launcher
137138
std::mutex mReloadCellsMutex;
138139
std::condition_variable mStartReloadCells;
139140
std::thread mReloadCellsThread;
141+
QTimer* mReloadCellsTimer;
140142

141143
void addArchive(const QString& name, Qt::CheckState selected, int row = -1);
142144
void addArchivesFromDir(const QString& dir);
@@ -151,6 +153,7 @@ namespace Launcher
151153
void addProfile(const QString& profile, bool setAsCurrent);
152154
void checkForDefaultProfile();
153155
void populateFileViews(const QString& contentModelName);
156+
void onReloadCellsTimerTimeout();
154157
void reloadCells();
155158
void refreshDataFilesView();
156159
void updateNavMeshProgress(int minDataSize);

0 commit comments

Comments
 (0)