diff options
author | jmarshallnz <jmarshallnz@svn> | 2010-05-31 10:29:00 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2010-05-31 10:29:00 +0000 |
commit | 0cefd50177442de30e6e7fd40f00a0046ea2af29 (patch) | |
tree | a80909f11bd5b73d838372d56e390768dd6c1c16 | |
parent | dc7b5669f64a4a37333cb274c398d99d069be3fb (diff) |
changed: Moved builtin screensavers to addons so that we can utilize the settings structure
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@30711 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r-- | addons/screensaver.xbmc.builtin.black/addon.xml | 12 | ||||
-rw-r--r-- | addons/screensaver.xbmc.builtin.dim/addon.xml | 12 | ||||
-rw-r--r-- | addons/screensaver.xbmc.builtin.dim/resources/language/English/strings.xml | 4 | ||||
-rw-r--r-- | addons/screensaver.xbmc.builtin.dim/resources/settings.xml | 4 | ||||
-rw-r--r-- | addons/screensaver.xbmc.builtin.slideshow/addon.xml | 12 | ||||
-rw-r--r-- | addons/screensaver.xbmc.builtin.slideshow/resources/language/English/strings.xml | 8 | ||||
-rw-r--r-- | addons/screensaver.xbmc.builtin.slideshow/resources/settings.xml | 5 | ||||
-rw-r--r-- | language/English/strings.xml | 2 | ||||
-rw-r--r-- | xbmc/Application.cpp | 52 | ||||
-rw-r--r-- | xbmc/GUISettings.cpp | 10 | ||||
-rw-r--r-- | xbmc/GUIWindowAddonBrowser.cpp | 10 | ||||
-rw-r--r-- | xbmc/GUIWindowSettingsCategory.cpp | 36 | ||||
-rw-r--r-- | xbmc/addons/AddonManager.cpp | 4 |
13 files changed, 111 insertions, 60 deletions
diff --git a/addons/screensaver.xbmc.builtin.black/addon.xml b/addons/screensaver.xbmc.builtin.black/addon.xml new file mode 100644 index 0000000000..3c98eed50d --- /dev/null +++ b/addons/screensaver.xbmc.builtin.black/addon.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<addon id="screensaver.xbmc.builtin.black"
+ name="Black"
+ version="1.0.0"
+ provider-name="Team XBMC">
+ <extension point="xbmc.ui.screensaver" library=""/>
+ <extension point="xbmc.addon.metadata">
+ <summary>Built-in black screensaver</summary>
+ <description>Simple black screen screensaver.</description>
+ <platform>all</platform>
+ </extension>
+</addon>
diff --git a/addons/screensaver.xbmc.builtin.dim/addon.xml b/addons/screensaver.xbmc.builtin.dim/addon.xml new file mode 100644 index 0000000000..d236f456e7 --- /dev/null +++ b/addons/screensaver.xbmc.builtin.dim/addon.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<addon id="screensaver.xbmc.builtin.dim"
+ name="Dim"
+ version="1.0.0"
+ provider-name="Team XBMC">
+ <extension point="xbmc.ui.screensaver" library=""/>
+ <extension point="xbmc.addon.metadata">
+ <summary>Built-in, dim screensaver</summary>
+ <description>Simple screen screensaver that dims the screen.</description>
+ <platform>all</platform>
+ </extension>
+</addon>
diff --git a/addons/screensaver.xbmc.builtin.dim/resources/language/English/strings.xml b/addons/screensaver.xbmc.builtin.dim/resources/language/English/strings.xml new file mode 100644 index 0000000000..146be60d85 --- /dev/null +++ b/addons/screensaver.xbmc.builtin.dim/resources/language/English/strings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<strings> + <string id="30000">Dim level</string> +</strings> diff --git a/addons/screensaver.xbmc.builtin.dim/resources/settings.xml b/addons/screensaver.xbmc.builtin.dim/resources/settings.xml new file mode 100644 index 0000000000..db4b867e7b --- /dev/null +++ b/addons/screensaver.xbmc.builtin.dim/resources/settings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<settings> + <setting label="30000" type="slider" id="level" range="20,1,100" default="20"/> +</settings> diff --git a/addons/screensaver.xbmc.builtin.slideshow/addon.xml b/addons/screensaver.xbmc.builtin.slideshow/addon.xml new file mode 100644 index 0000000000..53f0eb6b27 --- /dev/null +++ b/addons/screensaver.xbmc.builtin.slideshow/addon.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<addon id="screensaver.xbmc.builtin.slideshow"
+ name="Slideshow"
+ version="1.0.0"
+ provider-name="Team XBMC">
+ <extension point="xbmc.ui.screensaver" library=""/>
+ <extension point="xbmc.addon.metadata">
+ <summary>Slideshow screensaver</summary>
+ <description>Can be configured to show music or video fanart, or a folder of images</description>
+ <platform>all</platform>
+ </extension>
+</addon>
diff --git a/addons/screensaver.xbmc.builtin.slideshow/resources/language/English/strings.xml b/addons/screensaver.xbmc.builtin.slideshow/resources/language/English/strings.xml new file mode 100644 index 0000000000..81305b8a7b --- /dev/null +++ b/addons/screensaver.xbmc.builtin.slideshow/resources/language/English/strings.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<strings> + <string id="30000">Source of slideshow images</string> + <string id="30001">Folder</string> + <string id="30002">Video Fanart</string> + <string id="30003">Music Fanart</string> + <string id="30004">Image Folder</string> +</strings> diff --git a/addons/screensaver.xbmc.builtin.slideshow/resources/settings.xml b/addons/screensaver.xbmc.builtin.slideshow/resources/settings.xml new file mode 100644 index 0000000000..8938d8acaa --- /dev/null +++ b/addons/screensaver.xbmc.builtin.slideshow/resources/settings.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<settings> + <setting label="30000" type="enum" id="type" default="0" lvalues="30002|30003|30004"/> + <setting label="30001" type="folder" id="path" default="" enable="eq(-1,2)"/> +</settings> diff --git a/language/English/strings.xml b/language/English/strings.xml index b10b63d7d6..b4310ae635 100644 --- a/language/English/strings.xml +++ b/language/English/strings.xml @@ -682,7 +682,7 @@ <string id="851">Valid port range is 1-65535</string> <string id="852">Valid port range is 1024-65535</string> - <string id="1000">Screensaver preview</string> + <string id="1000">- Preview</string> <string id="1001">Unable to connect</string> <string id="1002">XBMC was unable to connect to the network location.</string> <string id="1003">This could be due to the network not being connected.</string> diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index e5b4a6c64a..a81c800256 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -1881,13 +1881,17 @@ static int screenSaverFadeAmount = 0; void CApplication::RenderScreenSaver() { - bool draw = false; - float amount = 0.0f; - if (m_screenSaverMode == "_virtual.dim") - amount = 1.0f - g_guiSettings.GetInt("screensaver.dimlevel")*0.01f; - else if (m_screenSaverMode == "_virtual.blk") - amount = 1.0f; // fully fade + if (m_screenSaverMode != "screensaver.xbmc.builtin.dim" && + m_screenSaverMode != "screensaver.xbmc.builtin.black") + return; // nothing to do + + float amount = 1.0f; + AddonPtr addon; + if (CAddonMgr::Get().GetAddon(m_screenSaverMode, addon) && addon->LoadSettings()) + amount = 1.0f - 0.01f * atof(addon->GetSetting("level")); + // special case for dim screensaver + bool draw = false; if (amount > 0.f) { if (m_bScreenSave) @@ -1984,7 +1988,7 @@ void CApplication::Render() int nDelayTime = 0; // Less fps in DPMS or Black screensaver bool lowfps = (m_dpmsIsActive - || (m_bScreenSave && (m_screenSaverMode == "_virtual.blk") + || (m_bScreenSave && (m_screenSaverMode == "screensaver.xbmc.builtin.black") && (screenSaverFadeAmount >= 100))); // Whether externalplayer is playing and we're unfocused bool extPlayerActive = m_eCurrentPlayer >= EPC_EXTPLAYER && IsPlaying() && !m_AppFocused; @@ -4228,7 +4232,7 @@ bool CApplication::WakeUpScreenSaver() if (g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && (g_settings.UsingLoginScreen() || g_guiSettings.GetBool("masterlock.startuplock")) && g_settings.GetCurrentProfile().getLockMode() != LOCK_MODE_EVERYONE && - m_screenSaverMode != "_virtual.dim" && m_screenSaverMode != "_virtual.blk" && m_screenSaverMode != "_virtual.viz") + m_screenSaverMode != "screensaver.xbmc.builtin.dim" && m_screenSaverMode != "screensaver.xbmc.builtin.black" && m_screenSaverMode != "_virtual.viz") { m_iScreenSaveLock = 2; CGUIMessage msg(GUI_MSG_CHECK_LOCK,0,0); @@ -4245,12 +4249,12 @@ bool CApplication::WakeUpScreenSaver() m_iScreenSaveLock = 0; ResetScreenSaverTimer(); - if (m_screenSaverMode == "_virtual.viz" || m_screenSaverMode == "_virtual.pic" || m_screenSaverMode == "_virtual.fan") + if (m_screenSaverMode == "_virtual.viz" || m_screenSaverMode == "screensaver.xbmc.builtin.slideshow") { // we can just continue as usual from vis mode return false; } - else if (m_screenSaverMode == "_virtual.dim" || m_screenSaverMode == "_virtual.blk") + else if (m_screenSaverMode == "screensaver.xbmc.builtin.dim" || m_screenSaverMode == "screensaver.xbmc.builtin.black") return true; else if (m_screenSaverMode != "_virtual.none") { // we're in screensaver window @@ -4330,7 +4334,7 @@ void CApplication::ActivateScreenSaver(bool forceType /*= false */) { // set to Dim in the case of a dialog on screen or playing video if (g_windowManager.HasModalDialog() || (IsPlayingVideo() && g_guiSettings.GetBool("screensaver.usedimonpause"))) - m_screenSaverMode = "_virtual.dim"; + m_screenSaverMode = "screensaver.xbmc.builtin.dim"; // Check if we are Playing Audio and Vis instead Screensaver! else if (IsPlayingAudio() && g_guiSettings.GetBool("screensaver.usemusicvisinstead") && g_guiSettings.GetString("musicplayer.visualisation") != "_virtual.none") { // activate the visualisation @@ -4340,21 +4344,27 @@ void CApplication::ActivateScreenSaver(bool forceType /*= false */) } } // Picture slideshow - if (m_screenSaverMode == "_virtual.pic" || m_screenSaverMode == "_virtual.fan") + if (m_screenSaverMode == "screensaver.xbmc.builtin.slideshow") { - // reset our codec info - don't want that on screen - g_infoManager.SetShowCodec(false); - CStdString path = g_guiSettings.GetString("screensaver.slideshowpath"); - if (path.IsEmpty()) + AddonPtr addon; + if (CAddonMgr::Get().GetAddon(m_screenSaverMode, addon) && addon->LoadSettings()) { - path = "special://profile/thumbnails/Video/Fanart"; - CLog::Log(LOGERROR,"No slideshow screensaver path set, defaulting to the available video fanart"); + // reset our codec info - don't want that on screen + g_infoManager.SetShowCodec(false); + CStdString type = addon->GetSetting("type"); + CStdString path = addon->GetSetting("path"); + if (type == "2" && path.IsEmpty()) + type = "0"; + if (type == "0") + path = "special://profile/thumbnails/Video/Fanart"; + if (type == "1") + path = "special://profile/thumbnails/Music/Fanart"; + m_applicationMessenger.PictureSlideShow(path, true, type != "2"); } - m_applicationMessenger.PictureSlideShow(path, true); } - else if (m_screenSaverMode == "_virtual.dim") + else if (m_screenSaverMode == "screensaver.xbmc.builtin.dim") return; - else if (m_screenSaverMode == "_virtual.blk") + else if (m_screenSaverMode == "screensaver.xbmc.builtin.black") return; else if (m_screenSaverMode != "_virtual.none") g_windowManager.ActivateWindow(WINDOW_SCREENSAVER); diff --git a/xbmc/GUISettings.cpp b/xbmc/GUISettings.cpp index 27a2f06948..af5e4aaea1 100644 --- a/xbmc/GUISettings.cpp +++ b/xbmc/GUISettings.cpp @@ -761,14 +761,12 @@ void CGUISettings::Initialize() CSettingsCategory* ss = AddCategory(7, "screensaver", 360); AddInt(ss, "screensaver.time", 355, 3, 1, 1, 60, SPIN_CONTROL_INT_PLUS, MASK_MINS); - AddDefaultAddon(ss, "screensaver.mode", 356, "_virtual.dim", ADDON_SCREENSAVER); + AddDefaultAddon(ss, "screensaver.mode", 356, "screensaver.xbmc.builtin.dim", ADDON_SCREENSAVER); + AddString(ss, "screensaver.settings", 21417, "", BUTTON_CONTROL_STANDARD); + AddString(ss, "screensaver.preview", 1000, "", BUTTON_CONTROL_STANDARD); + AddSeparator(ss, "screensaver.sep1"); AddBool(ss, "screensaver.usemusicvisinstead", 13392, true); AddBool(ss, "screensaver.usedimonpause", 22014, true); - AddSeparator(ss, "screensaver.sep1"); - AddInt(ss, "screensaver.dimlevel", 362, 20, 0, 10, 80, SPIN_CONTROL_INT_PLUS, MASK_PERCENT); - AddPath(ss, "screensaver.slideshowpath", 774, "", BUTTON_CONTROL_PATH_INPUT, false, 657); - AddSeparator(ss, "screensaver.sep2"); - AddString(ss, "screensaver.preview", 1000, "", BUTTON_CONTROL_STANDARD); AddCategory(7, "window", 0); AddInt(NULL, "window.width", 0, 720, 10, 1, INT_MAX, SPIN_CONTROL_INT); diff --git a/xbmc/GUIWindowAddonBrowser.cpp b/xbmc/GUIWindowAddonBrowser.cpp index 9665bc848a..1fff140174 100644 --- a/xbmc/GUIWindowAddonBrowser.cpp +++ b/xbmc/GUIWindowAddonBrowser.cpp @@ -511,16 +511,8 @@ bool CGUIWindowAddonBrowser::SelectAddonID(TYPE type, CStdString &addonID, bool if (showNone) items.Add(GetFileItem("", 231)); // add some built in options... - if (type == ADDON_VIZ) + if (type == ADDON_VIZ || type == ADDON_SCREENSAVER) items.Add(GetFileItem("_virtual.none", 231)); - if (type == ADDON_SCREENSAVER) - { - items.Add(GetFileItem("_virtual.none", 231)); - items.Add(GetFileItem("_virtual.dim", 352)); - items.Add(GetFileItem("_virtual.blk", 353)); - items.Add(GetFileItem("_virtual.pic", 108)); - items.Add(GetFileItem("_virtual.fan", 20425)); - } for (ADDON::IVECADDONS i = addons.begin(); i != addons.end(); ++i) items.Add(CAddonsDirectory::FileItemFromAddon(*i, "")); dialog->SetItems(&items); diff --git a/xbmc/GUIWindowSettingsCategory.cpp b/xbmc/GUIWindowSettingsCategory.cpp index d5b43331a4..72bce2b289 100644 --- a/xbmc/GUIWindowSettingsCategory.cpp +++ b/xbmc/GUIWindowSettingsCategory.cpp @@ -901,29 +901,22 @@ void CGUIWindowSettingsCategory::UpdateSettings() // CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID()); // if (pControl) pControl->SetEnabled(g_guiSettings.GetString("lookandfeel.font").Right(4) == ".ttf"); } - else if (strSetting.Equals("screensaver.dimlevel")) + else if (strSetting.Equals("screensaver.settings")) { - CGUIControl *pControl = (CGUIControl *)GetControl(GetSetting(strSetting)->GetID()); - pControl->SetEnabled(g_guiSettings.GetString("screensaver.mode") == "_virtual.dim"); - } - else if (strSetting.Equals("screensaver.slideshowpath")) - { - CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(GetSetting(strSetting)->GetID()); - pControl->SetEnabled(g_guiSettings.GetString("screensaver.mode") == "_virtual.pic"); - } - else if (strSetting.Equals("screensaver.slideshowshuffle")) - { - CGUIControl *pControl = (CGUIControl *)GetControl(GetSetting(strSetting)->GetID()); - pControl->SetEnabled(g_guiSettings.GetString("screensaver.mode") == "_virtual.pic" || - g_guiSettings.GetString("screensaver.mode") == "_virtual.fan"); + CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID()); + AddonPtr addon; + if (CAddonMgr::Get().GetAddon(g_guiSettings.GetString("screensaver.mode"), addon, ADDON_SCREENSAVER)) + pControl->SetEnabled(addon->HasSettings()); + else + pControl->SetEnabled(false); } else if (strSetting.Equals("screensaver.preview") || strSetting.Equals("screensaver.usedimonpause") || strSetting.Equals("screensaver.usemusicvisinstead")) { CGUIControl *pControl = (CGUIControl *)GetControl(GetSetting(strSetting)->GetID()); - pControl->SetEnabled(g_guiSettings.GetString("screensaver.mode") != "None"); - if (strSetting.Equals("screensaver.usedimonpause") && g_guiSettings.GetString("screensaver.mode").Equals("_virtual.dim")) + pControl->SetEnabled(g_guiSettings.GetString("screensaver.mode") != "_virtual.none"); + if (strSetting.Equals("screensaver.usedimonpause") && g_guiSettings.GetString("screensaver.mode").Equals("screensaver.xbmc.builtin.dim")) pControl->SetEnabled(false); } else if (strSetting.Left(16).Equals("weather.areacode")) @@ -1564,14 +1557,11 @@ void CGUIWindowSettingsCategory::OnSettingChanged(CBaseSettingControl *pSettingC { g_application.ActivateScreenSaver(true); } - else if (strSetting.Equals("screensaver.slideshowpath")) + else if (strSetting.Equals("screensaver.settings")) { - CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting(); - CStdString path = pSettingString->GetData(); - VECSOURCES shares = g_settings.m_pictureSources; - g_mediaManager.GetLocalDrives(shares); - if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares, g_localizeStrings.Get(pSettingString->m_iHeadingString), path)) - pSettingString->SetData(path); + AddonPtr addon; + if (CAddonMgr::Get().GetAddon(g_guiSettings.GetString("screensaver.mode"), addon, ADDON_SCREENSAVER)) + CGUIDialogAddonSettings::ShowAndGetInput(addon); } else if (strSetting.Equals("debug.screenshotpath") || strSetting.Equals("audiocds.recordingpath") || strSetting.Equals("subtitles.custompath")) { diff --git a/xbmc/addons/AddonManager.cpp b/xbmc/addons/AddonManager.cpp index 452a1fde8e..33f3720ab5 100644 --- a/xbmc/addons/AddonManager.cpp +++ b/xbmc/addons/AddonManager.cpp @@ -101,6 +101,10 @@ AddonPtr CAddonMgr::Factory(const cp_extension_t *props) // ideally platforms issues will be handled by C-Pluff // this is not an attempt at a solution CStdString value; + if (type == ADDON_SCREENSAVER && 0 == strnicmp(props->plugin->identifier, "screensaver.xbmc.builtin.", 25)) + { // built in screensaver + return AddonPtr(new CAddon(props)); + } #if defined(_LINUX) && !defined(__APPLE__) if ((value = GetExtValue(props->plugin->extensions->configuration, "@library_linux")) && value.empty()) break; |