mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 09:15:46 -04:00
Qt: Remove usage of QString where possible for settings
This commit is contained in:
@ -491,5 +491,5 @@ Controller::SettingList AnalogController::StaticGetSettings()
|
||||
void AnalogController::LoadSettings(HostInterface* host_interface, const char* section)
|
||||
{
|
||||
Controller::LoadSettings(host_interface, section);
|
||||
m_auto_enable_analog = host_interface->GetBooleanSettingValue(section, "AutoEnableAnalog", false);
|
||||
m_auto_enable_analog = host_interface->GetBoolSettingValue(section, "AutoEnableAnalog", false);
|
||||
}
|
||||
|
@ -572,9 +572,9 @@ std::string HostInterface::GetGameMemoryCardPath(const char* game_code, u32 slot
|
||||
return GetUserDirectoryRelativePath("memcards/%s_%d.mcd", game_code, slot + 1);
|
||||
}
|
||||
|
||||
bool HostInterface::GetBooleanSettingValue(const char* section, const char* key, bool default_value /*= false*/)
|
||||
bool HostInterface::GetBoolSettingValue(const char* section, const char* key, bool default_value /*= false*/)
|
||||
{
|
||||
std::string value = GetSettingValue(section, key, "");
|
||||
std::string value = GetStringSettingValue(section, key, "");
|
||||
if (value.empty())
|
||||
return default_value;
|
||||
|
||||
@ -582,19 +582,19 @@ bool HostInterface::GetBooleanSettingValue(const char* section, const char* key,
|
||||
return bool_value.value_or(default_value);
|
||||
}
|
||||
|
||||
s32 HostInterface::GetIntegerSettingValue(const char* section, const char* key, s32 default_value /*= 0*/)
|
||||
int HostInterface::GetIntSettingValue(const char* section, const char* key, int default_value /*= 0*/)
|
||||
{
|
||||
std::string value = GetSettingValue(section, key, "");
|
||||
std::string value = GetStringSettingValue(section, key, "");
|
||||
if (value.empty())
|
||||
return default_value;
|
||||
|
||||
std::optional<s32> int_value = StringUtil::FromChars<s32>(value);
|
||||
std::optional<int> int_value = StringUtil::FromChars<int>(value);
|
||||
return int_value.value_or(default_value);
|
||||
}
|
||||
|
||||
float HostInterface::GetFloatSettingValue(const char* section, const char* key, float default_value /*= 0.0f*/)
|
||||
{
|
||||
std::string value = GetSettingValue(section, key, "");
|
||||
std::string value = GetStringSettingValue(section, key, "");
|
||||
if (value.empty())
|
||||
return default_value;
|
||||
|
||||
|
@ -107,16 +107,16 @@ public:
|
||||
virtual std::string GetShaderCacheBasePath() const;
|
||||
|
||||
/// Returns a setting value from the configuration.
|
||||
virtual std::string GetSettingValue(const char* section, const char* key, const char* default_value = "") = 0;
|
||||
virtual std::string GetStringSettingValue(const char* section, const char* key, const char* default_value = "") = 0;
|
||||
|
||||
/// Returns a boolean setting from the configuration.
|
||||
bool GetBooleanSettingValue(const char* section, const char* key, bool default_value = false);
|
||||
virtual bool GetBoolSettingValue(const char* section, const char* key, bool default_value = false);
|
||||
|
||||
/// Returns an integer setting from the configuration.
|
||||
s32 GetIntegerSettingValue(const char* section, const char* key, s32 default_value = 0);
|
||||
virtual int GetIntSettingValue(const char* section, const char* key, int default_value = 0);
|
||||
|
||||
/// Returns a float setting from the configuration.
|
||||
float GetFloatSettingValue(const char* section, const char* key, float default_value = 0.0f);
|
||||
virtual float GetFloatSettingValue(const char* section, const char* key, float default_value = 0.0f);
|
||||
|
||||
protected:
|
||||
virtual bool AcquireHostDisplay() = 0;
|
||||
|
@ -238,7 +238,7 @@ void NamcoGunCon::LoadSettings(HostInterface* host_interface, const char* sectio
|
||||
{
|
||||
Controller::LoadSettings(host_interface, section);
|
||||
|
||||
std::string path = host_interface->GetSettingValue(section, "CrosshairImagePath");
|
||||
std::string path = host_interface->GetStringSettingValue(section, "CrosshairImagePath");
|
||||
if (path != m_crosshair_image_path)
|
||||
{
|
||||
m_crosshair_image_path = std::move(path);
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <array>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
class SettingsInterface
|
||||
@ -23,7 +22,7 @@ public:
|
||||
virtual void SetStringValue(const char* section, const char* key, const char* value) = 0;
|
||||
|
||||
virtual std::vector<std::string> GetStringList(const char* section, const char* key) = 0;
|
||||
virtual void SetStringList(const char* section, const char* key, const std::vector<std::string_view>& items) = 0;
|
||||
virtual void SetStringList(const char* section, const char* key, const std::vector<std::string>& items) = 0;
|
||||
virtual bool RemoveFromStringList(const char* section, const char* key, const char* item) = 0;
|
||||
virtual bool AddToStringList(const char* section, const char* key, const char* item) = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user