xbmc
SubtitlesSettings.h
1 /*
2  * Copyright (C) 2012-2021 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "settings/lib/ISettingCallback.h"
12 #include "utils/ColorUtils.h"
13 #include "utils/Observer.h"
14 
15 #include <memory>
16 #include <string>
17 
18 class CSetting;
19 class CSettings;
20 struct StringSettingOption;
21 
22 namespace KODI
23 {
24 namespace SUBTITLES
25 {
26 // This is a placeholder to keep the fontname setting valid
27 // even if the default app font could be changed
28 constexpr const char* FONT_DEFAULT_FAMILYNAME = "DEFAULT";
29 
30 enum class Align
31 {
32  MANUAL = 0,
33  BOTTOM_INSIDE,
34  BOTTOM_OUTSIDE,
35  TOP_INSIDE,
36  TOP_OUTSIDE
37 };
38 
39 enum class HorizontalAlign
40 {
41  LEFT = 0,
42  CENTER,
43  RIGHT
44 };
45 
46 enum class BackgroundType
47 {
48  NONE = 0,
49  SHADOW,
50  BOX,
51  SQUAREBOX
52 };
53 
54 enum class FontStyle
55 {
56  NORMAL = 0,
57  BOLD,
58  ITALIC,
59  BOLD_ITALIC
60 };
61 
62 enum class OverrideStyles
63 {
64  DISABLED = 0,
65  POSITIONS,
66  STYLES,
67  STYLES_POSITIONS
68 };
69 
71 {
72 public:
73  explicit CSubtitlesSettings(const std::shared_ptr<CSettings>& settings);
74  ~CSubtitlesSettings() override;
75 
76  // Inherited from ISettingCallback
77  void OnSettingChanged(const std::shared_ptr<const CSetting>& setting) override;
78 
83  Align GetAlignment();
84 
89  void SetAlignment(Align align);
90 
95  HorizontalAlign GetHorizontalAlignment();
96 
101  std::string GetFontName();
102 
107  FontStyle GetFontStyle();
108 
113  int GetFontSize();
114 
119  UTILS::COLOR::Color GetFontColor();
120 
125  int GetFontOpacity();
126 
131  int GetBorderSize();
132 
137  UTILS::COLOR::Color GetBorderColor();
138 
143  int GetShadowSize();
144 
149  UTILS::COLOR::Color GetShadowColor();
150 
155  int GetShadowOpacity();
156 
161  int GetBlurSize();
162 
167  BackgroundType GetBackgroundType();
168 
173  UTILS::COLOR::Color GetBackgroundColor();
174 
179  int GetBackgroundOpacity();
180 
185  bool IsOverrideFonts();
186 
191  OverrideStyles GetOverrideStyles();
192 
197  float GetVerticalMarginPerc();
198 
199  static void SettingOptionsSubtitleFontsFiller(const std::shared_ptr<const CSetting>& setting,
200  std::vector<StringSettingOption>& list,
201  std::string& current,
202  void* data);
203 
204 private:
205  CSubtitlesSettings() = delete;
206 
207  const std::shared_ptr<CSettings> m_settings;
208 };
209 
210 } // namespace SUBTITLES
211 } // namespace KODI
Wrapper around CSettingsManager responsible for properly setting up the settings manager and register...
Definition: Settings.h:27
Definition: ISettingCallback.h:16
Setting base class containing all the properties which are common to all settings independent of the ...
Definition: Setting.h:46
Definition: SettingDefinitions.h:85
Controller configuration window.
Definition: AudioDecoder.h:18
Definition: settings.py:1
Definition: SubtitlesSettings.h:70
Definition: Observer.h:44