1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
/*
* Copyright (C) 2012-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#include "guilib/guiinfo/SkinGUIInfo.h"
#include "ServiceBroker.h"
#include "addons/Skin.h"
#include "guilib/LocalizeStrings.h"
#include "guilib/guiinfo/GUIInfo.h"
#include "guilib/guiinfo/GUIInfoLabels.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
#include "settings/SkinSettings.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
using namespace KODI::GUILIB::GUIINFO;
bool CSkinGUIInfo::InitCurrentItem(CFileItem *item)
{
return false;
}
bool CSkinGUIInfo::GetLabel(std::string& value, const CFileItem *item, int contextWindow, const CGUIInfo &info, std::string *fallback) const
{
switch (info.m_info)
{
///////////////////////////////////////////////////////////////////////////////////////////////
// SKIN_*
///////////////////////////////////////////////////////////////////////////////////////////////
case SKIN_BOOL:
{
bool bInfo = CSkinSettings::GetInstance().GetBool(info.GetData1());
if (bInfo)
{
value = g_localizeStrings.Get(20122); // True
return true;
}
break;
}
case SKIN_STRING:
{
value = CSkinSettings::GetInstance().GetString(info.GetData1());
return true;
}
case SKIN_THEME:
{
value = CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_LOOKANDFEEL_SKINTHEME);
return true;
}
case SKIN_COLOUR_THEME:
{
value = CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_LOOKANDFEEL_SKINCOLORS);
return true;
}
case SKIN_ASPECT_RATIO:
{
if (g_SkinInfo)
{
value = g_SkinInfo->GetCurrentAspect();
return true;
}
break;
}
case SKIN_FONT:
{
value = CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_LOOKANDFEEL_FONT);
return true;
}
case SKIN_TIMER_ELAPSEDSECS:
{
value = std::to_string(g_SkinInfo->GetTimerElapsedSeconds(info.GetData3()));
return true;
}
}
return false;
}
bool CSkinGUIInfo::GetInt(int& value, const CGUIListItem *gitem, int contextWindow, const CGUIInfo &info) const
{
switch (info.m_info)
{
case SKIN_INTEGER:
{
value = CSkinSettings::GetInstance().GetInt(info.GetData1());
return true;
}
case SKIN_TIMER_ELAPSEDSECS:
{
value = g_SkinInfo->GetTimerElapsedSeconds(info.GetData3());
return true;
}
}
return false;
}
bool CSkinGUIInfo::GetBool(bool& value, const CGUIListItem *gitem, int contextWindow, const CGUIInfo &info) const
{
switch (info.m_info)
{
///////////////////////////////////////////////////////////////////////////////////////////////
// SKIN_*
///////////////////////////////////////////////////////////////////////////////////////////////
case SKIN_BOOL:
{
value = CSkinSettings::GetInstance().GetBool(info.GetData1());
return true;
}
case SKIN_STRING_IS_EQUAL:
{
value = StringUtils::EqualsNoCase(CSkinSettings::GetInstance().GetString(info.GetData1()), info.GetData3());
return true;
}
case SKIN_STRING:
{
value = !CSkinSettings::GetInstance().GetString(info.GetData1()).empty();
return true;
}
case SKIN_HAS_THEME:
{
std::string theme = CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_LOOKANDFEEL_SKINTHEME);
URIUtils::RemoveExtension(theme);
value = StringUtils::EqualsNoCase(theme, info.GetData3());
return true;
}
case SKIN_TIMER_IS_RUNNING:
{
value = g_SkinInfo->TimerIsRunning(info.GetData3());
return true;
}
}
return false;
}
|