diff options
author | Kai Sommerfeld <3226626+ksooo@users.noreply.github.com> | 2023-09-01 22:15:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-01 22:15:46 +0200 |
commit | e2eab005faff6dacda5eb1f03352f34b5dff9b9b (patch) | |
tree | 4bdac8cc94afc2210cb691a76896ed1cddc67141 | |
parent | b6cbc52add16022213152b3fac522d8953a64855 (diff) | |
parent | e2b9f545df43b860b785acb4215352bce996e697 (diff) | |
download | xbmc-e2eab005faff6dacda5eb1f03352f34b5dff9b9b.tar.xz |
Merge pull request #23682 from ksooo/listproviders-more-item
[listproviders][Estuary][PVR] Add special 'more...' item to size limited lists in case there are more items available.
-rw-r--r-- | addons/skin.estuary/xml/Home.xml | 6 | ||||
-rw-r--r-- | addons/skin.estuary/xml/Includes_Home.xml | 81 | ||||
-rw-r--r-- | addons/skin.estuary/xml/Variables.xml | 9 | ||||
-rw-r--r-- | xbmc/listproviders/DirectoryProvider.cpp | 45 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRChannels.cpp | 12 |
5 files changed, 117 insertions, 36 deletions
diff --git a/addons/skin.estuary/xml/Home.xml b/addons/skin.estuary/xml/Home.xml index 9a27af758a..cf89675000 100644 --- a/addons/skin.estuary/xml/Home.xml +++ b/addons/skin.estuary/xml/Home.xml @@ -365,7 +365,7 @@ <param name="widget_header" value="$LOCALIZE[136]"/> <param name="widget_target" value="videos"/> <param name="list_id" value="11200"/> - <param name="icon" value="DefaultPlaylist.png"/> + <param name="icon" value="$VAR[WidgetPlaylistIconVar]"/> </include> </control> <include content="ImageWidget"> @@ -398,6 +398,7 @@ <param name="sortby" value="lastplayed"/> <param name="sortorder" value="descending"/> <param name="widget_header" value="$LOCALIZE[31016]"/> + <param name="widget_target" value="tvchannels"/> <param name="item_limit" value="15"/> <param name="list_id" value="12200"/> <param name="info_update" value="5000"/> @@ -407,6 +408,7 @@ <param name="sortby" value="date"/> <param name="sortorder" value="descending"/> <param name="widget_header" value="$LOCALIZE[31015]"/> + <param name="widget_target" value="tvrecordings"/> <param name="item_limit" value="15"/> <param name="list_id" value="12300"/> <param name="label" value="$INFO[ListItem.Title]$INFO[ListItem.Date, (,)]"/> @@ -468,6 +470,7 @@ <param name="sortby" value="lastplayed"/> <param name="sortorder" value="descending"/> <param name="widget_header" value="$LOCALIZE[31018]"/> + <param name="widget_target" value="radiochannels"/> <param name="item_limit" value="15"/> <param name="list_id" value="13200"/> <param name="info_update" value="5000"/> @@ -477,6 +480,7 @@ <param name="sortby" value="date"/> <param name="sortorder" value="descending"/> <param name="widget_header" value="$LOCALIZE[31015]"/> + <param name="widget_target" value="radiorecordings"/> <param name="item_limit" value="15"/> <param name="list_id" value="13300"/> <param name="label" value="$INFO[ListItem.Title]$INFO[ListItem.Date, (,)]"/> diff --git a/addons/skin.estuary/xml/Includes_Home.xml b/addons/skin.estuary/xml/Includes_Home.xml index bfcae45514..f608f49bfe 100644 --- a/addons/skin.estuary/xml/Includes_Home.xml +++ b/addons/skin.estuary/xml/Includes_Home.xml @@ -449,23 +449,38 @@ <texture fallback="DefaultTVShows.png">$PARAM[icon]</texture> <aspectratio>keep</aspectratio> </control> + <control type="group"> + <visible>!String.IsEqual(ListItem.Property(node.type),target_folder)</visible> + <control type="label"> + <left>42</left> + <top>247</top> + <width>245</width> + <height>70</height> + <label>$PARAM[label]</label> + <font>font12</font> + <shadowcolor>text_shadow</shadowcolor> + <align>center</align> + <aligny>top</aligny> + </control> + <control type="label"> + <left>42</left> + <top>277</top> + <width>245</width> + <height>65</height> + <label>$PARAM[label2]</label> + <font>font12</font> + <shadowcolor>text_shadow</shadowcolor> + <align>center</align> + <aligny>top</aligny> + </control> + </control> <control type="label"> <left>42</left> <top>247</top> <width>245</width> <height>70</height> - <label>$PARAM[label]</label> - <font>font12</font> - <shadowcolor>text_shadow</shadowcolor> - <align>center</align> - <aligny>top</aligny> - </control> - <control type="label"> - <left>42</left> - <top>277</top> - <width>245</width> - <height>65</height> - <label>$PARAM[label2]</label> + <visible>String.IsEqual(ListItem.Property(node.type),target_folder)</visible> + <label>$INFO[ListItem.Label]</label> <font>font12</font> <shadowcolor>text_shadow</shadowcolor> <align>center</align> @@ -532,24 +547,40 @@ <texture fallback="DefaultTVShows.png">$PARAM[icon]</texture> <aspectratio>keep</aspectratio> </control> + <control type="group"> + <visible>!String.IsEqual(ListItem.Property(node.type),target_folder)</visible> + <control type="label"> + <left>42</left> + <top>247</top> + <width>245</width> + <height>70</height> + <label>$PARAM[label]</label> + <font>font12</font> + <shadowcolor>text_shadow</shadowcolor> + <align>center</align> + <scroll>true</scroll> + <aligny>top</aligny> + </control> + <control type="label"> + <left>42</left> + <top>277</top> + <width>245</width> + <height>65</height> + <label>$PARAM[label2]</label> + <font>font12</font> + <shadowcolor>text_shadow</shadowcolor> + <align>center</align> + <scroll>true</scroll> + <aligny>top</aligny> + </control> + </control> <control type="label"> <left>42</left> <top>247</top> <width>245</width> <height>70</height> - <label>$PARAM[label]</label> - <font>font12</font> - <shadowcolor>text_shadow</shadowcolor> - <align>center</align> - <scroll>true</scroll> - <aligny>top</aligny> - </control> - <control type="label"> - <left>42</left> - <top>277</top> - <width>245</width> - <height>65</height> - <label>$PARAM[label2]</label> + <visible>String.IsEqual(ListItem.Property(node.type),target_folder)</visible> + <label>$INFO[ListItem.Label]</label> <font>font12</font> <shadowcolor>text_shadow</shadowcolor> <align>center</align> diff --git a/addons/skin.estuary/xml/Variables.xml b/addons/skin.estuary/xml/Variables.xml index f3787b1f05..6e3fa51369 100644 --- a/addons/skin.estuary/xml/Variables.xml +++ b/addons/skin.estuary/xml/Variables.xml @@ -159,13 +159,19 @@ <value condition="MusicPlayer.IsMultiDisc">$INFO[MusicPlayer.DiscNumber]$INFO[MusicPlayer.DiscTitle, - ]</value> </variable> <variable name="WidgetGenreIconVar"> + <value condition="String.IsEqual(ListItem.Property(node.type),target_folder)">$INFO[ListItem.Icon]</value> <value condition="System.AddonIsEnabled(resource.images.moviegenreicons.transparent)">$INFO[ListItem.Label,resource://resource.images.moviegenreicons.transparent/,.png]</value> <value>DefaultGenre.png</value> </variable> <variable name="WidgetStudioIconVar"> + <value condition="String.IsEqual(ListItem.Property(node.type),target_folder)">$INFO[ListItem.Icon]</value> <value condition="System.AddonIsEnabled(resource.images.studios.white)">$INFO[ListItem.Label,resource://resource.images.studios.white/,.png]</value> <value>DefaultStudios.png</value> </variable> + <variable name="WidgetPlaylistIconVar"> + <value condition="String.IsEqual(ListItem.Property(node.type),target_folder)">$INFO[ListItem.Icon]</value> + <value>DefaultPlaylist.png</value> + </variable> <variable name="AddonsLabel2Var"> <value condition="ListItem.Property(addon.downloading)">$INFO[ListItem.Property(addon.status)]</value> <value condition="!Container.SortMethod(1)">$INFO[ListItem.Label2]</value> @@ -190,6 +196,7 @@ <value>$LOCALIZE[37015]</value> </variable> <variable name="AlbumOnClickActionVar"> + <value condition="String.IsEqual(ListItem.Property(node.type),target_folder)">ActivateWindow(music,$INFO[ListItem.FilenameAndPath],return)</value> <value condition="Skin.HasSetting(album_onclick_browse)">ActivateWindow(music,musicdb://albums/$INFO[ListItem.DBID]/,return)</value> <value condition="Skin.HasSetting(album_onclick_play)">PlayMedia(musicdb://albums/$INFO[ListItem.DBID]/)</value> <value condition="Skin.HasSetting(album_onclick_playnext)">QueueMedia(musicdb://albums/$INFO[ListItem.DBID]/,playnext)</value> @@ -205,6 +212,7 @@ <value>$LOCALIZE[37015]</value> </variable> <variable name="TVShowOnClickActionVar"> + <value condition="String.IsEqual(ListItem.Property(node.type),target_folder)">ActivateWindow(videos,$INFO[ListItem.FilenameAndPath],return)</value> <value condition="Skin.HasSetting(tvshow_onclick_browse)">ActivateWindow(videos,videodb://tvshows/titles/$INFO[ListItem.DBID]/,return)</value> <value condition="Skin.HasSetting(tvshow_onclick_continuewatching)">PlayMedia(videodb://tvshows/titles/$INFO[ListItem.DBID]/,resume)</value> <value condition="Skin.HasSetting(tvshow_onclick_playfrombeginning)">PlayMedia(videodb://tvshows/titles/$INFO[ListItem.DBID]/,noresume)</value> @@ -221,6 +229,7 @@ <value>$LOCALIZE[37015]</value> </variable> <variable name="MovieSetOnClickActionVar"> + <value condition="String.IsEqual(ListItem.Property(node.type),target_folder)">ActivateWindow(videos,$INFO[ListItem.FilenameAndPath],return)</value> <value condition="Skin.HasSetting(movieset_onclick_browse)">ActivateWindow(videos,videodb://movies/sets/$INFO[ListItem.DBID]/,return)</value> <value condition="Skin.HasSetting(movieset_onclick_continuewatching)">PlayMedia(videodb://movies/sets/$INFO[ListItem.DBID]/,resume)</value> <value condition="Skin.HasSetting(movieset_onclick_playfrombeginning)">PlayMedia(videodb://movies/sets/$INFO[ListItem.DBID]/,noresume)</value> diff --git a/xbmc/listproviders/DirectoryProvider.cpp b/xbmc/listproviders/DirectoryProvider.cpp index 0d9872e823..76135d4ac7 100644 --- a/xbmc/listproviders/DirectoryProvider.cpp +++ b/xbmc/listproviders/DirectoryProvider.cpp @@ -18,6 +18,7 @@ #include "filesystem/Directory.h" #include "guilib/GUIComponent.h" #include "guilib/GUIWindowManager.h" +#include "guilib/LocalizeStrings.h" #include "interfaces/AnnouncementManager.h" #include "music/MusicThumbLoader.h" #include "music/dialogs/GUIDialogMusicInfo.h" @@ -50,11 +51,12 @@ using namespace PVR; class CDirectoryJob : public CJob { public: - CDirectoryJob(const std::string &url, SortDescription sort, int limit, int parentID) - : m_url(url), - m_sort(sort), - m_limit(limit), - m_parentID(parentID) + CDirectoryJob(const std::string& url, + const std::string& target, + SortDescription sort, + int limit, + int parentID) + : m_url(url), m_target(target), m_sort(sort), m_limit(limit), m_parentID(parentID) { } ~CDirectoryJob() override = default; @@ -80,9 +82,12 @@ public: items.Sort(m_sort); // limit must not exceed the number of items - int limit = (m_limit == 0) ? items.Size() : std::min((int) m_limit, items.Size()); + int limit = (m_limit == 0) ? items.Size() : std::min(static_cast<int>(m_limit), items.Size()); + if (limit < items.Size()) + m_items.reserve(limit + 1); + else + m_items.reserve(limit); // convert to CGUIStaticItem's and set visibility and targets - m_items.reserve(limit); for (int i = 0; i < limit; i++) { CGUIStaticItemPtr item(new CGUIStaticItem(*items[i])); @@ -93,7 +98,27 @@ public: m_items.push_back(item); } - m_target = items.GetProperty("node.target").asString(); + + if (items.HasProperty("node.target")) + m_target = items.GetProperty("node.target").asString(); + + if (limit < items.Size()) + { + // Add a special item to the end of the limited list, which can be used to open the + // full listing containg all items in the given target window. + if (!m_target.empty()) + { + CFileItem item(m_url, true); + item.SetLabel(g_localizeStrings.Get(22082)); // More... + item.SetArt("icon", "DefaultFolder.png"); + item.SetProperty("node.target", m_target); + item.SetProperty("node.type", "target_folder"); // make item identifyable, e.g. by skins + + m_items.emplace_back(std::make_shared<CGUIStaticItem>(item)); + } + else + CLog::LogF(LOGWARNING, "Cannot add 'More...' item to list. No target window given."); + } } return true; } @@ -231,7 +256,9 @@ bool CDirectoryProvider::Update(bool forceRefresh) if (m_jobID) CServiceBroker::GetJobManager()->CancelJob(m_jobID); m_jobID = CServiceBroker::GetJobManager()->AddJob( - new CDirectoryJob(m_currentUrl, m_currentSort, m_currentLimit, m_parentID), this); + new CDirectoryJob(m_currentUrl, m_target.GetLabel(m_parentID, false), m_currentSort, + m_currentLimit, m_parentID), + this); } if (!changed) diff --git a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp index 6b6e87776b..6e97a504b7 100644 --- a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp @@ -161,7 +161,17 @@ bool CGUIWindowPVRChannelsBase::OnMessage(CGUIMessage& message) { // if a path to a channel group is given we must init // that group instead of last played/selected group - m_channelGroupPath = message.GetStringParam(0); + if (path.GetGroupName() == "*") // all channels + { + // Replace wildcard with real group name + const auto group = + CServiceBroker::GetPVRManager().ChannelGroups()->GetGroupAll(path.IsRadio()); + m_channelGroupPath = group->GetPath(); + } + else + { + m_channelGroupPath = message.GetStringParam(0); + } } break; } |