diff --git a/src/common/layered_settings_interface.cpp b/src/common/layered_settings_interface.cpp index 53995bfb5..177a8378a 100644 --- a/src/common/layered_settings_interface.cpp +++ b/src/common/layered_settings_interface.cpp @@ -9,16 +9,6 @@ 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() { return false; diff --git a/src/common/layered_settings_interface.h b/src/common/layered_settings_interface.h index a4c53756f..da6398814 100644 --- a/src/common/layered_settings_interface.h +++ b/src/common/layered_settings_interface.h @@ -22,10 +22,6 @@ public: SettingsInterface* GetLayer(Layer layer) const { return m_layers[layer]; } void SetLayer(Layer layer, SettingsInterface* sif) { m_layers[layer] = sif; } - bool Save(Error* error = nullptr) override; - - void Clear() override; - bool IsEmpty() override; bool GetIntValue(const char* section, const char* key, s32* value) const override; diff --git a/src/common/memory_settings_interface.cpp b/src/common/memory_settings_interface.cpp index 57d8c6f24..060cb9c57 100644 --- a/src/common/memory_settings_interface.cpp +++ b/src/common/memory_settings_interface.cpp @@ -11,17 +11,6 @@ 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() { return m_sections.empty(); diff --git a/src/common/memory_settings_interface.h b/src/common/memory_settings_interface.h index a4a59c797..6460e1399 100644 --- a/src/common/memory_settings_interface.h +++ b/src/common/memory_settings_interface.h @@ -12,10 +12,6 @@ public: MemorySettingsInterface(); ~MemorySettingsInterface() override; - bool Save(Error* error = nullptr) override; - - void Clear() override; - bool IsEmpty() override; bool GetIntValue(const char* section, const char* key, s32* value) const override; diff --git a/src/common/settings_interface.h b/src/common/settings_interface.h index 1cf1c5ef4..82aa66d4a 100644 --- a/src/common/settings_interface.h +++ b/src/common/settings_interface.h @@ -17,8 +17,6 @@ class SettingsInterface public: virtual ~SettingsInterface() = default; - virtual bool Save(Error* error = nullptr) = 0; - virtual void Clear() = 0; virtual bool IsEmpty() = 0; virtual bool GetIntValue(const char* section, const char* key, s32* value) const = 0; diff --git a/src/duckstation-qt/advancedsettingswidget.cpp b/src/duckstation-qt/advancedsettingswidget.cpp index b8df0656d..aaa54b482 100644 --- a/src/duckstation-qt/advancedsettingswidget.cpp +++ b/src/duckstation-qt/advancedsettingswidget.cpp @@ -349,7 +349,7 @@ void AdvancedSettingsWidget::onResetToDefaultClicked() } // 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", "LoadDevicesFromSaveStates"); sif->DeleteValue("Main", "CompressSaveStates"); diff --git a/src/duckstation-qt/controllersettingswindow.cpp b/src/duckstation-qt/controllersettingswindow.cpp index a40da0572..8e31a3e97 100644 --- a/src/duckstation-qt/controllersettingswindow.cpp +++ b/src/duckstation-qt/controllersettingswindow.cpp @@ -22,7 +22,7 @@ #include #include -ControllerSettingsWindow::ControllerSettingsWindow(SettingsInterface* game_sif /* = nullptr */, +ControllerSettingsWindow::ControllerSettingsWindow(INISettingsInterface* game_sif /* = nullptr */, bool edit_profiles /* = false */, QWidget* parent /* = nullptr */) : 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; -void ControllerSettingsWindow::editControllerSettingsForGame(QWidget* parent, SettingsInterface* sif) +void ControllerSettingsWindow::editControllerSettingsForGame(QWidget* parent, INISettingsInterface* sif) { ControllerSettingsWindow* dlg = new ControllerSettingsWindow(sif, false, parent); dlg->setWindowFlag(Qt::Window); diff --git a/src/duckstation-qt/controllersettingswindow.h b/src/duckstation-qt/controllersettingswindow.h index fd6968ffb..f4dcd8326 100644 --- a/src/duckstation-qt/controllersettingswindow.h +++ b/src/duckstation-qt/controllersettingswindow.h @@ -27,7 +27,7 @@ class ControllerGlobalSettingsWidget; class ControllerBindingWidget; class HotkeySettingsWidget; -class SettingsInterface; +class INISettingsInterface; class ControllerSettingsWindow final : public QWidget { @@ -42,11 +42,11 @@ public: Count }; - ControllerSettingsWindow(SettingsInterface* game_sif = nullptr, bool edit_profiles = false, + ControllerSettingsWindow(INISettingsInterface* game_sif = nullptr, bool edit_profiles = false, QWidget* parent = nullptr); ~ControllerSettingsWindow(); - static void editControllerSettingsForGame(QWidget* parent, SettingsInterface* sif); + static void editControllerSettingsForGame(QWidget* parent, INISettingsInterface* sif); ALWAYS_INLINE HotkeySettingsWidget* getHotkeySettingsWidget() const { return m_hotkey_settings; } @@ -59,7 +59,7 @@ public: return (!m_editing_input_profiles && m_editing_settings_interface); } 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; @@ -106,13 +106,13 @@ private: Ui::ControllerSettingsWindow m_ui; - SettingsInterface* m_editing_settings_interface = nullptr; + INISettingsInterface* m_editing_settings_interface = nullptr; ControllerGlobalSettingsWidget* m_global_settings = nullptr; std::array m_port_bindings{}; HotkeySettingsWidget* m_hotkey_settings = nullptr; QString m_profile_name; - std::unique_ptr m_profile_settings_interface; + std::unique_ptr m_profile_settings_interface; bool m_editing_input_profiles = false; }; diff --git a/src/duckstation-qt/gamepatchsettingswidget.cpp b/src/duckstation-qt/gamepatchsettingswidget.cpp index beb1adbdb..ad6274108 100644 --- a/src/duckstation-qt/gamepatchsettingswidget.cpp +++ b/src/duckstation-qt/gamepatchsettingswidget.cpp @@ -42,7 +42,7 @@ GamePatchDetailsWidget::~GamePatchDetailsWidget() = default; void GamePatchDetailsWidget::onEnabledStateChanged(int state) { - SettingsInterface* si = m_dialog->getSettingsInterface(); + INISettingsInterface* si = m_dialog->getSettingsInterface(); if (state == Qt::Checked) si->AddToStringList("Patches", "Enable", m_name.c_str()); else diff --git a/src/duckstation-qt/qthost.cpp b/src/duckstation-qt/qthost.cpp index b4b4c6034..e2a6dab96 100644 --- a/src/duckstation-qt/qthost.cpp +++ b/src/duckstation-qt/qthost.cpp @@ -290,7 +290,7 @@ bool QtHost::SaveGameSettings(SettingsInterface* sif, bool delete_if_empty) // see above const auto lock = Host::GetSettingsLock(); - if (!sif->Save(&error)) + if (!ini->Save(&error)) { Host::ReportErrorAsync( TRANSLATE_SV("QtHost", "Error"), diff --git a/src/util/ini_settings_interface.h b/src/util/ini_settings_interface.h index 38871e2b3..2ec493d84 100644 --- a/src/util/ini_settings_interface.h +++ b/src/util/ini_settings_interface.h @@ -20,9 +20,10 @@ public: bool Load(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 GetIntValue(const char* section, const char* key, s32* value) const override;