|
@@ -1,15 +1,91 @@
|
|
#include "gamesettings.h"
|
|
#include "gamesettings.h"
|
|
#include "ui_gamesettings.h"
|
|
#include "ui_gamesettings.h"
|
|
|
|
|
|
|
|
+#include "models/settings.h"
|
|
|
|
+#include "models/filesystem.h"
|
|
|
|
+#include "models/patchinstaller.h"
|
|
|
|
+
|
|
|
|
+#include <QFileDialog>
|
|
|
|
+
|
|
GameSettings::GameSettings(QWidget *parent) :
|
|
GameSettings::GameSettings(QWidget *parent) :
|
|
QWidget(parent),
|
|
QWidget(parent),
|
|
ui(new Ui::GameSettings)
|
|
ui(new Ui::GameSettings)
|
|
{
|
|
{
|
|
ui->setupUi(this);
|
|
ui->setupUi(this);
|
|
setAttribute(Qt::WA_StyledBackground, true);
|
|
setAttribute(Qt::WA_StyledBackground, true);
|
|
|
|
+ setActualParametersValues();
|
|
}
|
|
}
|
|
|
|
|
|
GameSettings::~GameSettings()
|
|
GameSettings::~GameSettings()
|
|
{
|
|
{
|
|
delete ui;
|
|
delete ui;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+void GameSettings::setActualParametersValues()
|
|
|
|
+{
|
|
|
|
+ QString game_path = Settings::getValue("Lotro/game_path").toString();
|
|
|
|
+ if (game_path == "none") {
|
|
|
|
+ game_path = "Путь к файлам игры не выбран";
|
|
|
|
+ }
|
|
|
|
+ ui->game_folder_path->setText(game_path);
|
|
|
|
+
|
|
|
|
+ QString original_locale = Settings::getValue("Lotro/original_locale").toString();
|
|
|
|
+ int index = 0;
|
|
|
|
+
|
|
|
|
+ if (original_locale == "English")
|
|
|
|
+ index = 0;
|
|
|
|
+ if (original_locale == "DE")
|
|
|
|
+ index = 1;
|
|
|
|
+ if (original_locale == "FR")
|
|
|
|
+ index = 2;
|
|
|
|
+ ui->lotro_base_language_combobox->setCurrentIndex(index);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void GameSettings::on_change_folder_button_clicked()
|
|
|
|
+{
|
|
|
|
+ QStringList known_paths = FileSystem::recognizeRegistryLotroPath();
|
|
|
|
+ QString template_path = known_paths.empty() ? "" : known_paths[0];
|
|
|
|
+ QString str = QFileDialog::getOpenFileName(0, "Расположение игры", template_path, "LotroLauncher.exe");
|
|
|
|
+
|
|
|
|
+ if (str.isEmpty()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ QString game_folder= str.replace("/LotroLauncher.exe", "").replace("\\", "/").replace("//", "/") + "/";
|
|
|
|
+ ui->game_folder_path->setText(game_folder);
|
|
|
|
+
|
|
|
|
+ Settings::setValue("Lotro/game_path", game_folder);
|
|
|
|
+
|
|
|
|
+ QMetaObject::invokeMethod(&PatchInstaller::instance(), &PatchInstaller::deinit, Qt::QueuedConnection);
|
|
|
|
+ QMetaObject::invokeMethod(&PatchInstaller::instance(), &PatchInstaller::init, Qt::QueuedConnection);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void GameSettings::on_lotro_base_language_combobox_currentIndexChanged(int index)
|
|
|
|
+{
|
|
|
|
+ QString value = "English";
|
|
|
|
+
|
|
|
|
+ if (index == 0)
|
|
|
|
+ value = "English";
|
|
|
|
+ if (index == 1)
|
|
|
|
+ value = "DE";
|
|
|
|
+ if (index == 2)
|
|
|
|
+ value = "FR";
|
|
|
|
+
|
|
|
|
+ Settings::setValue("Lotro/original_locale", value);
|
|
|
|
+
|
|
|
|
+ QMetaObject::invokeMethod(&PatchInstaller::instance(), &PatchInstaller::deinit, Qt::QueuedConnection);
|
|
|
|
+ QMetaObject::invokeMethod(&PatchInstaller::instance(), &PatchInstaller::init, Qt::QueuedConnection);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+void GameSettings::onPatchTotalOperationsStarted() {
|
|
|
|
+ ui->change_folder_button->setDisabled(true);
|
|
|
|
+ ui->lotro_base_language_combobox->setDisabled(true);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void GameSettings::onPatchTotalOperationsFinished() {
|
|
|
|
+ ui->change_folder_button->setEnabled(true);
|
|
|
|
+ ui->lotro_base_language_combobox->setEnabled(true);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|