mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-10-26 18:09:20 +00:00
Merge #15
This commit is contained in:
parent
7d8fe0f105
commit
871da4e307
275 changed files with 33002 additions and 27474 deletions
33
Source/Core/DolphinQt/Config/ConfigControls/ConfigBool.cpp
Normal file
33
Source/Core/DolphinQt/Config/ConfigControls/ConfigBool.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
|
||||
|
||||
#include <QEvent>
|
||||
#include <QFont>
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
ConfigBool::ConfigBool(const QString& label, const Config::Info<bool>& setting, bool reverse)
|
||||
: ToolTipCheckBox(label), m_setting(setting), m_reverse(reverse)
|
||||
{
|
||||
connect(this, &QCheckBox::toggled, this, &ConfigBool::Update);
|
||||
setChecked(Config::Get(m_setting) ^ reverse);
|
||||
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
||||
QFont bf = font();
|
||||
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||
setFont(bf);
|
||||
|
||||
const QSignalBlocker blocker(this);
|
||||
setChecked(Config::Get(m_setting) ^ m_reverse);
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigBool::Update()
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, static_cast<bool>(isChecked() ^ m_reverse));
|
||||
}
|
||||
25
Source/Core/DolphinQt/Config/ConfigControls/ConfigBool.h
Normal file
25
Source/Core/DolphinQt/Config/ConfigControls/ConfigBool.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
|
||||
|
||||
namespace Config
|
||||
{
|
||||
template <typename T>
|
||||
class Info;
|
||||
}
|
||||
|
||||
class ConfigBool : public ToolTipCheckBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfigBool(const QString& label, const Config::Info<bool>& setting, bool reverse = false);
|
||||
|
||||
private:
|
||||
void Update();
|
||||
|
||||
const Config::Info<bool>& m_setting;
|
||||
bool m_reverse;
|
||||
};
|
||||
32
Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp
Normal file
32
Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigChoice.h"
|
||||
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
ConfigChoice::ConfigChoice(const QStringList& options, const Config::Info<int>& setting)
|
||||
: m_setting(setting)
|
||||
{
|
||||
addItems(options);
|
||||
connect(this, qOverload<int>(&QComboBox::currentIndexChanged), this, &ConfigChoice::Update);
|
||||
setCurrentIndex(Config::Get(m_setting));
|
||||
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
||||
QFont bf = font();
|
||||
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||
setFont(bf);
|
||||
|
||||
const QSignalBlocker blocker(this);
|
||||
setCurrentIndex(Config::Get(m_setting));
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigChoice::Update(int choice)
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, choice);
|
||||
}
|
||||
20
Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.h
Normal file
20
Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipComboBox.h"
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
class ConfigChoice : public ToolTipComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfigChoice(const QStringList& options, const Config::Info<int>& setting);
|
||||
|
||||
private:
|
||||
void Update(int choice);
|
||||
|
||||
Config::Info<int> m_setting;
|
||||
};
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright 2019 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigInteger.h"
|
||||
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
ConfigInteger::ConfigInteger(int minimum, int maximum, const Config::Info<int>& setting, int step)
|
||||
: ToolTipSpinBox(), m_setting(setting)
|
||||
{
|
||||
setMinimum(minimum);
|
||||
setMaximum(maximum);
|
||||
setSingleStep(step);
|
||||
|
||||
setValue(Config::Get(setting));
|
||||
|
||||
connect(this, qOverload<int>(&ConfigInteger::valueChanged), this, &ConfigInteger::Update);
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
||||
QFont bf = font();
|
||||
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||
setFont(bf);
|
||||
|
||||
const QSignalBlocker blocker(this);
|
||||
setValue(Config::Get(m_setting));
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigInteger::Update(int value)
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, value);
|
||||
}
|
||||
23
Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.h
Normal file
23
Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2019 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipSpinBox.h"
|
||||
|
||||
namespace Config
|
||||
{
|
||||
template <typename T>
|
||||
class Info;
|
||||
}
|
||||
|
||||
class ConfigInteger : public ToolTipSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfigInteger(int minimum, int maximum, const Config::Info<int>& setting, int step = 1);
|
||||
void Update(int value);
|
||||
|
||||
private:
|
||||
const Config::Info<int>& m_setting;
|
||||
};
|
||||
34
Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp
Normal file
34
Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright 2018 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigRadio.h"
|
||||
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
ConfigRadioInt::ConfigRadioInt(const QString& label, const Config::Info<int>& setting, int value)
|
||||
: ToolTipRadioButton(label), m_setting(setting), m_value(value)
|
||||
{
|
||||
setChecked(Config::Get(m_setting) == m_value);
|
||||
connect(this, &QRadioButton::toggled, this, &ConfigRadioInt::Update);
|
||||
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
||||
QFont bf = font();
|
||||
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||
setFont(bf);
|
||||
|
||||
const QSignalBlocker blocker(this);
|
||||
setChecked(Config::Get(m_setting) == m_value);
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigRadioInt::Update()
|
||||
{
|
||||
if (!isChecked())
|
||||
return;
|
||||
|
||||
Config::SetBaseOrCurrent(m_setting, m_value);
|
||||
}
|
||||
21
Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.h
Normal file
21
Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2018 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipRadioButton.h"
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
class ConfigRadioInt : public ToolTipRadioButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfigRadioInt(const QString& label, const Config::Info<int>& setting, int value);
|
||||
|
||||
private:
|
||||
void Update();
|
||||
|
||||
Config::Info<int> m_setting;
|
||||
int m_value;
|
||||
};
|
||||
36
Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.cpp
Normal file
36
Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.cpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigSlider.h"
|
||||
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
ConfigSlider::ConfigSlider(int minimum, int maximum, const Config::Info<int>& setting, int tick)
|
||||
: ToolTipSlider(Qt::Horizontal), m_setting(setting)
|
||||
{
|
||||
setMinimum(minimum);
|
||||
setMaximum(maximum);
|
||||
setTickInterval(tick);
|
||||
|
||||
setValue(Config::Get(setting));
|
||||
|
||||
connect(this, &ConfigSlider::valueChanged, this, &ConfigSlider::Update);
|
||||
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
||||
QFont bf = font();
|
||||
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||
setFont(bf);
|
||||
|
||||
const QSignalBlocker blocker(this);
|
||||
setValue(Config::Get(m_setting));
|
||||
});
|
||||
}
|
||||
|
||||
void ConfigSlider::Update(int value)
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, value);
|
||||
}
|
||||
23
Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.h
Normal file
23
Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipSlider.h"
|
||||
|
||||
namespace Config
|
||||
{
|
||||
template <typename T>
|
||||
class Info;
|
||||
}
|
||||
|
||||
class ConfigSlider : public ToolTipSlider
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfigSlider(int minimum, int maximum, const Config::Info<int>& setting, int tick = 0);
|
||||
void Update(int value);
|
||||
|
||||
private:
|
||||
const Config::Info<int>& m_setting;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue