1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-21 21:11:35 +00:00

Show progress dialog for setting content list

This commit is contained in:
elsid 2025-05-21 22:07:17 +02:00
parent 3955428f87
commit 157e8c763c
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40

View file

@ -13,6 +13,7 @@
#include <QDirIterator>
#include <QFont>
#include <QIODevice>
#include <QProgressDialog>
#include <components/esm/format.hpp>
#include <components/esm3/esmreader.hpp>
@ -707,10 +708,14 @@ bool ContentSelectorModel::ContentModel::isLoadOrderError(const EsmFile* file) c
void ContentSelectorModel::ContentModel::setContentList(const QStringList& fileList)
{
QProgressDialog progressDialog("Setting content list", {}, 0, static_cast<int>(fileList.size()));
progressDialog.setWindowModality(Qt::WindowModal);
progressDialog.setValue(0);
int previousPosition = -1;
for (const QString& filepath : fileList)
for (qsizetype i = 0, n = fileList.size(); i < n; ++i)
{
const EsmFile* file = item(filepath);
const EsmFile* file = item(fileList[i]);
if (setCheckState(file, true))
{
// setCheckState already gracefully handles builtIn and fromAnotherConfigFile
@ -725,7 +730,10 @@ void ContentSelectorModel::ContentModel::setContentList(const QStringList& fileL
previousPosition = filePosition;
}
}
progressDialog.setValue(static_cast<int>(i + 1));
}
refreshModel();
}