uisettings.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // SPDX-FileCopyrightText: 2016 Citra Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "yuzu/uisettings.h"
  4. #ifndef CANNOT_EXPLICITLY_INSTANTIATE
  5. namespace Settings {
  6. template class Setting<bool>;
  7. template class Setting<std::string>;
  8. template class Setting<u16, true>;
  9. template class Setting<u32>;
  10. template class Setting<u8, true>;
  11. template class Setting<u8>;
  12. template class Setting<unsigned long long>;
  13. } // namespace Settings
  14. #endif
  15. namespace UISettings {
  16. const Themes themes{{
  17. {"Default", "default"},
  18. {"Default Colorful", "colorful"},
  19. {"Dark", "qdarkstyle"},
  20. {"Dark Colorful", "colorful_dark"},
  21. {"Midnight Blue", "qdarkstyle_midnight_blue"},
  22. {"Midnight Blue Colorful", "colorful_midnight_blue"},
  23. }};
  24. bool IsDarkTheme() {
  25. const auto& theme = UISettings::values.theme;
  26. return theme == QStringLiteral("qdarkstyle") ||
  27. theme == QStringLiteral("qdarkstyle_midnight_blue") ||
  28. theme == QStringLiteral("colorful_dark") ||
  29. theme == QStringLiteral("colorful_midnight_blue");
  30. }
  31. Values values = {};
  32. u32 CalculateWidth(u32 height, Settings::AspectRatio ratio) {
  33. switch (ratio) {
  34. case Settings::AspectRatio::R4_3:
  35. return height * 4 / 3;
  36. case Settings::AspectRatio::R21_9:
  37. return height * 21 / 9;
  38. case Settings::AspectRatio::R16_10:
  39. return height * 16 / 10;
  40. case Settings::AspectRatio::R16_9:
  41. case Settings::AspectRatio::Stretch:
  42. // TODO: Move this function wherever appropriate to implement Stretched aspect
  43. break;
  44. }
  45. return height * 16 / 9;
  46. }
  47. } // namespace UISettings