aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorksooo <3226626+ksooo@users.noreply.github.com>2023-01-01 16:15:08 +0100
committerksooo <3226626+ksooo@users.noreply.github.com>2023-01-02 11:35:58 +0100
commit759391fd0163b5b411ecca6c8b05e81aabb0223d (patch)
treef139fccf635e98dde2a868904b83785cfc1e31fa
parent01f4d336ac04d6ce0f6d91ac85e4a84d1adab5ec (diff)
downloadxbmc-759391fd0163b5b411ecca6c8b05e81aabb0223d.tar.xz
[PVR][Estuary] Timer settings dialog: Show client name in timer type selection dialog if more than one client supports timers.
-rw-r--r--addons/skin.estuary/xml/Includes_DialogSelect.xml42
-rw-r--r--xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp31
-rw-r--r--xbmc/settings/SettingControl.h4
-rw-r--r--xbmc/settings/dialogs/GUIDialogSettingsManualBase.cpp49
-rw-r--r--xbmc/settings/dialogs/GUIDialogSettingsManualBase.h32
-rw-r--r--xbmc/settings/lib/SettingDefinitions.h18
-rw-r--r--xbmc/settings/windows/GUIControlSettings.cpp9
7 files changed, 151 insertions, 34 deletions
diff --git a/addons/skin.estuary/xml/Includes_DialogSelect.xml b/addons/skin.estuary/xml/Includes_DialogSelect.xml
index 85e49bdc55..3d0daeaf36 100644
--- a/addons/skin.estuary/xml/Includes_DialogSelect.xml
+++ b/addons/skin.estuary/xml/Includes_DialogSelect.xml
@@ -54,6 +54,27 @@
<height>110</height>
<texture>$VAR[InfoWallThumbVar]</texture>
<aspectratio>keep</aspectratio>
+ <visible>!ListItem.Property(PVR.IsRecordingTimer) + !ListItem.Property(PVR.IsRemindingTimer)</visible>
+ </control>
+ <control type="image">
+ <left>27</left>
+ <top>22</top>
+ <width>80</width>
+ <height>80</height>
+ <aspectratio align="top">keep</aspectratio>
+ <aligny>center</aligny>
+ <texture>icons/pvr/timers/recording.png</texture>
+ <visible>ListItem.Property(PVR.IsRecordingTimer)</visible>
+ </control>
+ <control type="image">
+ <left>27</left>
+ <top>22</top>
+ <width>80</width>
+ <height>80</height>
+ <aspectratio align="top">keep</aspectratio>
+ <aligny>center</aligny>
+ <texture>icons/pvr/timers/bell.png</texture>
+ <visible>ListItem.Property(PVR.IsRemindingTimer)</visible>
</control>
<control type="label">
<left>135</left>
@@ -90,6 +111,27 @@
<height>110</height>
<texture>$VAR[InfoWallThumbVar]</texture>
<aspectratio>keep</aspectratio>
+ <visible>!ListItem.Property(PVR.IsRecordingTimer) + !ListItem.Property(PVR.IsRemindingTimer)</visible>
+ </control>
+ <control type="image">
+ <left>27</left>
+ <top>22</top>
+ <width>80</width>
+ <height>80</height>
+ <aspectratio align="top">keep</aspectratio>
+ <aligny>center</aligny>
+ <texture>icons/pvr/timers/recording.png</texture>
+ <visible>ListItem.Property(PVR.IsRecordingTimer)</visible>
+ </control>
+ <control type="image">
+ <left>27</left>
+ <top>22</top>
+ <width>80</width>
+ <height>80</height>
+ <aspectratio align="top">keep</aspectratio>
+ <aligny>center</aligny>
+ <texture>icons/pvr/timers/bell.png</texture>
+ <visible>ListItem.Property(PVR.IsRemindingTimer)</visible>
</control>
<control type="label">
<left>135</left>
diff --git a/xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp b/xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
index dfb8d84f66..8c17467026 100644
--- a/xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
+++ b/xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
@@ -240,7 +240,26 @@ void CGUIDialogPVRTimerSettings::InitializeSettings()
std::shared_ptr<CSetting> setting = NULL;
// Timer type
- setting = AddList(group, SETTING_TMR_TYPE, 803, SettingLevel::Basic, 0, TypesFiller, 803);
+ bool useDetails = false;
+ bool foundClientSupportingTimers = false;
+
+ const CPVRClientMap clients = CServiceBroker::GetPVRManager().Clients()->GetCreatedClients();
+ for (const auto& client : clients)
+ {
+ if (client.second->GetClientCapabilities().SupportsTimers())
+ {
+ if (foundClientSupportingTimers)
+ {
+ // found second client supporting timers, use detailed timer type list layout
+ useDetails = true;
+ break;
+ }
+ foundClientSupportingTimers = true;
+ }
+ }
+
+ setting = AddList(group, SETTING_TMR_TYPE, 803, SettingLevel::Basic, 0, TypesFiller, 803, true,
+ -1, useDetails);
AddTypeDependentEnableCondition(setting, SETTING_TMR_TYPE);
// Timer enabled/disabled
@@ -888,10 +907,18 @@ void CGUIDialogPVRTimerSettings::TypesFiller(const SettingConstPtr& setting,
static const std::vector<std::pair<std::string, CVariant>> recordingTimerProps{
std::make_pair("PVR.IsRecordingTimer", CVariant{true})};
+ const auto clients = CServiceBroker::GetPVRManager().Clients();
+
bool foundCurrent(false);
for (const auto& typeEntry : pThis->m_typeEntries)
{
- list.emplace_back(typeEntry.second->GetDescription(), typeEntry.first,
+ std::string clientName;
+
+ const auto client = clients->GetCreatedClient(typeEntry.second->GetClientId());
+ if (client)
+ clientName = client->GetFriendlyName();
+
+ list.emplace_back(typeEntry.second->GetDescription(), clientName, typeEntry.first,
typeEntry.second->IsReminder() ? reminderTimerProps : recordingTimerProps);
if (!foundCurrent && (*(pThis->m_timerType) == *(typeEntry.second)))
diff --git a/xbmc/settings/SettingControl.h b/xbmc/settings/SettingControl.h
index 68e0e1d67c..c86f040e34 100644
--- a/xbmc/settings/SettingControl.h
+++ b/xbmc/settings/SettingControl.h
@@ -196,12 +196,16 @@ public:
SettingControlListValueFormatter GetFormatter() const { return m_formatter; }
void SetFormatter(SettingControlListValueFormatter formatter) { m_formatter = formatter; }
+ bool UseDetails() const { return m_useDetails; }
+ void SetUseDetails(bool useDetails) { m_useDetails = useDetails; }
+
protected:
int m_heading = -1;
bool m_multiselect = false;
bool m_hideValue = false;
int m_addButtonLabel = -1;
SettingControlListValueFormatter m_formatter = nullptr;
+ bool m_useDetails{false};
};
class CSettingControlSlider;
diff --git a/xbmc/settings/dialogs/GUIDialogSettingsManualBase.cpp b/xbmc/settings/dialogs/GUIDialogSettingsManualBase.cpp
index 07f7ae34b1..84114db80c 100644
--- a/xbmc/settings/dialogs/GUIDialogSettingsManualBase.cpp
+++ b/xbmc/settings/dialogs/GUIDialogSettingsManualBase.cpp
@@ -697,7 +697,8 @@ std::shared_ptr<CSettingString> CGUIDialogSettingsManualBase::AddList(
StringSettingOptionsFiller filler,
int heading,
bool visible /* = true */,
- int help /* = -1 */)
+ int help /* = -1 */,
+ bool details /* = false */)
{
if (group == NULL || id.empty() || label < 0 || filler == NULL ||
GetSetting(id) != NULL)
@@ -707,7 +708,7 @@ std::shared_ptr<CSettingString> CGUIDialogSettingsManualBase::AddList(
if (setting == NULL)
return NULL;
- setting->SetControl(GetListControl("string", false, heading, false));
+ setting->SetControl(GetListControl("string", false, heading, false, nullptr, details));
setting->SetOptionsFiller(filler, this);
setSettingDetails(setting, level, visible, help);
@@ -724,7 +725,8 @@ std::shared_ptr<CSettingInt> CGUIDialogSettingsManualBase::AddList(
const TranslatableIntegerSettingOptions& entries,
int heading,
bool visible /* = true */,
- int help /* = -1 */)
+ int help /* = -1 */,
+ bool details /* = false */)
{
if (group == NULL || id.empty() || label < 0 || entries.empty() ||
GetSetting(id) != NULL)
@@ -734,7 +736,7 @@ std::shared_ptr<CSettingInt> CGUIDialogSettingsManualBase::AddList(
if (setting == NULL)
return NULL;
- setting->SetControl(GetListControl("integer", false, heading, false));
+ setting->SetControl(GetListControl("integer", false, heading, false, nullptr, details));
setting->SetTranslatableOptions(entries);
setSettingDetails(setting, level, visible, help);
@@ -751,7 +753,8 @@ std::shared_ptr<CSettingInt> CGUIDialogSettingsManualBase::AddList(
const IntegerSettingOptions& entries,
int heading,
bool visible /* = true */,
- int help /* = -1 */)
+ int help /* = -1 */,
+ bool details /* = false */)
{
if (group == NULL || id.empty() || label < 0 || entries.empty() ||
GetSetting(id) != NULL)
@@ -761,7 +764,7 @@ std::shared_ptr<CSettingInt> CGUIDialogSettingsManualBase::AddList(
if (setting == NULL)
return NULL;
- setting->SetControl(GetListControl("integer", false, heading, false));
+ setting->SetControl(GetListControl("integer", false, heading, false, nullptr, details));
setting->SetOptions(entries);
setSettingDetails(setting, level, visible, help);
@@ -778,7 +781,8 @@ std::shared_ptr<CSettingInt> CGUIDialogSettingsManualBase::AddList(
IntegerSettingOptionsFiller filler,
int heading,
bool visible /* = true */,
- int help /* = -1 */)
+ int help /* = -1 */,
+ bool details /* = false */)
{
if (group == NULL || id.empty() || label < 0 || filler == NULL ||
GetSetting(id) != NULL)
@@ -788,7 +792,7 @@ std::shared_ptr<CSettingInt> CGUIDialogSettingsManualBase::AddList(
if (setting == NULL)
return NULL;
- setting->SetControl(GetListControl("integer", false, heading, false));
+ setting->SetControl(GetListControl("integer", false, heading, false, nullptr, details));
setting->SetOptionsFiller(filler, this);
setSettingDetails(setting, level, visible, help);
@@ -807,7 +811,8 @@ std::shared_ptr<CSettingList> CGUIDialogSettingsManualBase::AddList(
int minimumItems /* = 0 */,
int maximumItems /* = -1 */,
bool visible /* = true */,
- int help /* = -1 */)
+ int help /* = -1 */,
+ bool details /* = false */)
{
if (group == NULL || id.empty() || label < 0 || filler == NULL ||
GetSetting(id) != NULL)
@@ -832,7 +837,7 @@ std::shared_ptr<CSettingList> CGUIDialogSettingsManualBase::AddList(
// setting the default will also set the actual value on an unchanged setting
setting->SetDefault(settingValues);
- setting->SetControl(GetListControl("string", false, heading, true));
+ setting->SetControl(GetListControl("string", false, heading, true, nullptr, details));
setting->SetMinimumItems(minimumItems);
setting->SetMaximumItems(maximumItems);
setSettingDetails(setting, level, visible, help);
@@ -852,7 +857,8 @@ std::shared_ptr<CSettingList> CGUIDialogSettingsManualBase::AddList(
int minimumItems /* = 0 */,
int maximumItems /* = -1 */,
bool visible /* = true */,
- int help /* = -1 */)
+ int help /* = -1 */,
+ bool details /* = false */)
{
if (group == NULL || id.empty() || label < 0 || entries.empty() ||
GetSetting(id) != NULL)
@@ -877,7 +883,7 @@ std::shared_ptr<CSettingList> CGUIDialogSettingsManualBase::AddList(
// setting the default will also set the actual value on an unchanged setting
setting->SetDefault(settingValues);
- setting->SetControl(GetListControl("integer", false, heading, true));
+ setting->SetControl(GetListControl("integer", false, heading, true, nullptr, details));
setting->SetMinimumItems(minimumItems);
setting->SetMaximumItems(maximumItems);
setSettingDetails(setting, level, visible, help);
@@ -897,7 +903,8 @@ std::shared_ptr<CSettingList> CGUIDialogSettingsManualBase::AddList(
int minimumItems /* = 0 */,
int maximumItems /* = -1 */,
bool visible /* = true */,
- int help /* = -1 */)
+ int help /* = -1 */,
+ bool details /* = false */)
{
if (group == NULL || id.empty() || label < 0 || entries.empty() ||
GetSetting(id) != NULL)
@@ -922,7 +929,7 @@ std::shared_ptr<CSettingList> CGUIDialogSettingsManualBase::AddList(
// setting the default will also set the actual value on an unchanged setting
setting->SetDefault(settingValues);
- setting->SetControl(GetListControl("integer", false, heading, true));
+ setting->SetControl(GetListControl("integer", false, heading, true, nullptr, details));
setting->SetMinimumItems(minimumItems);
setting->SetMaximumItems(maximumItems);
setSettingDetails(setting, level, visible, help);
@@ -943,7 +950,8 @@ std::shared_ptr<CSettingList> CGUIDialogSettingsManualBase::AddList(
int maximumItems /* = -1 */,
bool visible /* = true */,
int help /* = -1 */,
- SettingControlListValueFormatter formatter /* = NULL */)
+ SettingControlListValueFormatter formatter /* = NULL */,
+ bool details /* = false */)
{
if (group == NULL || id.empty() || label < 0 || filler == NULL ||
GetSetting(id) != NULL)
@@ -968,7 +976,7 @@ std::shared_ptr<CSettingList> CGUIDialogSettingsManualBase::AddList(
// setting the default will also set the actual value on an unchanged setting
setting->SetDefault(settingValues);
- setting->SetControl(GetListControl("integer", false, heading, true, formatter));
+ setting->SetControl(GetListControl("integer", false, heading, true, formatter, details));
setting->SetMinimumItems(minimumItems);
setting->SetMaximumItems(maximumItems);
setSettingDetails(setting, level, visible, help);
@@ -1550,7 +1558,13 @@ std::shared_ptr<ISettingControl> CGUIDialogSettingsManualBase::GetSpinnerControl
return control;
}
-std::shared_ptr<ISettingControl> CGUIDialogSettingsManualBase::GetListControl(const std::string &format, bool delayed /* = false */, int heading /* = -1 */, bool multiselect /* = false */,SettingControlListValueFormatter formatter /* = NULL */)
+std::shared_ptr<ISettingControl> CGUIDialogSettingsManualBase::GetListControl(
+ const std::string& format,
+ bool delayed /* = false */,
+ int heading /* = -1 */,
+ bool multiselect /* = false */,
+ SettingControlListValueFormatter formatter /* = NULL */,
+ bool details /* = false */)
{
std::shared_ptr<CSettingControlList> control = std::make_shared<CSettingControlList>();
if (!control->SetFormat(format))
@@ -1560,6 +1574,7 @@ std::shared_ptr<ISettingControl> CGUIDialogSettingsManualBase::GetListControl(co
control->SetHeading(heading);
control->SetMultiSelect(multiselect);
control->SetFormatter(formatter);
+ control->SetUseDetails(details);
return control;
}
diff --git a/xbmc/settings/dialogs/GUIDialogSettingsManualBase.h b/xbmc/settings/dialogs/GUIDialogSettingsManualBase.h
index a877902dba..338259cb13 100644
--- a/xbmc/settings/dialogs/GUIDialogSettingsManualBase.h
+++ b/xbmc/settings/dialogs/GUIDialogSettingsManualBase.h
@@ -288,7 +288,8 @@ protected:
StringSettingOptionsFiller filler,
int heading,
bool visible = true,
- int help = -1);
+ int help = -1,
+ bool details = false);
std::shared_ptr<CSettingInt> AddList(const std::shared_ptr<CSettingGroup>& group,
const std::string& id,
int label,
@@ -297,7 +298,8 @@ protected:
const TranslatableIntegerSettingOptions& entries,
int heading,
bool visible = true,
- int help = -1);
+ int help = -1,
+ bool details = false);
std::shared_ptr<CSettingInt> AddList(const std::shared_ptr<CSettingGroup>& group,
const std::string& id,
int label,
@@ -306,7 +308,8 @@ protected:
const IntegerSettingOptions& entries,
int heading,
bool visible = true,
- int help = -1);
+ int help = -1,
+ bool details = false);
std::shared_ptr<CSettingInt> AddList(const std::shared_ptr<CSettingGroup>& group,
const std::string& id,
int label,
@@ -315,7 +318,8 @@ protected:
IntegerSettingOptionsFiller filler,
int heading,
bool visible = true,
- int help = -1);
+ int help = -1,
+ bool details = false);
std::shared_ptr<CSettingList> AddList(const std::shared_ptr<CSettingGroup>& group,
const std::string& id,
int label,
@@ -326,7 +330,8 @@ protected:
int minimumItems = 0,
int maximumItems = -1,
bool visible = true,
- int help = -1);
+ int help = -1,
+ bool details = false);
std::shared_ptr<CSettingList> AddList(const std::shared_ptr<CSettingGroup>& group,
const std::string& id,
int label,
@@ -337,7 +342,8 @@ protected:
int minimumItems = 0,
int maximumItems = -1,
bool visible = true,
- int help = -1);
+ int help = -1,
+ bool details = false);
std::shared_ptr<CSettingList> AddList(const std::shared_ptr<CSettingGroup>& group,
const std::string& id,
int label,
@@ -348,7 +354,8 @@ protected:
int minimumItems = 0,
int maximumItems = -1,
bool visible = true,
- int help = -1);
+ int help = -1,
+ bool details = false);
std::shared_ptr<CSettingList> AddList(const std::shared_ptr<CSettingGroup>& group,
const std::string& id,
int label,
@@ -360,7 +367,8 @@ protected:
int maximumItems = -1,
bool visible = true,
int help = -1,
- SettingControlListValueFormatter formatter = NULL);
+ SettingControlListValueFormatter formatter = nullptr,
+ bool details = false);
// slider controls
std::shared_ptr<CSettingInt> AddPercentageSlider(const std::shared_ptr<CSettingGroup>& group,
@@ -588,7 +596,13 @@ protected:
std::shared_ptr<ISettingControl> GetButtonControl(const std::string &format, bool delayed = false, int heading = -1, bool hideValue = false, bool showInstalledAddons = true,
bool showInstallableAddons = false, bool showMoreAddons = true);
std::shared_ptr<ISettingControl> GetSpinnerControl(const std::string &format, bool delayed = false, int minimumLabel = -1, int formatLabel = -1, const std::string &formatString = "");
- std::shared_ptr<ISettingControl> GetListControl(const std::string &format, bool delayed = false, int heading = -1, bool multiselect = false, SettingControlListValueFormatter formatter = NULL);
+ std::shared_ptr<ISettingControl> GetListControl(
+ const std::string& format,
+ bool delayed = false,
+ int heading = -1,
+ bool multiselect = false,
+ SettingControlListValueFormatter formatter = nullptr,
+ bool details = false);
std::shared_ptr<ISettingControl> GetSliderControl(const std::string &format, bool delayed = false, int heading = -1, bool usePopup = false, int formatLabel = -1, const std::string &formatString = "");
std::shared_ptr<ISettingControl> GetRangeControl(const std::string &format, bool delayed = false, int formatLabel = -1, int valueFormatLabel = -1, const std::string &valueFormatString = "");
diff --git a/xbmc/settings/lib/SettingDefinitions.h b/xbmc/settings/lib/SettingDefinitions.h
index 74aea817d7..ae18347760 100644
--- a/xbmc/settings/lib/SettingDefinitions.h
+++ b/xbmc/settings/lib/SettingDefinitions.h
@@ -68,11 +68,16 @@ struct IntegerSettingOption
IntegerSettingOption(const std::string& _label, int _value)
: label(_label), value(_value) {}
- IntegerSettingOption(const std::string& _label, int _value,
+ IntegerSettingOption(const std::string& _label,
+ const std::string& _label2,
+ int _value,
const std::vector<std::pair<std::string, CVariant>>& props)
- : label(_label), value(_value), properties(props) {}
+ : label(_label), label2(_label2), value(_value), properties(props)
+ {
+ }
std::string label;
+ std::string label2;
int value = 0;
std::vector<std::pair<std::string, CVariant>> properties;
};
@@ -82,11 +87,16 @@ struct StringSettingOption
StringSettingOption(const std::string& _label, const std::string& _value)
: label(_label), value(_value) {}
- StringSettingOption(const std::string& _label, const std::string& _value,
+ StringSettingOption(const std::string& _label,
+ const std::string& _label2,
+ const std::string& _value,
const std::vector<std::pair<std::string, CVariant>>& props)
- : label(_label), value(_value), properties(props) {}
+ : label(_label), label2(_label2), value(_value), properties(props)
+ {
+ }
std::string label;
+ std::string label2;
std::string value;
std::vector<std::pair<std::string, CVariant>> properties;
};
diff --git a/xbmc/settings/windows/GUIControlSettings.cpp b/xbmc/settings/windows/GUIControlSettings.cpp
index 4dc8688cc7..fcbf1fa908 100644
--- a/xbmc/settings/windows/GUIControlSettings.cpp
+++ b/xbmc/settings/windows/GUIControlSettings.cpp
@@ -68,12 +68,14 @@ static std::string Localize(std::uint32_t code,
template<typename TValueType>
static CFileItemPtr GetFileItem(const std::string& label,
+ const std::string& label2,
const TValueType& value,
const std::vector<std::pair<std::string, CVariant>>& properties,
const std::set<TValueType>& selectedValues)
{
CFileItemPtr item(new CFileItem(label));
item->SetProperty("value", value);
+ item->SetLabel2(label2);
for (const auto& prop : properties)
item->SetProperty(prop.first, prop.second);
@@ -678,6 +680,7 @@ bool CGUIControlListSetting::OnClick()
dialog->SetHeading(CVariant{Localize(m_pSetting->GetLabel())});
dialog->SetItems(options);
dialog->SetMultiSelection(control->CanMultiSelect());
+ dialog->SetUseDetails(control->UseDetails());
dialog->Open();
if (!dialog->IsConfirmed())
@@ -897,7 +900,8 @@ bool CGUIControlListSetting::GetIntegerItems(const SettingConstPtr& setting,
// turn them into CFileItems and add them to the item list
for (const auto& option : options)
- items.Add(GetFileItem(option.label, option.value, option.properties, selectedValues));
+ items.Add(
+ GetFileItem(option.label, option.label2, option.value, option.properties, selectedValues));
return true;
}
@@ -914,7 +918,8 @@ bool CGUIControlListSetting::GetStringItems(const SettingConstPtr& setting,
// turn them into CFileItems and add them to the item list
for (const auto& option : options)
- items.Add(GetFileItem(option.label, option.value, option.properties, selectedValues));
+ items.Add(
+ GetFileItem(option.label, option.label2, option.value, option.properties, selectedValues));
return true;
}