Merge pull request #5379 from Ryanel/qt-settings-cpu
Qt: Copy General Tab from WX
This commit is contained in:
commit
289005f702
|
@ -11,12 +11,14 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QRadioButton>
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "Core/Analytics.h"
|
#include "Core/Analytics.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
#include "DolphinQt2/Settings.h"
|
#include "DolphinQt2/Settings.h"
|
||||||
|
|
||||||
GeneralPane::GeneralPane(QWidget* parent) : QWidget(parent)
|
GeneralPane::GeneralPane(QWidget* parent) : QWidget(parent)
|
||||||
|
@ -32,26 +34,26 @@ void GeneralPane::CreateLayout()
|
||||||
m_main_layout = new QVBoxLayout;
|
m_main_layout = new QVBoxLayout;
|
||||||
// Create layout here
|
// Create layout here
|
||||||
CreateBasic();
|
CreateBasic();
|
||||||
|
|
||||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||||
CreateAnalytics();
|
CreateAnalytics();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CreateAdvanced();
|
CreateAdvanced();
|
||||||
|
|
||||||
m_main_layout->addStretch(1);
|
m_main_layout->addStretch(1);
|
||||||
setLayout(m_main_layout);
|
setLayout(m_main_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralPane::ConnectLayout()
|
void GeneralPane::ConnectLayout()
|
||||||
{
|
{
|
||||||
connect(m_combobox_language, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
|
connect(m_checkbox_dualcore, &QCheckBox::clicked, this, &GeneralPane::OnSaveConfig);
|
||||||
[this](int index) { OnSaveConfig(); });
|
connect(m_checkbox_cheats, &QCheckBox::clicked, this, &GeneralPane::OnSaveConfig);
|
||||||
|
|
||||||
// Advanced
|
// Advanced
|
||||||
connect(m_checkbox_force_ntsc, &QCheckBox::clicked, this, &GeneralPane::OnSaveConfig);
|
connect(m_checkbox_force_ntsc, &QCheckBox::clicked, this, &GeneralPane::OnSaveConfig);
|
||||||
connect(m_slider_speedlimit, static_cast<void (QSlider::*)(int)>(&QSlider::valueChanged),
|
connect(m_combobox_speedlimit,
|
||||||
[this](int index) { OnSaveConfig(); });
|
static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::activated),
|
||||||
|
[this](const QString& text) { OnSaveConfig(); });
|
||||||
|
connect(m_radio_interpreter, &QRadioButton::clicked, this, &GeneralPane::OnSaveConfig);
|
||||||
|
connect(m_radio_cached_interpreter, &QRadioButton::clicked, this, &GeneralPane::OnSaveConfig);
|
||||||
|
connect(m_radio_jit, &QRadioButton::clicked, this, &GeneralPane::OnSaveConfig);
|
||||||
|
|
||||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||||
connect(m_checkbox_enable_analytics, &QCheckBox::clicked, this, &GeneralPane::OnSaveConfig);
|
connect(m_checkbox_enable_analytics, &QCheckBox::clicked, this, &GeneralPane::OnSaveConfig);
|
||||||
|
@ -67,13 +69,31 @@ void GeneralPane::CreateBasic()
|
||||||
basic_group->setLayout(basic_group_layout);
|
basic_group->setLayout(basic_group_layout);
|
||||||
m_main_layout->addWidget(basic_group);
|
m_main_layout->addWidget(basic_group);
|
||||||
|
|
||||||
auto* language_layout = new QFormLayout;
|
m_checkbox_dualcore = new QCheckBox(tr("Enable Dual Core (speedup)"));
|
||||||
basic_group_layout->addLayout(language_layout);
|
basic_group_layout->addWidget(m_checkbox_dualcore);
|
||||||
|
|
||||||
m_combobox_language = new QComboBox;
|
m_checkbox_cheats = new QCheckBox(tr("Enable Cheats"));
|
||||||
// TODO: Support more languages other then English
|
basic_group_layout->addWidget(m_checkbox_cheats);
|
||||||
m_combobox_language->addItem(tr("English"));
|
|
||||||
language_layout->addRow(tr("&Language:"), m_combobox_language);
|
auto* speed_limit_layout = new QFormLayout;
|
||||||
|
basic_group_layout->addLayout(speed_limit_layout);
|
||||||
|
|
||||||
|
m_combobox_speedlimit = new QComboBox();
|
||||||
|
m_combobox_speedlimit->setMaximumWidth(300);
|
||||||
|
|
||||||
|
m_combobox_speedlimit->addItem(tr("Unlimited"));
|
||||||
|
for (int i = 10; i <= 200; i += 10) // from 10% to 200%
|
||||||
|
{
|
||||||
|
QString str;
|
||||||
|
if (i != 100)
|
||||||
|
str.sprintf("%i%%", i);
|
||||||
|
else
|
||||||
|
str.sprintf("%i%% (Normal Speed)", i);
|
||||||
|
|
||||||
|
m_combobox_speedlimit->addItem(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
speed_limit_layout->addRow(tr("&Speed Limit:"), m_combobox_speedlimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||||
|
@ -86,6 +106,7 @@ void GeneralPane::CreateAnalytics()
|
||||||
|
|
||||||
m_checkbox_enable_analytics = new QCheckBox(tr("Enable Usage Statistics Reporting"));
|
m_checkbox_enable_analytics = new QCheckBox(tr("Enable Usage Statistics Reporting"));
|
||||||
m_button_generate_new_identity = new QPushButton(tr("Generate a New Statistics Identity"));
|
m_button_generate_new_identity = new QPushButton(tr("Generate a New Statistics Identity"));
|
||||||
|
m_button_generate_new_identity->setMaximumWidth(300);
|
||||||
analytics_group_layout->addWidget(m_checkbox_enable_analytics);
|
analytics_group_layout->addWidget(m_checkbox_enable_analytics);
|
||||||
analytics_group_layout->addWidget(m_button_generate_new_identity);
|
analytics_group_layout->addWidget(m_button_generate_new_identity);
|
||||||
}
|
}
|
||||||
|
@ -99,23 +120,18 @@ void GeneralPane::CreateAdvanced()
|
||||||
m_main_layout->addWidget(advanced_group);
|
m_main_layout->addWidget(advanced_group);
|
||||||
|
|
||||||
// Speed Limit
|
// Speed Limit
|
||||||
auto* speed_limit_layout = new QFormLayout;
|
auto* engine_group = new QGroupBox(tr("CPU Emulation Engine"));
|
||||||
auto* speed_limit_container = new QHBoxLayout;
|
auto* engine_group_layout = new QVBoxLayout;
|
||||||
speed_limit_container->addLayout(speed_limit_layout);
|
engine_group->setLayout(engine_group_layout);
|
||||||
advanced_group_layout->addLayout(speed_limit_container);
|
advanced_group_layout->addWidget(engine_group);
|
||||||
|
|
||||||
m_slider_speedlimit = new QSlider(Qt::Orientation::Horizontal);
|
m_radio_interpreter = new QRadioButton(tr("Interpreter (slowest)"));
|
||||||
m_slider_speedlimit->setTickInterval(1);
|
m_radio_cached_interpreter = new QRadioButton(tr("Cached Interpreter (slower)"));
|
||||||
m_slider_speedlimit->setMinimum(1);
|
m_radio_jit = new QRadioButton(tr("JIT Recompiler (recommended)"));
|
||||||
m_slider_speedlimit->setMaximum(21);
|
|
||||||
m_slider_speedlimit->setTickPosition(QSlider::TicksBelow);
|
|
||||||
m_slider_speedlimit->setSingleStep(1);
|
|
||||||
speed_limit_layout->addRow(tr("&Speed Limit:"), m_slider_speedlimit);
|
|
||||||
|
|
||||||
m_label_speedlimit = new QLabel(tr("Unlimited"));
|
engine_group_layout->addWidget(m_radio_interpreter);
|
||||||
m_label_speedlimit->setMinimumWidth(48);
|
engine_group_layout->addWidget(m_radio_cached_interpreter);
|
||||||
m_label_speedlimit->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
engine_group_layout->addWidget(m_radio_jit);
|
||||||
speed_limit_container->addWidget(m_label_speedlimit);
|
|
||||||
|
|
||||||
// NTSC-J
|
// NTSC-J
|
||||||
m_checkbox_force_ntsc = new QCheckBox(tr("Force Console as NTSC-J"));
|
m_checkbox_force_ntsc = new QCheckBox(tr("Force Console as NTSC-J"));
|
||||||
|
@ -126,25 +142,29 @@ void GeneralPane::LoadConfig()
|
||||||
{
|
{
|
||||||
m_checkbox_force_ntsc->setChecked(Settings().GetForceNTSCJ());
|
m_checkbox_force_ntsc->setChecked(Settings().GetForceNTSCJ());
|
||||||
m_checkbox_enable_analytics->setChecked(Settings().GetAnalyticsEnabled());
|
m_checkbox_enable_analytics->setChecked(Settings().GetAnalyticsEnabled());
|
||||||
|
m_checkbox_dualcore->setChecked(SConfig::GetInstance().bCPUThread);
|
||||||
|
m_checkbox_cheats->setChecked(SConfig::GetInstance().bEnableCheats);
|
||||||
int selection = qRound(Settings().GetEmulationSpeed() * 10);
|
int selection = qRound(Settings().GetEmulationSpeed() * 10);
|
||||||
if (selection < m_slider_speedlimit->maximum())
|
if (selection < m_combobox_speedlimit->count())
|
||||||
{
|
m_combobox_speedlimit->setCurrentIndex(selection);
|
||||||
if (selection == 0)
|
m_checkbox_dualcore->setChecked(SConfig::GetInstance().bCPUThread);
|
||||||
{
|
|
||||||
m_slider_speedlimit->setValue(21);
|
|
||||||
m_slider_speedlimit->setToolTip(tr("Unlimited"));
|
|
||||||
m_label_speedlimit->setText(tr("Unlimited"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_slider_speedlimit->setValue(selection);
|
|
||||||
|
|
||||||
QString val = QString::fromStdString(std::to_string(m_slider_speedlimit->value() * 10)) +
|
switch (SConfig::GetInstance().iCPUCore)
|
||||||
QStringLiteral("%");
|
{
|
||||||
m_slider_speedlimit->setToolTip(val);
|
case PowerPC::CPUCore::CORE_INTERPRETER:
|
||||||
m_label_speedlimit->setText(val);
|
m_radio_interpreter->setChecked(true);
|
||||||
}
|
break;
|
||||||
|
case PowerPC::CPUCore::CORE_CACHEDINTERPRETER:
|
||||||
|
m_radio_cached_interpreter->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PowerPC::CPUCore::CORE_JIT64:
|
||||||
|
m_radio_jit->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PowerPC::CPUCore::CORE_JITARM64:
|
||||||
|
// TODO: Implement JITARM
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,20 +172,20 @@ void GeneralPane::OnSaveConfig()
|
||||||
{
|
{
|
||||||
Settings().SetForceNTSCJ(m_checkbox_force_ntsc->isChecked());
|
Settings().SetForceNTSCJ(m_checkbox_force_ntsc->isChecked());
|
||||||
Settings().SetAnalyticsEnabled(m_checkbox_enable_analytics->isChecked());
|
Settings().SetAnalyticsEnabled(m_checkbox_enable_analytics->isChecked());
|
||||||
if (m_slider_speedlimit->value() < 21)
|
SConfig::GetInstance().bCPUThread = m_checkbox_dualcore->isChecked();
|
||||||
{
|
SConfig::GetInstance().bEnableCheats = m_checkbox_cheats->isChecked();
|
||||||
Settings().SetEmulationSpeed(m_slider_speedlimit->value() * 0.1f);
|
SConfig::GetInstance().m_EmulationSpeed = m_combobox_speedlimit->currentIndex() * 0.1f;
|
||||||
QString val = QString::fromStdString(std::to_string(m_slider_speedlimit->value() * 10)) +
|
int engine_value = 0;
|
||||||
QStringLiteral("%");
|
if (m_radio_interpreter->isChecked())
|
||||||
m_slider_speedlimit->setToolTip(val);
|
engine_value = PowerPC::CPUCore::CORE_INTERPRETER;
|
||||||
m_label_speedlimit->setText(val);
|
else if (m_radio_cached_interpreter->isChecked())
|
||||||
}
|
engine_value = PowerPC::CPUCore::CORE_CACHEDINTERPRETER;
|
||||||
|
else if (m_radio_jit->isChecked())
|
||||||
|
engine_value = PowerPC::CPUCore::CORE_JIT64;
|
||||||
else
|
else
|
||||||
{
|
engine_value = PowerPC::CPUCore::CORE_JIT64;
|
||||||
Settings().SetEmulationSpeed(0);
|
|
||||||
m_slider_speedlimit->setToolTip(tr("Unlimited"));
|
SConfig::GetInstance().iCPUCore = engine_value;
|
||||||
m_label_speedlimit->setText(tr("Unlimited"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||||
|
|
|
@ -10,6 +10,7 @@ class QCheckBox;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
|
class QRadioButton;
|
||||||
class QSlider;
|
class QSlider;
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
|
|
||||||
|
@ -30,11 +31,16 @@ private:
|
||||||
|
|
||||||
// Widgets
|
// Widgets
|
||||||
QVBoxLayout* m_main_layout;
|
QVBoxLayout* m_main_layout;
|
||||||
QComboBox* m_combobox_language;
|
QComboBox* m_combobox_speedlimit;
|
||||||
QSlider* m_slider_speedlimit;
|
|
||||||
QCheckBox* m_checkbox_force_ntsc;
|
QCheckBox* m_checkbox_force_ntsc;
|
||||||
|
QCheckBox* m_checkbox_dualcore;
|
||||||
|
QCheckBox* m_checkbox_cheats;
|
||||||
QLabel* m_label_speedlimit;
|
QLabel* m_label_speedlimit;
|
||||||
|
|
||||||
|
QRadioButton* m_radio_interpreter;
|
||||||
|
QRadioButton* m_radio_cached_interpreter;
|
||||||
|
QRadioButton* m_radio_jit;
|
||||||
|
|
||||||
// Analytics related
|
// Analytics related
|
||||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||||
void CreateAnalytics();
|
void CreateAnalytics();
|
||||||
|
|
|
@ -42,11 +42,20 @@ void InterfacePane::CreateUI()
|
||||||
groupbox->setLayout(groupbox_layout);
|
groupbox->setLayout(groupbox_layout);
|
||||||
m_main_layout->addWidget(groupbox);
|
m_main_layout->addWidget(groupbox);
|
||||||
|
|
||||||
|
auto* combobox_layout = new QFormLayout;
|
||||||
|
groupbox_layout->addLayout(combobox_layout);
|
||||||
|
|
||||||
|
m_combobox_language = new QComboBox;
|
||||||
|
m_combobox_language->setMaximumWidth(300);
|
||||||
|
// TODO: Support more languages other then English
|
||||||
|
m_combobox_language->addItem(tr("English"));
|
||||||
|
combobox_layout->addRow(tr("&Language:"), m_combobox_language);
|
||||||
|
|
||||||
// Theme Combobox
|
// Theme Combobox
|
||||||
auto* theme_layout = new QFormLayout;
|
auto* theme_layout = new QFormLayout;
|
||||||
m_combobox_theme = new QComboBox;
|
m_combobox_theme = new QComboBox;
|
||||||
theme_layout->addRow(tr("&Theme:"), m_combobox_theme);
|
m_combobox_theme->setMaximumWidth(300);
|
||||||
groupbox_layout->addLayout(theme_layout);
|
combobox_layout->addRow(tr("&Theme:"), m_combobox_theme);
|
||||||
|
|
||||||
// List avalable themes
|
// List avalable themes
|
||||||
auto file_search_results = Common::DoFileSearch(
|
auto file_search_results = Common::DoFileSearch(
|
||||||
|
@ -99,6 +108,8 @@ void InterfacePane::ConnectLayout()
|
||||||
connect(m_checkbox_render_to_window, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig);
|
connect(m_checkbox_render_to_window, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig);
|
||||||
connect(m_combobox_theme, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::activated),
|
connect(m_combobox_theme, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::activated),
|
||||||
[this](const QString& text) { OnSaveConfig(); });
|
[this](const QString& text) { OnSaveConfig(); });
|
||||||
|
connect(m_combobox_language, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
|
||||||
|
[this](int index) { OnSaveConfig(); });
|
||||||
connect(m_checkbox_confirm_on_stop, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig);
|
connect(m_checkbox_confirm_on_stop, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig);
|
||||||
connect(m_checkbox_use_panic_handlers, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig);
|
connect(m_checkbox_use_panic_handlers, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig);
|
||||||
connect(m_checkbox_enable_osd, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig);
|
connect(m_checkbox_enable_osd, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig);
|
||||||
|
|
|
@ -25,6 +25,8 @@ private:
|
||||||
void OnSaveConfig();
|
void OnSaveConfig();
|
||||||
|
|
||||||
QVBoxLayout* m_main_layout;
|
QVBoxLayout* m_main_layout;
|
||||||
|
QComboBox* m_combobox_language;
|
||||||
|
|
||||||
QComboBox* m_combobox_theme;
|
QComboBox* m_combobox_theme;
|
||||||
QCheckBox* m_checkbox_auto_window;
|
QCheckBox* m_checkbox_auto_window;
|
||||||
QCheckBox* m_checkbox_top_window;
|
QCheckBox* m_checkbox_top_window;
|
||||||
|
|
Loading…
Reference in New Issue