Merge pull request #4628 from FearlessTobi/backport-some-stuff
Backport various minor frontend review changes from yuzu and port minor PR from yuzu
This commit is contained in:
commit
de1128c60d
6 changed files with 20 additions and 16 deletions
|
@ -635,11 +635,11 @@ void Config::SaveValues() {
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant Config::ReadSetting(const QString& name) {
|
QVariant Config::ReadSetting(const QString& name) const {
|
||||||
return qt_config->value(name);
|
return qt_config->value(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant Config::ReadSetting(const QString& name, const QVariant& default_value) {
|
QVariant Config::ReadSetting(const QString& name, const QVariant& default_value) const {
|
||||||
QVariant result;
|
QVariant result;
|
||||||
if (qt_config->value(name + "/default", false).toBool()) {
|
if (qt_config->value(name + "/default", false).toBool()) {
|
||||||
result = default_value;
|
result = default_value;
|
||||||
|
|
|
@ -27,8 +27,8 @@ public:
|
||||||
private:
|
private:
|
||||||
void ReadValues();
|
void ReadValues();
|
||||||
void SaveValues();
|
void SaveValues();
|
||||||
QVariant ReadSetting(const QString& name);
|
QVariant ReadSetting(const QString& name) const;
|
||||||
QVariant ReadSetting(const QString& name, const QVariant& default_value);
|
QVariant ReadSetting(const QString& name, const QVariant& default_value) const;
|
||||||
void WriteSetting(const QString& name, const QVariant& value);
|
void WriteSetting(const QString& name, const QVariant& value);
|
||||||
void WriteSetting(const QString& name, const QVariant& value, const QVariant& default_value);
|
void WriteSetting(const QString& name, const QVariant& value, const QVariant& default_value);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <QHash>
|
#include <map>
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
#include "citra_qt/configuration/config.h"
|
#include "citra_qt/configuration/config.h"
|
||||||
#include "citra_qt/configuration/configure_dialog.h"
|
#include "citra_qt/configuration/configure_dialog.h"
|
||||||
|
@ -74,7 +74,7 @@ void ConfigureDialog::PopulateSelectionList() {
|
||||||
{tr("Controls"), {QT_TR_NOOP("Input"), QT_TR_NOOP("Hotkeys")}}}};
|
{tr("Controls"), {QT_TR_NOOP("Input"), QT_TR_NOOP("Hotkeys")}}}};
|
||||||
|
|
||||||
for (const auto& entry : items) {
|
for (const auto& entry : items) {
|
||||||
auto* item = new QListWidgetItem(entry.first);
|
auto* const item = new QListWidgetItem(entry.first);
|
||||||
item->setData(Qt::UserRole, entry.second);
|
item->setData(Qt::UserRole, entry.second);
|
||||||
|
|
||||||
ui->selectorList->addItem(item);
|
ui->selectorList->addItem(item);
|
||||||
|
@ -111,11 +111,11 @@ void ConfigureDialog::retranslateUi() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDialog::UpdateVisibleTabs() {
|
void ConfigureDialog::UpdateVisibleTabs() {
|
||||||
auto items = ui->selectorList->selectedItems();
|
const auto items = ui->selectorList->selectedItems();
|
||||||
if (items.isEmpty())
|
if (items.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QHash<QString, QWidget*> widgets = {
|
const std::map<QString, QWidget*> widgets = {
|
||||||
{"General", ui->generalTab}, {"System", ui->systemTab},
|
{"General", ui->generalTab}, {"System", ui->systemTab},
|
||||||
{"Input", ui->inputTab}, {"Hotkeys", ui->hotkeysTab},
|
{"Input", ui->inputTab}, {"Hotkeys", ui->hotkeysTab},
|
||||||
{"Graphics", ui->graphicsTab}, {"Audio", ui->audioTab},
|
{"Graphics", ui->graphicsTab}, {"Audio", ui->audioTab},
|
||||||
|
@ -124,8 +124,8 @@ void ConfigureDialog::UpdateVisibleTabs() {
|
||||||
|
|
||||||
ui->tabWidget->clear();
|
ui->tabWidget->clear();
|
||||||
|
|
||||||
QStringList tabs = items[0]->data(Qt::UserRole).toStringList();
|
const QStringList tabs = items[0]->data(Qt::UserRole).toStringList();
|
||||||
|
|
||||||
for (const auto& tab : tabs)
|
for (const auto& tab : tabs)
|
||||||
ui->tabWidget->addTab(widgets[tab], tr(qPrintable(tab)));
|
ui->tabWidget->addTab(widgets.at(tab), tr(qPrintable(tab)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,6 @@ public:
|
||||||
~ConfigureDialog() override;
|
~ConfigureDialog() override;
|
||||||
|
|
||||||
void applyConfiguration();
|
void applyConfiguration();
|
||||||
void UpdateVisibleTabs();
|
|
||||||
void PopulateSelectionList();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onLanguageChanged(const QString& locale);
|
void onLanguageChanged(const QString& locale);
|
||||||
|
@ -33,6 +31,8 @@ signals:
|
||||||
private:
|
private:
|
||||||
void setConfiguration();
|
void setConfiguration();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
void UpdateVisibleTabs();
|
||||||
|
void PopulateSelectionList();
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureDialog> ui;
|
std::unique_ptr<Ui::ConfigureDialog> ui;
|
||||||
HotkeyRegistry& registry;
|
HotkeyRegistry& registry;
|
||||||
|
|
|
@ -46,7 +46,11 @@ public:
|
||||||
return rasterizer.get();
|
return rasterizer.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
EmuWindow& GetRenderWindow() const {
|
EmuWindow& GetRenderWindow() {
|
||||||
|
return render_window;
|
||||||
|
}
|
||||||
|
|
||||||
|
const EmuWindow& GetRenderWindow() const {
|
||||||
return render_window;
|
return render_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,9 +71,9 @@ void RequestScreenshot(void* data, std::function<void()> callback,
|
||||||
|
|
||||||
u16 GetResolutionScaleFactor() {
|
u16 GetResolutionScaleFactor() {
|
||||||
if (g_hw_renderer_enabled) {
|
if (g_hw_renderer_enabled) {
|
||||||
return !Settings::values.resolution_factor
|
return Settings::values.resolution_factor
|
||||||
? g_renderer->GetRenderWindow().GetFramebufferLayout().GetScalingRatio()
|
? Settings::values.resolution_factor
|
||||||
: Settings::values.resolution_factor;
|
: g_renderer->GetRenderWindow().GetFramebufferLayout().GetScalingRatio();
|
||||||
} else {
|
} else {
|
||||||
// Software renderer always render at native resolution
|
// Software renderer always render at native resolution
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in a new issue