|
@@ -297,16 +297,12 @@ void LotroDatManager::enableCategory(QString patch_name, LotroDatManager::Catego
|
|
|
emit operationFinished("enableCategory", {patch_name, category}, false);
|
|
|
return;
|
|
|
}
|
|
|
- client_local_file_.GetFileSystem().CommitDirectories();
|
|
|
- client_local_file_.GetLocaleManager().CommitLocales();
|
|
|
|
|
|
if (client_general_file_.GetLocaleManager().EnableCategory(category).result != LOTRO_DAT::SUCCESS) {
|
|
|
emit errorOccured("enableCategory", {patch_name, category}, "ErrorEnableCategoryClientGeneral");
|
|
|
emit operationFinished("enableCategory", {patch_name, category}, false);
|
|
|
return;
|
|
|
}
|
|
|
- client_general_file_.GetFileSystem().CommitDirectories();
|
|
|
- client_general_file_.GetLocaleManager().CommitLocales();
|
|
|
|
|
|
emit operationFinished("enableCategory", {patch_name, category});
|
|
|
}
|
|
@@ -332,32 +328,39 @@ void LotroDatManager::disableCategory(QString patch_name, LotroDatManager::Categ
|
|
|
|
|
|
void LotroDatManager::createBackup()
|
|
|
{
|
|
|
- // TODO: Error handling
|
|
|
emit operationStarted("createBackup");
|
|
|
QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
|
|
|
- client_local_file_.GetBackupManager().CreateBackup((QApplication::applicationDirPath() + "/backup/client_local_" + locale_prefix + ".dat").toStdString());
|
|
|
- client_general_file_.GetBackupManager().CreateBackup((QApplication::applicationDirPath() + "/backup/client_general.dat").toStdString());
|
|
|
- emit operationFinished("createBackup");
|
|
|
+ QString client_local_backup_path = QApplication::applicationDirPath() + Settings::getValue("Backup/path").toString() + "client_local_" + locale_prefix + ".dat";
|
|
|
+ QString client_general_backup_path = QApplication::applicationDirPath() + Settings::getValue("Backup/path").toString() + "client_general.dat";
|
|
|
+ auto loc_res = client_local_file_.GetBackupManager().CreateBackup(client_local_backup_path.toStdString());
|
|
|
+ auto gen_res = client_general_file_.GetBackupManager().CreateBackup(client_general_backup_path.toStdString());
|
|
|
+ bool operations_result = (loc_res.result == LOTRO_DAT::SUCCESS && gen_res.result == LOTRO_DAT::SUCCESS);
|
|
|
+
|
|
|
+ emit operationFinished("createBackup", {client_local_backup_path, client_general_backup_path}, operations_result);
|
|
|
}
|
|
|
|
|
|
void LotroDatManager::restoreFromBackup()
|
|
|
{
|
|
|
- // TODO: Error handling
|
|
|
emit operationStarted("restoreFromBackup");
|
|
|
QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
|
|
|
- client_local_file_.GetBackupManager().RestoreFromBackup((QApplication::applicationDirPath() + "/backup/client_local_" + locale_prefix + ".dat").toStdString());
|
|
|
- client_general_file_.GetBackupManager().RestoreFromBackup((QApplication::applicationDirPath() + "/backup/client_general.dat").toStdString());
|
|
|
- emit operationFinished("restoreFromBackup");
|
|
|
+ QString client_local_backup_path = QApplication::applicationDirPath() + Settings::getValue("Backup/path").toString() + "client_local_" + locale_prefix + ".dat";
|
|
|
+ QString client_general_backup_path = QApplication::applicationDirPath() + Settings::getValue("Backup/path").toString() + "client_general.dat";
|
|
|
+ auto loc_res = client_local_file_.GetBackupManager().RestoreFromBackup(client_local_backup_path.toStdString());
|
|
|
+ auto gen_res = client_general_file_.GetBackupManager().RestoreFromBackup(client_general_backup_path.toStdString());
|
|
|
+ bool operations_result = (loc_res.result == LOTRO_DAT::SUCCESS && gen_res.result == LOTRO_DAT::SUCCESS);
|
|
|
+ emit operationFinished("restoreFromBackup", {}, operations_result);
|
|
|
}
|
|
|
|
|
|
void LotroDatManager::removeBackup()
|
|
|
{
|
|
|
- // TODO: Error handling
|
|
|
emit operationStarted("removeBackup");
|
|
|
QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
|
|
|
- client_local_file_.GetBackupManager().RemoveBackup((QApplication::applicationDirPath() + "/backup/client_local_" + locale_prefix + ".dat").toStdString());
|
|
|
- client_general_file_.GetBackupManager().RemoveBackup((QApplication::applicationDirPath() + "/backup/client_general.dat").toStdString());
|
|
|
- emit operationFinished("removeBackup");
|
|
|
+ QString client_local_backup_path = QApplication::applicationDirPath() + Settings::getValue("Backup/path").toString() + "client_local_" + locale_prefix + ".dat";
|
|
|
+ QString client_general_backup_path = QApplication::applicationDirPath() + Settings::getValue("Backup/path").toString() + "client_general.dat";
|
|
|
+ auto loc_res = client_local_file_.GetBackupManager().RemoveBackup(client_local_backup_path.toStdString());
|
|
|
+ auto gen_res = client_general_file_.GetBackupManager().RemoveBackup(client_general_backup_path.toStdString());
|
|
|
+ bool operations_result = (loc_res.result == LOTRO_DAT::SUCCESS && gen_res.result == LOTRO_DAT::SUCCESS);
|
|
|
+ emit operationFinished("removeBackup", {}, operations_result);
|
|
|
}
|
|
|
|
|
|
bool LotroDatManager::startLotroLauncherWithParameters(LOTRO_DAT::DatLocaleManager::LOCALE locale)
|