mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 12:58:00 +03:00
Add progress bars where the launcher can be limited by IO
I tested this with a USB3 external hard drive. These two places were the only ones where we're IO-bound and block the main thread, so they're the only ones that need progress bars. If trying to replicate this test, then it's important to unplug the hard drive between each repeat. Apparently Windows is excellent at disk caching these days as it takes a minute and a half to start the launcher with Total Overhaul on this drive when it's just been plugged in, but less time than the first launch after a reboot on an NVME drive once the cache has been warmed up.
This commit is contained in:
parent
894ea4ba62
commit
096759435a
2 changed files with 15 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
|
#include <QProgressDialog>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -353,9 +354,15 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
|
||||||
|
|
||||||
QIcon containsDataIcon(":/images/openmw-plugin.png");
|
QIcon containsDataIcon(":/images/openmw-plugin.png");
|
||||||
|
|
||||||
|
QProgressDialog progressBar("Adding data directories", {}, 0, directories.count(), this);
|
||||||
|
progressBar.setWindowModality(Qt::WindowModal);
|
||||||
|
progressBar.setValue(0);
|
||||||
|
|
||||||
std::unordered_set<QString> visitedDirectories;
|
std::unordered_set<QString> visitedDirectories;
|
||||||
for (const Config::SettingValue& currentDir : directories)
|
for (const Config::SettingValue& currentDir : directories)
|
||||||
{
|
{
|
||||||
|
progressBar.setValue(progressBar.value() + 1);
|
||||||
|
|
||||||
if (!visitedDirectories.insert(currentDir.value).second)
|
if (!visitedDirectories.insert(currentDir.value).second)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "gamesettings.hpp"
|
#include "gamesettings.hpp"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QProgressDialog>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
|
||||||
#include <components/files/configurationmanager.hpp>
|
#include <components/files/configurationmanager.hpp>
|
||||||
|
@ -37,8 +38,13 @@ void Config::GameSettings::validatePaths()
|
||||||
|
|
||||||
mDataDirs.clear();
|
mDataDirs.clear();
|
||||||
|
|
||||||
|
QProgressDialog progressBar("Validating paths", {}, 0, paths.count() + 1);
|
||||||
|
progressBar.setWindowModality(Qt::WindowModal);
|
||||||
|
progressBar.setValue(0);
|
||||||
|
|
||||||
for (const auto& dataDir : paths)
|
for (const auto& dataDir : paths)
|
||||||
{
|
{
|
||||||
|
progressBar.setValue(progressBar.value() + 1);
|
||||||
if (QDir(dataDir.value).exists())
|
if (QDir(dataDir.value).exists())
|
||||||
{
|
{
|
||||||
SettingValue copy = dataDir;
|
SettingValue copy = dataDir;
|
||||||
|
@ -50,6 +56,8 @@ void Config::GameSettings::validatePaths()
|
||||||
// Do the same for data-local
|
// Do the same for data-local
|
||||||
const QString& local = mSettings.value(QString("data-local")).value;
|
const QString& local = mSettings.value(QString("data-local")).value;
|
||||||
|
|
||||||
|
progressBar.setValue(progressBar.value() + 1);
|
||||||
|
|
||||||
if (!local.isEmpty() && QDir(local).exists())
|
if (!local.isEmpty() && QDir(local).exists())
|
||||||
{
|
{
|
||||||
mDataLocal = QDir(local).canonicalPath();
|
mDataLocal = QDir(local).canonicalPath();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue