Skip to content

Commit 157e8c7

Browse files
committed
Show progress dialog for setting content list
1 parent 3955428 commit 157e8c7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

components/contentselector/model/contentmodel.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <QDirIterator>
1414
#include <QFont>
1515
#include <QIODevice>
16+
#include <QProgressDialog>
1617

1718
#include <components/esm/format.hpp>
1819
#include <components/esm3/esmreader.hpp>
@@ -707,10 +708,14 @@ bool ContentSelectorModel::ContentModel::isLoadOrderError(const EsmFile* file) c
707708

708709
void ContentSelectorModel::ContentModel::setContentList(const QStringList& fileList)
709710
{
711+
QProgressDialog progressDialog("Setting content list", {}, 0, static_cast<int>(fileList.size()));
712+
progressDialog.setWindowModality(Qt::WindowModal);
713+
progressDialog.setValue(0);
714+
710715
int previousPosition = -1;
711-
for (const QString& filepath : fileList)
716+
for (qsizetype i = 0, n = fileList.size(); i < n; ++i)
712717
{
713-
const EsmFile* file = item(filepath);
718+
const EsmFile* file = item(fileList[i]);
714719
if (setCheckState(file, true))
715720
{
716721
// setCheckState already gracefully handles builtIn and fromAnotherConfigFile
@@ -725,7 +730,10 @@ void ContentSelectorModel::ContentModel::setContentList(const QStringList& fileL
725730
previousPosition = filePosition;
726731
}
727732
}
733+
734+
progressDialog.setValue(static_cast<int>(i + 1));
728735
}
736+
729737
refreshModel();
730738
}
731739

0 commit comments

Comments
 (0)