OBSBasic_Icons.cpp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. /******************************************************************************
  2. Copyright (C) 2023 by Lain Bailey <[email protected]>
  3. Zachary Lund <[email protected]>
  4. Philippe Groarke <[email protected]>
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ******************************************************************************/
  16. #include "OBSBasic.hpp"
  17. QIcon OBSBasic::GetSourceIcon(const char *id) const
  18. {
  19. obs_icon_type type = obs_source_get_icon_type(id);
  20. switch (type) {
  21. case OBS_ICON_TYPE_IMAGE:
  22. return GetImageIcon();
  23. case OBS_ICON_TYPE_COLOR:
  24. return GetColorIcon();
  25. case OBS_ICON_TYPE_SLIDESHOW:
  26. return GetSlideshowIcon();
  27. case OBS_ICON_TYPE_AUDIO_INPUT:
  28. return GetAudioInputIcon();
  29. case OBS_ICON_TYPE_AUDIO_OUTPUT:
  30. return GetAudioOutputIcon();
  31. case OBS_ICON_TYPE_DESKTOP_CAPTURE:
  32. return GetDesktopCapIcon();
  33. case OBS_ICON_TYPE_WINDOW_CAPTURE:
  34. return GetWindowCapIcon();
  35. case OBS_ICON_TYPE_GAME_CAPTURE:
  36. return GetGameCapIcon();
  37. case OBS_ICON_TYPE_CAMERA:
  38. return GetCameraIcon();
  39. case OBS_ICON_TYPE_TEXT:
  40. return GetTextIcon();
  41. case OBS_ICON_TYPE_MEDIA:
  42. return GetMediaIcon();
  43. case OBS_ICON_TYPE_BROWSER:
  44. return GetBrowserIcon();
  45. case OBS_ICON_TYPE_CUSTOM:
  46. //TODO: Add ability for sources to define custom icons
  47. return GetDefaultIcon();
  48. case OBS_ICON_TYPE_PROCESS_AUDIO_OUTPUT:
  49. return GetAudioProcessOutputIcon();
  50. default:
  51. return GetDefaultIcon();
  52. }
  53. }
  54. void OBSBasic::SetImageIcon(const QIcon &icon)
  55. {
  56. imageIcon = icon;
  57. }
  58. void OBSBasic::SetColorIcon(const QIcon &icon)
  59. {
  60. colorIcon = icon;
  61. }
  62. void OBSBasic::SetSlideshowIcon(const QIcon &icon)
  63. {
  64. slideshowIcon = icon;
  65. }
  66. void OBSBasic::SetAudioInputIcon(const QIcon &icon)
  67. {
  68. audioInputIcon = icon;
  69. }
  70. void OBSBasic::SetAudioOutputIcon(const QIcon &icon)
  71. {
  72. audioOutputIcon = icon;
  73. }
  74. void OBSBasic::SetDesktopCapIcon(const QIcon &icon)
  75. {
  76. desktopCapIcon = icon;
  77. }
  78. void OBSBasic::SetWindowCapIcon(const QIcon &icon)
  79. {
  80. windowCapIcon = icon;
  81. }
  82. void OBSBasic::SetGameCapIcon(const QIcon &icon)
  83. {
  84. gameCapIcon = icon;
  85. }
  86. void OBSBasic::SetCameraIcon(const QIcon &icon)
  87. {
  88. cameraIcon = icon;
  89. }
  90. void OBSBasic::SetTextIcon(const QIcon &icon)
  91. {
  92. textIcon = icon;
  93. }
  94. void OBSBasic::SetMediaIcon(const QIcon &icon)
  95. {
  96. mediaIcon = icon;
  97. }
  98. void OBSBasic::SetBrowserIcon(const QIcon &icon)
  99. {
  100. browserIcon = icon;
  101. }
  102. void OBSBasic::SetGroupIcon(const QIcon &icon)
  103. {
  104. groupIcon = icon;
  105. }
  106. void OBSBasic::SetSceneIcon(const QIcon &icon)
  107. {
  108. sceneIcon = icon;
  109. }
  110. void OBSBasic::SetDefaultIcon(const QIcon &icon)
  111. {
  112. defaultIcon = icon;
  113. }
  114. void OBSBasic::SetAudioProcessOutputIcon(const QIcon &icon)
  115. {
  116. audioProcessOutputIcon = icon;
  117. }
  118. QIcon OBSBasic::GetImageIcon() const
  119. {
  120. return imageIcon;
  121. }
  122. QIcon OBSBasic::GetColorIcon() const
  123. {
  124. return colorIcon;
  125. }
  126. QIcon OBSBasic::GetSlideshowIcon() const
  127. {
  128. return slideshowIcon;
  129. }
  130. QIcon OBSBasic::GetAudioInputIcon() const
  131. {
  132. return audioInputIcon;
  133. }
  134. QIcon OBSBasic::GetAudioOutputIcon() const
  135. {
  136. return audioOutputIcon;
  137. }
  138. QIcon OBSBasic::GetDesktopCapIcon() const
  139. {
  140. return desktopCapIcon;
  141. }
  142. QIcon OBSBasic::GetWindowCapIcon() const
  143. {
  144. return windowCapIcon;
  145. }
  146. QIcon OBSBasic::GetGameCapIcon() const
  147. {
  148. return gameCapIcon;
  149. }
  150. QIcon OBSBasic::GetCameraIcon() const
  151. {
  152. return cameraIcon;
  153. }
  154. QIcon OBSBasic::GetTextIcon() const
  155. {
  156. return textIcon;
  157. }
  158. QIcon OBSBasic::GetMediaIcon() const
  159. {
  160. return mediaIcon;
  161. }
  162. QIcon OBSBasic::GetBrowserIcon() const
  163. {
  164. return browserIcon;
  165. }
  166. QIcon OBSBasic::GetGroupIcon() const
  167. {
  168. return groupIcon;
  169. }
  170. QIcon OBSBasic::GetSceneIcon() const
  171. {
  172. return sceneIcon;
  173. }
  174. QIcon OBSBasic::GetDefaultIcon() const
  175. {
  176. return defaultIcon;
  177. }
  178. QIcon OBSBasic::GetAudioProcessOutputIcon() const
  179. {
  180. return audioProcessOutputIcon;
  181. }