aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeak3d <pfau@peak3d.de>2018-06-10 13:55:10 +0200
committerpeak3d <pfau@peak3d.de>2018-06-10 13:55:10 +0200
commit5ce101d92ccf06339a82902392fc1bacd3c75126 (patch)
treec1e2f35a00921d34097f4dd7ae55429dd0c7c27b
parent4cfea45f0192e9fac891ccc58ba8a40cfa2ef7b1 (diff)
Refine Video::Autoplay options
-rw-r--r--addons/resource.language.en_gb/resources/strings.po14
-rwxr-xr-xsystem/settings/settings.xml19
-rw-r--r--xbmc/music/GUIViewStateMusic.cpp4
-rw-r--r--xbmc/music/GUIViewStateMusic.h4
-rw-r--r--xbmc/settings/SettingsBase.cpp8
-rw-r--r--xbmc/settings/SettingsBase.h9
-rw-r--r--xbmc/settings/lib/SettingsManager.cpp14
-rw-r--r--xbmc/settings/lib/SettingsManager.h9
-rw-r--r--xbmc/video/GUIViewStateVideo.cpp11
-rw-r--r--xbmc/video/GUIViewStateVideo.h3
-rw-r--r--xbmc/view/GUIViewState.cpp38
-rw-r--r--xbmc/view/GUIViewState.h4
12 files changed, 114 insertions, 23 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index 300d6666f0..79ad5afaa7 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -12636,6 +12636,7 @@ msgstr ""
#: xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp
#: xbmc/media/MediaTypes.cpp
#: addons/skin.estuary/xml/Variables.xml
+#: xbmc/view/GUIViewState.cpp
msgctxt "#20342"
msgid "Movies"
msgstr ""
@@ -12646,6 +12647,7 @@ msgstr ""
#: addons/skin.estuary/xml/Home.xml
#: addons/skin.estuary/xml/SkinSettings.xml
#: addons/skin.estuary/xml/Variables.xml
+#: xbmc/view/GUIViewState.cpp
msgctxt "#20343"
msgid "TV shows"
msgstr ""
@@ -12738,6 +12740,7 @@ msgstr ""
#: xbmc/playlists/SmartPlaylist.cpp
#: addons/skin.estuary/xml/View_51_Poster.xml
#: addons/skin.estuary/xml/Variables.xml
+#: xbmc/view/GUIViewState.cpp
msgctxt "#20360"
msgid "Episodes"
msgstr ""
@@ -12880,6 +12883,7 @@ msgstr ""
#: xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.cpp
#: xbmc/media/MediaTypes.cpp
#: addons/skin.estuary/xml/Variables.xml
+#: xbmc/view/GUIViewState.cpp
msgctxt "#20389"
msgid "Music videos"
msgstr ""
@@ -13358,7 +13362,13 @@ msgctxt "#21344"
msgid "If mp4 or mkv files have tags, use this for library metadata"
msgstr ""
-#empty strings from id 21345 to 21357
+#. Used in AutoPlayNextItem dialogs for not categorized listItem directories
+#: xbmc/view/GUIViewState.cpp
+msgctxt "#21345"
+msgid "Uncategorized"
+msgstr ""
+
+#empty strings from id 21346 to 21357
#: system/settings/settings.xml
msgctxt "#21358"
@@ -17964,7 +17974,7 @@ msgstr ""
#. Description of setting with label #13433 "Play next video automatically"
#: system/settings/settings.xml
msgctxt "#36152"
-msgid "Enable automatic playback of the next file in the list."
+msgid "Enable automatic playback of the next file in the list for selected playlist types."
msgstr ""
#. Description of setting with label #13415 "Render method"
diff --git a/system/settings/settings.xml b/system/settings/settings.xml
index 1a408886cf..a6b9080cf5 100755
--- a/system/settings/settings.xml
+++ b/system/settings/settings.xml
@@ -3,10 +3,23 @@
<section id="player" label="14200" help="38100">
<category id="videoplayer" label="14215" help="38103">
<group id="1" label="14230">
- <setting id="videoplayer.autoplaynextitem" type="boolean" label="13433" help="36152">
+ <setting id="videoplayer.autoplaynextitem" type="list[integer]" label="13433" help="36152">
+ <constraints>
+ <options>
+ <option label="20389">0</option> <!-- musicvideos -->
+ <option label="20343">1</option> <!-- tvshows -->
+ <option label="20360">2</option> <!-- episodes -->
+ <option label="20342">3</option> <!-- movies -->
+ <option label="21345">4</option> <!-- uncategorized -->
+ </options>
+ <delimiter>,</delimiter>
+ </constraints>
<level>0</level>
- <default>false</default>
- <control type="toggle" />
+ <default></default>
+ <control type="list" format="string">
+ <multiselect>true</multiselect>
+ <hidevalue>false</hidevalue>
+ </control>
</setting>
<setting id="videoplayer.seeksteps" type="list[integer]" label="13556" help="37042">
<level>1</level>
diff --git a/xbmc/music/GUIViewStateMusic.cpp b/xbmc/music/GUIViewStateMusic.cpp
index 3f4c4c7543..624061f82b 100644
--- a/xbmc/music/GUIViewStateMusic.cpp
+++ b/xbmc/music/GUIViewStateMusic.cpp
@@ -39,7 +39,7 @@
using namespace XFILE;
using namespace MUSICDATABASEDIRECTORY;
-int CGUIViewStateWindowMusic::GetPlaylist()
+int CGUIViewStateWindowMusic::GetPlaylist() const
{
//return PLAYLIST_MUSIC_TEMP;
return PLAYLIST_MUSIC;
@@ -580,7 +580,7 @@ void CGUIViewStateWindowMusicPlaylist::SaveViewState()
SaveViewToDb(m_items.GetPath(), WINDOW_MUSIC_PLAYLIST);
}
-int CGUIViewStateWindowMusicPlaylist::GetPlaylist()
+int CGUIViewStateWindowMusicPlaylist::GetPlaylist() const
{
return PLAYLIST_MUSIC;
}
diff --git a/xbmc/music/GUIViewStateMusic.h b/xbmc/music/GUIViewStateMusic.h
index f884a9938f..6d759e5a42 100644
--- a/xbmc/music/GUIViewStateMusic.h
+++ b/xbmc/music/GUIViewStateMusic.h
@@ -28,7 +28,7 @@ public:
explicit CGUIViewStateWindowMusic(const CFileItemList& items) : CGUIViewState(items) {}
protected:
VECSOURCES& GetSources() override;
- int GetPlaylist() override;
+ int GetPlaylist() const override;
bool AutoPlayNextItem() override;
std::string GetLockType() override;
std::string GetExtensions() override;
@@ -90,7 +90,7 @@ public:
protected:
void SaveViewState() override;
- int GetPlaylist() override;
+ int GetPlaylist() const override;
bool AutoPlayNextItem() override;
bool HideParentDirItems() override;
VECSOURCES& GetSources() override;
diff --git a/xbmc/settings/SettingsBase.cpp b/xbmc/settings/SettingsBase.cpp
index a3caa3e634..240851a0c5 100644
--- a/xbmc/settings/SettingsBase.cpp
+++ b/xbmc/settings/SettingsBase.cpp
@@ -175,6 +175,14 @@ void CSettingsBase::UnregisterCallback(ISettingCallback* callback)
m_settingsManager->UnregisterCallback(callback);
}
+bool CSettingsBase::FindIntInList(const std::string &id, int value) const
+{
+ if (id.empty())
+ return false;
+
+ return m_settingsManager->FindIntInList(id, value);
+}
+
SettingPtr CSettingsBase::GetSetting(const std::string& id) const
{
if (id.empty())
diff --git a/xbmc/settings/SettingsBase.h b/xbmc/settings/SettingsBase.h
index 3990845772..b80969d5e7 100644
--- a/xbmc/settings/SettingsBase.h
+++ b/xbmc/settings/SettingsBase.h
@@ -111,6 +111,15 @@ public:
void UnregisterCallback(ISettingCallback* callback);
/*!
+ \brief Search in a list of Ints for a given value.
+
+ \param id Setting identifier
+ \param value value to search for
+ \return True if value was found in list, false otherwise
+ */
+ bool FindIntInList(const std::string &id, int value) const;
+
+ /*!
\brief Gets the setting with the given identifier.
\param id Setting identifier
diff --git a/xbmc/settings/lib/SettingsManager.cpp b/xbmc/settings/lib/SettingsManager.cpp
index 7ba37079f5..d82e50eebc 100644
--- a/xbmc/settings/lib/SettingsManager.cpp
+++ b/xbmc/settings/lib/SettingsManager.cpp
@@ -714,6 +714,20 @@ bool CSettingsManager::SetList(const std::string &id, const std::vector< std::sh
return std::static_pointer_cast<CSettingList>(setting)->SetValue(value);
}
+bool CSettingsManager::FindIntInList(const std::string &id, int value) const
+{
+ CSharedLock lock(m_settingsCritical);
+ SettingPtr setting = GetSetting(id);
+ if (setting == nullptr || setting->GetType() != SettingType::List)
+ return false;
+
+ for (const auto item : std::static_pointer_cast<CSettingList>(setting)->GetValue())
+ if (item->GetType() == SettingType::Integer && std::static_pointer_cast<CSettingInt>(item)->GetValue() == value)
+ return true;
+
+ return false;
+}
+
bool CSettingsManager::SetDefault(const std::string &id)
{
CSharedLock lock(m_settingsCritical);
diff --git a/xbmc/settings/lib/SettingsManager.h b/xbmc/settings/lib/SettingsManager.h
index 958ee5988a..7ecc474830 100644
--- a/xbmc/settings/lib/SettingsManager.h
+++ b/xbmc/settings/lib/SettingsManager.h
@@ -416,6 +416,15 @@ public:
bool SetList(const std::string &id, const std::vector< std::shared_ptr<CSetting> > &value);
/*!
+ \brief Search in a list of Ints for a given value.
+
+ \param id Setting identifier
+ \param value value to search for
+ \return True if value was found in list, false otherwise
+ */
+ bool FindIntInList(const std::string &id, int value) const;
+
+ /*!
\brief Sets the value of the setting to its default.
\param id Setting identifier
diff --git a/xbmc/video/GUIViewStateVideo.cpp b/xbmc/video/GUIViewStateVideo.cpp
index 8dceac56fd..aba2787aab 100644
--- a/xbmc/video/GUIViewStateVideo.cpp
+++ b/xbmc/video/GUIViewStateVideo.cpp
@@ -47,7 +47,7 @@ std::string CGUIViewStateWindowVideo::GetExtensions()
return CServiceBroker::GetFileExtensionProvider().GetVideoExtensions();
}
-int CGUIViewStateWindowVideo::GetPlaylist()
+int CGUIViewStateWindowVideo::GetPlaylist() const
{
return PLAYLIST_VIDEO;
}
@@ -58,6 +58,13 @@ VECSOURCES& CGUIViewStateWindowVideo::GetSources()
return CGUIViewState::GetSources();
}
+bool CGUIViewStateWindowVideo::AutoPlayNextItem()
+{
+ return AutoPlayNextVideoItem();
+}
+
+/***************************/
+
CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
{
SortAttribute sortAttributes = SortAttributeNone;
@@ -398,7 +405,7 @@ bool CGUIViewStateWindowVideoNav::AutoPlayNextItem()
if (params.GetContentType() == VIDEODB_CONTENT_MUSICVIDEOS || params.GetContentType() == 6) // recently added musicvideos
return CServiceBroker::GetSettings().GetBool(CSettings::SETTING_MUSICPLAYER_AUTOPLAYNEXTITEM);
- return CServiceBroker::GetSettings().GetBool(CSettings::SETTING_VIDEOPLAYER_AUTOPLAYNEXTITEM);
+ return CGUIViewStateWindowVideo::AutoPlayNextItem();
}
CGUIViewStateWindowVideoPlaylist::CGUIViewStateWindowVideoPlaylist(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
diff --git a/xbmc/video/GUIViewStateVideo.h b/xbmc/video/GUIViewStateVideo.h
index 05d1572396..6feeaa6fa1 100644
--- a/xbmc/video/GUIViewStateVideo.h
+++ b/xbmc/video/GUIViewStateVideo.h
@@ -30,8 +30,9 @@ public:
protected:
VECSOURCES& GetSources() override;
std::string GetLockType() override;
- int GetPlaylist() override;
+ int GetPlaylist() const override;
std::string GetExtensions() override;
+ bool AutoPlayNextItem() override;
};
class CGUIViewStateWindowVideoNav : public CGUIViewStateWindowVideo
diff --git a/xbmc/view/GUIViewState.cpp b/xbmc/view/GUIViewState.cpp
index d45fde9d31..9757b9df36 100644
--- a/xbmc/view/GUIViewState.cpp
+++ b/xbmc/view/GUIViewState.cpp
@@ -60,6 +60,12 @@ using namespace PVR;
std::string CGUIViewState::m_strPlaylistDirectory;
VECSOURCES CGUIViewState::m_sources;
+static const int SETTING_AUTOPLAYNEXT_MUSICVIDEOS = 0;
+static const int SETTING_AUTOPLAYNEXT_TVSHOWS = 1;
+static const int SETTING_AUTOPLAYNEXT_EPISODES = 2;
+static const int SETTING_AUTOPLAYNEXT_MOVIES = 3;
+static const int SETTING_AUTOPLAYNEXT_UNCATEGORIZED = 4;
+
CGUIViewState* CGUIViewState::GetViewState(int windowId, const CFileItemList& items)
{
// don't expect derived classes to clear the sources
@@ -402,7 +408,7 @@ bool CGUIViewState::DisableAddSourceButtons()
return true;
}
-int CGUIViewState::GetPlaylist()
+int CGUIViewState::GetPlaylist() const
{
return m_playlist;
}
@@ -497,6 +503,26 @@ void CGUIViewState::SetSortOrder(SortOrder sortOrder)
m_sortMethods[m_currentSortMethod].m_sortDescription.sortOrder = sortOrder;
}
+bool CGUIViewState::AutoPlayNextVideoItem() const
+{
+ if (GetPlaylist() != PLAYLIST_VIDEO)
+ return false;
+
+ int settingValue(-1);
+ if (m_items.GetContent() == "musicvideos")
+ settingValue = SETTING_AUTOPLAYNEXT_MUSICVIDEOS;
+ else if (m_items.GetContent() == "tvshows")
+ settingValue = SETTING_AUTOPLAYNEXT_TVSHOWS;
+ else if (m_items.GetContent() == "episodes")
+ settingValue = SETTING_AUTOPLAYNEXT_EPISODES;
+ else if (m_items.GetContent() == "movies")
+ settingValue = SETTING_AUTOPLAYNEXT_MOVIES;
+ else
+ settingValue = SETTING_AUTOPLAYNEXT_UNCATEGORIZED;
+
+ return settingValue >= 0 && CServiceBroker::GetSettings().FindIntInList(CSettings::SETTING_VIDEOPLAYER_AUTOPLAYNEXTITEM, settingValue);
+}
+
void CGUIViewState::LoadViewState(const std::string &path, int windowID)
{ // get our view state from the db
CViewDatabase db;
@@ -589,15 +615,7 @@ CGUIViewStateFromItems::CGUIViewStateFromItems(const CFileItemList &items) : CGU
bool CGUIViewStateFromItems::AutoPlayNextItem()
{
- if (m_items.GetContent() == "musicvideos" ||
- m_items.GetContent() == "tvshows" ||
- m_items.GetContent() == "episodes" ||
- m_items.GetContent() == "movies")
- {
- return CServiceBroker::GetSettings().GetBool(CSettings::SETTING_VIDEOPLAYER_AUTOPLAYNEXTITEM);
- }
-
- return false;
+ return AutoPlayNextVideoItem();
}
void CGUIViewStateFromItems::SaveViewState()
diff --git a/xbmc/view/GUIViewState.h b/xbmc/view/GUIViewState.h
index c08d6644c9..02d0484f14 100644
--- a/xbmc/view/GUIViewState.h
+++ b/xbmc/view/GUIViewState.h
@@ -55,7 +55,7 @@ public:
virtual bool HideParentDirItems();
virtual bool DisableAddSourceButtons();
- virtual int GetPlaylist();
+ virtual int GetPlaylist() const;
const std::string& GetPlaylistDirectory();
void SetPlaylistDirectory(const std::string& strDirectory);
bool IsCurrentPlaylistDirectory(const std::string& strDirectory);
@@ -94,6 +94,8 @@ protected:
void SetSortMethod(SortDescription sortDescription);
void SetSortOrder(SortOrder sortOrder);
+ bool AutoPlayNextVideoItem() const;
+
const CFileItemList& m_items;
int m_currentViewAsControl;