settingswidget.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. #include "ui_settingswidget.h"
  2. #include "models/settings.h"
  3. #include "models/filesystem.h"
  4. #include "models/patchdownloader.h"
  5. #include "widgets/settingswidget.h"
  6. #include "widgets/mainwindow.h"
  7. #include "constants.h"
  8. #include <QDebug>
  9. #include <QScrollBar>
  10. #include <QFileDialog>
  11. #include <QMetaObject>
  12. #include <QMessageBox>
  13. using namespace SettingsWidgetPrivate;
  14. SettingsWidget::SettingsWidget(QWidget *parent)
  15. : QWidget(parent)
  16. , ui(new Ui::SettingsWidget)
  17. {
  18. settings_changed_ = false;
  19. ui->setupUi(this);
  20. combobox_scrolling_disabler = new ComboboxScrollingDisabler();
  21. scroller = new SettingsTabsScroller({ui->sub_entry_1,
  22. ui->sub_entry_2,
  23. ui->sub_entry_3,
  24. ui->sub_entry_4
  25. },
  26. ui->content_scroll_area);
  27. ui->lotro_base_language_combobox->installEventFilter(combobox_scrolling_disabler);
  28. ui->interface_scale_combobox->installEventFilter(combobox_scrolling_disabler);
  29. // ui->content_scroll_area->verticalScrollBar()->installEventFilter(scroller);
  30. ui->patch_installing_label->hide();
  31. // connect(legacy_patches, &PatchList::patchOperationsStarted, this, &SettingsWidget::onPatchTotalOperationsStarted);
  32. // connect(legacy_patches, &PatchList::patchOperationsFinished, this, &SettingsWidget::onPatchTotalOperationsFinished);
  33. // connect(legacy_patches, &PatchList::backupSettingsInfoChanged, this, &SettingsWidget::onBackupSettingsInfoChanged);
  34. // connect(legacy_patches->getManager(), &LotroDatManager::statusChanged, this, &SettingsWidget::onLotroManagerProcessChanged);
  35. ui->apply_changes_button->hide();
  36. ui->apply_changes_label->hide();
  37. ui->patch_installing_label->hide();
  38. settings_backup_ = Settings::createSettingsBackup();
  39. setActualParametersValues();
  40. }
  41. SettingsWidget::~SettingsWidget()
  42. {
  43. delete combobox_scrolling_disabler;
  44. delete scroller;
  45. delete ui;
  46. }
  47. void SettingsWidget::setActualParametersValues()
  48. {
  49. QString game_path = Settings::getValue("Lotro/game_path").toString();
  50. if (game_path == "none") {
  51. game_path = "Путь к файлам игры не выбран";
  52. }
  53. ui->game_folder_path->setText(game_path);
  54. QString original_locale = Settings::getValue("Lotro/original_locale").toString();
  55. int index = 0;
  56. if (original_locale == "English")
  57. index = 0;
  58. if (original_locale == "DE")
  59. index = 1;
  60. if (original_locale == "FR")
  61. index = 2;
  62. ui->lotro_base_language_combobox->setCurrentIndex(index);
  63. ui->skiprawdownload_checkbox->setChecked(Settings::getValue("Lotro/skip_raw_download").toBool());
  64. ui->nosplashscreen_checkbox->setChecked(Settings::getValue("Lotro/no_splash_screen").toBool());
  65. QString backup_status = Settings::getValue("Backup/installed").toBool() ? "Активна" : "Отсутствует";
  66. ui->backup_status_value->setText(backup_status);
  67. ui->backup_path_value->setText(QApplication::applicationDirPath() + Settings::getValue("Backup/path").toString());
  68. QString backup_creation_time = Settings::getValue("Backup/creation_time").toString();
  69. if (backup_creation_time == "none")
  70. backup_creation_time = "-";
  71. ui->backup_creation_time_value->setText(backup_creation_time);
  72. ui->patch_texts_checkbox->setChecked(Settings::getValue("Components/texts_main").toBool());
  73. ui->patch_items_checkbox->setChecked(Settings::getValue("Components/texts_items").toBool());
  74. ui->patch_emotes_checkbox->setChecked(Settings::getValue("Components/texts_emotes").toBool());
  75. ui->patch_maps_checkbox->setChecked(Settings::getValue("Components/maps").toBool());
  76. ui->patch_loadscreens_checkbox->setChecked(Settings::getValue("Components/loadscreens").toBool());
  77. ui->patch_textures_checkbox->setChecked(Settings::getValue("Components/textures").toBool());
  78. ui->patch_sounds_checkbox->setChecked(Settings::getValue("Components/sounds").toBool());
  79. ui->patch_video_checkbox->setChecked(Settings::getValue("Components/videos").toBool());
  80. ui->micropatch_checkbox->setChecked(Settings::getValue("Components/micropatch").toBool());
  81. int interface_scale = Settings::getValue("General/UI_scale").toInt();
  82. int interface_scale_combobox_index = 0;
  83. if (interface_scale == 50)
  84. interface_scale_combobox_index = 0;
  85. if (interface_scale == 75)
  86. interface_scale_combobox_index = 1;
  87. if (interface_scale == 100)
  88. interface_scale_combobox_index = 2;
  89. if (interface_scale == 125)
  90. interface_scale_combobox_index = 3;
  91. if (interface_scale == 150)
  92. interface_scale_combobox_index = 4;
  93. if (interface_scale == 175)
  94. interface_scale_combobox_index = 5;
  95. if (interface_scale == 200)
  96. interface_scale_combobox_index = 6;
  97. ui->interface_scale_combobox->setCurrentIndex(interface_scale_combobox_index);
  98. }
  99. void SettingsWidget::updateFontsSizes()
  100. {
  101. ui->frame_title->setFont(trajan_10pt);
  102. ui->group_label_1->setFont(trajan_9pt);
  103. ui->group_label_2->setFont(trajan_9pt);
  104. ui->group_label_3->setFont(trajan_9pt);
  105. ui->group_label_4->setFont(trajan_9pt);
  106. ui->patch_installing_label->setFont(crimson_12pt);
  107. ui->apply_changes_button->setFont(trajan_10pt);
  108. ui->sub_entry_1_title->setFont(garamond_11pt);
  109. ui->sub_entry_2_title->setFont(garamond_11pt);
  110. ui->sub_entry_3_title->setFont(garamond_11pt);
  111. ui->sub_entry_4_title->setFont(garamond_11pt);
  112. ui->backup_create_button->setFont(trajan_8pt);
  113. ui->backup_restore_button->setFont(trajan_8pt);
  114. ui->backup_remove_button->setFont(trajan_8pt);
  115. ui->game_folder_label->setFont(crimson_11pt);
  116. ui->game_folder_path->setFont(crimson_11pt);
  117. ui->lotro_base_language_label->setFont(crimson_11pt);
  118. ui->lotro_base_language_combobox->setFont(crimson_11pt);
  119. ui->lotro_base_language_combobox->insertItem(ui->lotro_base_language_combobox->count(), ""); // is needed to invoke elements resize
  120. ui->lotro_base_language_combobox->removeItem(ui->lotro_base_language_combobox->count() - 1);
  121. ui->skiprawdownload_checkbox->setFont(crimson_11pt);
  122. ui->nosplashscreen_checkbox->setFont(crimson_11pt);
  123. ui->backup_status_label->setFont(crimson_11pt);
  124. ui->backup_status_value->setFont(crimson_11pt);
  125. ui->backup_creation_time_label->setFont(crimson_11pt);
  126. ui->backup_creation_time_value->setFont(crimson_11pt);
  127. ui->backup_path_label->setFont(crimson_11pt);
  128. ui->backup_path_value->setFont(crimson_11pt);
  129. ui->patch_emotes_checkbox->setFont(crimson_11pt);
  130. ui->patch_items_checkbox->setFont(crimson_11pt);
  131. ui->patch_loadscreens_checkbox->setFont(crimson_11pt);
  132. ui->patch_maps_checkbox->setFont(crimson_11pt);
  133. ui->patch_sounds_checkbox->setFont(crimson_11pt);
  134. ui->patch_textures_checkbox->setFont(crimson_11pt);
  135. ui->patch_video_checkbox->setFont(crimson_11pt);
  136. ui->patch_texts_checkbox->setFont(crimson_11pt);
  137. ui->micropatch_checkbox->setFont(crimson_11pt);
  138. ui->interface_scale_label->setFont(crimson_11pt);
  139. ui->interface_scale_combobox->setFont(crimson_11pt);
  140. ui->interface_scale_combobox->insertItem(ui->interface_scale_combobox->count(), "250%"); // is needed to invoke elements resize
  141. ui->interface_scale_combobox->removeItem(ui->interface_scale_combobox->count() - 1);
  142. ui->texts_block_label->setFont(crimson_12pt);
  143. ui->graphics_block_label->setFont(crimson_12pt);
  144. ui->sounds_block_label->setFont(crimson_12pt);
  145. }
  146. void SettingsWidget::resizeEvent(QResizeEvent *)
  147. {
  148. updateFontsSizes();
  149. double coefficient = window_width / default_window_width;
  150. ui->frame_title->move(QPoint(45, 33) * coefficient);
  151. ui->frame_title->resize(QSize(201, 21) * coefficient);
  152. ui->checkpoints_list->move(QPoint(25, 70) * coefficient);
  153. ui->checkpoints_list->resize(QSize(265, 451) * coefficient);
  154. ui->content_scroll_area->move(QPoint(310, 0) * coefficient);
  155. ui->content_scroll_area->resize(QSize(671, 521) * coefficient);
  156. ui->content_widget->setMinimumWidth(650 * coefficient);
  157. ui->change_folder_button->setMinimumSize(QSize(36, 32) * coefficient);
  158. ui->patch_texts_icon->setMinimumSize(QSize(80, 80) * coefficient);
  159. ui->patch_graphics_icon->setMinimumSize(QSize(80, 80) * coefficient);
  160. ui->patch_sounds_icon->setMinimumSize(QSize(80, 80) * coefficient);
  161. ui->apply_changes_button->setMinimumSize(QSize(160, 60) * coefficient);
  162. }
  163. void SettingsWidget::onLotroManagerProcessChanged(PatchInstaller::Status status)
  164. {
  165. // if (status.status != LOTRO_DAT::DatStatus::E_BACKUP_CREATING &&
  166. // status.status != LOTRO_DAT::DatStatus::E_BACKUP_REMOVING &&
  167. // status.status != LOTRO_DAT::DatStatus::E_BACKUP_RESTORING) {
  168. // return;
  169. // }
  170. // QString operation;
  171. // if (status.status == LOTRO_DAT::DatStatus::E_BACKUP_CREATING) {
  172. // operation = "Создание копии";
  173. // }
  174. // if (status.status == LOTRO_DAT::DatStatus::E_BACKUP_REMOVING) {
  175. // operation = "Удаление копии";
  176. // }
  177. // if (status.status == LOTRO_DAT::DatStatus::E_BACKUP_RESTORING) {
  178. // operation = "Восстановление данных";
  179. // }
  180. // operation = operation + " " + QString::number(status.percentage, 'f', 1) + "%";
  181. // ui->backup_status_value->setText(operation);
  182. }
  183. void SettingsWidget::onBackupSettingsInfoChanged()
  184. {
  185. settings_backup_["Backup/installed"] = Settings::getValue("Backup/installed");
  186. settings_backup_["Backup/path"] = Settings::getValue("Backup/path");
  187. settings_backup_["Backup/creation_time"] = Settings::getValue("Backup/creation_time");
  188. QString backup_status = Settings::getValue("Backup/installed").toBool() ? "Активна" : "Отсутствует";
  189. ui->backup_status_value->setText(backup_status);
  190. ui->backup_path_value->setText(QApplication::applicationDirPath() + Settings::getValue("Backup/path").toString());
  191. QString backup_creation_time = Settings::getValue("Backup/creation_time").toString();
  192. if (backup_creation_time == "none")
  193. backup_creation_time = "-";
  194. ui->backup_creation_time_value->setText(backup_creation_time);
  195. }
  196. void SettingsWidget::processParameterChange() {
  197. if (!settings_changed_) {
  198. settings_changed_ = true;
  199. emit SettingsChanged();
  200. ui->apply_changes_label->show();
  201. ui->apply_changes_button->show();
  202. }
  203. }
  204. void SettingsWidget::checkIfParametersWereReset() {
  205. if (settings_changed_ && settings_backup_ == Settings::createSettingsBackup()) {
  206. settings_changed_ = false;
  207. emit SettingsReset();
  208. ui->apply_changes_label->hide();
  209. ui->apply_changes_button->hide();
  210. }
  211. }
  212. void SettingsWidget::on_change_folder_button_clicked()
  213. {
  214. QStringList known_paths = FileSystem::recognizeRegistryLotroPath();
  215. QString template_path = known_paths.empty() ? "" : known_paths[0];
  216. QString str = QFileDialog::getOpenFileName(0, "Расположение игры", template_path, "LotroLauncher.exe");
  217. if (str.isEmpty()) {
  218. return;
  219. }
  220. QString game_folder= str.replace("/LotroLauncher.exe", "").replace("\\", "/").replace("//", "/") + "/";
  221. if (settings_backup_["Lotro/game_path"].toString() == game_folder) {
  222. return;
  223. }
  224. processParameterChange();
  225. settings_backup_["Lotro/game_path"] = game_folder;
  226. ui->game_folder_path->setText(game_folder);
  227. checkIfParametersWereReset();
  228. }
  229. void SettingsWidget::on_lotro_base_language_combobox_currentIndexChanged(int index)
  230. {
  231. QString value = "English";
  232. if (index == 0)
  233. value = "English";
  234. if (index == 1)
  235. value = "DE";
  236. if (index == 2)
  237. value = "FR";
  238. if (settings_backup_["Lotro/original_locale"].toString() == value) {
  239. return;
  240. }
  241. processParameterChange();
  242. settings_backup_["Lotro/original_locale"] = value;
  243. checkIfParametersWereReset();
  244. }
  245. void SettingsWidget::on_skiprawdownload_checkbox_stateChanged(int arg1) {
  246. if (arg1 == Qt::Checked) {
  247. Settings::setValue("Lotro/skip_raw_download", true);
  248. settings_backup_["Lotro/skip_raw_download"] = true;
  249. }
  250. if (arg1 == Qt::Unchecked) {
  251. Settings::setValue("Lotro/skip_raw_download", false);
  252. settings_backup_["Lotro/skip_raw_download"] = false;
  253. }
  254. }
  255. void SettingsWidget::on_nosplashscreen_checkbox_stateChanged(int arg1)
  256. {
  257. if (arg1 == Qt::Checked) {
  258. Settings::setValue("Lotro/no_splash_screen", true);
  259. settings_backup_["Lotro/no_splash_screen"] = true;
  260. }
  261. if (arg1 == Qt::Unchecked) {
  262. Settings::setValue("Lotro/no_splash_screen", false);
  263. settings_backup_["Lotro/no_splash_screen"] = false;
  264. }
  265. }
  266. void SettingsWidget::on_backup_create_button_clicked()
  267. {
  268. if (settings_changed_) {
  269. QMessageBox::warning(nullptr, "Невозможно выполнить действие!", "Некоторые настройки были изменены. Чтобы создать резервную копию, примените или отмените изменения!");
  270. return;
  271. }
  272. if (Settings::getValue("Backup/installed").toBool()) {
  273. int result = QMessageBox::question(nullptr, "Подтвердите действие", "Резервная копия уже существует. Вы хотите перезаписать существующую копию?", QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton);
  274. if (result != QMessageBox::Yes) {
  275. return;
  276. }
  277. }
  278. // QMetaObject::invokeMethod(legacy_patches_, "createBackup", Qt::QueuedConnection);
  279. }
  280. void SettingsWidget::on_backup_restore_button_clicked()
  281. {
  282. if (!Settings::getValue("Backup/installed").toBool()) {
  283. QMessageBox::warning(nullptr, "Невозможно выполнить действие.", "Резервная копия не найдена. Создайте резервную копию, чтобы иметь возможность восстановления данных.");
  284. return;
  285. }
  286. if (settings_changed_) {
  287. QMessageBox::warning(nullptr, "Невозможно выполнить действие.", "Некоторые настройки были изменены. Чтобы восстановить данные из резервной копии, примените или отмените изменения!");
  288. return;
  289. }
  290. // QMetaObject::invokeMethod(legacy_patches_, "restoreFromBackup", Qt::QueuedConnection);
  291. }
  292. void SettingsWidget::on_backup_remove_button_clicked()
  293. {
  294. if (Settings::getValue("Backup/installed").toBool()) {
  295. int result = QMessageBox::question(nullptr, "Подтвердите действие", "Вы уверены, что хотите удалить существующую резервную копию?", QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton);
  296. if (result != QMessageBox::Yes) {
  297. return;
  298. }
  299. } else {
  300. QMessageBox::information(nullptr, "Невозможно выполнить действие.", "Удаление невозможно: резервной копии не существует.");
  301. return;
  302. }
  303. // QMetaObject::invokeMethod(legacy_patches_, "removeBackup", Qt::QueuedConnection);
  304. }
  305. void SettingsWidget::on_patch_texts_checkbox_clicked()
  306. {
  307. processParameterChange();
  308. if (ui->patch_texts_checkbox->isChecked()) {
  309. settings_backup_["Components/texts_main"] = true;
  310. } else {
  311. settings_backup_["Components/texts_main"] = false;
  312. }
  313. checkIfParametersWereReset();
  314. }
  315. void SettingsWidget::on_patch_items_checkbox_clicked()
  316. {
  317. processParameterChange();
  318. if (ui->patch_items_checkbox->isChecked()) {
  319. settings_backup_["Components/texts_items"] = true;
  320. } else {
  321. settings_backup_["Components/texts_items"] = false;
  322. }
  323. checkIfParametersWereReset();
  324. }
  325. void SettingsWidget::on_patch_emotes_checkbox_clicked()
  326. {
  327. processParameterChange();
  328. if (ui->patch_emotes_checkbox->isChecked()) {
  329. settings_backup_["Components/texts_emotes"] = true;
  330. } else {
  331. settings_backup_["Components/texts_emotes"] = false;
  332. }
  333. checkIfParametersWereReset();
  334. }
  335. void SettingsWidget::on_patch_maps_checkbox_clicked()
  336. {
  337. processParameterChange();
  338. if (ui->patch_maps_checkbox->isChecked()) {
  339. settings_backup_["Components/maps"] = true;
  340. } else {
  341. settings_backup_["Components/maps"] = false;
  342. }
  343. checkIfParametersWereReset();
  344. }
  345. void SettingsWidget::on_patch_textures_checkbox_clicked()
  346. {
  347. processParameterChange();
  348. if (ui->patch_textures_checkbox->isChecked()) {
  349. settings_backup_["Components/textures"] = true;
  350. } else {
  351. settings_backup_["Components/textures"] = false;
  352. }
  353. checkIfParametersWereReset();
  354. }
  355. void SettingsWidget::on_patch_loadscreens_checkbox_clicked()
  356. {
  357. processParameterChange();
  358. if (ui->patch_loadscreens_checkbox->isChecked()) {
  359. settings_backup_["Components/loadscreens"] = true;
  360. } else {
  361. settings_backup_["Components/loadscreens"] = false;
  362. }
  363. checkIfParametersWereReset();
  364. }
  365. void SettingsWidget::on_patch_sounds_checkbox_clicked()
  366. {
  367. processParameterChange();
  368. if (ui->patch_sounds_checkbox->isChecked()) {
  369. settings_backup_["Components/sounds"] = true;
  370. } else {
  371. settings_backup_["Components/sounds"] = false;
  372. }
  373. checkIfParametersWereReset();
  374. }
  375. void SettingsWidget::on_patch_video_checkbox_clicked()
  376. {
  377. processParameterChange();
  378. if (ui->patch_video_checkbox->isChecked()) {
  379. settings_backup_["Components/videos"] = true;
  380. } else {
  381. settings_backup_["Components/videos"] = false;
  382. }
  383. checkIfParametersWereReset();
  384. }
  385. void SettingsWidget::on_patch_force_apply_button_clicked()
  386. {
  387. const auto isComponentActivated = [](QString component_name) -> bool {
  388. return Settings::getValue("Components/" + component_name).toBool();
  389. };
  390. const bool texts_activated = (isComponentActivated("videos") || isComponentActivated("texts_main") || isComponentActivated("texts_items") || isComponentActivated("texts_emotes"));
  391. const bool fonts_activated = (isComponentActivated("texts_main") || isComponentActivated("texts_items") || isComponentActivated("texts_emotes"));
  392. const bool images_activated = isComponentActivated("maps");
  393. const bool loadscreens_activated = isComponentActivated("loadscreens");
  394. const bool textures_activated = isComponentActivated("textures");
  395. const bool sounds_activated = isComponentActivated("sounds");
  396. const bool videos_activated = isComponentActivated("videos");
  397. const bool micropatch_activated = isComponentActivated("micropatch");
  398. if (texts_activated)
  399. Settings::setValue("DatabaseNeedInstall/text", true);
  400. if (fonts_activated)
  401. Settings::setValue("DatabaseNeedInstall/font", true);
  402. if (images_activated)
  403. Settings::setValue("DatabaseNeedInstall/image", true);
  404. if (loadscreens_activated)
  405. Settings::setValue("DatabaseNeedInstall/loadscreen", true);
  406. if (textures_activated)
  407. Settings::setValue("DatabaseNeedInstall/texture", true);
  408. if (sounds_activated)
  409. Settings::setValue("DatabaseNeedInstall/sound", true);
  410. if (videos_activated)
  411. Settings::setValue("DatabaseNeedInstall/video", true);
  412. if (micropatch_activated)
  413. Settings::setValue("DatabaseNeedInstall/micro", true);
  414. QMetaObject::invokeMethod(&PatchDownloader::instance(), "startPatchDownloaderChain");
  415. }
  416. void SettingsWidget::on_micropatch_checkbox_clicked()
  417. {
  418. processParameterChange();
  419. if (ui->micropatch_checkbox->isChecked()) {
  420. settings_backup_["Components/micropatch"] = true;
  421. } else {
  422. settings_backup_["Components/micropatch"] = false;
  423. }
  424. checkIfParametersWereReset();
  425. }
  426. void SettingsWidget::on_interface_scale_combobox_currentIndexChanged(const QString &arg1)
  427. {
  428. MainWindow* window = qobject_cast<MainWindow*>(qApp->activeWindow());
  429. if (!window) {
  430. ui->interface_scale_combobox->setCurrentText(Settings::getValue("General/UI_scale").toString() + "%");
  431. qDebug() << "CANNOT FIND MAIN WINDOW!!!";
  432. return;
  433. }
  434. int value = arg1.left(arg1.length() - 1).toInt();
  435. window->resize(default_window_width * value / 100, default_window_height * value / 100);
  436. Settings::setValue("General/UI_scale", value);
  437. settings_backup_["General/UI_scale"] = value;
  438. }
  439. void SettingsWidget::onPatchTotalOperationsStarted()
  440. {
  441. patch_operations_running_ = true;
  442. ui->patch_installing_label->show();
  443. ui->change_folder_button->setEnabled(false);
  444. ui->lotro_base_language_combobox->setEnabled(false);
  445. ui->backup_create_button->setEnabled(false);
  446. ui->backup_restore_button->setEnabled(false);
  447. ui->backup_remove_button->setEnabled(false);
  448. ui->patch_texts_checkbox->setEnabled(false);
  449. ui->patch_items_checkbox->setEnabled(false);
  450. ui->patch_emotes_checkbox->setEnabled(false);
  451. ui->patch_maps_checkbox->setEnabled(false);
  452. ui->patch_textures_checkbox->setEnabled(false);
  453. ui->patch_loadscreens_checkbox->setEnabled(false);
  454. ui->patch_sounds_checkbox->setEnabled(false);
  455. ui->patch_video_checkbox->setEnabled(false);
  456. ui->patch_force_apply_button->setEnabled(false);
  457. ui->micropatch_checkbox->setEnabled(false);
  458. }
  459. void SettingsWidget::onPatchTotalOperationsFinished()
  460. {
  461. patch_operations_running_ = false;
  462. ui->patch_installing_label->hide();
  463. settings_backup_ = Settings::createSettingsBackup();
  464. ui->change_folder_button->setEnabled(true);
  465. ui->lotro_base_language_combobox->setEnabled(true);
  466. ui->backup_create_button->setEnabled(true);
  467. ui->backup_restore_button->setEnabled(true);
  468. ui->backup_remove_button->setEnabled(true);
  469. ui->patch_texts_checkbox->setEnabled(true);
  470. ui->patch_items_checkbox->setEnabled(true);
  471. ui->patch_emotes_checkbox->setEnabled(true);
  472. ui->patch_maps_checkbox->setEnabled(true);
  473. ui->patch_textures_checkbox->setEnabled(true);
  474. ui->patch_loadscreens_checkbox->setEnabled(true);
  475. ui->patch_sounds_checkbox->setEnabled(true);
  476. ui->patch_video_checkbox->setEnabled(true);
  477. ui->patch_force_apply_button->setEnabled(true);
  478. ui->micropatch_checkbox->setEnabled(true);
  479. }
  480. void SettingsWidget::on_apply_changes_button_clicked()
  481. {
  482. Settings::restoreFromSettingsBackup(settings_backup_);
  483. Settings::updatePatchComponentsDependencies();
  484. settings_changed_ = false;
  485. ui->apply_changes_label->hide();
  486. ui->apply_changes_button->hide();
  487. emit SettingsApplied();
  488. }