mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-19 21:41:33 +00:00
Launcher: Reload cells after a short delay (#8478)
This commit is contained in:
parent
2342dbe0f5
commit
e8b0ee874f
2 changed files with 16 additions and 1 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <QPair>
|
||||
#include <QProgressDialog>
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
|
||||
#include <algorithm>
|
||||
#include <mutex>
|
||||
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue