mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-23 06:57:08 +00:00
FreeLookWidget: Use ConfigControls where applicable
This commit is contained in:
parent
33fd06d7f3
commit
1e227bd736
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "DolphinQt/Config/FreeLookWidget.h"
|
#include "DolphinQt/Config/FreeLookWidget.h"
|
||||||
|
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
@ -15,9 +14,9 @@
|
|||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
|
|
||||||
|
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
|
||||||
#include "DolphinQt/Config/ConfigControls/ConfigChoice.h"
|
#include "DolphinQt/Config/ConfigControls/ConfigChoice.h"
|
||||||
#include "DolphinQt/Config/Mapping/MappingWindow.h"
|
#include "DolphinQt/Config/Mapping/MappingWindow.h"
|
||||||
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
|
|
||||||
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
|
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
|
||||||
#include "DolphinQt/Settings.h"
|
#include "DolphinQt/Settings.h"
|
||||||
|
|
||||||
@ -32,8 +31,7 @@ void FreeLookWidget::CreateLayout()
|
|||||||
{
|
{
|
||||||
auto* layout = new QVBoxLayout();
|
auto* layout = new QVBoxLayout();
|
||||||
|
|
||||||
m_enable_freelook = new ToolTipCheckBox(tr("Enable"));
|
m_enable_freelook = new ConfigBool(tr("Enable"), Config::FREE_LOOK_ENABLED);
|
||||||
m_enable_freelook->setChecked(Config::Get(Config::FREE_LOOK_ENABLED));
|
|
||||||
m_enable_freelook->SetDescription(
|
m_enable_freelook->SetDescription(
|
||||||
tr("Allows manipulation of the in-game camera.<br><br><dolphin_emphasis>If unsure, "
|
tr("Allows manipulation of the in-game camera.<br><br><dolphin_emphasis>If unsure, "
|
||||||
"leave this unchecked.</dolphin_emphasis>"));
|
"leave this unchecked.</dolphin_emphasis>"));
|
||||||
@ -67,8 +65,8 @@ void FreeLookWidget::CreateLayout()
|
|||||||
description->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
description->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||||
description->setOpenExternalLinks(true);
|
description->setOpenExternalLinks(true);
|
||||||
|
|
||||||
m_freelook_background_input = new QCheckBox(tr("Background Input"));
|
m_freelook_background_input =
|
||||||
m_freelook_background_input->setChecked(Config::Get(Config::FREE_LOOK_BACKGROUND_INPUT));
|
new ConfigBool(tr("Background Input"), Config::FREE_LOOK_BACKGROUND_INPUT);
|
||||||
|
|
||||||
auto* hlayout = new QHBoxLayout();
|
auto* hlayout = new QHBoxLayout();
|
||||||
hlayout->addWidget(new QLabel(tr("Camera 1")));
|
hlayout->addWidget(new QLabel(tr("Camera 1")));
|
||||||
@ -87,8 +85,6 @@ void FreeLookWidget::ConnectWidgets()
|
|||||||
{
|
{
|
||||||
connect(m_freelook_controller_configure_button, &QPushButton::clicked, this,
|
connect(m_freelook_controller_configure_button, &QPushButton::clicked, this,
|
||||||
&FreeLookWidget::OnFreeLookControllerConfigured);
|
&FreeLookWidget::OnFreeLookControllerConfigured);
|
||||||
connect(m_enable_freelook, &QCheckBox::clicked, this, &FreeLookWidget::SaveSettings);
|
|
||||||
connect(m_freelook_background_input, &QCheckBox::clicked, this, &FreeLookWidget::SaveSettings);
|
|
||||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
||||||
const QSignalBlocker blocker(this);
|
const QSignalBlocker blocker(this);
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
@ -109,7 +105,6 @@ void FreeLookWidget::OnFreeLookControllerConfigured()
|
|||||||
void FreeLookWidget::LoadSettings()
|
void FreeLookWidget::LoadSettings()
|
||||||
{
|
{
|
||||||
const bool checked = Config::Get(Config::FREE_LOOK_ENABLED);
|
const bool checked = Config::Get(Config::FREE_LOOK_ENABLED);
|
||||||
m_enable_freelook->setChecked(checked);
|
|
||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||||
const bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
const bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
|
||||||
m_enable_freelook->setEnabled(!hardcore);
|
m_enable_freelook->setEnabled(!hardcore);
|
||||||
@ -118,14 +113,3 @@ void FreeLookWidget::LoadSettings()
|
|||||||
m_freelook_controller_configure_button->setEnabled(checked);
|
m_freelook_controller_configure_button->setEnabled(checked);
|
||||||
m_freelook_background_input->setEnabled(checked);
|
m_freelook_background_input->setEnabled(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeLookWidget::SaveSettings()
|
|
||||||
{
|
|
||||||
const bool checked = m_enable_freelook->isChecked();
|
|
||||||
Config::SetBaseOrCurrent(Config::FREE_LOOK_ENABLED, checked);
|
|
||||||
Config::SetBaseOrCurrent(Config::FREE_LOOK_BACKGROUND_INPUT,
|
|
||||||
m_freelook_background_input->isChecked());
|
|
||||||
m_freelook_control_type->setEnabled(checked);
|
|
||||||
m_freelook_controller_configure_button->setEnabled(checked);
|
|
||||||
m_freelook_background_input->setEnabled(checked);
|
|
||||||
}
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
class ConfigBool;
|
||||||
class ConfigChoice;
|
class ConfigChoice;
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
@ -24,7 +25,7 @@ private:
|
|||||||
void LoadSettings();
|
void LoadSettings();
|
||||||
void SaveSettings();
|
void SaveSettings();
|
||||||
|
|
||||||
ToolTipCheckBox* m_enable_freelook;
|
ConfigBool* m_enable_freelook;
|
||||||
ConfigChoice* m_freelook_control_type;
|
ConfigChoice* m_freelook_control_type;
|
||||||
QPushButton* m_freelook_controller_configure_button;
|
QPushButton* m_freelook_controller_configure_button;
|
||||||
QCheckBox* m_freelook_background_input;
|
QCheckBox* m_freelook_background_input;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user