[videodb] Remove nested transaction when saving state after stopping PVR playback
[xbmc.git] / xbmc / settings / SubtitlesSettings.h
blob831dfaf3741d91de7dcf01c43de99e4570685af0
1 /*
2 * Copyright (C) 2012-2021 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "settings/lib/ISettingCallback.h"
12 #include "utils/ColorUtils.h"
13 #include "utils/Observer.h"
15 #include <memory>
16 #include <string>
18 class CSetting;
19 class CSettings;
20 struct StringSettingOption;
22 namespace KODI
24 namespace SUBTITLES
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";
30 enum class Align
32 MANUAL = 0,
33 BOTTOM_INSIDE,
34 BOTTOM_OUTSIDE,
35 TOP_INSIDE,
36 TOP_OUTSIDE
39 enum class HorizontalAlign
41 LEFT = 0,
42 CENTER,
43 RIGHT
46 enum class BackgroundType
48 NONE = 0,
49 SHADOW,
50 BOX,
51 SQUAREBOX
54 enum class FontStyle
56 NORMAL = 0,
57 BOLD,
58 ITALIC,
59 BOLD_ITALIC
62 enum class OverrideStyles
64 DISABLED = 0,
65 POSITIONS,
66 STYLES,
67 STYLES_POSITIONS
70 class CSubtitlesSettings : public ISettingCallback, public Observable
72 public:
73 explicit CSubtitlesSettings(const std::shared_ptr<CSettings>& settings);
74 ~CSubtitlesSettings() override;
76 // Inherited from ISettingCallback
77 void OnSettingChanged(const std::shared_ptr<const CSetting>& setting) override;
79 /*!
80 * \brief Get subtitle alignment
81 * \return The alignment
83 Align GetAlignment();
85 /*!
86 * \brief Set the subtitle alignment
87 * \param align The alignment
89 void SetAlignment(Align align);
91 /*!
92 * \brief Get horizontal text alignment
93 * \return The alignment
95 HorizontalAlign GetHorizontalAlignment();
97 /*!
98 * \brief Get font name
99 * \return The font name
101 std::string GetFontName();
104 * \brief Get font style
105 * \return The font style
107 FontStyle GetFontStyle();
110 * \brief Get font size
111 * \return The font size in PX
113 int GetFontSize();
116 * \brief Get font color
117 * \return The font color
119 UTILS::COLOR::Color GetFontColor();
122 * \brief Get font opacity
123 * \return The font opacity in %
125 int GetFontOpacity();
128 * \brief Get border size
129 * \return The border size in %
131 int GetBorderSize();
134 * \brief Get border color
135 * \return The border color
137 UTILS::COLOR::Color GetBorderColor();
140 * \brief Get shadow size
141 * \return The shadow size in %
143 int GetShadowSize();
146 * \brief Get shadow color
147 * \return The shadow color
149 UTILS::COLOR::Color GetShadowColor();
152 * \brief Get shadow opacity
153 * \return The shadow opacity in %
155 int GetShadowOpacity();
158 * \brief Get blur size
159 * \return The blur size in %
161 int GetBlurSize();
164 * \brief Get line spacing
165 * \return The line spacing
167 int GetLineSpacing();
170 * \brief Get background type
171 * \return The background type
173 BackgroundType GetBackgroundType();
176 * \brief Get background color
177 * \return The background color
179 UTILS::COLOR::Color GetBackgroundColor();
182 * \brief Get background opacity
183 * \return The background opacity in %
185 int GetBackgroundOpacity();
188 * \brief Check if font override is enabled
189 * \return True if fonts must be overriden, otherwise false
191 bool IsOverrideFonts();
194 * \brief Get override styles
195 * \return The styles to be overriden
197 OverrideStyles GetOverrideStyles();
200 * \brief Get the subtitle vertical margin
201 * \return The vertical margin in %
203 float GetVerticalMarginPerc();
205 static void SettingOptionsSubtitleFontsFiller(const std::shared_ptr<const CSetting>& setting,
206 std::vector<StringSettingOption>& list,
207 std::string& current,
208 void* data);
210 private:
211 CSubtitlesSettings() = delete;
213 const std::shared_ptr<CSettings> m_settings;
216 } // namespace SUBTITLES
217 } // namespace KODI