OBSThemeVariable.hpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /******************************************************************************
  2. Copyright (C) 2023 by Dennis Sädtler <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #pragma once
  15. #include <QVariant>
  16. #include <filesystem>
  17. struct OBSThemeVariable;
  18. struct OBSTheme {
  19. /* internal name, must be unique */
  20. QString id;
  21. QString name;
  22. QString author;
  23. QString extends;
  24. /* First ancestor base theme */
  25. QString parent;
  26. /* Dependencies from root to direct ancestor */
  27. QStringList dependencies;
  28. /* File path */
  29. std::filesystem::path location;
  30. std::filesystem::path filename; /* Filename without extension */
  31. bool isDark;
  32. bool isVisible; /* Whether it should be shown to the user */
  33. bool isBaseTheme; /* Whether it is a "style" or variant */
  34. bool isHighContrast; /* Whether it is a high-contrast adjustment layer */
  35. };
  36. struct OBSThemeVariable {
  37. enum VariableType {
  38. Color, /* RGB color value*/
  39. Size, /* Number with suffix denoting size (e.g. px, pt, em) */
  40. Number, /* Number without suffix */
  41. String, /* Raw string (e.g. color name, border style, etc.) */
  42. Alias, /* Points at another variable, value will be the key */
  43. Calc, /* Simple calculation with two operands */
  44. };
  45. /* Whether the variable should be editable in the UI */
  46. bool editable = false;
  47. /* Used for VariableType::Size only */
  48. QString suffix;
  49. VariableType type;
  50. QString name;
  51. QVariant value;
  52. QVariant userValue; /* If overwritten by user, use this value instead */
  53. };