SettingsInterface: Drop some unused virtual methods

This commit is contained in:
Stenzek 2025-06-05 20:28:56 +10:00
parent 59f7d0b2ff
commit 9cd371d5ff
No known key found for this signature in database
11 changed files with 14 additions and 44 deletions

View File

@ -9,16 +9,6 @@ LayeredSettingsInterface::LayeredSettingsInterface() = default;
LayeredSettingsInterface::~LayeredSettingsInterface() = default; LayeredSettingsInterface::~LayeredSettingsInterface() = default;
bool LayeredSettingsInterface::Save(Error* error /* = nullptr */)
{
Panic("Attempting to save layered settings interface");
}
void LayeredSettingsInterface::Clear()
{
Panic("Attempting to clear layered settings interface");
}
bool LayeredSettingsInterface::IsEmpty() bool LayeredSettingsInterface::IsEmpty()
{ {
return false; return false;

View File

@ -22,10 +22,6 @@ public:
SettingsInterface* GetLayer(Layer layer) const { return m_layers[layer]; } SettingsInterface* GetLayer(Layer layer) const { return m_layers[layer]; }
void SetLayer(Layer layer, SettingsInterface* sif) { m_layers[layer] = sif; } void SetLayer(Layer layer, SettingsInterface* sif) { m_layers[layer] = sif; }
bool Save(Error* error = nullptr) override;
void Clear() override;
bool IsEmpty() override; bool IsEmpty() override;
bool GetIntValue(const char* section, const char* key, s32* value) const override; bool GetIntValue(const char* section, const char* key, s32* value) const override;

View File

@ -11,17 +11,6 @@ MemorySettingsInterface::MemorySettingsInterface() = default;
MemorySettingsInterface::~MemorySettingsInterface() = default; MemorySettingsInterface::~MemorySettingsInterface() = default;
bool MemorySettingsInterface::Save(Error* error /* = nullptr */)
{
Error::SetStringView(error, "Memory settings cannot be saved.");
return false;
}
void MemorySettingsInterface::Clear()
{
m_sections.clear();
}
bool MemorySettingsInterface::IsEmpty() bool MemorySettingsInterface::IsEmpty()
{ {
return m_sections.empty(); return m_sections.empty();

View File

@ -12,10 +12,6 @@ public:
MemorySettingsInterface(); MemorySettingsInterface();
~MemorySettingsInterface() override; ~MemorySettingsInterface() override;
bool Save(Error* error = nullptr) override;
void Clear() override;
bool IsEmpty() override; bool IsEmpty() override;
bool GetIntValue(const char* section, const char* key, s32* value) const override; bool GetIntValue(const char* section, const char* key, s32* value) const override;

View File

@ -17,8 +17,6 @@ class SettingsInterface
public: public:
virtual ~SettingsInterface() = default; virtual ~SettingsInterface() = default;
virtual bool Save(Error* error = nullptr) = 0;
virtual void Clear() = 0;
virtual bool IsEmpty() = 0; virtual bool IsEmpty() = 0;
virtual bool GetIntValue(const char* section, const char* key, s32* value) const = 0; virtual bool GetIntValue(const char* section, const char* key, s32* value) const = 0;

View File

@ -349,7 +349,7 @@ void AdvancedSettingsWidget::onResetToDefaultClicked()
} }
// for per-game it's easier to just clear and recreate // for per-game it's easier to just clear and recreate
SettingsInterface* sif = m_dialog->getSettingsInterface(); INISettingsInterface* sif = m_dialog->getSettingsInterface();
sif->DeleteValue("Main", "ApplyCompatibilitySettings"); sif->DeleteValue("Main", "ApplyCompatibilitySettings");
sif->DeleteValue("Main", "LoadDevicesFromSaveStates"); sif->DeleteValue("Main", "LoadDevicesFromSaveStates");
sif->DeleteValue("Main", "CompressSaveStates"); sif->DeleteValue("Main", "CompressSaveStates");

View File

@ -22,7 +22,7 @@
#include <QtWidgets/QTextEdit> #include <QtWidgets/QTextEdit>
#include <array> #include <array>
ControllerSettingsWindow::ControllerSettingsWindow(SettingsInterface* game_sif /* = nullptr */, ControllerSettingsWindow::ControllerSettingsWindow(INISettingsInterface* game_sif /* = nullptr */,
bool edit_profiles /* = false */, QWidget* parent /* = nullptr */) bool edit_profiles /* = false */, QWidget* parent /* = nullptr */)
: QWidget(parent), m_editing_settings_interface(game_sif), m_editing_input_profiles(edit_profiles) : QWidget(parent), m_editing_settings_interface(game_sif), m_editing_input_profiles(edit_profiles)
{ {
@ -106,7 +106,7 @@ ControllerSettingsWindow::ControllerSettingsWindow(SettingsInterface* game_sif /
ControllerSettingsWindow::~ControllerSettingsWindow() = default; ControllerSettingsWindow::~ControllerSettingsWindow() = default;
void ControllerSettingsWindow::editControllerSettingsForGame(QWidget* parent, SettingsInterface* sif) void ControllerSettingsWindow::editControllerSettingsForGame(QWidget* parent, INISettingsInterface* sif)
{ {
ControllerSettingsWindow* dlg = new ControllerSettingsWindow(sif, false, parent); ControllerSettingsWindow* dlg = new ControllerSettingsWindow(sif, false, parent);
dlg->setWindowFlag(Qt::Window); dlg->setWindowFlag(Qt::Window);

View File

@ -27,7 +27,7 @@ class ControllerGlobalSettingsWidget;
class ControllerBindingWidget; class ControllerBindingWidget;
class HotkeySettingsWidget; class HotkeySettingsWidget;
class SettingsInterface; class INISettingsInterface;
class ControllerSettingsWindow final : public QWidget class ControllerSettingsWindow final : public QWidget
{ {
@ -42,11 +42,11 @@ public:
Count Count
}; };
ControllerSettingsWindow(SettingsInterface* game_sif = nullptr, bool edit_profiles = false, ControllerSettingsWindow(INISettingsInterface* game_sif = nullptr, bool edit_profiles = false,
QWidget* parent = nullptr); QWidget* parent = nullptr);
~ControllerSettingsWindow(); ~ControllerSettingsWindow();
static void editControllerSettingsForGame(QWidget* parent, SettingsInterface* sif); static void editControllerSettingsForGame(QWidget* parent, INISettingsInterface* sif);
ALWAYS_INLINE HotkeySettingsWidget* getHotkeySettingsWidget() const { return m_hotkey_settings; } ALWAYS_INLINE HotkeySettingsWidget* getHotkeySettingsWidget() const { return m_hotkey_settings; }
@ -59,7 +59,7 @@ public:
return (!m_editing_input_profiles && m_editing_settings_interface); return (!m_editing_input_profiles && m_editing_settings_interface);
} }
ALWAYS_INLINE bool isEditingProfile() const { return m_editing_input_profiles; } ALWAYS_INLINE bool isEditingProfile() const { return m_editing_input_profiles; }
ALWAYS_INLINE SettingsInterface* getEditingSettingsInterface() { return m_editing_settings_interface; } ALWAYS_INLINE INISettingsInterface* getEditingSettingsInterface() { return m_editing_settings_interface; }
Category getCurrentCategory() const; Category getCurrentCategory() const;
@ -106,13 +106,13 @@ private:
Ui::ControllerSettingsWindow m_ui; Ui::ControllerSettingsWindow m_ui;
SettingsInterface* m_editing_settings_interface = nullptr; INISettingsInterface* m_editing_settings_interface = nullptr;
ControllerGlobalSettingsWidget* m_global_settings = nullptr; ControllerGlobalSettingsWidget* m_global_settings = nullptr;
std::array<ControllerBindingWidget*, NUM_CONTROLLER_AND_CARD_PORTS> m_port_bindings{}; std::array<ControllerBindingWidget*, NUM_CONTROLLER_AND_CARD_PORTS> m_port_bindings{};
HotkeySettingsWidget* m_hotkey_settings = nullptr; HotkeySettingsWidget* m_hotkey_settings = nullptr;
QString m_profile_name; QString m_profile_name;
std::unique_ptr<SettingsInterface> m_profile_settings_interface; std::unique_ptr<INISettingsInterface> m_profile_settings_interface;
bool m_editing_input_profiles = false; bool m_editing_input_profiles = false;
}; };

View File

@ -42,7 +42,7 @@ GamePatchDetailsWidget::~GamePatchDetailsWidget() = default;
void GamePatchDetailsWidget::onEnabledStateChanged(int state) void GamePatchDetailsWidget::onEnabledStateChanged(int state)
{ {
SettingsInterface* si = m_dialog->getSettingsInterface(); INISettingsInterface* si = m_dialog->getSettingsInterface();
if (state == Qt::Checked) if (state == Qt::Checked)
si->AddToStringList("Patches", "Enable", m_name.c_str()); si->AddToStringList("Patches", "Enable", m_name.c_str());
else else

View File

@ -290,7 +290,7 @@ bool QtHost::SaveGameSettings(SettingsInterface* sif, bool delete_if_empty)
// see above // see above
const auto lock = Host::GetSettingsLock(); const auto lock = Host::GetSettingsLock();
if (!sif->Save(&error)) if (!ini->Save(&error))
{ {
Host::ReportErrorAsync( Host::ReportErrorAsync(
TRANSLATE_SV("QtHost", "Error"), TRANSLATE_SV("QtHost", "Error"),

View File

@ -20,9 +20,10 @@ public:
bool Load(Error* error = nullptr); bool Load(Error* error = nullptr);
bool Load(std::string new_path, Error* error = nullptr); bool Load(std::string new_path, Error* error = nullptr);
bool Save(Error* error = nullptr) override; bool Save(Error* error = nullptr);
void Clear();
void Clear() override;
bool IsEmpty() override; bool IsEmpty() override;
bool GetIntValue(const char* section, const char* key, s32* value) const override; bool GetIntValue(const char* section, const char* key, s32* value) const override;