diff options
37 files changed, 815 insertions, 307 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index be67081a3a..e07666cb44 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -464,7 +464,8 @@ msgctxt "#117" msgid "Delete" msgstr "" -#: xbmc/dialogs/GUIDialogFavourites.cpp +#: xbmc/favourites/ContextMenus.h +#: xbmc/favourites/GUIDialogFavourites.cpp #: xbmc/pvr/PVRContextMenus.cpp #: xbmc/windows/GUIWindowFileManager.cpp #: xbmc/games/dialogs/osd/DialogGameSaves.cpp @@ -4049,7 +4050,7 @@ msgctxt "#1029" msgid "Enter the new label" msgstr "" -#: xbmc/dialogs/GUIDialogFavourites.cpp +#: xbmc/favourites/GUIWindowFavourites.cpp #: xbmc/music/dialogs/GUIDialogMusicInfo.cpp msgctxt "#1030" msgid "Browse for image" @@ -4076,6 +4077,8 @@ msgctxt "#1035" msgid "Enable submenu buttons" msgstr "" +#: xbmc/addons/Skin.cpp +#: addons/skin.estuary/xml/MyFavourites.xml msgctxt "#1036" msgid "Favourites" msgstr "" @@ -5152,7 +5155,14 @@ msgctxt "#10058" msgid "Remove tag from library" msgstr "" -#empty strings from id 10059 to 10098 +#empty string with id 10059 + +#: xbmc/guilib/WindowIDs.h +msgctxt "#10060" +msgid "Favourites" +msgstr "" + +#empty strings from id 10061 to 10098 #: xbmc/guilib/WindowIDs.h msgctxt "#10099" @@ -6850,12 +6860,14 @@ msgctxt "#13331" msgid "Error: Out of memory" msgstr "" -#: xbmc/dialogs/GUIDialogFavourites.cpp +#: xbmc/favourites/ContextMenus.h +#: xbmc/favourites/GUIDialogFavourites.cpp msgctxt "#13332" msgid "Move up" msgstr "" -#: xbmc/dialogs/GUIDialogFavourites.cpp +#: xbmc/favourites/ContextMenus.h +#: xbmc/favourites/GUIDialogFavourites.cpp msgctxt "#13333" msgid "Move down" msgstr "" @@ -8594,7 +8606,8 @@ msgctxt "#15014" msgid "Keep" msgstr "" -#: xbmc/dialogs/GUIDialogFavourites.cpp +#: xbmc/favourites/ContextMenus.h +#: xbmc/favourites/GUIDialogFavourites.cpp #: xbmc/video/VideoDatabase.cpp msgctxt "#15015" msgid "Remove" @@ -8745,7 +8758,62 @@ msgctxt "#15216" msgid "Play in party mode" msgstr "" -#empty strings from id 15217 to 15299 +#. Label for actions associated with favourites +#: addons/skin.estuary/xml/Variables.xml +msgctxt "#15217" +msgid "Action" +msgstr "" + +#. Label for an action associated with a favourite. +#: xbmc/Util.cpp +msgctxt "#15218" +msgid "Play media" +msgstr "" + +#. Label for an action associated with a favourite +#: xbmc/Util.cpp +msgctxt "#15219" +msgid "Show picture" +msgstr "" + +#. Label for an action associated with a favourite. Placeholder will be filled with the name of the window the favourite's content will be displayed in. +#: xbmc/favourites/FavouritesService.cpp +#: xbmc/Util.cpp +msgctxt "#15220" +msgid "Show content in \"{}\"" +msgstr "" + +#. Label for an action associated with a favourite +#: xbmc/Util.cpp +msgctxt "#15221" +msgid "Execute script" +msgstr "" + +#. Label for an action associated with a favourite +#: xbmc/Util.cpp +msgctxt "#15222" +msgid "Execute Android app" +msgstr "" + +#. Label for an action associated with a favourite +#: xbmc/Util.cpp +msgctxt "#15223" +msgid "Execute add-on" +msgstr "" + +#. Label for an action associated with a favourite +#: xbmc/Util.cpp +msgctxt "#15224" +msgid "Other / Unknown" +msgstr "" + +#. genric label for 'provider' +#: addons/skin.estuary/xml/Variables.xml +msgctxt "#15225" +msgid "Provider" +msgstr "" + +#empty strings from id 15225 to 15299 #: xbmc/windows/GUIMediaWindow.cpp #: xbmc/windows/GUIWindowFileManager.cpp @@ -8826,7 +8894,7 @@ msgstr "" #empty strings from id 16005 to 16007 -#: xbmc/dialogs/GUIDialogFavourites.cpp +#: xbmc/favourites/GUIWindowFavourites.cpp msgctxt "#16008" msgid "Enter new title" msgstr "" @@ -11462,7 +11530,13 @@ msgctxt "#19348" msgid "Provider" msgstr "" -#empty strings from id 19349 to 19498 +#. label for 'by user preference' sort method +#: xbmc/utils/SortUtils.cpp +msgctxt "#19349" +msgid "User preference" +msgstr "" + +#empty strings from id 19350 to 19498 #. label for epg genre value #: xbmc/pvr/epg/Epg.cpp @@ -12171,6 +12245,7 @@ msgid "Remote thumb" msgstr "" #: xbmc/dialogs/GUIDialogContextMenu.cpp +#: xbmc/favourites/GUIWindowFavourites.cpp #: xbmc/music/dialogs/GUIDialogMusicInfo.cpp msgctxt "#20016" msgid "Current thumb" @@ -12184,13 +12259,15 @@ msgid "Local thumb" msgstr "" #: xbmc/dialogs/GUIDialogContextMenu.cpp +#: xbmc/favourites/GUIWindowFavourites.cpp #: xbmc/music/dialogs/GUIDialogMusicInfo.cpp msgctxt "#20018" msgid "No thumb" msgstr "" #: xbmc/dialogs/GUIDialogContextMenu.cpp -#: xbmc/dialogs/GUIDialogFavourites.cpp +#: xbmc/favourites/ContextMenus.h +#: xbmc/favourites/GUIDialogFavourites.cpp msgctxt "#20019" msgid "Choose thumbnail" msgstr "" diff --git a/addons/skin.estuary/xml/Home.xml b/addons/skin.estuary/xml/Home.xml index 9db8d89902..17e6567d01 100644 --- a/addons/skin.estuary/xml/Home.xml +++ b/addons/skin.estuary/xml/Home.xml @@ -998,7 +998,7 @@ </item> <item> <label>$LOCALIZE[10134]</label> - <onclick>ActivateWindow(favourites)</onclick> + <onclick>ActivateWindow(favouritesbrowser)</onclick> <property name="menu_id">$NUMBER[14000]</property> <thumb>icons/sidemenu/favourites.png</thumb> <property name="id">favorites</property> diff --git a/addons/skin.estuary/xml/MyFavourites.xml b/addons/skin.estuary/xml/MyFavourites.xml new file mode 100644 index 0000000000..968d23c9e0 --- /dev/null +++ b/addons/skin.estuary/xml/MyFavourites.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<window> + <defaultcontrol always="true">500</defaultcontrol> + <backgroundcolor>background</backgroundcolor> + <views>50,52,53,55,500</views> + <menucontrol>9000</menucontrol> + <controls> + <include>DefaultBackground</include> + <control type="group"> + <animation effect="fade" start="100" end="0" time="200" tween="sine" condition="$EXP[infodialog_active]">Conditional</animation> + <include>View_50_List</include> + <include>View_52_IconWall</include> + <include>View_53_Shift</include> + <include>View_55_WideList</include> + <include>View_500_Wall</include> + <control type="group"> + <depth>DepthContentPanel</depth> + <include>OpenClose_Left</include> + <include>Visible_Left</include> + <visible>Control.IsVisible(55)</visible> + <include>ListThumbInfoPanel</include> + </control> + <include content="TopBar"> + <param name="breadcrumbs_label" value="$LOCALIZE[1036]" /> + </include> + <include content="BottomBar"> + <param name="info_visible" value="true" /> + </include> + <include>CommonScrollbars</include> + <include>MediaMenuMouseOverlay</include> + <control type="group"> + <include>MediaMenuCommon</include> + <control type="grouplist" id="9000"> + <top>50</top> + <include>MediaMenuListCommon</include> + <include>MediaMenuNowPlaying</include> + </control> + </control> + </control> + </controls> +</window> diff --git a/addons/skin.estuary/xml/Variables.xml b/addons/skin.estuary/xml/Variables.xml index 94200b646d..73a29b64c0 100644 --- a/addons/skin.estuary/xml/Variables.xml +++ b/addons/skin.estuary/xml/Variables.xml @@ -51,6 +51,7 @@ <value condition="String.IsEqual(ListItem.DbType,episode) + System.Setting(hideunwatchedepisodethumbs) + Integer.IsEqual(ListItem.Playcount,0) + !String.IsEmpty(Listitem.Art(fanart))">$INFO[Listitem.Art(fanart)]</value> <value condition="String.IsEqual(ListItem.DbType,episode) + System.Setting(hideunwatchedepisodethumbs) + Integer.IsEqual(ListItem.Playcount,0) + String.IsEmpty(Listitem.Art(fanart))">OverlaySpoiler.png</value> <value condition="String.IsEqual(ListItem.DbType,episode) + [ !System.Setting(hideunwatchedepisodethumbs) | Integer.IsGreater(ListItem.Playcount,0) ]">$INFO[Listitem.Art(thumb)]</value> + <value condition="Container.Content(favourites) + String.IsEmpty(Listitem.Art(thumb))">DefaultFavourites.png</value> <value>$INFO[ListItem.Art(thumb)]</value> </variable> <variable name="MusicInfoThumbVar"> @@ -100,6 +101,7 @@ <value condition="String.IsEqual(listitem.dbtype,artist)">$INFO[ListItem.Genre,[COLOR button_focus]$LOCALIZE[515]: [/COLOR],[CR]]$INFO[ListItem.Property(Artist_YearsActive),[COLOR button_focus]$LOCALIZE[21898]: [/COLOR],[CR]]$INFO[ListItem.Property(Artist_Style),[COLOR button_focus]$LOCALIZE[736]: [/COLOR],[CR]]</value> <value condition="String.IsEqual(listitem.dbtype,album)">$INFO[ListItem.Year,[COLOR button_focus]$LOCALIZE[345]: [/COLOR],[CR]]$INFO[ListItem.Genre,[COLOR button_focus]$LOCALIZE[515]: [/COLOR],[CR]]$INFO[ListItem.Property(album_label),[COLOR button_focus]$LOCALIZE[21899]: [/COLOR],[CR]]$INFO[ListItem.Property(album_style),[COLOR button_focus]$LOCALIZE[736]: [/COLOR],[CR]]</value> <value condition="String.IsEqual(Listitem.DBType,season) | String.IsEqual(Listitem.DBType,tvshow)">$INFO[ListItem.Genre,[COLOR button_focus]$LOCALIZE[515]: [/COLOR],[CR]]$INFO[ListItem.Premiered,[COLOR button_focus]$LOCALIZE[20416]: [/COLOR]]</value> + <value condition="Container.Content(favourites)">$INFO[ListItem.Property(favourite.action),[COLOR button_focus]$LOCALIZE[15217]: [/COLOR],[CR]]$INFO[ListItem.Property(favourite.provider),[COLOR button_focus]$LOCALIZE[15225]: [/COLOR],[CR]]</value> <value>$INFO[ListItem.Genre,[COLOR button_focus]$LOCALIZE[515]: [/COLOR],[CR]]$INFO[ListItem.Director,[COLOR button_focus]$LOCALIZE[20339]: [/COLOR],[CR]]$INFO[ListItem.Writer,[COLOR button_focus]$LOCALIZE[20417]: [/COLOR],[CR]]$INFO[ListItem.Premiered,[COLOR button_focus]$LOCALIZE[20416]: [/COLOR]]</value> </variable> <variable name="ShiftRightTextBoxVar"> @@ -137,6 +139,7 @@ <value condition="!String.IsEmpty(ListItem.Plot)">$INFO[ListItem.Plot]</value> <value condition="String.IsEqual(ListItem.DBType,song) + !Window.IsActive(musicplaylist)">$VAR[MusicTrackInfo,[COLOR button_focus]$LOCALIZE[554]: [/COLOR],[CR]]$INFO[ListItem.Artist,[COLOR button_focus]$LOCALIZE[557]: [/COLOR],[CR]]$INFO[listitem.Album,[COLOR button_focus]$LOCALIZE[558]: [/COLOR],[CR]]$VAR[InfoDiscVar,[COLOR button_focus]$LOCALIZE[427]: [/COLOR],[CR]]$INFO[ListItem.Year,[COLOR button_focus]$LOCALIZE[345]: [/COLOR],[CR]]$INFO[ListItem.Genre,[COLOR button_focus]$LOCALIZE[515]: [/COLOR],[CR]]$INFO[ListItem.Duration,[COLOR button_focus]$LOCALIZE[180]: [/COLOR],[CR]]$INFO[ListItem.Playcount,[COLOR button_focus]$LOCALIZE[567]: [/COLOR],[CR]]$INFO[ListItem.LastPlayed,[COLOR button_focus]$LOCALIZE[568]: [/COLOR],]</value> <value condition="String.IsEqual(ListItem.DBType,song) + Window.IsActive(musicplaylist)">[COLOR button_focus][B]$LOCALIZE[31037]: [/COLOR]$INFO[Container.CurrentItem,,/]$INFO[Container.NumItems][/B][CR]$VAR[MusicTrackInfo,[COLOR button_focus]$LOCALIZE[554]: [/COLOR],[CR]]$INFO[ListItem.Artist,[COLOR button_focus]$LOCALIZE[557]: [/COLOR],[CR]]$INFO[listitem.Album,[COLOR button_focus]$LOCALIZE[558]: [/COLOR],[CR]]$VAR[InfoDiscVar,[COLOR button_focus]$LOCALIZE[427]: [/COLOR],[CR]]$INFO[ListItem.Year,[COLOR button_focus]$LOCALIZE[345]: [/COLOR],[CR]]$INFO[ListItem.Genre,[COLOR button_focus]$LOCALIZE[515]: [/COLOR],[CR]]$INFO[ListItem.Duration,[COLOR button_focus]$LOCALIZE[180]: [/COLOR],[CR]]$INFO[ListItem.Playcount,[COLOR button_focus]$LOCALIZE[567]: [/COLOR]]</value> + <value condition="Container.Content(favourites)">$INFO[ListItem.Property(favourite.action),[COLOR button_focus]$LOCALIZE[15217]: [/COLOR],[CR]]$INFO[ListItem.Property(favourite.provider),[COLOR button_focus]$LOCALIZE[15225]: [/COLOR],[CR]]</value> <value>$INFO[ListItem.Genre,[COLOR button_focus]$LOCALIZE[515]: [/COLOR],[CR]]</value> </variable> <variable name="NowPlayingInfoVar"> diff --git a/addons/skin.estuary/xml/View_500_Wall.xml b/addons/skin.estuary/xml/View_500_Wall.xml index 31a49dd2ee..ee2ba50a08 100644 --- a/addons/skin.estuary/xml/View_500_Wall.xml +++ b/addons/skin.estuary/xml/View_500_Wall.xml @@ -21,7 +21,7 @@ <preloaditems>2</preloaditems> <pagecontrol>531</pagecontrol> <scrolltime tween="cubic" easing="out">500</scrolltime> - <visible>Container.Content(movies) | Container.Content(sets) | Container.Content(tvshows) | Container.Content(seasons) | Container.Content(episodes) | Container.Content(artists) | Container.Content(albums) | Container.Content(musicvideos) | Container.Content(addons) | Container.Content(images) | Container.Content(videos) | Container.Content(games)</visible> + <visible>Container.Content(movies) | Container.Content(sets) | Container.Content(tvshows) | Container.Content(seasons) | Container.Content(episodes) | Container.Content(artists) | Container.Content(albums) | Container.Content(musicvideos) | Container.Content(addons) | Container.Content(images) | Container.Content(videos) | Container.Content(games) | Container.Content(favourites)</visible> <itemlayout height="445" width="300" condition="Container.Content(movies) | Container.Content(sets) | Container.Content(tvshows) | Container.Content(seasons) | [Container.Content(musicvideos) + Skin.HasSetting(show_musicvideoposter)]"> <control type="group"> <top>120</top> @@ -111,14 +111,34 @@ <control type="group"> <depth>DepthContentPopout</depth> <top>150</top> - <animation effect="zoom" start="100" end="110" time="200" tween="sine" easing="inout" center="150,350">Focus</animation> - <animation effect="zoom" start="110" end="100" time="200" tween="sine" easing="inout" center="150,350">UnFocus</animation> + <animation effect="zoom" start="100" end="110" time="200" tween="sine" easing="inout" center="160,350">Focus</animation> + <animation effect="zoom" start="110" end="100" time="200" tween="sine" easing="inout" center="160,350">UnFocus</animation> <include content="InfoWallMusicLayout"> <param name="fallback_image" value="DefaultAddon.png" /> <param name="focused" value="true" /> </include> </control> </focusedlayout> + <itemlayout height="401" width="300" condition="Container.Content(favourites)"> + <control type="group"> + <top>150</top> + <include content="InfoWallMusicLayout"> + <param name="fallback_image" value="DefaultFavourites.png" /> + </include> + </control> + </itemlayout> + <focusedlayout height="401" width="300" condition="Container.Content(favourites)"> + <control type="group"> + <depth>DepthContentPopout</depth> + <top>150</top> + <animation effect="zoom" start="100" end="110" time="200" tween="sine" easing="inout" center="160,350">Focus</animation> + <animation effect="zoom" start="110" end="100" time="200" tween="sine" easing="inout" center="160,350">UnFocus</animation> + <include content="InfoWallMusicLayout"> + <param name="fallback_image" value="DefaultFavourites.png" /> + <param name="focused" value="true" /> + </include> + </control> + </focusedlayout> </control> </control> </include> diff --git a/addons/skin.estuary/xml/View_52_IconWall.xml b/addons/skin.estuary/xml/View_52_IconWall.xml index bdfc95b804..cf06cfde87 100644 --- a/addons/skin.estuary/xml/View_52_IconWall.xml +++ b/addons/skin.estuary/xml/View_52_IconWall.xml @@ -17,7 +17,7 @@ <onup>52</onup> <ondown>52</ondown> <scrolltime tween="cubic" easing="out">500</scrolltime> - <visible>Container.Content() | Container.Content(files) | Container.Content(tags) | Container.Content(years) | Container.Content(roles) | Container.Content(sources) | Container.Content(genres) | Container.Content(countries) | Container.Content(studios) | Container.Content(playlists) | Container.Content(unknown)</visible> + <visible>Container.Content() | Container.Content(files) | Container.Content(tags) | Container.Content(years) | Container.Content(roles) | Container.Content(sources) | Container.Content(genres) | Container.Content(countries) | Container.Content(studios) | Container.Content(playlists) | Container.Content(favourites) | Container.Content(unknown)</visible> <viewtype label="31099">icon</viewtype> <itemlayout height="280" width="440" condition="Container.Content() | Container.Content(files) | Container.Content(tags) | Container.Content(playlists) | [Container.Content(studios) + System.AddonIsEnabled(resource.images.studios.white)]"> <control type="group"> diff --git a/addons/skin.estuary/xml/View_53_Shift.xml b/addons/skin.estuary/xml/View_53_Shift.xml index d554158349..b9bf6e0007 100644 --- a/addons/skin.estuary/xml/View_53_Shift.xml +++ b/addons/skin.estuary/xml/View_53_Shift.xml @@ -54,7 +54,7 @@ <pagecontrol>5199</pagecontrol> <scrolltime tween="cubic" easing="out">500</scrolltime> <orientation>horizontal</orientation> - <visible>Container.Content(movies) | Container.Content(sets) | Container.Content(tvshows) | Container.Content(seasons) | Container.Content(musicvideos) | Container.Content(artists) | Container.Content(albums) | Container.Content(mixed) | Container.Content(images) | Container.Content(videos) | Container.Content(games)</visible> + <visible>Container.Content(movies) | Container.Content(sets) | Container.Content(tvshows) | Container.Content(seasons) | Container.Content(musicvideos) | Container.Content(artists) | Container.Content(albums) | Container.Content(mixed) | Container.Content(images) | Container.Content(videos) | Container.Content(games) | Container.Content(favourites)</visible> <onleft>53</onleft> <onup>9000</onup> <ondown>5199</ondown> diff --git a/addons/skin.estuary/xml/View_55_WideList.xml b/addons/skin.estuary/xml/View_55_WideList.xml index ff28da0995..eadc18a8a3 100644 --- a/addons/skin.estuary/xml/View_55_WideList.xml +++ b/addons/skin.estuary/xml/View_55_WideList.xml @@ -86,7 +86,7 @@ <shadowcolor>text_shadow</shadowcolor> </control> </itemlayout> - <focusedlayout height="list_item_height" condition="!Container.Content(songs) + !Container.Content(addons) + !Container.Content(playlists) + !Container.Content() + !Container.Content(tvshows) + !Container.Content(seasons) + !Container.Content(episodes) + !Container.Content(movies) + !Container.Content(musicvideos) + !Container.Content(videos)"> + <focusedlayout height="list_item_height" condition="!Container.Content(songs) + !Container.Content(addons) + !Container.Content(playlists) + !Container.Content() + !Container.Content(tvshows) + !Container.Content(seasons) + !Container.Content(episodes) + !Container.Content(movies) + !Container.Content(musicvideos) + !Container.Content(videos)+ !Container.Content(favourites)"> <control type="image"> <left>0</left> <right>0</right> @@ -122,7 +122,7 @@ <shadowcolor>text_shadow</shadowcolor> </control> </focusedlayout> - <itemlayout height="list_item_height" condition="!Container.Content(songs) + !Container.Content(addons) + !Container.Content(playlists) + !Container.Content() + !Container.Content(tvshows) + !Container.Content(seasons) + !Container.Content(episodes) + !Container.Content(movies) + !Container.Content(musicvideos) + !Container.Content(videos)"> + <itemlayout height="list_item_height" condition="!Container.Content(songs) + !Container.Content(addons) + !Container.Content(playlists) + !Container.Content() + !Container.Content(tvshows) + !Container.Content(seasons) + !Container.Content(episodes) + !Container.Content(movies) + !Container.Content(musicvideos) + !Container.Content(videos) + !Container.Content(favourites)"> <control type="image"> <left>35</left> <centertop>50%</centertop> @@ -150,7 +150,7 @@ <shadowcolor>text_shadow</shadowcolor> </control> </itemlayout> - <focusedlayout height="list_item_height" condition="Container.Content(playlists) | Container.Content()"> + <focusedlayout height="list_item_height" condition="Container.Content(playlists) | Container.Content(favourites) | Container.Content()"> <control type="image"> <left>0</left> <right>0</right> @@ -177,7 +177,7 @@ <shadowcolor>text_shadow</shadowcolor> </control> </focusedlayout> - <itemlayout height="list_item_height" condition="Container.Content(playlists) | Container.Content()"> + <itemlayout height="list_item_height" condition="Container.Content(playlists) | Container.Content(favourites) | Container.Content()"> <control type="image"> <left>20</left> <top>10</top> diff --git a/xbmc/ContextMenuManager.cpp b/xbmc/ContextMenuManager.cpp index 5a5cf37e67..00229b125f 100644 --- a/xbmc/ContextMenuManager.cpp +++ b/xbmc/ContextMenuManager.cpp @@ -80,9 +80,11 @@ void CContextMenuManager::Init() std::make_shared<CONTEXTMENU::CRemoveResumePoint>(), std::make_shared<CONTEXTMENU::CEjectDisk>(), std::make_shared<CONTEXTMENU::CEjectDrive>(), - std::make_shared<CONTEXTMENU::CRemoveFavourite>(), - std::make_shared<CONTEXTMENU::CRenameFavourite>(), + std::make_shared<CONTEXTMENU::CMoveUpFavourite>(), + std::make_shared<CONTEXTMENU::CMoveDownFavourite>(), std::make_shared<CONTEXTMENU::CChooseThumbnailForFavourite>(), + std::make_shared<CONTEXTMENU::CRenameFavourite>(), + std::make_shared<CONTEXTMENU::CRemoveFavourite>(), std::make_shared<CONTEXTMENU::CAddRemoveFavourite>(), }; diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp index 7d2eea9ed5..098916ff9d 100644 --- a/xbmc/FileItem.cpp +++ b/xbmc/FileItem.cpp @@ -810,6 +810,12 @@ void CFileItem::ToSortable(SortItem &sortable, Field field) const if (m_eventLogEntry) m_eventLogEntry->ToSortable(sortable, field); + + if (IsFavourite()) + { + if (field == FieldUserPreference) + sortable[FieldUserPreference] = GetProperty("favourite.index").asString(); + } } void CFileItem::ToSortable(SortItem &sortable, const Fields &fields) const @@ -1249,6 +1255,11 @@ bool CFileItem::IsStack() const return URIUtils::IsStack(m_strPath); } +bool CFileItem::IsFavourite() const +{ + return URIUtils::IsFavourite(m_strPath); +} + bool CFileItem::IsPlugin() const { return URIUtils::IsPlugin(m_strPath); @@ -1469,6 +1480,10 @@ void CFileItem::FillInDefaultIcon() { SetArt("icon", "DefaultScript.png"); } + else if (IsFavourite()) + { + SetArt("icon", "DefaultFavourites.png"); + } else { // default icon for unknown file type diff --git a/xbmc/FileItem.h b/xbmc/FileItem.h index aad0483495..ab97252f3c 100644 --- a/xbmc/FileItem.h +++ b/xbmc/FileItem.h @@ -234,6 +234,7 @@ public: bool IsSmb() const; bool IsURL() const; bool IsStack() const; + bool IsFavourite() const; bool IsMultiPath() const; bool IsMusicDb() const; bool IsVideoDb() const; diff --git a/xbmc/SortFileItem.h b/xbmc/SortFileItem.h index 1eb31723bf..a5c29a5f63 100644 --- a/xbmc/SortFileItem.h +++ b/xbmc/SortFileItem.h @@ -62,5 +62,6 @@ typedef enum SORT_METHOD_VIDEO_ORIGINAL_TITLE, SORT_METHOD_VIDEO_ORIGINAL_TITLE_IGNORE_THE, SORT_METHOD_PROVIDER, + SORT_METHOD_USER_PREFERENCE, SORT_METHOD_MAX } SORT_METHOD; diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp index 27e5ca4b14..8ee176ebc6 100644 --- a/xbmc/Util.cpp +++ b/xbmc/Util.cpp @@ -29,19 +29,20 @@ #include "platform/android/activity/XBMCApp.h" #include "CompileInfo.h" #endif -#include <stdlib.h> -#include <algorithm> -#include <array> - -#include "addons/VFSEntry.h" #include "ServiceBroker.h" #include "Util.h" -#include "filesystem/PVRDirectory.h" +#include "addons/AddonManager.h" +#include "addons/VFSEntry.h" #include "filesystem/Directory.h" -#include "filesystem/StackDirectory.h" #include "filesystem/MultiPathDirectory.h" -#include "filesystem/SpecialProtocol.h" +#include "filesystem/PVRDirectory.h" #include "filesystem/RSSDirectory.h" +#include "filesystem/SpecialProtocol.h" +#include "filesystem/StackDirectory.h" + +#include <algorithm> +#include <array> +#include <stdlib.h> #ifdef HAS_UPNP #include "filesystem/UPnPDirectory.h" #endif @@ -63,6 +64,7 @@ #include "cores/VideoPlayer/DVDSubtitles/DVDSubtitleTagSami.h" #include "filesystem/File.h" #include "guilib/LocalizeStrings.h" +#include "music/tags/MusicInfoTag.h" #include "platform/Environment.h" #include "settings/AdvancedSettings.h" #include "settings/MediaSettings.h" @@ -73,6 +75,7 @@ #include "utils/FontUtils.h" #include "utils/LangCodeExpander.h" #include "utils/StringUtils.h" +#include "utils/SystemInfo.h" #include "utils/TimeUtils.h" #include "utils/URIUtils.h" #include "utils/log.h" @@ -1024,6 +1027,160 @@ void CUtil::SplitExecFunction(const std::string &execString, std::string &functi SplitParams(paramString, parameters); } +std::string CUtil::GetExecPath(const CFileItem& item, const std::string& contextWindow) +{ + // Note: If changing this function, also check whether CUtil::GetExecActionLabelFromPath + // and CUtil::GetExecProviderLabelFromPath must be adjusted as well. + + std::string execute; + if (URIUtils::IsProtocol(item.GetPath(), "favourites")) + { + const CURL url(item.GetPath()); + execute = CURL::Decode(url.GetHostName()); + } + else if (item.m_bIsFolder && + (CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_playlistAsFolders || + !(item.IsSmartPlayList() || item.IsPlayList()))) + { + if (!contextWindow.empty()) + execute = StringUtils::Format("ActivateWindow({},{},return)", contextWindow, + StringUtils::Paramify(item.GetPath())); + } + //! @todo STRING_CLEANUP + else if (item.IsScript() && item.GetPath().size() > 9) // script://<foo> + execute = StringUtils::Format("RunScript({})", StringUtils::Paramify(item.GetPath().substr(9))); + else if (item.IsAddonsPath() && item.GetPath().size() > 9) // addons://<foo> + { + CURL url(item.GetPath()); + if (url.GetHostName() == "install") + execute = "InstallFromZip"; + else + execute = StringUtils::Format("RunAddon({})", url.GetFileName()); + } + else if (item.IsAndroidApp() && item.GetPath().size() > 26) // androidapp://sources/apps/<foo> + execute = StringUtils::Format("StartAndroidActivity({})", + StringUtils::Paramify(item.GetPath().substr(26))); + else // assume a media file + { + if (item.IsVideoDb() && item.HasVideoInfoTag()) + { + std::string paramPlaylistTypeHint; + if (item.HasProperty("playlist_type_hint")) + { + paramPlaylistTypeHint = + ",playlist_type_hint=" + item.GetProperty("playlist_type_hint").asString(); + } + execute = StringUtils::Format( + "PlayMedia({}{})", StringUtils::Paramify(item.GetVideoInfoTag()->m_strFileNameAndPath), + paramPlaylistTypeHint); + } + else if (item.IsMusicDb() && item.HasMusicInfoTag()) + { + std::string paramPlaylistTypeHint; + if (item.HasProperty("playlist_type_hint")) + { + paramPlaylistTypeHint = + ",playlist_type_hint=" + item.GetProperty("playlist_type_hint").asString(); + } + execute = StringUtils::Format("PlayMedia({}{})", + StringUtils::Paramify(item.GetMusicInfoTag()->GetURL()), + paramPlaylistTypeHint); + } + else if (item.IsPicture()) + execute = StringUtils::Format("ShowPicture({})", StringUtils::Paramify(item.GetPath())); + else + execute = StringUtils::Format("PlayMedia({})", StringUtils::Paramify(item.GetPath())); + } + return execute; +} + +std::string CUtil::GetExecActionLabelFromPath(const std::string& path) +{ + const CURL url(path); + const std::string execString = CURL::Decode(url.GetHostName()); + + std::string execute; + std::vector<std::string> params; + CUtil::SplitExecFunction(execString, execute, params); + StringUtils::ToLower(execute); + + if (execute == "playmedia") + return g_localizeStrings.Get(15218); + else if (execute == "showpicture") + return g_localizeStrings.Get(15219); + else if (execute == "activatewindow") + { + int windowID = -1; + if (!params.empty() && StringUtils::IsInteger(params.front())) + windowID = std::atoi(params.front().c_str()); + return StringUtils::Format(g_localizeStrings.Get(15220), g_localizeStrings.Get(windowID)); + } + else if (execute == "runscript") + return g_localizeStrings.Get(15221); + else if (execute == "startandroidactivity") + return g_localizeStrings.Get(15222); + else if (execute == "runaddon") + return g_localizeStrings.Get(15223); + else + return g_localizeStrings.Get(15224); // "Other / unknown" +} + +std::string CUtil::GetExecProviderLabelFromPath(const std::string& path) +{ + const CURL url(path); + const std::string execString = CURL::Decode(url.GetHostName()); + + std::string execute; + std::vector<std::string> params; + CUtil::SplitExecFunction(execString, execute, params); + StringUtils::ToLower(execute); + + std::string provider; + + if (!params.empty()) + { + std::string path; + if (execute == "activatewindow") + { + // path is in param #2 + path = params[1]; + } + else + { + // for all others path is in param #1 + path = params[0]; + } + + bool pathIsAddonID = false; + if (execute == "runscript" || execute == "runaddon") + { + // for scripts and addons, path contains the add-on ID, for the others + // the path contains a URL or a file system path. + pathIsAddonID = true; + } + + if (!path.empty()) + { + if (pathIsAddonID || URIUtils::IsPlugin(path)) + { + // get the add-on name + const std::string plugin = pathIsAddonID ? path : CURL(path).GetHostName(); + + ADDON::AddonPtr addon; + CServiceBroker::GetAddonMgr().GetAddon(plugin, addon, ADDON::ADDON_UNKNOWN, + ADDON::OnlyEnabled::CHOICE_NO); + if (addon) + provider = addon->Name(); + } + } + } + + if (provider.empty()) + provider = CSysInfo::GetAppName(); + + return provider; +} + void CUtil::SplitParams(const std::string ¶mString, std::vector<std::string> ¶meters) { bool inQuotes = false; diff --git a/xbmc/Util.h b/xbmc/Util.h index 07c238c58e..817ab5a7c7 100644 --- a/xbmc/Util.h +++ b/xbmc/Util.h @@ -22,6 +22,7 @@ #define LEGAL_WIN32_COMPAT 1 #define LEGAL_FATX 2 +class CFileItem; class CFileItemList; class CURL; @@ -130,6 +131,9 @@ public: */ static void SplitParams(const std::string ¶mString, std::vector<std::string> ¶meters); static void SplitExecFunction(const std::string &execString, std::string &function, std::vector<std::string> ¶meters); + static std::string GetExecPath(const CFileItem& item, const std::string& contextWindow); + static std::string GetExecActionLabelFromPath(const std::string& path); + static std::string GetExecProviderLabelFromPath(const std::string& path); static int GetMatchingSource(const std::string& strPath, VECSOURCES& VECSOURCES, bool& bIsSourceName); static std::string TranslateSpecialSource(const std::string &strSpecial); static void DeleteDirectoryCache(const std::string &prefix = ""); diff --git a/xbmc/addons/Skin.cpp b/xbmc/addons/Skin.cpp index 0f08553cb0..0e1300039e 100644 --- a/xbmc/addons/Skin.cpp +++ b/xbmc/addons/Skin.cpp @@ -333,6 +333,7 @@ bool CSkinInfo::LoadStartupWindows(const AddonInfoPtr& addonInfo) m_startupWindows.emplace_back(WINDOW_FILES, "7"); m_startupWindows.emplace_back(WINDOW_SETTINGS_MENU, "5"); m_startupWindows.emplace_back(WINDOW_WEATHER, "8"); + m_startupWindows.emplace_back(WINDOW_FAVOURITES, "1036"); return true; } diff --git a/xbmc/favourites/CMakeLists.txt b/xbmc/favourites/CMakeLists.txt index badaa05214..a1f0511924 100644 --- a/xbmc/favourites/CMakeLists.txt +++ b/xbmc/favourites/CMakeLists.txt @@ -1,9 +1,13 @@ set(SOURCES ContextMenus.cpp GUIDialogFavourites.cpp + GUIViewStateFavourites.cpp + GUIWindowFavourites.cpp FavouritesService.cpp) set(HEADERS ContextMenus.h GUIDialogFavourites.h + GUIViewStateFavourites.h + GUIWindowFavourites.h FavouritesService.h) core_add_library(favourites) diff --git a/xbmc/favourites/ContextMenus.cpp b/xbmc/favourites/ContextMenus.cpp index 26b80e0216..4a0c730d10 100644 --- a/xbmc/favourites/ContextMenus.cpp +++ b/xbmc/favourites/ContextMenus.cpp @@ -9,8 +9,9 @@ #include "ContextMenus.h" #include "FileItem.h" -#include "GUIDialogFavourites.h" #include "ServiceBroker.h" +#include "favourites/FavouritesService.h" +#include "favourites/GUIWindowFavourites.h" #include "utils/URIUtils.h" @@ -36,6 +37,30 @@ namespace CONTEXTMENU return false; } + bool CMoveUpFavourite::DoExecute(CFileItemList& items, + const std::shared_ptr<CFileItem>& item) const + { + return CGUIWindowFavourites::MoveItem(items, *item, -1); + } + + bool CMoveUpFavourite::IsVisible(const CFileItem& item) const + { + return CFavouriteContextMenuAction::IsVisible(item) && + CGUIWindowFavourites::ShouldEnableMoveItems(); + } + + bool CMoveDownFavourite::DoExecute(CFileItemList& items, + const std::shared_ptr<CFileItem>& item) const + { + return CGUIWindowFavourites::MoveItem(items, *item, +1); + } + + bool CMoveDownFavourite::IsVisible(const CFileItem& item) const + { + return CFavouriteContextMenuAction::IsVisible(item) && + CGUIWindowFavourites::ShouldEnableMoveItems(); + } + bool CRemoveFavourite::DoExecute(CFileItemList& items, const std::shared_ptr<CFileItem>& item) const { @@ -46,13 +71,13 @@ namespace CONTEXTMENU bool CRenameFavourite::DoExecute(CFileItemList&, const std::shared_ptr<CFileItem>& item) const { - return CGUIDialogFavourites::ChooseAndSetNewName(item); + return CGUIWindowFavourites::ChooseAndSetNewName(*item); } bool CChooseThumbnailForFavourite::DoExecute(CFileItemList&, const std::shared_ptr<CFileItem>& item) const { - return CGUIDialogFavourites::ChooseAndSetNewThumbnail(item); + return CGUIWindowFavourites::ChooseAndSetNewThumbnail(*item); } } // namespace CONTEXTMENU diff --git a/xbmc/favourites/ContextMenus.h b/xbmc/favourites/ContextMenus.h index 4345993b45..fe1edc8629 100644 --- a/xbmc/favourites/ContextMenus.h +++ b/xbmc/favourites/ContextMenus.h @@ -29,6 +29,26 @@ protected: virtual bool DoExecute(CFileItemList& items, const std::shared_ptr<CFileItem>& item) const = 0; }; +class CMoveUpFavourite : public CFavouriteContextMenuAction +{ +public: + CMoveUpFavourite() : CFavouriteContextMenuAction(13332) {} // Move up + bool IsVisible(const CFileItem& item) const override; + +protected: + bool DoExecute(CFileItemList& items, const std::shared_ptr<CFileItem>& item) const override; +}; + +class CMoveDownFavourite : public CFavouriteContextMenuAction +{ +public: + CMoveDownFavourite() : CFavouriteContextMenuAction(13333) {} // Move down + bool IsVisible(const CFileItem& item) const override; + +protected: + bool DoExecute(CFileItemList& items, const std::shared_ptr<CFileItem>& item) const override; +}; + class CRemoveFavourite : public CFavouriteContextMenuAction { public: diff --git a/xbmc/favourites/FavouritesService.cpp b/xbmc/favourites/FavouritesService.cpp index d3eac74edf..3c08e66278 100644 --- a/xbmc/favourites/FavouritesService.cpp +++ b/xbmc/favourites/FavouritesService.cpp @@ -14,16 +14,13 @@ #include "URL.h" #include "Util.h" #include "filesystem/File.h" -#include "music/tags/MusicInfoTag.h" #include "profiles/ProfileManager.h" -#include "settings/AdvancedSettings.h" #include "settings/SettingsComponent.h" #include "utils/ContentUtils.h" #include "utils/StringUtils.h" #include "utils/URIUtils.h" #include "utils/XBMCTinyXML.h" #include "utils/log.h" -#include "video/VideoInfoTag.h" #include <mutex> @@ -95,9 +92,8 @@ bool IsMediasourceOfFavItemUnlocked(const std::shared_ptr<CFileItem>& item) return true; } -} // anonymous namespace -static bool LoadFromFile(const std::string& strPath, CFileItemList& items) +bool LoadFromFile(const std::string& strPath, CFileItemList& items) { CXBMCTinyXML doc; if (!doc.LoadFile(strPath)) @@ -140,8 +136,9 @@ static bool LoadFromFile(const std::string& strPath, CFileItemList& items) } return true; } +} // unnamed namespace -CFavouritesService::CFavouritesService(std::string userDataFolder) +CFavouritesService::CFavouritesService(std::string userDataFolder) : m_favourites("favourites://") { ReInit(std::move(userDataFolder)); } @@ -150,16 +147,16 @@ void CFavouritesService::ReInit(std::string userDataFolder) { m_userDataFolder = std::move(userDataFolder); m_favourites.Clear(); + m_favourites.SetContent("favourites"); - CFileItemList items; std::string favourites = "special://xbmc/system/favourites.xml"; - if(XFILE::CFile::Exists(favourites)) + if (XFILE::CFile::Exists(favourites)) LoadFromFile(favourites, m_favourites); else CLog::Log(LOGDEBUG, "CFavourites::Load - no system favourites found, skipping"); favourites = URIUtils::AddFileToFolder(m_userDataFolder, "favourites.xml"); - if(XFILE::CFile::Exists(favourites)) + if (XFILE::CFile::Exists(favourites)) LoadFromFile(favourites, m_favourites); else CLog::Log(LOGDEBUG, "CFavourites::Load - no userdata favourites found, skipping"); @@ -211,7 +208,7 @@ std::string CFavouritesService::GetFavouritesUrl(const CFileItem& item, int cont { CURL url; url.SetProtocol("favourites"); - url.SetHostName(CURL::Encode(GetExecutePath(item, contextWindow))); + url.SetHostName(CURL::Encode(CUtil::GetExecPath(item, std::to_string(contextWindow)))); return url.Get(); } @@ -246,74 +243,6 @@ bool CFavouritesService::IsFavourited(const CFileItem& item, int contextWindow) return m_favourites.Contains(GetFavouritesUrl(item, contextWindow)); } -std::string CFavouritesService::GetExecutePath(const CFileItem &item, int contextWindow) const -{ - return GetExecutePath(item, std::to_string(contextWindow)); -} - -std::string CFavouritesService::GetExecutePath(const CFileItem &item, const std::string &contextWindow) const -{ - std::string execute; - if (URIUtils::IsProtocol(item.GetPath(), "favourites")) - { - const CURL url(item.GetPath()); - execute = CURL::Decode(url.GetHostName()); - } - else if (item.m_bIsFolder && (CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_playlistAsFolders || - !(item.IsSmartPlayList() || item.IsPlayList()))) - { - if (!contextWindow.empty()) - execute = StringUtils::Format("ActivateWindow({},{},return)", contextWindow, - StringUtils::Paramify(item.GetPath())); - } - //! @todo STRING_CLEANUP - else if (item.IsScript() && item.GetPath().size() > 9) // script://<foo> - execute = StringUtils::Format("RunScript({})", StringUtils::Paramify(item.GetPath().substr(9))); - else if (item.IsAddonsPath() && item.GetPath().size() > 9) // addons://<foo> - { - CURL url(item.GetPath()); - if (url.GetHostName() == "install") - execute = "installfromzip"; - else - execute = StringUtils::Format("RunAddon({})", url.GetFileName()); - } - else if (item.IsAndroidApp() && item.GetPath().size() > 26) // androidapp://sources/apps/<foo> - execute = StringUtils::Format("StartAndroidActivity({})", - StringUtils::Paramify(item.GetPath().substr(26))); - else // assume a media file - { - if (item.IsVideoDb() && item.HasVideoInfoTag()) - { - std::string paramPlaylistTypeHint; - if (item.HasProperty("playlist_type_hint")) - { - paramPlaylistTypeHint = - ",playlist_type_hint=" + item.GetProperty("playlist_type_hint").asString(); - } - execute = StringUtils::Format( - "PlayMedia({}{})", StringUtils::Paramify(item.GetVideoInfoTag()->m_strFileNameAndPath), - paramPlaylistTypeHint); - } - else if (item.IsMusicDb() && item.HasMusicInfoTag()) - { - std::string paramPlaylistTypeHint; - if (item.HasProperty("playlist_type_hint")) - { - paramPlaylistTypeHint = - ",playlist_type_hint=" + item.GetProperty("playlist_type_hint").asString(); - } - execute = StringUtils::Format("PlayMedia({}{})", - StringUtils::Paramify(item.GetMusicInfoTag()->GetURL()), - paramPlaylistTypeHint); - } - else if (item.IsPicture()) - execute = StringUtils::Format("ShowPicture({})", StringUtils::Paramify(item.GetPath())); - else - execute = StringUtils::Format("PlayMedia({})", StringUtils::Paramify(item.GetPath())); - } - return execute; -} - void CFavouritesService::GetAll(CFileItemList& items) const { std::unique_lock<CCriticalSection> lock(m_criticalSection); @@ -330,6 +259,14 @@ void CFavouritesService::GetAll(CFileItemList& items) const items.Add(fav); } } + + int index = 0; + for (const auto& item : items) + { + item->SetProperty("favourite.action", CUtil::GetExecActionLabelFromPath(item->GetPath())); + item->SetProperty("favourite.provider", CUtil::GetExecProviderLabelFromPath(item->GetPath())); + item->SetProperty("favourite.index", index++); + } } void CFavouritesService::RefreshFavourites() diff --git a/xbmc/favourites/FavouritesService.h b/xbmc/favourites/FavouritesService.h index 399a64cd67..3656c3e5f5 100644 --- a/xbmc/favourites/FavouritesService.h +++ b/xbmc/favourites/FavouritesService.h @@ -32,8 +32,6 @@ public: bool IsFavourited(const CFileItem& item, int contextWindow) const; void GetAll(CFileItemList& items) const; - std::string GetExecutePath(const CFileItem &item, int contextWindow) const; - std::string GetExecutePath(const CFileItem &item, const std::string &contextWindow) const; bool AddOrRemove(const CFileItem& item, int contextWindow); bool Save(const CFileItemList& items); diff --git a/xbmc/favourites/GUIDialogFavourites.cpp b/xbmc/favourites/GUIDialogFavourites.cpp index 3d35ed2280..2c167bd77e 100644 --- a/xbmc/favourites/GUIDialogFavourites.cpp +++ b/xbmc/favourites/GUIDialogFavourites.cpp @@ -9,21 +9,14 @@ #include "GUIDialogFavourites.h" #include "ContextMenuManager.h" -#include "FileItem.h" #include "ServiceBroker.h" +#include "Util.h" #include "dialogs/GUIDialogContextMenu.h" -#include "dialogs/GUIDialogFileBrowser.h" -#include "favourites/FavouritesService.h" -#include "filesystem/Directory.h" +#include "favourites/GUIWindowFavourites.h" #include "guilib/GUIComponent.h" -#include "guilib/GUIKeyboardFactory.h" +#include "guilib/GUIMessage.h" #include "guilib/GUIWindowManager.h" -#include "guilib/LocalizeStrings.h" -#include "input/Key.h" -#include "storage/MediaManager.h" -#include "utils/Variant.h" - -using namespace XFILE; +#include "input/actions/ActionIDs.h" #define FAVOURITES_LIST 450 @@ -95,7 +88,7 @@ void CGUIDialogFavourites::OnClick(int item) return; CGUIMessage message(GUI_MSG_EXECUTE, 0, GetID()); - message.SetStringParam(m_favouritesService.GetExecutePath(*(*m_favourites)[item], GetID())); + message.SetStringParam(CUtil::GetExecPath(*(*m_favourites)[item], std::to_string(GetID()))); Close(); @@ -116,9 +109,9 @@ void CGUIDialogFavourites::OnPopupMenu(int item) choices.Add(1, 13332); // Move up choices.Add(2, 13333); // Move down } - choices.Add(3, 15015); // Remove + choices.Add(3, 20019); // Choose thumbnail choices.Add(4, 118); // Rename - choices.Add(5, 20019); // Choose thumbnail + choices.Add(5, 15015); // Remove CFileItemPtr itemPtr = m_favourites->Get(item); @@ -138,13 +131,13 @@ void CGUIDialogFavourites::OnPopupMenu(int item) if (button == 1) OnMoveItem(item, -1); else if (button == 2) - OnMoveItem(item, 1); + OnMoveItem(item, +1); else if (button == 3) - OnDelete(item); + OnSetThumb(item); else if (button == 4) OnRename(item); else if (button == 5) - OnSetThumb(item); + OnDelete(item); else if (button >= addonItemOffset) CONTEXTMENU::LoopFrom(*addonItems.at(button - addonItemOffset), itemPtr); } @@ -183,7 +176,7 @@ void CGUIDialogFavourites::OnRename(int item) if (item < 0 || item >= m_favourites->Size()) return; - if (ChooseAndSetNewName((*m_favourites)[item])) + if (CGUIWindowFavourites::ChooseAndSetNewName(*(*m_favourites)[item])) { m_favouritesService.Save(*m_favourites); UpdateList(); @@ -195,7 +188,7 @@ void CGUIDialogFavourites::OnSetThumb(int item) if (item < 0 || item >= m_favourites->Size()) return; - if (ChooseAndSetNewThumbnail((*m_favourites)[item])) + if (CGUIWindowFavourites::ChooseAndSetNewThumbnail(*(*m_favourites)[item])) { m_favouritesService.Save(*m_favourites); UpdateList(); @@ -218,41 +211,3 @@ CFileItemPtr CGUIDialogFavourites::GetCurrentListItem(int offset) if (item < 0) item += m_favourites->Size(); return (*m_favourites)[item]; } - -bool CGUIDialogFavourites::ChooseAndSetNewName(const CFileItemPtr &item) -{ - std::string label(item->GetLabel()); - if (CGUIKeyboardFactory::ShowAndGetInput(label, CVariant{g_localizeStrings.Get(16008)}, false)) // Enter new title - { - item->SetLabel(label); - return true; - } - return false; -} - -bool CGUIDialogFavourites::ChooseAndSetNewThumbnail(const CFileItemPtr &item) -{ - CFileItemList prefilledItems; - if (item->HasArt("thumb")) - { - const CFileItemPtr current(std::make_shared<CFileItem>("thumb://Current", false)); - current->SetArt("thumb", item->GetArt("thumb")); - current->SetLabel(g_localizeStrings.Get(20016)); // Current thumb - prefilledItems.Add(current); - } - - const CFileItemPtr none(std::make_shared<CFileItem>("thumb://None", false)); - none->SetArt("icon", item->GetArt("icon")); - none->SetLabel(g_localizeStrings.Get(20018)); // No thumb - prefilledItems.Add(none); - - std::string thumb; - VECSOURCES sources; - CServiceBroker::GetMediaManager().GetLocalDrives(sources); - if (CGUIDialogFileBrowser::ShowAndGetImage(prefilledItems, sources, g_localizeStrings.Get(1030), thumb)) // Browse for image - { - item->SetArt("thumb", thumb); - return true; - } - return false; -} diff --git a/xbmc/favourites/GUIDialogFavourites.h b/xbmc/favourites/GUIDialogFavourites.h index d77a05b098..72d26bd659 100644 --- a/xbmc/favourites/GUIDialogFavourites.h +++ b/xbmc/favourites/GUIDialogFavourites.h @@ -27,9 +27,6 @@ public: bool HasListItems() const override { return true; } - static bool ChooseAndSetNewName(const CFileItemPtr &item); - static bool ChooseAndSetNewThumbnail(const CFileItemPtr &item); - protected: int GetSelectedItem(); void OnClick(int item); diff --git a/xbmc/favourites/GUIViewStateFavourites.cpp b/xbmc/favourites/GUIViewStateFavourites.cpp new file mode 100644 index 0000000000..7bb5ff1195 --- /dev/null +++ b/xbmc/favourites/GUIViewStateFavourites.cpp @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2022 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 "GUIViewStateFavourites.h" + +#include "FileItem.h" +#include "guilib/WindowIDs.h" + +CGUIViewStateFavourites::CGUIViewStateFavourites(const CFileItemList& items) : CGUIViewState(items) +{ + AddSortMethod(SortByUserPreference, 19349, + LABEL_MASKS("%L", "", "%L", "")); // Label, empty | Label, empty + AddSortMethod(SortByLabel, 551, LABEL_MASKS("%L", "", "%L", "")); // Label, empty | Label, empty + + SetSortMethod(SortByUserPreference); + + LoadViewState(items.GetPath(), WINDOW_FAVOURITES); +} + +void CGUIViewStateFavourites::SaveViewState() +{ + SaveViewToDb(m_items.GetPath(), WINDOW_FAVOURITES); +} diff --git a/xbmc/favourites/GUIViewStateFavourites.h b/xbmc/favourites/GUIViewStateFavourites.h new file mode 100644 index 0000000000..aad4444a1f --- /dev/null +++ b/xbmc/favourites/GUIViewStateFavourites.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2022 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. + */ + +#pragma once + +#include "view/GUIViewState.h" + +class CFileItemList; + +class CGUIViewStateFavourites : public CGUIViewState +{ +public: + CGUIViewStateFavourites(const CFileItemList& items); + ~CGUIViewStateFavourites() override = default; + +protected: + void SaveViewState() override; + bool HideParentDirItems() override { return true; }; +}; diff --git a/xbmc/favourites/GUIWindowFavourites.cpp b/xbmc/favourites/GUIWindowFavourites.cpp new file mode 100644 index 0000000000..787ed7c18e --- /dev/null +++ b/xbmc/favourites/GUIWindowFavourites.cpp @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2022 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 "GUIWindowFavourites.h" + +#include "FileItem.h" +#include "ServiceBroker.h" +#include "Util.h" +#include "dialogs/GUIDialogFileBrowser.h" +#include "guilib/GUIComponent.h" +#include "guilib/GUIKeyboardFactory.h" +#include "guilib/GUIWindowManager.h" +#include "guilib/LocalizeStrings.h" +#include "storage/MediaManager.h" +#include "view/GUIViewState.h" + +CGUIWindowFavourites::CGUIWindowFavourites() + : CGUIMediaWindow(WINDOW_FAVOURITES, "MyFavourites.xml") +{ + m_loadType = KEEP_IN_MEMORY; +} + +bool CGUIWindowFavourites::OnSelect(int item) +{ + if (item < 0 || item >= m_vecItems->Size()) + return false; + + CGUIMessage message(GUI_MSG_EXECUTE, 0, GetID()); + message.SetStringParam(CUtil::GetExecPath(*(*m_vecItems)[item], std::to_string(GetID()))); + CServiceBroker::GetGUI()->GetWindowManager().SendMessage(message); + + return true; +} + +bool CGUIWindowFavourites::OnPopupMenu(int item) +{ + return CGUIMediaWindow::OnPopupMenu(item) && Refresh(true); +} + +bool CGUIWindowFavourites::Update(const std::string& strDirectory, + bool updateFilterPath /* = true */) +{ + std::string directory = strDirectory; + if (directory.empty()) + directory = "favourites://"; + + return CGUIMediaWindow::Update(directory, updateFilterPath); +} + +bool CGUIWindowFavourites::ChooseAndSetNewName(CFileItem& item) +{ + std::string label = item.GetLabel(); + if (CGUIKeyboardFactory::ShowAndGetInput(label, CVariant{g_localizeStrings.Get(16008)}, + false)) // Enter new title + { + item.SetLabel(label); + return true; + } + return false; +} + +bool CGUIWindowFavourites::ChooseAndSetNewThumbnail(CFileItem& item) +{ + CFileItemList prefilledItems; + if (item.HasArt("thumb")) + { + const auto current = std::make_shared<CFileItem>("thumb://Current", false); + current->SetArt("thumb", item.GetArt("thumb")); + current->SetLabel(g_localizeStrings.Get(20016)); // Current thumb + prefilledItems.Add(current); + } + + const auto none = std::make_shared<CFileItem>("thumb://None", false); + none->SetArt("icon", item.GetArt("icon")); + none->SetLabel(g_localizeStrings.Get(20018)); // No thumb + prefilledItems.Add(none); + + std::string thumb; + VECSOURCES sources; + CServiceBroker::GetMediaManager().GetLocalDrives(sources); + if (CGUIDialogFileBrowser::ShowAndGetImage(prefilledItems, sources, g_localizeStrings.Get(1030), + thumb)) // Browse for image + { + item.SetArt("thumb", thumb); + return true; + } + return false; +} + +bool CGUIWindowFavourites::MoveItem(CFileItemList& items, const CFileItem& item, int amount) +{ + if (items.Size() < 2 || amount == 0) + return false; + + int itemPos = -1; + for (const auto& i : items) + { + itemPos++; + + if (i->GetPath() == item.GetPath()) + break; + } + + if (itemPos < 0 || itemPos >= items.Size()) + return false; + + int nextItem = (itemPos + amount) % items.Size(); + if (nextItem < 0) + nextItem += items.Size(); + + items.Swap(itemPos, nextItem); + return true; +} + +bool CGUIWindowFavourites::ShouldEnableMoveItems() +{ + auto& mgr = CServiceBroker::GetGUI()->GetWindowManager(); + CGUIWindowFavourites* window = mgr.GetWindow<CGUIWindowFavourites>(WINDOW_FAVOURITES); + if (window && window->IsActive()) + { + const CGUIViewState* state = window->GetViewState(); + if (state && state->GetSortMethod().sortBy != SortByUserPreference) + return false; // in favs window, allow move only if current sort method is by user preference + } + return true; +} diff --git a/xbmc/favourites/GUIWindowFavourites.h b/xbmc/favourites/GUIWindowFavourites.h new file mode 100644 index 0000000000..966c29eedb --- /dev/null +++ b/xbmc/favourites/GUIWindowFavourites.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2022 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. + */ + +#pragma once + +#include "windows/GUIMediaWindow.h" + +class CFileItem; +class CFileItemList; + +class CGUIWindowFavourites : public CGUIMediaWindow +{ +public: + CGUIWindowFavourites(); + ~CGUIWindowFavourites() override = default; + + static bool ChooseAndSetNewName(CFileItem& item); + static bool ChooseAndSetNewThumbnail(CFileItem& item); + static bool MoveItem(CFileItemList& items, const CFileItem& item, int amount); + static bool ShouldEnableMoveItems(); + +protected: + std::string GetRootPath() const override { return "favourites://"; } + + bool OnSelect(int item) override; + bool OnPopupMenu(int iItem) override; + + bool Update(const std::string& strDirectory, bool updateFilterPath = true) override; +}; diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp index d73dce68b0..f15489e00e 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -23,6 +23,7 @@ #include "application/ApplicationPlayer.h" #include "events/windows/GUIWindowEventLog.h" #include "favourites/GUIDialogFavourites.h" +#include "favourites/GUIWindowFavourites.h" #include "input/actions/Action.h" #include "input/actions/ActionIDs.h" #include "messaging/ApplicationMessenger.h" @@ -304,6 +305,8 @@ void CGUIWindowManager::CreateWindows() Add(new CGUIWindowEventLog); + Add(new CGUIWindowFavourites); + Add(new GAME::CGUIControllerWindow); Add(new GAME::CGUIPortWindow); Add(new GAME::CGUIWindowGames); @@ -450,6 +453,8 @@ bool CGUIWindowManager::DestroyWindows() DestroyWindow(WINDOW_EVENT_LOG); + DestroyWindow(WINDOW_FAVOURITES); + DestroyWindow(WINDOW_DIALOG_PERIPHERALS); DestroyWindow(WINDOW_DIALOG_PERIPHERAL_SETTINGS); } diff --git a/xbmc/guilib/WindowIDs.dox b/xbmc/guilib/WindowIDs.dox index cdf36788d6..68fdc7dc08 100644 --- a/xbmc/guilib/WindowIDs.dox +++ b/xbmc/guilib/WindowIDs.dox @@ -6,139 +6,140 @@ This page shows the window names, the window definition, the window ID and the s @note Window names are case-insensitive -| Name | Definition | WindowID | XML Filename | -|:------------------------|:-------------------------------------|:----------|:------------------------------------| -| Home | WINDOW_HOME | 10000 | Home.xml | -| Programs | WINDOW_PROGRAMS | 10001 | MyPrograms.xml | -| Pictures | WINDOW_PICTURES | 10002 | MyPics.xml | -| FileManager | WINDOW_FILES | 10003 | FileManager.xml | -| Settings | WINDOW_SETTINGS_MENU | 10004 | Settings.xml | -| SystemInfo | WINDOW_SYSTEM_INFORMATION | 10007 | SettingsSystemInfo.xml | -| ScreenCalibration | WINDOW_SCREEN_CALIBRATION | 10011 | SettingsScreenCalibration.xml | -| SystemSettings | WINDOW_SETTINGS_SYSTEM | 10016 | SettingsCategory.xml | -| ServiceSettings | WINDOW_SETTINGS_SERVICE | 10018 | SettingsCategory.xml | -| PVRSettings | WINDOW_SETTINGS_MYPVR | 10021 | SettingsCategory.xml | -| GameSettings | WINDOW_SETTINGS_MYGAMES | 10022 | SettingsCategory.xml | -| Videos | WINDOW_VIDEO_NAV | 10025 | MyVideoNav.xml | -| VideoPlaylist | WINDOW_VIDEO_PLAYLIST | 10028 | MyPlaylist.xml | -| LoginScreen | WINDOW_LOGIN_SCREEN | 10029 | LoginScreen.xml | -| PlayerSettings | WINDOW_SETTINGS_PLAYER | 10030 | SettingsCategory.xml | -| MediaSettings | WINDOW_SETTINGS_MEDIA | 10031 | SettingsCategory.xml | -| InterfaceSettings | WINDOW_SETTINGS_INTERFACE | 10032 | SettingsCategory.xml | -| Profiles | WINDOW_SETTINGS_PROFILES | 10034 | SettingsProfile.xml | -| SkinSettings | WINDOW_SKIN_SETTINGS | 10035 | SkinSettings.xml | -| AddonBrowser | WINDOW_ADDON_BROWSER | 10040 | AddonBrowser.xml | -| EventLog | WINDOW_EVENT_LOG | 10050 | EventLog.xml | -| Pointer | WINDOW_DIALOG_POINTER | 10099 | Pointer.xml | -| YesNoDialog | WINDOW_DIALOG_YES_NO | 10100 | DialogConfirm.xml | -| ProgressDialog | WINDOW_DIALOG_PROGRESS | 10101 | DialogConfirm.xml | -| VirtualKeyboard | WINDOW_DIALOG_KEYBOARD | 10103 | DialogKeyboard.xml | -| VolumeBar | WINDOW_DIALOG_VOLUME_BAR | 10104 | DialogVolumeBar.xml | -| SubMenu | WINDOW_DIALOG_SUB_MENU | 10105 | DialogSubMenu.xml | -| ContextMenu | WINDOW_DIALOG_CONTEXT_MENU | 10106 | DialogContextMenu.xml | -| Notification | WINDOW_DIALOG_KAI_TOAST | 10107 | DialogNotification.xml | -| NumericInput | WINDOW_DIALOG_NUMERIC | 10109 | DialogNumeric.xml | -| GamepadInput | WINDOW_DIALOG_GAMEPAD | 10110 | DialogSelect.xml | -| ShutdownMenu | WINDOW_DIALOG_BUTTON_MENU | 10111 | DialogButtonMenu.xml | -| PlayerControls | WINDOW_DIALOG_PLAYER_CONTROLS | 10114 | PlayerControls.xml | -| SeekBar | WINDOW_DIALOG_SEEK_BAR | 10115 | DialogSeekBar.xml | -| PlayerProcessInfo | WINDOW_DIALOG_PLAYER_PROCESS_INFO | 10116 | DialogPlayerProcessInfo.xml | -| MusicOSD | WINDOW_DIALOG_MUSIC_OSD | 10120 | MusicOSD.xml | -| | WINDOW_DIALOG_VIS_SETTINGS | 10121 | | -| VisualisationPresetList | WINDOW_DIALOG_VIS_PRESET_LIST | 10122 | DialogSelect.xml | -| OSDVideoSettings | WINDOW_DIALOG_VIDEO_OSD_SETTINGS | 10123 | DialogSettings.xml | -| OSDAudioSettings | WINDOW_DIALOG_AUDIO_OSD_SETTINGS | 10124 | DialogSettings.xml | -| VideoBookmarks | WINDOW_DIALOG_VIDEO_BOOKMARKS | 10125 | VideoOSDBookmarks.xml | -| FileBrowser | WINDOW_DIALOG_FILE_BROWSER | 10126 | FileBrowser.xml | -| NetworkSetup | WINDOW_DIALOG_NETWORK_SETUP | 10128 | DialogSettings.xml | -| MediaSource | WINDOW_DIALOG_MEDIA_SOURCE | 10129 | DialogMediaSource.xml | -| ProfileSettings | WINDOW_DIALOG_PROFILE_SETTINGS | 10130 | DialogSettings.xml | -| LockSettings | WINDOW_DIALOG_LOCK_SETTINGS | 10131 | DialogSettings.xml | -| ContentSettings | WINDOW_DIALOG_CONTENT_SETTINGS | 10132 | DialogSettings.xml | -| LibexportSettings | WINDOW_DIALOG_LIBEXPORT_SETTINGS | 10133 | DialogSettings.xml | -| Favourites | WINDOW_DIALOG_FAVOURITES | 10134 | DialogFavourites.xml | -| SongInformation | WINDOW_DIALOG_SONG_INFO | 10135 | DialogMusicInfo.xml | -| SmartPlaylistEditor | WINDOW_DIALOG_SMART_PLAYLIST_EDITOR | 10136 | SmartPlaylistEditor.xml | -| SmartPlaylistRule | WINDOW_DIALOG_SMART_PLAYLIST_RULE | 10137 | SmartPlaylistRule.xml | -| BusyDialog | WINDOW_DIALOG_BUSY | 10138 | DialogBusy.xml | -| PictureInfo | WINDOW_DIALOG_PICTURE_INFO | 10139 | DialogPictureInfo.xml | -| AddonSettings | WINDOW_DIALOG_ADDON_SETTINGS | 10140 | DialogAddonSettings.xml | -| FullscreenInfo | WINDOW_DIALOG_FULLSCREEN_INFO | 10142 | DialogFullScreenInfo.xml | -| SliderDialog | WINDOW_DIALOG_SLIDER | 10145 | DialogSlider.xml | -| AddonInformation | WINDOW_DIALOG_ADDON_INFO | 10146 | DialogAddonInfo.xml | -| TextViewer | WINDOW_DIALOG_TEXT_VIEWER | 10147 | DialogTextViewer.xml | -| | WINDOW_DIALOG_PLAY_EJECT | 10148 | DialogConfirm.xml | -| | WINDOW_DIALOG_PERIPHERALS | 10149 | DialogSelect.xml | -| PeripheralSettings | WINDOW_DIALOG_PERIPHERAL_SETTINGS | 10150 | DialogSettings.xml | -| ExtendedProgressDialog | WINDOW_DIALOG_EXT_PROGRESS | 10151 | DialogExtendedProgressBar.xml | -| MediaFilter | WINDOW_DIALOG_MEDIA_FILTER | 10152 | DialogSettings.xml | -| SubtitleSearch | WINDOW_DIALOG_SUBTITLES | 10153 | DialogSubtitles.xml | -| | WINDOW_DIALOG_KEYBOARD_TOUCH | 10156 | | -| OSDCMSSettings | WINDOW_DIALOG_CMS_OSD_SETTINGS | 10157 | DialogSettings.xml | -| InfoproviderSettings | WINDOW_DIALOG_INFOPROVIDER_SETTINGS | 10158 | DialogSettings.xml | -| OSDSubtitleSettings | WINDOW_DIALOG_SUBTITLE_OSD_SETTINGS | 10159 | DialogSettings.xml | -| BusyDialogNoCancel | WINDOW_DIALOG_BUSY_NOCANCEL | 10160 | DialogBusy.xml | -| MusicPlaylist | WINDOW_MUSIC_PLAYLIST | 10500 | MyPlaylist.xml | -| Music | WINDOW_MUSIC_NAV | 10502 | MyMusicNav.xml | -| MusicPlaylistEditor | WINDOW_MUSIC_PLAYLIST_EDITOR | 10503 | MyMusicPlaylistEditor.xml | -| Teletext | WINDOW_DIALOG_OSD_TELETEXT | 10550 | | -| PVRGuideInfo | WINDOW_DIALOG_PVR_GUIDE_INFO | 10600 | DialogPVRInfo.xml | -| PVRRecordingInfo | WINDOW_DIALOG_PVR_RECORDING_INFO | 10601 | DialogPVRInfo.xml | -| PVRTimerSetting | WINDOW_DIALOG_PVR_TIMER_SETTING | 10602 | DialogSettings.xml | -| PVRGroupManager | WINDOW_DIALOG_PVR_GROUP_MANAGER | 10603 | DialogPVRGroupManager.xml | -| PVRChannelManager | WINDOW_DIALOG_PVR_CHANNEL_MANAGER | 10604 | DialogPVRChannelManager.xml | -| PVRGuideSearch | WINDOW_DIALOG_PVR_GUIDE_SEARCH | 10605 | DialogPVRGuideSearch.xml | -| PVRChannelScan | WINDOW_DIALOG_PVR_CHANNEL_SCAN | 10606 | none (unused) | -| PVRUpdateProgress | WINDOW_DIALOG_PVR_UPDATE_PROGRESS | 10607 | none (unused) | -| PVROSDChannels | WINDOW_DIALOG_PVR_OSD_CHANNELS | 10608 | DialogPVRChannelsOSD.xml | -| PVRChannelGuide | WINDOW_DIALOG_PVR_CHANNEL_GUIDE | 10609 | DialogPVRChannelGuide.xml | -| PVRRadioRDSInfo | WINDOW_DIALOG_PVR_RADIO_RDS_INFO | 10610 | DialogPVRRadioRDSInfo.xml | -| PVRRecordingSettings | WINDOW_DIALOG_PVR_RECORDING_SETTING | 10611 | DialogSettings.xml | -| | WINDOW_DIALOG_PVR_CLIENT_PRIORITIES | 10612 | DialogSettings.xml | -| TVChannels | WINDOW_TV_CHANNELS | 10700 | MyPVRChannels.xml | -| TVRecordings | WINDOW_TV_RECORDINGS | 10701 | MyPVRRecordings.xml | -| TVGuide | WINDOW_TV_GUIDE | 10702 | MyPVRGuide.xml | -| TVTimers | WINDOW_TV_TIMERS | 10703 | MyPVRTimers.xml | -| TVSearch | WINDOW_TV_SEARCH | 10704 | MyPVRSearch.xml | -| RadioChannels | WINDOW_RADIO_CHANNELS | 10705 | MyPVRChannels.xml | -| RadioRecordings | WINDOW_RADIO_RECORDINGS | 10706 | MyPVRRecordings.xml | -| RadioGuide | WINDOW_RADIO_GUIDE | 10707 | MyPVRGuide.xml | -| RadioTimers | WINDOW_RADIO_TIMERS | 10708 | MyPVRTimers.xml | -| RadioSearch | WINDOW_RADIO_SEARCH | 10709 | MyPVRSearch.xml | -| TVTimerRules | WINDOW_TV_TIMER_RULES | 10710 | MyPVRTimers.xml | -| RadioTimerRules | WINDOW_RADIO_TIMER_RULES | 10711 | MyPVRTimers.xml | -| FullscreenLiveTV | WINDOW_FULLSCREEN_LIVETV | 10800 | None (shortcut to fullscreenvideo) | -| FullscreenRadio | WINDOW_FULLSCREEN_RADIO | 10801 | None (shortcut to visualisation) | -| FullscreenLivetvPreview | WINDOW_FULLSCREEN_LIVETV_PREVIEW | 10802 | None (shortcut to fullscreenlivetv) | -| FullscreenRadioPreview | WINDOW_FULLSCREEN_RADIO_PREVIEW | 10803 | None (shortcut to fullscreenradio) | -| FullscreenLivetvInput | WINDOW_FULLSCREEN_LIVETV_INPUT | 10804 | None (shortcut to fullscreenlivetv) | -| FullscreenRadioInput | WINDOW_FULLSCREEN_RADIO_INPUT | 10805 | None (shortcut to fullscreenradio) | -| GameControllers | WINDOW_DIALOG_GAME_CONTROLLERS | 10820 | DialogGameControllers.xml | -| Games | WINDOW_GAMES | 10821 | MyGames.xml | -| GameOSD | WINDOW_DIALOG_GAME_OSD | 10822 | GameOSD.xml | -| GameVideoFilter | WINDOW_DIALOG_GAME_VIDEO_FILTER | 10823 | DialogSelect.xml | -| GameStretchMode | WINDOW_DIALOG_GAME_STRETCH_MODE | 10824 | DialogSelect.xml | -| GameVolume | WINDOW_DIALOG_GAME_VOLUME | 10825 | DialogVolumeBar.xml | -| GameAdvancedSettings | WINDOW_DIALOG_GAME_ADVANCED_SETTINGS | 10826 | DialogAddonSettings.xml | -| GameVideoRotation | WINDOW_DIALOG_GAME_VIDEO_ROTATION | 10827 | DialogSelect.xml | -| Custom Skin Windows | - | - | custom*.xml | -| SelectDialog | WINDOW_DIALOG_SELECT | 12000 | DialogSelect.xml | -| MusicInformation | WINDOW_DIALOG_MUSIC_INFO | 12001 | DialogMusicInfo.xml | -| OKDialog | WINDOW_DIALOG_OK | 12002 | DialogConfirm.xml | -| MovieInformation | WINDOW_DIALOG_VIDEO_INFO | 12003 | DialogVideoInfo.xml | -| FullscreenVideo | WINDOW_FULLSCREEN_VIDEO | 12005 | VideoFullScreen.xml | -| Visualisation | WINDOW_VISUALISATION | 12006 | MusicVisualisation.xml | -| Slideshow | WINDOW_SLIDESHOW | 12007 | SlideShow.xml | -| DialogColorPicker | WINDOW_DIALOG_COLOR_PICKER | 12008 | DialogColorPicker.xml | -| Weather | WINDOW_WEATHER | 12600 | MyWeather.xml | -| Screensaver | WINDOW_SCREENSAVER | 12900 | none | -| VideoOSD | WINDOW_DIALOG_VIDEO_OSD | 12901 | VideoOSD.xml | -| VideoMenu | WINDOW_VIDEO_MENU | 12902 | none | -| VideoTimeSeek | WINDOW_VIDEO_TIME_SEEK | 12905 | none | -| FullscreenGame | WINDOW_FULLSCREEN_GAME | 12906 | none | -| Splash | WINDOW_SPLASH | 12997 | none | -| StartWindow | WINDOW_START | 12998 | shortcut to the current startwindow | -| Startup | WINDOW_STARTUP_ANIM | 12999 | Startup.xml | +| Name | Definition | WindowID | XML Filename | Revision history | +|:------------------------|:-------------------------------------|:----------|:------------------------------------|:-----------------------------------| +| Home | WINDOW_HOME | 10000 | Home.xml | | +| Programs | WINDOW_PROGRAMS | 10001 | MyPrograms.xml | | +| Pictures | WINDOW_PICTURES | 10002 | MyPics.xml | | +| FileManager | WINDOW_FILES | 10003 | FileManager.xml | | +| Settings | WINDOW_SETTINGS_MENU | 10004 | Settings.xml | | +| SystemInfo | WINDOW_SYSTEM_INFORMATION | 10007 | SettingsSystemInfo.xml | | +| ScreenCalibration | WINDOW_SCREEN_CALIBRATION | 10011 | SettingsScreenCalibration.xml | | +| SystemSettings | WINDOW_SETTINGS_SYSTEM | 10016 | SettingsCategory.xml | | +| ServiceSettings | WINDOW_SETTINGS_SERVICE | 10018 | SettingsCategory.xml | | +| PVRSettings | WINDOW_SETTINGS_MYPVR | 10021 | SettingsCategory.xml | | +| GameSettings | WINDOW_SETTINGS_MYGAMES | 10022 | SettingsCategory.xml | | +| Videos | WINDOW_VIDEO_NAV | 10025 | MyVideoNav.xml | | +| VideoPlaylist | WINDOW_VIDEO_PLAYLIST | 10028 | MyPlaylist.xml | | +| LoginScreen | WINDOW_LOGIN_SCREEN | 10029 | LoginScreen.xml | | +| PlayerSettings | WINDOW_SETTINGS_PLAYER | 10030 | SettingsCategory.xml | | +| MediaSettings | WINDOW_SETTINGS_MEDIA | 10031 | SettingsCategory.xml | | +| InterfaceSettings | WINDOW_SETTINGS_INTERFACE | 10032 | SettingsCategory.xml | | +| Profiles | WINDOW_SETTINGS_PROFILES | 10034 | SettingsProfile.xml | | +| SkinSettings | WINDOW_SKIN_SETTINGS | 10035 | SkinSettings.xml | | +| AddonBrowser | WINDOW_ADDON_BROWSER | 10040 | AddonBrowser.xml | | +| EventLog | WINDOW_EVENT_LOG | 10050 | EventLog.xml | | +| Pointer | WINDOW_DIALOG_POINTER | 10099 | Pointer.xml | | +| YesNoDialog | WINDOW_DIALOG_YES_NO | 10100 | DialogConfirm.xml | | +| ProgressDialog | WINDOW_DIALOG_PROGRESS | 10101 | DialogConfirm.xml | | +| VirtualKeyboard | WINDOW_DIALOG_KEYBOARD | 10103 | DialogKeyboard.xml | | +| VolumeBar | WINDOW_DIALOG_VOLUME_BAR | 10104 | DialogVolumeBar.xml | | +| SubMenu | WINDOW_DIALOG_SUB_MENU | 10105 | DialogSubMenu.xml | | +| ContextMenu | WINDOW_DIALOG_CONTEXT_MENU | 10106 | DialogContextMenu.xml | | +| Notification | WINDOW_DIALOG_KAI_TOAST | 10107 | DialogNotification.xml | | +| NumericInput | WINDOW_DIALOG_NUMERIC | 10109 | DialogNumeric.xml | | +| GamepadInput | WINDOW_DIALOG_GAMEPAD | 10110 | DialogSelect.xml | | +| ShutdownMenu | WINDOW_DIALOG_BUTTON_MENU | 10111 | DialogButtonMenu.xml | | +| PlayerControls | WINDOW_DIALOG_PLAYER_CONTROLS | 10114 | PlayerControls.xml | | +| SeekBar | WINDOW_DIALOG_SEEK_BAR | 10115 | DialogSeekBar.xml | | +| PlayerProcessInfo | WINDOW_DIALOG_PLAYER_PROCESS_INFO | 10116 | DialogPlayerProcessInfo.xml | | +| MusicOSD | WINDOW_DIALOG_MUSIC_OSD | 10120 | MusicOSD.xml | | +| | WINDOW_DIALOG_VIS_SETTINGS | 10121 | | | +| VisualisationPresetList | WINDOW_DIALOG_VIS_PRESET_LIST | 10122 | DialogSelect.xml | | +| OSDVideoSettings | WINDOW_DIALOG_VIDEO_OSD_SETTINGS | 10123 | DialogSettings.xml | | +| OSDAudioSettings | WINDOW_DIALOG_AUDIO_OSD_SETTINGS | 10124 | DialogSettings.xml | | +| VideoBookmarks | WINDOW_DIALOG_VIDEO_BOOKMARKS | 10125 | VideoOSDBookmarks.xml | | +| FileBrowser | WINDOW_DIALOG_FILE_BROWSER | 10126 | FileBrowser.xml | | +| NetworkSetup | WINDOW_DIALOG_NETWORK_SETUP | 10128 | DialogSettings.xml | | +| MediaSource | WINDOW_DIALOG_MEDIA_SOURCE | 10129 | DialogMediaSource.xml | | +| ProfileSettings | WINDOW_DIALOG_PROFILE_SETTINGS | 10130 | DialogSettings.xml | | +| LockSettings | WINDOW_DIALOG_LOCK_SETTINGS | 10131 | DialogSettings.xml | | +| ContentSettings | WINDOW_DIALOG_CONTENT_SETTINGS | 10132 | DialogSettings.xml | | +| LibexportSettings | WINDOW_DIALOG_LIBEXPORT_SETTINGS | 10133 | DialogSettings.xml | | +| Favourites | WINDOW_DIALOG_FAVOURITES | 10134 | DialogFavourites.xml | @deprecated Dialog **Favourites** is deprecated and is scheduled for removal in v21.<p></p> @skinning_v20 Deprecated. Please use **FavouritesBrowser** window instead. <p></p> | +| SongInformation | WINDOW_DIALOG_SONG_INFO | 10135 | DialogMusicInfo.xml | | +| SmartPlaylistEditor | WINDOW_DIALOG_SMART_PLAYLIST_EDITOR | 10136 | SmartPlaylistEditor.xml | | +| SmartPlaylistRule | WINDOW_DIALOG_SMART_PLAYLIST_RULE | 10137 | SmartPlaylistRule.xml | | +| BusyDialog | WINDOW_DIALOG_BUSY | 10138 | DialogBusy.xml | | +| PictureInfo | WINDOW_DIALOG_PICTURE_INFO | 10139 | DialogPictureInfo.xml | | +| AddonSettings | WINDOW_DIALOG_ADDON_SETTINGS | 10140 | DialogAddonSettings.xml | | +| FullscreenInfo | WINDOW_DIALOG_FULLSCREEN_INFO | 10142 | DialogFullScreenInfo.xml | | +| SliderDialog | WINDOW_DIALOG_SLIDER | 10145 | DialogSlider.xml | | +| AddonInformation | WINDOW_DIALOG_ADDON_INFO | 10146 | DialogAddonInfo.xml | | +| TextViewer | WINDOW_DIALOG_TEXT_VIEWER | 10147 | DialogTextViewer.xml | | +| | WINDOW_DIALOG_PLAY_EJECT | 10148 | DialogConfirm.xml | | +| | WINDOW_DIALOG_PERIPHERALS | 10149 | DialogSelect.xml | | +| PeripheralSettings | WINDOW_DIALOG_PERIPHERAL_SETTINGS | 10150 | DialogSettings.xml | | +| ExtendedProgressDialog | WINDOW_DIALOG_EXT_PROGRESS | 10151 | DialogExtendedProgressBar.xml | | +| MediaFilter | WINDOW_DIALOG_MEDIA_FILTER | 10152 | DialogSettings.xml | | +| SubtitleSearch | WINDOW_DIALOG_SUBTITLES | 10153 | DialogSubtitles.xml | | +| | WINDOW_DIALOG_KEYBOARD_TOUCH | 10156 | | | +| OSDCMSSettings | WINDOW_DIALOG_CMS_OSD_SETTINGS | 10157 | DialogSettings.xml | | +| InfoproviderSettings | WINDOW_DIALOG_INFOPROVIDER_SETTINGS | 10158 | DialogSettings.xml | | +| OSDSubtitleSettings | WINDOW_DIALOG_SUBTITLE_OSD_SETTINGS | 10159 | DialogSettings.xml | | +| BusyDialogNoCancel | WINDOW_DIALOG_BUSY_NOCANCEL | 10160 | DialogBusy.xml | | +| MusicPlaylist | WINDOW_MUSIC_PLAYLIST | 10500 | MyPlaylist.xml | | +| Music | WINDOW_MUSIC_NAV | 10502 | MyMusicNav.xml | | +| MusicPlaylistEditor | WINDOW_MUSIC_PLAYLIST_EDITOR | 10503 | MyMusicPlaylistEditor.xml | | +| Teletext | WINDOW_DIALOG_OSD_TELETEXT | 10550 | | | +| PVRGuideInfo | WINDOW_DIALOG_PVR_GUIDE_INFO | 10600 | DialogPVRInfo.xml | | +| PVRRecordingInfo | WINDOW_DIALOG_PVR_RECORDING_INFO | 10601 | DialogPVRInfo.xml | | +| PVRTimerSetting | WINDOW_DIALOG_PVR_TIMER_SETTING | 10602 | DialogSettings.xml | | +| PVRGroupManager | WINDOW_DIALOG_PVR_GROUP_MANAGER | 10603 | DialogPVRGroupManager.xml | | +| PVRChannelManager | WINDOW_DIALOG_PVR_CHANNEL_MANAGER | 10604 | DialogPVRChannelManager.xml | | +| PVRGuideSearch | WINDOW_DIALOG_PVR_GUIDE_SEARCH | 10605 | DialogPVRGuideSearch.xml | | +| PVRChannelScan | WINDOW_DIALOG_PVR_CHANNEL_SCAN | 10606 | none (unused) | | +| PVRUpdateProgress | WINDOW_DIALOG_PVR_UPDATE_PROGRESS | 10607 | none (unused) | | +| PVROSDChannels | WINDOW_DIALOG_PVR_OSD_CHANNELS | 10608 | DialogPVRChannelsOSD.xml | | +| PVRChannelGuide | WINDOW_DIALOG_PVR_CHANNEL_GUIDE | 10609 | DialogPVRChannelGuide.xml | | +| PVRRadioRDSInfo | WINDOW_DIALOG_PVR_RADIO_RDS_INFO | 10610 | DialogPVRRadioRDSInfo.xml | | +| PVRRecordingSettings | WINDOW_DIALOG_PVR_RECORDING_SETTING | 10611 | DialogSettings.xml | | +| | WINDOW_DIALOG_PVR_CLIENT_PRIORITIES | 10612 | DialogSettings.xml | | +| TVChannels | WINDOW_TV_CHANNELS | 10700 | MyPVRChannels.xml | | +| TVRecordings | WINDOW_TV_RECORDINGS | 10701 | MyPVRRecordings.xml | | +| TVGuide | WINDOW_TV_GUIDE | 10702 | MyPVRGuide.xml | | +| TVTimers | WINDOW_TV_TIMERS | 10703 | MyPVRTimers.xml | | +| TVSearch | WINDOW_TV_SEARCH | 10704 | MyPVRSearch.xml | | +| RadioChannels | WINDOW_RADIO_CHANNELS | 10705 | MyPVRChannels.xml | | +| RadioRecordings | WINDOW_RADIO_RECORDINGS | 10706 | MyPVRRecordings.xml | | +| RadioGuide | WINDOW_RADIO_GUIDE | 10707 | MyPVRGuide.xml | | +| RadioTimers | WINDOW_RADIO_TIMERS | 10708 | MyPVRTimers.xml | | +| RadioSearch | WINDOW_RADIO_SEARCH | 10709 | MyPVRSearch.xml | | +| TVTimerRules | WINDOW_TV_TIMER_RULES | 10710 | MyPVRTimers.xml | | +| RadioTimerRules | WINDOW_RADIO_TIMER_RULES | 10711 | MyPVRTimers.xml | | +| FullscreenLiveTV | WINDOW_FULLSCREEN_LIVETV | 10800 | None (shortcut to fullscreenvideo) | | +| FullscreenRadio | WINDOW_FULLSCREEN_RADIO | 10801 | None (shortcut to visualisation) | | +| FullscreenLivetvPreview | WINDOW_FULLSCREEN_LIVETV_PREVIEW | 10802 | None (shortcut to fullscreenlivetv) | | +| FullscreenRadioPreview | WINDOW_FULLSCREEN_RADIO_PREVIEW | 10803 | None (shortcut to fullscreenradio) | | +| FullscreenLivetvInput | WINDOW_FULLSCREEN_LIVETV_INPUT | 10804 | None (shortcut to fullscreenlivetv) | | +| FullscreenRadioInput | WINDOW_FULLSCREEN_RADIO_INPUT | 10805 | None (shortcut to fullscreenradio) | | +| GameControllers | WINDOW_DIALOG_GAME_CONTROLLERS | 10820 | DialogGameControllers.xml | | +| Games | WINDOW_GAMES | 10821 | MyGames.xml | | +| GameOSD | WINDOW_DIALOG_GAME_OSD | 10822 | GameOSD.xml | | +| GameVideoFilter | WINDOW_DIALOG_GAME_VIDEO_FILTER | 10823 | DialogSelect.xml | | +| GameStretchMode | WINDOW_DIALOG_GAME_STRETCH_MODE | 10824 | DialogSelect.xml | | +| GameVolume | WINDOW_DIALOG_GAME_VOLUME | 10825 | DialogVolumeBar.xml | | +| GameAdvancedSettings | WINDOW_DIALOG_GAME_ADVANCED_SETTINGS | 10826 | DialogAddonSettings.xml | | +| GameVideoRotation | WINDOW_DIALOG_GAME_VIDEO_ROTATION | 10827 | DialogSelect.xml | | +| Custom Skin Windows | - | - | custom*.xml | | +| SelectDialog | WINDOW_DIALOG_SELECT | 12000 | DialogSelect.xml | | +| MusicInformation | WINDOW_DIALOG_MUSIC_INFO | 12001 | DialogMusicInfo.xml | | +| OKDialog | WINDOW_DIALOG_OK | 12002 | DialogConfirm.xml | | +| MovieInformation | WINDOW_DIALOG_VIDEO_INFO | 12003 | DialogVideoInfo.xml | | +| FullscreenVideo | WINDOW_FULLSCREEN_VIDEO | 12005 | VideoFullScreen.xml | | +| Visualisation | WINDOW_VISUALISATION | 12006 | MusicVisualisation.xml | | +| Slideshow | WINDOW_SLIDESHOW | 12007 | SlideShow.xml | | +| DialogColorPicker | WINDOW_DIALOG_COLOR_PICKER | 12008 | DialogColorPicker.xml | | +| Weather | WINDOW_WEATHER | 12600 | MyWeather.xml | | +| Screensaver | WINDOW_SCREENSAVER | 12900 | none | | +| VideoOSD | WINDOW_DIALOG_VIDEO_OSD | 12901 | VideoOSD.xml | | +| VideoMenu | WINDOW_VIDEO_MENU | 12902 | none | | +| VideoTimeSeek | WINDOW_VIDEO_TIME_SEEK | 12905 | none | | +| FullscreenGame | WINDOW_FULLSCREEN_GAME | 12906 | none | | +| Splash | WINDOW_SPLASH | 12997 | none | | +| StartWindow | WINDOW_START | 12998 | shortcut to the current startwindow | | +| Startup | WINDOW_STARTUP_ANIM | 12999 | Startup.xml | | +| FavouritesBrowser | WINDOW_FAVOURITES | 10060 | MyFavourites.xml | @skinning_v20 **New window** FavouritesBrowser, replaces the old Favourites dialog.<p></p> | */ diff --git a/xbmc/guilib/WindowIDs.h b/xbmc/guilib/WindowIDs.h index 0bc968261d..02ff8ebaac 100644 --- a/xbmc/guilib/WindowIDs.h +++ b/xbmc/guilib/WindowIDs.h @@ -41,6 +41,8 @@ #define WINDOW_EVENT_LOG 10050 +#define WINDOW_FAVOURITES 10060 + #define WINDOW_SCREENSAVER_DIM 97 #define WINDOW_DEBUG_INFO 98 #define WINDOW_DIALOG_POINTER 10099 diff --git a/xbmc/input/WindowTranslator.cpp b/xbmc/input/WindowTranslator.cpp index 8b824aaabc..cceb3f06f2 100644 --- a/xbmc/input/WindowTranslator.cpp +++ b/xbmc/input/WindowTranslator.cpp @@ -159,6 +159,7 @@ const CWindowTranslator::WindowMapByName CWindowTranslator::WindowMappingByName {"mediafilter", WINDOW_DIALOG_MEDIA_FILTER}, {"addon", WINDOW_ADDON_START}, {"eventlog", WINDOW_EVENT_LOG}, + {"favouritesbrowser", WINDOW_FAVOURITES}, {"tvtimerrules", WINDOW_TV_TIMER_RULES}, {"radiotimerrules", WINDOW_RADIO_TIMER_RULES}, {"gameosd", WINDOW_DIALOG_GAME_OSD}, diff --git a/xbmc/listproviders/DirectoryProvider.cpp b/xbmc/listproviders/DirectoryProvider.cpp index 3521fecedb..fb47720d66 100644 --- a/xbmc/listproviders/DirectoryProvider.cpp +++ b/xbmc/listproviders/DirectoryProvider.cpp @@ -11,6 +11,7 @@ #include "ContextMenuManager.h" #include "FileItem.h" #include "ServiceBroker.h" +#include "Util.h" #include "addons/AddonManager.h" #include "addons/gui/GUIDialogAddonInfo.h" #include "favourites/FavouritesService.h" @@ -420,7 +421,7 @@ bool CDirectoryProvider::OnClick(const CGUIListItemPtr &item) fileItem.SetPath(fileItem.GetProperty("node.target_url").asString()); // grab the execute string - std::string execute = CServiceBroker::GetFavouritesService().GetExecutePath(fileItem, GetTarget(fileItem)); + const std::string execute = CUtil::GetExecPath(fileItem, GetTarget(fileItem)); if (!execute.empty()) { CGUIMessage message(GUI_MSG_EXECUTE, 0, 0); diff --git a/xbmc/utils/DatabaseUtils.h b/xbmc/utils/DatabaseUtils.h index 3fef46de8b..4e206a791c 100644 --- a/xbmc/utils/DatabaseUtils.h +++ b/xbmc/utils/DatabaseUtils.h @@ -148,6 +148,7 @@ typedef enum FieldAlbumDuration, FieldHdrType, FieldProvider, + FieldUserPreference, FieldMax } Field; diff --git a/xbmc/utils/SortUtils.cpp b/xbmc/utils/SortUtils.cpp index 13af663725..b6b2c2142c 100644 --- a/xbmc/utils/SortUtils.cpp +++ b/xbmc/utils/SortUtils.cpp @@ -468,6 +468,11 @@ std::string ByProvider(SortAttribute attributes, const SortItem& values) return values.at(FieldProvider).asString(); } +std::string ByUserPreference(SortAttribute attributes, const SortItem& values) +{ + return values.at(FieldUserPreference).asString(); +} + std::string ByDateTaken(SortAttribute attributes, const SortItem &values) { return values.at(FieldDateTaken).asString(); @@ -680,6 +685,7 @@ std::map<SortBy, SortUtils::SortPreparator> fillPreparators() preparators[SortByChannelNumber] = ByChannelNumber; preparators[SortByClientChannelOrder] = ByClientChannelOrder; preparators[SortByProvider] = ByProvider; + preparators[SortByUserPreference] = ByUserPreference; preparators[SortByDateTaken] = ByDateTaken; preparators[SortByRelevance] = ByRelevance; preparators[SortByInstallDate] = ByInstallDate; @@ -774,6 +780,7 @@ std::map<SortBy, Fields> fillSortingFields() sortingFields[SortByChannelNumber].insert(FieldChannelNumber); sortingFields[SortByClientChannelOrder].insert(FieldClientChannelOrder); sortingFields[SortByProvider].insert(FieldProvider); + sortingFields[SortByUserPreference].insert(FieldUserPreference); sortingFields[SortByDateTaken].insert(FieldDateTaken); sortingFields[SortByRelevance].insert(FieldRelevance); sortingFields[SortByInstallDate].insert(FieldInstallDate); @@ -1188,6 +1195,7 @@ const sort_map table[] = { { SortByChannel, SORT_METHOD_CHANNEL_NUMBER, SortAttributeNone, 549 }, { SortByChannel, SORT_METHOD_CLIENT_CHANNEL_ORDER, SortAttributeNone, 19315 }, { SortByProvider, SORT_METHOD_PROVIDER, SortAttributeNone, 19348 }, + { SortByUserPreference, SORT_METHOD_USER_PREFERENCE, SortAttributeNone, 19349 }, { SortByDateTaken, SORT_METHOD_DATE_TAKEN, SortAttributeIgnoreFolders, 577 }, { SortByNone, SORT_METHOD_NONE, SortAttributeNone, 16018 }, { SortByTotalDiscs, SORT_METHOD_TOTAL_DISCS, SortAttributeNone, 38077 }, @@ -1339,6 +1347,7 @@ const std::map<std::string, SortBy> sortMethods = { {"channelnumber", SortByChannelNumber}, {"clientchannelorder", SortByClientChannelOrder}, {"provider", SortByProvider}, + {"userpreference", SortByUserPreference}, {"datetaken", SortByDateTaken}, {"userrating", SortByUserRating}, {"installdate", SortByInstallDate}, diff --git a/xbmc/utils/SortUtils.h b/xbmc/utils/SortUtils.h index e8e513d8ee..19a7d07f55 100644 --- a/xbmc/utils/SortUtils.h +++ b/xbmc/utils/SortUtils.h @@ -167,6 +167,9 @@ typedef enum /// __58__ : Sort by provider <em>(String: <b><c>Provider</c></b>)</em> /// @skinning_v20 <b>SortByProvider</b> New sort method added. SortByProvider, + /// __59__ : Sort by user preference <em>(String: <b><c>UserPreference</c></b>)</em> + /// @skinning_v20 <b>SortByUserPreference</b> New sort method added. + SortByUserPreference, } SortBy; ///@} diff --git a/xbmc/utils/URIUtils.cpp b/xbmc/utils/URIUtils.cpp index 0784b519c7..c5353b9f2d 100644 --- a/xbmc/utils/URIUtils.cpp +++ b/xbmc/utils/URIUtils.cpp @@ -767,6 +767,11 @@ bool URIUtils::IsStack(const std::string& strFile) return IsProtocol(strFile, "stack"); } +bool URIUtils::IsFavourite(const std::string& strFile) +{ + return IsProtocol(strFile, "favourites"); +} + bool URIUtils::IsRAR(const std::string& strFile) { std::string strExtension = GetExtension(strFile); diff --git a/xbmc/utils/URIUtils.h b/xbmc/utils/URIUtils.h index 195c32e29d..0594ce0997 100644 --- a/xbmc/utils/URIUtils.h +++ b/xbmc/utils/URIUtils.h @@ -153,6 +153,7 @@ public: static bool IsSmb(const std::string& strFile); static bool IsSpecial(const std::string& strFile); static bool IsStack(const std::string& strFile); + static bool IsFavourite(const std::string& strFile); static bool IsUPnP(const std::string& strFile); static bool IsURL(const std::string& strFile); static bool IsVideoDb(const std::string& strFile); diff --git a/xbmc/view/GUIViewState.cpp b/xbmc/view/GUIViewState.cpp index 9796422fea..5378828176 100644 --- a/xbmc/view/GUIViewState.cpp +++ b/xbmc/view/GUIViewState.cpp @@ -21,6 +21,7 @@ #include "addons/gui/GUIViewStateAddonBrowser.h" #include "dialogs/GUIDialogSelect.h" #include "events/windows/GUIViewStateEventLog.h" +#include "favourites/GUIViewStateFavourites.h" #include "games/windows/GUIViewStateWindowGames.h" #include "guilib/GUIComponent.h" #include "guilib/GUIWindowManager.h" @@ -182,6 +183,9 @@ CGUIViewState* CGUIViewState::GetViewState(int windowId, const CFileItemList& it if (windowId == WINDOW_EVENT_LOG) return new CGUIViewStateEventLog(items); + if (windowId == WINDOW_FAVOURITES) + return new CGUIViewStateFavourites(items); + // Use as fallback/default return new CGUIViewStateGeneral(items); } |