|
@@ -1,7 +1,6 @@
|
|
|
#include "graphicspatch.h"
|
|
|
#include "LotroDat/LotroDat.h"
|
|
|
#include "LotroDat/Database.h"
|
|
|
-#include "models/lotrodatmanagerobserver.h"
|
|
|
#include "models/lotrodatmanager.h"
|
|
|
|
|
|
#include <QUrlQuery>
|
|
@@ -11,12 +10,11 @@ GraphicsPatch::GraphicsPatch(LotroDatManager *mgr, QObject *parent) : Patch("Gra
|
|
|
{
|
|
|
connect(lotro_mgr_, &LotroDatManager::operationStarted, this, &GraphicsPatch::onLotroDatManagerOperationStarted);
|
|
|
connect(lotro_mgr_, &LotroDatManager::operationFinished, this, &GraphicsPatch::onLotroDatManagerOperationFinished);
|
|
|
- connect(lotro_mgr_->getObserver(), &LotroDatManagerObserver::statusChanged, this, &GraphicsPatch::onLotroDatManagerStatusChanged);
|
|
|
+ connect(lotro_mgr_, &LotroDatManager::statusChanged, this, &GraphicsPatch::onLotroDatManagerStatusChanged);
|
|
|
}
|
|
|
|
|
|
void GraphicsPatch::checkForUpdates()
|
|
|
{
|
|
|
- emit operationStarted("checkForUpdates", this);
|
|
|
QUrlQuery query; // query for building GET-request aka patch-version
|
|
|
|
|
|
foreach (QString db_name, databases_names) {
|
|
@@ -35,26 +33,26 @@ void GraphicsPatch::checkForUpdates()
|
|
|
downloader.waitForDownloaded();
|
|
|
|
|
|
if (target_array.isEmpty()) {
|
|
|
- qDebug() << __FUNCTION__ << "Cannot download, target_array is empty!";
|
|
|
- emit errorOccured("checkForUpdates", this, "QueryDownloadFailed");
|
|
|
- emit operationFinished("checkForUpdates", this, false);
|
|
|
+ qWarning() << *this << "Cannot check for updates, target_array is empty!";
|
|
|
+ emit errorOccured(E_CHECKFORUPDATES, this, "");
|
|
|
+ emit operationFinished(E_CHECKFORUPDATES, this);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
QStringList patch_info = QString(target_array).split('|');
|
|
|
if (patch_info.size() != databases_names.size()) {
|
|
|
- qDebug() << __FUNCTION__ << "Incorrect patches number! Data: " << patch_info;
|
|
|
- emit errorOccured("checkForUpdates", this, "IncorrectQueryResult");
|
|
|
- emit operationFinished("checkForUpdates", this, false);
|
|
|
+ qCritical() << __FUNCTION__ << "Incorrect patches number! Data: " << patch_info;
|
|
|
+ emit errorOccured(E_CHECKFORUPDATES, this, "");
|
|
|
+ emit operationFinished(E_CHECKFORUPDATES, this);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < databases_names.size(); ++i) {
|
|
|
QStringList patch_data = patch_info[i].split(":::");
|
|
|
if (patch_data.size() != 3) {
|
|
|
- qDebug() << __FUNCTION__ << "Incorrect patch entry size! Entry: " << patch_data;
|
|
|
- emit errorOccured("checkForUpdates", this, "IncorrectDbInfo");
|
|
|
- emit operationFinished("checkForUpdates", this, false);
|
|
|
+ qCritical() << __FUNCTION__ << "Incorrect patch entry size! Entry: " << patch_data;
|
|
|
+ emit errorOccured(E_CHECKFORUPDATES, this, "");
|
|
|
+ emit operationFinished(E_CHECKFORUPDATES, this);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -65,42 +63,32 @@ void GraphicsPatch::checkForUpdates()
|
|
|
Settings::setValue("PatchDatabases/" + databases_names[i] + "/datetime", patch_data[2]);
|
|
|
Settings::setValue("PatchDatabases/" + databases_names[i] + "/path", patch_filename);
|
|
|
}
|
|
|
- emit operationFinished("checkForUpdates", this, true);
|
|
|
+
|
|
|
+ emit operationFinished(E_CHECKFORUPDATES, this);
|
|
|
}
|
|
|
|
|
|
void GraphicsPatch::download()
|
|
|
{
|
|
|
- if (elapsed_patches_to_download_ != 0) {
|
|
|
- qDebug() << "Trying to start download of patch set " << patch_name_ << " while download is still active!";
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- emit operationStarted("download", this);
|
|
|
-
|
|
|
- bool download_started = false;
|
|
|
-
|
|
|
foreach (QString db_name, databases_names) {
|
|
|
QString settings_prefix = "PatchDatabases/" + db_name;
|
|
|
|
|
|
QString target_filename = QApplication::applicationDirPath() + "/" + Settings::getValue(settings_prefix + "/path").toString();
|
|
|
- qDebug() << "GraphicsPatch: Checking if there's no need to download file " << target_filename;
|
|
|
+ qDebug() << patch_name_ << ": Checking if file " << target_filename << " matches its hashsum";
|
|
|
|
|
|
if (FileSystem::fileHash(target_filename) == Settings::getValue(settings_prefix + "/hashsum").toString()) {
|
|
|
- qDebug() << "GraphicsPatch: file " << target_filename << " is fresh, no need to download";
|
|
|
+ qInfo() << *this << ": file " << target_filename << " is up-to-date, no need to download";
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
FileSystem::createFilePath(target_filename);
|
|
|
QFile* target_file = new QFile(target_filename);
|
|
|
if (!target_file->open(QIODevice::ReadWrite | QIODevice::Truncate)) {
|
|
|
- emit errorOccured("download", this, "CantOpenDbFile");
|
|
|
+ qWarning() << *this << "Cannot open file " << target_filename;
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- qDebug() << "GraphicsPatch: beginning download of file " << target_filename;
|
|
|
- download_started = true;
|
|
|
+ qInfo() << *this << ": beginning download of file " << target_filename;
|
|
|
|
|
|
- ++elapsed_patches_to_download_;
|
|
|
Downloader* downloader = new Downloader();
|
|
|
downloader->setUrl(Settings::getValue(settings_prefix + "/url").toUrl());
|
|
|
downloader->targetFile = target_file;
|
|
@@ -110,77 +98,53 @@ void GraphicsPatch::download()
|
|
|
downloader->start();
|
|
|
}
|
|
|
|
|
|
- if (!download_started) {
|
|
|
- emit operationFinished("download", this, true);
|
|
|
- } // otherwise will be emitted on the last onDownloaderFinished signal
|
|
|
+ if (downloaders_.empty()) {
|
|
|
+ emit operationFinished(E_DOWNLOAD, this);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void GraphicsPatch::install()
|
|
|
{
|
|
|
- if (elapsed_databases_to_install_ > 0) {
|
|
|
- emit errorOccured("install", this, "Установка набора графических патчей ещё не закончена");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- emit operationStarted("install", this);
|
|
|
-
|
|
|
- status_.process = CurrentProcess::E_INSTALL;
|
|
|
- status_.percent = 0;
|
|
|
- status_.total_parts = 3;
|
|
|
- status_.current_part = 0;
|
|
|
+ emit operationFinished(E_INSTALL, this);
|
|
|
+ return;
|
|
|
|
|
|
installLoadscreens();
|
|
|
|
|
|
- status_.process = CurrentProcess::E_AWAITING_INSTALL;
|
|
|
-
|
|
|
foreach (QString db_name, QStringList({"image", "texture"})) {
|
|
|
- ++elapsed_databases_to_install_;
|
|
|
- QMetaObject::invokeMethod(lotro_mgr_,
|
|
|
- "installPatch",
|
|
|
- Qt::QueuedConnection,
|
|
|
- Q_ARG(QString, "GraphicsPatch_" + db_name),
|
|
|
+ ++elapsed_patches_to_install_;
|
|
|
+ QMetaObject::invokeMethod(lotro_mgr_, "installPatch", Qt::QueuedConnection,
|
|
|
+ Q_ARG(QString, getPatchName() + "_" + db_name),
|
|
|
Q_ARG(QString, Settings::getValue("PatchDatabases/" + db_name + "/path").toString())
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
void GraphicsPatch::activate()
|
|
|
{
|
|
|
+ emit operationFinished(E_ACTIVATE, this);
|
|
|
+ return;
|
|
|
+
|
|
|
if (Settings::getValue("Components/loadscreens").toBool()) {
|
|
|
enableLoadscreens();
|
|
|
} else {
|
|
|
disableLoadscreens();
|
|
|
}
|
|
|
|
|
|
- if (Settings::getValue("Components/maps").toBool()) {
|
|
|
- QMetaObject::invokeMethod(lotro_mgr_,
|
|
|
- "enableCategory",
|
|
|
- Qt::QueuedConnection,
|
|
|
- Q_ARG(QString, "GraphicsPatch_maps"),
|
|
|
- Q_ARG(LotroDatManager::Category, LotroDatManager::Category::E_MAPS_COMMON)
|
|
|
- );
|
|
|
- } else {
|
|
|
- QMetaObject::invokeMethod(lotro_mgr_,
|
|
|
- "disableCategory",
|
|
|
- Q_ARG(QString, "GraphicsPatch_maps"),
|
|
|
+ QString operation_name;
|
|
|
+
|
|
|
+ operation_name = Settings::getValue("Components/maps").toBool() ? "enableCategory" : "disableCategory";
|
|
|
+ ++elapsed_patches_to_install_;
|
|
|
+ QMetaObject::invokeMethod(lotro_mgr_, operation_name.toLocal8Bit().constData(), Qt::QueuedConnection,
|
|
|
+ Q_ARG(QString, getPatchName() + "_maps"),
|
|
|
Q_ARG(LotroDatManager::Category, LotroDatManager::Category::E_MAPS_COMMON)
|
|
|
);
|
|
|
- }
|
|
|
|
|
|
- if (Settings::getValue("Components/textures").toBool()) {
|
|
|
- QMetaObject::invokeMethod(lotro_mgr_,
|
|
|
- "enableCategory",
|
|
|
- Q_ARG(QString, "GraphicsPatch_maps"),
|
|
|
- Q_ARG(LotroDatManager::Category, LotroDatManager::Category::E_TEXTURES_COMMON)
|
|
|
- );
|
|
|
- } else {
|
|
|
- QMetaObject::invokeMethod(lotro_mgr_,
|
|
|
- "disableCategory",
|
|
|
- Q_ARG(QString, "GraphicsPatch_maps"),
|
|
|
+ operation_name = Settings::getValue("Components/textures").toBool() ? "enableCategory" : "disableCategory";
|
|
|
+ ++elapsed_patches_to_install_;
|
|
|
+ QMetaObject::invokeMethod(lotro_mgr_, operation_name.toLocal8Bit().constData(), Qt::QueuedConnection,
|
|
|
+ Q_ARG(QString, getPatchName() + "_textures"),
|
|
|
Q_ARG(LotroDatManager::Category, LotroDatManager::Category::E_TEXTURES_COMMON)
|
|
|
);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
void GraphicsPatch::onDownloaderProgressChanged(Downloader *, Downloader::Status)
|
|
@@ -190,119 +154,84 @@ void GraphicsPatch::onDownloaderProgressChanged(Downloader *, Downloader::Status
|
|
|
all_downloads_status = all_downloads_status + downloader->getDownloadStatus();
|
|
|
}
|
|
|
|
|
|
- emit downloadStatusChanged(this, all_downloads_status);
|
|
|
+ emit progressChanged(OperationProgress(all_downloads_status), this);
|
|
|
}
|
|
|
|
|
|
void GraphicsPatch::onDownloaderFinished(Downloader *ptr)
|
|
|
{
|
|
|
+ ptr->targetFile->close();
|
|
|
+ ptr->targetFile->deleteLater();
|
|
|
+
|
|
|
Downloader::Status all_downloads_status;
|
|
|
- foreach (Downloader* downloader, downloaders_) {
|
|
|
+ for (const Downloader* downloader : downloaders_) {
|
|
|
all_downloads_status = all_downloads_status + downloader->getDownloadStatus();
|
|
|
}
|
|
|
|
|
|
- ptr->targetFile->close();
|
|
|
- ptr->targetFile->deleteLater();
|
|
|
-
|
|
|
- if (elapsed_patches_to_download_ == 1) {
|
|
|
- foreach (Downloader* downloader, downloaders_) {
|
|
|
+ if (!all_downloads_status.running) {
|
|
|
+ for (Downloader* downloader : downloaders_) {
|
|
|
downloader->deleteLater();
|
|
|
}
|
|
|
downloaders_.clear();
|
|
|
-
|
|
|
- emit downloadStatusChanged(this, all_downloads_status);
|
|
|
- emit operationFinished("download", this, true);
|
|
|
+ emit operationFinished(E_DOWNLOAD, this);
|
|
|
}
|
|
|
-
|
|
|
- --elapsed_patches_to_download_;
|
|
|
}
|
|
|
|
|
|
void GraphicsPatch::onLotroDatManagerOperationFinished(QString operation_name, QVector<QVariant> args, bool successful)
|
|
|
{
|
|
|
- if (operation_name == "installPatch") {
|
|
|
- if (!args[0].toString().contains("GraphicsPatch_")) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- status_.process = CurrentProcess::E_AWAITING_INSTALL;
|
|
|
- status_.percent = 100;
|
|
|
- emit installStatusChanged(this, status_);
|
|
|
-
|
|
|
- --elapsed_databases_to_install_;
|
|
|
+ if (args.size() == 0 || !args[0].toString().contains(getPatchName())) {
|
|
|
+ return; // This means, that message from LotroManager is addressed to another patchset
|
|
|
+ }
|
|
|
|
|
|
+ if (operation_name.contains("installPatch")) {
|
|
|
if (!successful) {
|
|
|
- emit errorOccured("install", this, "Database " + args[0].toString() + " (" + args[1].toString() + ") was not installed due to Legacy core error.");
|
|
|
+ qCritical() << *this << "Database " + args[0].toString() + " (" + args[1].toString() + ") was not installed due to Legacy core error.";
|
|
|
+ emit errorOccured(E_INSTALL, this, "Database " + args[0].toString() + " (" + args[1].toString() + ") was not installed due to Legacy core error.");
|
|
|
}
|
|
|
|
|
|
- if (elapsed_databases_to_install_ == 0) {
|
|
|
- status_.process = CurrentProcess::E_FINISHED;
|
|
|
- emit operationFinished("install", this, true);
|
|
|
+ --elapsed_patches_to_install_;
|
|
|
+ if (!elapsed_patches_to_install_) {
|
|
|
+ is_being_patched_by_lotro_dat_manager_ = false;
|
|
|
+ emit operationFinished(E_INSTALL, this);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (operation_name == "enableCategory" || operation_name == "disableCategory") {
|
|
|
- if (!args[0].toString().contains("GraphicsPatch_")) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- status_.process = CurrentProcess::E_AWAITING_APPLY;
|
|
|
- status_.percent = 100;
|
|
|
- emit installStatusChanged(this, status_);
|
|
|
-
|
|
|
- --elapsed_categories_to_activate_;
|
|
|
+ if (operation_name.contains("enableCategory") || operation_name.contains("disableCategory")) {
|
|
|
if (!successful) {
|
|
|
- emit errorOccured("activate", this, "Error in patch " + args[0].toString() + ": activating category " + QString::number(args[1].toInt()) + " failed.");
|
|
|
+ qCritical() << *this << "Error in patch " + args[0].toString() + ": activating category " + QString::number(args[1].toInt()) + " failed.";
|
|
|
+ emit errorOccured(E_ACTIVATE, this, "Error in patch " + args[0].toString() + ": activating category " + QString::number(args[1].toInt()) + " failed.");
|
|
|
}
|
|
|
|
|
|
- if (elapsed_categories_to_activate_ == 0) {
|
|
|
- status_.process = CurrentProcess::E_FINISHED;
|
|
|
- emit operationFinished("activate", this, true);
|
|
|
+ --elapsed_patches_to_install_;
|
|
|
+ if (!elapsed_patches_to_install_) {
|
|
|
+ is_being_patched_by_lotro_dat_manager_ = false;
|
|
|
+ emit operationFinished(E_ACTIVATE, this);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void GraphicsPatch::onLotroDatManagerOperationStarted(QString operation_name, QVector<QVariant> args)
|
|
|
{
|
|
|
- if (operation_name == "installPatch") {
|
|
|
- if (!args[0].toString().contains("GraphicsPatch_")) {
|
|
|
- return;
|
|
|
- }
|
|
|
- status_.process = CurrentProcess::E_INSTALL;
|
|
|
- status_.current_part++;
|
|
|
- status_.percent = 0;
|
|
|
- emit installStatusChanged(this, status_);
|
|
|
+ if (args.size() == 0 || !args[0].toString().contains(getPatchName())) {
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- if (operation_name == "enableCategory" || operation_name == "disableCategory") {
|
|
|
- if (!args[0].toString().contains("GraphicsPatch_")) {
|
|
|
- return;
|
|
|
- }
|
|
|
- status_.process = CurrentProcess::E_APPLY;
|
|
|
- status_.current_part++;
|
|
|
- status_.percent = 0;
|
|
|
- emit installStatusChanged(this, status_);
|
|
|
- }
|
|
|
+ is_being_patched_by_lotro_dat_manager_ = true;
|
|
|
}
|
|
|
|
|
|
void GraphicsPatch::onLotroDatManagerStatusChanged(LotroDatManager::Status status)
|
|
|
{
|
|
|
- if (status_.process != CurrentProcess::E_INSTALL || status_.process != CurrentProcess::E_APPLY) {
|
|
|
+ if (!is_being_patched_by_lotro_dat_manager_) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- status_.percent = status.percent;
|
|
|
- emit installStatusChanged(this, status_);
|
|
|
+ emit progressChanged(OperationProgress(status), this);
|
|
|
}
|
|
|
|
|
|
void GraphicsPatch::installLoadscreens()
|
|
|
{
|
|
|
- status_.current_part++;
|
|
|
- status_.process = CurrentProcess::E_INSTALL;
|
|
|
- status_.percent = 0;
|
|
|
- emit installStatusChanged(this, status_);
|
|
|
-
|
|
|
QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
|
|
|
|
|
|
- QStringList filenames = {
|
|
|
+ const QStringList loadscreens_filenames = {
|
|
|
locale_prefix == "English" ? "lotro_ad_pregame.jpg" : "lotro_ad_pregame_" + locale_prefix + ".jpg",
|
|
|
"lotro_generic_teleport_screen_01.jpg",
|
|
|
"lotro_generic_teleport_screen_02.jpg",
|
|
@@ -316,9 +245,13 @@ void GraphicsPatch::installLoadscreens()
|
|
|
"lotro_generic_teleport_screen_10.jpg"
|
|
|
};
|
|
|
|
|
|
+ OperationProgress progress;
|
|
|
+ progress.install_finished_parts = 0;
|
|
|
+ progress.install_total_parts = loadscreens_filenames.size() * 2;
|
|
|
+
|
|
|
LOTRO_DAT::Database database;
|
|
|
if (!database.InitDatabase(Settings::getValue("PatchDatabases/Loadscreen/path").toString().toStdString())) {
|
|
|
- emit errorOccured("install", this, "installLoadscreensCannotInitDb");
|
|
|
+ qCritical() << *this << "database.InitDatabase() of " << Settings::getValue("PatchDatabases/Loadscreen/path").toString() << " FAILED!";
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -326,24 +259,22 @@ void GraphicsPatch::installLoadscreens()
|
|
|
|
|
|
QString logo_path = Settings::getValue("Lotro/game_path").toString() + "/raw/" + (locale_prefix == "English" ? "en" : locale_prefix) + "/logo/";
|
|
|
|
|
|
- for (size_t i = 0; i < qMin(size_t(filenames.size()), database.CountRows()); ++i) {
|
|
|
- QFile::remove(logo_path + filenames[i] + "_ru");
|
|
|
- if (!data.binary_data.WriteToFile((logo_path + filenames[i] + "_ru").toStdString())) {
|
|
|
- emit errorOccured("install", this, "Не могу осуществить запись в файл " + logo_path + filenames[i]);
|
|
|
- }
|
|
|
- status_.percent = double(i) * 50.0 / (qMin(double(filenames.size()), double(database.CountRows())));
|
|
|
- emit installStatusChanged(this, status_);
|
|
|
- }
|
|
|
+ for (size_t i = 0; i < qMin(size_t(loadscreens_filenames.size()), database.CountRows()); ++i) {
|
|
|
+ QFile::remove(logo_path + loadscreens_filenames[i] + "_ru");
|
|
|
|
|
|
+ if (!data.binary_data.WriteToFile((logo_path + loadscreens_filenames[i] + "_ru").toStdString())) {
|
|
|
+ qWarning() << patch_name_ << "Cannot write to file " << logo_path + loadscreens_filenames[i];
|
|
|
+ }
|
|
|
|
|
|
- for (int i = 0; i < filenames.size(); ++i) {
|
|
|
- QFile::copy(logo_path + filenames[i], logo_path + filenames[i] + "_orig");
|
|
|
- status_.percent = 50 + double(i) * 50.0 / double(filenames.size());
|
|
|
- emit installStatusChanged(this, status_);
|
|
|
+ progress.install_finished_parts++;
|
|
|
+ emit progressChanged(progress, this);
|
|
|
}
|
|
|
|
|
|
- status_.percent = 100;
|
|
|
- emit installStatusChanged(this, status_);
|
|
|
+ for (int i = 0; i < loadscreens_filenames.size(); ++i) {
|
|
|
+ QFile::copy(logo_path + loadscreens_filenames[i], logo_path + loadscreens_filenames[i] + "_orig"); // Will not copy if _orig file already exists
|
|
|
+ progress.install_finished_parts++;
|
|
|
+ emit progressChanged(progress, this);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void GraphicsPatch::enableLoadscreens()
|
|
@@ -351,7 +282,7 @@ void GraphicsPatch::enableLoadscreens()
|
|
|
QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
|
|
|
QString logo_path = Settings::getValue("Lotro/game_path").toString() + "/raw/" + (locale_prefix == "English" ? "en" : locale_prefix) + "/logo/";
|
|
|
|
|
|
- QStringList filenames = {
|
|
|
+ const QStringList loadscreens_filenames = {
|
|
|
locale_prefix == "English" ? "lotro_ad_pregame.jpg" : "lotro_ad_pregame_" + locale_prefix + ".jpg",
|
|
|
"lotro_generic_teleport_screen_01.jpg",
|
|
|
"lotro_generic_teleport_screen_02.jpg",
|
|
@@ -365,9 +296,15 @@ void GraphicsPatch::enableLoadscreens()
|
|
|
"lotro_generic_teleport_screen_10.jpg"
|
|
|
};
|
|
|
|
|
|
- for (int i = 0; i < filenames.size(); ++i) {
|
|
|
- QFile::remove(logo_path + filenames[i]);
|
|
|
- QFile::copy(logo_path + filenames[i] + "_ru", logo_path + filenames[i]);
|
|
|
+ OperationProgress progress;
|
|
|
+ progress.install_total_parts = loadscreens_filenames.size();
|
|
|
+
|
|
|
+ for (int i = 0; i < loadscreens_filenames.size(); ++i) {
|
|
|
+ QFile::remove(logo_path + loadscreens_filenames[i]);
|
|
|
+ QFile::copy(logo_path + loadscreens_filenames[i] + "_ru", logo_path + loadscreens_filenames[i]);
|
|
|
+
|
|
|
+ progress.install_finished_parts++;
|
|
|
+ emit progressChanged(progress, this);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -376,7 +313,7 @@ void GraphicsPatch::disableLoadscreens()
|
|
|
QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
|
|
|
QString logo_path = Settings::getValue("Lotro/game_path").toString() + "/raw/" + (locale_prefix == "English" ? "en" : locale_prefix) + "/logo/";
|
|
|
|
|
|
- QStringList filenames = {
|
|
|
+ const QStringList loadscreens_filenames = {
|
|
|
locale_prefix == "English" ? "lotro_ad_pregame.jpg" : "lotro_ad_pregame_" + locale_prefix + ".jpg",
|
|
|
"lotro_generic_teleport_screen_01.jpg",
|
|
|
"lotro_generic_teleport_screen_02.jpg",
|
|
@@ -390,8 +327,14 @@ void GraphicsPatch::disableLoadscreens()
|
|
|
"lotro_generic_teleport_screen_10.jpg"
|
|
|
};
|
|
|
|
|
|
- for (int i = 0; i < filenames.size(); ++i) {
|
|
|
- QFile::remove(logo_path + filenames[i]);
|
|
|
- QFile::copy(logo_path + filenames[i] + "_orig", logo_path + filenames[i]);
|
|
|
+ OperationProgress progress;
|
|
|
+ progress.install_total_parts = loadscreens_filenames.size();
|
|
|
+
|
|
|
+ for (int i = 0; i < loadscreens_filenames.size(); ++i) {
|
|
|
+ QFile::remove(logo_path + loadscreens_filenames[i]);
|
|
|
+ QFile::copy(logo_path + loadscreens_filenames[i] + "_orig", logo_path + loadscreens_filenames[i]);
|
|
|
+
|
|
|
+ progress.install_finished_parts++;
|
|
|
+ emit progressChanged(progress, this);
|
|
|
}
|
|
|
}
|