configure_general.cpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2016 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "core/core.h"
  5. #include "core/settings.h"
  6. #include "ui_configure_general.h"
  7. #include "yuzu/configuration/configure_general.h"
  8. #include "yuzu/ui_settings.h"
  9. ConfigureGeneral::ConfigureGeneral(QWidget* parent)
  10. : QWidget(parent), ui(new Ui::ConfigureGeneral) {
  11. ui->setupUi(this);
  12. for (auto theme : UISettings::themes) {
  13. ui->theme_combobox->addItem(theme.first, theme.second);
  14. }
  15. this->setConfiguration();
  16. ui->cpu_core_combobox->setEnabled(!Core::System::GetInstance().IsPoweredOn());
  17. }
  18. ConfigureGeneral::~ConfigureGeneral() {}
  19. void ConfigureGeneral::setConfiguration() {
  20. ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan);
  21. ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
  22. // The first item is "auto-select" with actual value -1, so plus one here will do the trick
  23. ui->region_combobox->setCurrentIndex(Settings::values.region_value + 1);
  24. ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme));
  25. ui->cpu_core_combobox->setCurrentIndex(static_cast<int>(Settings::values.cpu_core));
  26. }
  27. void ConfigureGeneral::applyConfiguration() {
  28. UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked();
  29. UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
  30. UISettings::values.theme =
  31. ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString();
  32. Settings::values.region_value = ui->region_combobox->currentIndex() - 1;
  33. Settings::values.cpu_core =
  34. static_cast<Settings::CpuCore>(ui->cpu_core_combobox->currentIndex());
  35. Settings::Apply();
  36. }