diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2018-05-11 22:38:44 +0200 |
|---|---|---|
| committer | Léo Lam <leo@innovatetechnologi.es> | 2018-05-12 18:10:26 +0200 |
| commit | 6763a3fce1df5a949900dd976393c7fe89fa4aec (patch) | |
| tree | cdf3ad1c04d6746d62d7f53ff0a2c46e547727b9 /Source/Core/DolphinWX/Frame.cpp | |
| parent | 7dca7c237eb9ae40765e581317df6df4b4fc1ad4 (diff) | |
Config: Add support for enums
This makes it possible to use enums as the config type.
Default values are now clearer and there's no need for casts
when calling Config::Get/Set anymore.
In order to add support for enums, the common code was updated to
handle enums by using the underlying type when loading/saving settings.
A copy constructor is also provided for conversions from
`ConfigInfo<Enum>` to `ConfigInfo<underlying_type<Enum>>`
so that enum settings can still easily work with code that doesn't care
about the actual enum values (like Graphics{Choice,Radio} in DolphinQt2
which only treat the setting as an integer).
Diffstat (limited to 'Source/Core/DolphinWX/Frame.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/Frame.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 212c32430d..954be63fd3 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -1441,9 +1441,9 @@ void CFrame::ParseHotkeys() { show_msg(OSDMessage::ARToggled); // Toggle aspect ratio - int aspect_ratio = Config::Get(Config::GFX_ASPECT_RATIO); + int aspect_ratio = static_cast<int>(Config::Get(Config::GFX_ASPECT_RATIO)); aspect_ratio = (aspect_ratio + 1) & 3; - Config::SetCurrent(Config::GFX_ASPECT_RATIO, aspect_ratio); + Config::SetCurrent(Config::GFX_ASPECT_RATIO, static_cast<AspectMode>(aspect_ratio)); } if (IsHotkey(HK_TOGGLE_EFBCOPIES)) { @@ -1526,11 +1526,11 @@ void CFrame::ParseHotkeys() { Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, ""); } - Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::SBS)); + Config::SetCurrent(Config::GFX_STEREO_MODE, StereoMode::SBS); } else { - Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::Off)); + Config::SetCurrent(Config::GFX_STEREO_MODE, StereoMode::Off); } } if (IsHotkey(HK_TOGGLE_STEREO_TAB)) @@ -1541,11 +1541,11 @@ void CFrame::ParseHotkeys() { Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, ""); } - Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::TAB)); + Config::SetCurrent(Config::GFX_STEREO_MODE, StereoMode::TAB); } else { - Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::Off)); + Config::SetCurrent(Config::GFX_STEREO_MODE, StereoMode::Off); } } if (IsHotkey(HK_TOGGLE_STEREO_ANAGLYPH)) @@ -1554,12 +1554,12 @@ void CFrame::ParseHotkeys() { // Setting the anaglyph mode also requires a specific // post-processing shader to be activated. - Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::Anaglyph)); + Config::SetCurrent(Config::GFX_STEREO_MODE, StereoMode::Anaglyph); Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, "dubois"); } else { - Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::Off)); + Config::SetCurrent(Config::GFX_STEREO_MODE, StereoMode::Off); Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, ""); } } @@ -1571,11 +1571,11 @@ void CFrame::ParseHotkeys() { Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, ""); } - Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::Nvidia3DVision)); + Config::SetCurrent(Config::GFX_STEREO_MODE, StereoMode::Nvidia3DVision); } else { - Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(StereoMode::Off)); + Config::SetCurrent(Config::GFX_STEREO_MODE, StereoMode::Off); } } |
