Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added: addon.set.default built-in to set the default for a particular…

… addon type from a button control. Thanks to spiff.

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@31284 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information...
commit 730b6da25d0ae3aa360a786bcff81fcf34e32b5e 1 parent cb67d3d
jmarshallnz authored
View
35 xbmc/addons/AddonManager.cpp
@@ -333,6 +333,9 @@ bool CAddonMgr::GetDefault(const TYPE &type, AddonPtr &addon)
case ADDON_VIZ:
setting = g_guiSettings.GetString("musicplayer.visualisation");
break;
+ case ADDON_SCREENSAVER:
+ setting = g_guiSettings.GetString("screensaver.mode");
+ break;
case ADDON_SCRAPER_ALBUMS:
setting = g_guiSettings.GetString("musiclibrary.albumsscraper");
break;
@@ -354,6 +357,38 @@ bool CAddonMgr::GetDefault(const TYPE &type, AddonPtr &addon)
return GetAddon(setting, addon, type);
}
+bool CAddonMgr::SetDefault(const TYPE &type, const CStdString &addonID)
+{
+ switch (type)
+ {
+ case ADDON_VIZ:
+ g_guiSettings.SetString("musicplayer.visualisation",addonID);
+ break;
+ case ADDON_SCREENSAVER:
+ g_guiSettings.SetString("screensaver.mode",addonID);
+ break;
+ case ADDON_SCRAPER_ALBUMS:
+ g_guiSettings.SetString("musiclibrary.albumsscraper",addonID);
+ break;
+ case ADDON_SCRAPER_ARTISTS:
+ g_guiSettings.SetString("musiclibrary.artistsscraper",addonID);
+ break;
+ case ADDON_SCRAPER_MOVIES:
+ g_guiSettings.SetString("scrapers.moviesdefault",addonID);
+ break;
+ case ADDON_SCRAPER_MUSICVIDEOS:
+ g_guiSettings.SetString("scrapers.musicvideosdefault",addonID);
+ break;
+ case ADDON_SCRAPER_TVSHOWS:
+ g_guiSettings.SetString("scrapers.tvshowsdefault",addonID);
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
CStdString CAddonMgr::GetString(const CStdString &id, const int number)
{
AddonPtr addon;
View
1  xbmc/addons/AddonManager.h
@@ -85,6 +85,7 @@ namespace ADDON
/* Addon access */
bool GetDefault(const TYPE &type, AddonPtr &addon);
+ bool SetDefault(const TYPE &type, const CStdString &addonID);
bool GetAddon(const CStdString &str, AddonPtr &addon, const TYPE &type = ADDON_UNKNOWN, bool enabled = true);
bool HasAddons(const TYPE &type, bool enabled = true);
bool GetAddons(const TYPE &type, VECADDONS &addons, bool enabled = true);
View
11 xbmc/utils/Builtins.cpp
@@ -181,6 +181,7 @@ const BUILT_IN commands[] = {
{ "PlayWith", true, "Play the selected item with the specified core" },
{ "WakeOnLan", true, "Sends the wake-up packet to the broadcast address for the specified MAC address" },
{ "Addon.Default.OpenSettings", true, "Open a settings dialog for the default addon of the given type" },
+ { "Addon.Default.Set", true, "Open a select dialog to allow choosing the default addon of the given type" },
{ "ToggleDPMS", false, "Toggle DPMS mode manually"},
#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE)
{ "LIRC.Stop", false, "Removes XBMC as LIRC client" },
@@ -1307,6 +1308,16 @@ int CBuiltins::Execute(const CStdString& execString)
g_windowManager.SendMessage(GUI_MSG_VISUALISATION_RELOAD, 0, 0);
}
}
+ else if (execute.Equals("addon.default.set") && params.size() == 1)
+ {
+ CStdString addonID;
+ TYPE type = TranslateType(params[0]);
+ if (type != ADDON_UNKNOWN &&
+ CGUIWindowAddonBrowser::SelectAddonID(type,addonID,false))
+ {
+ CAddonMgr::Get().SetDefault(type,addonID);
+ }
+ }
else if (execute.Equals("toggledpms"))
{
g_application.ToggleDPMS(true);
Please sign in to comment.
Something went wrong with that request. Please try again.