diff options
-rwxr-xr-x | language/English/strings.po | 14 | ||||
-rw-r--r-- | system/settings/settings.xml | 11 | ||||
-rw-r--r-- | xbmc/addons/AddonInstaller.h | 6 | ||||
-rw-r--r-- | xbmc/addons/GUIWindowAddonBrowser.cpp | 29 | ||||
-rw-r--r-- | xbmc/addons/Repository.cpp | 2 | ||||
-rw-r--r-- | xbmc/pvr/PVRManager.cpp | 2 |
6 files changed, 57 insertions, 7 deletions
diff --git a/language/English/strings.po b/language/English/strings.po index fb26ead6b5..b6b521e035 100755 --- a/language/English/strings.po +++ b/language/English/strings.po @@ -4914,7 +4914,19 @@ msgctxt "#12395" msgid "Battery level" msgstr "" -#empty strings from id 12396 to 12599 +#. Used on the button to toggle add-on update mode in the Add-on Manager. +#: xbmc/addons/GUIWindowAddonBrowser.cpp +msgctxt "#12396" +msgid "Auto updates: On" +msgstr "" + +#. Used on the button to toggle add-on update mode in the Add-on Manager. +#: xbmc/addons/GUIWindowAddonBrowser.cpp +msgctxt "#12397" +msgid "Auto updates: Notify" +msgstr "" + +#empty strings from id 12398 to 12599 #: xbmc/guilib/WindowIDs.h msgctxt "#12600" diff --git a/system/settings/settings.xml b/system/settings/settings.xml index 391bcee967..86cbe1d0d3 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -2981,9 +2981,16 @@ </category> <category id="general" label="" help="36412"> <group id="1"> - <setting id="general.addonautoupdate" type="boolean" label="0" help="36413"> + <setting id="general.addonupdates" type="integer" label="0" help="36413"> <level>4</level> - <default>true</default> + <default>0</default> + <constraints> + <options> + <option label="12396">0</option> <!-- AUTO_UPDATES_ON --> + <option label="12397">1</option> <!-- AUTO_UPDATES_NOTIFY --> + </options> + </constraints> + <control type="spinner" format="string" /> </setting> <setting id="general.addonnotifications" type="boolean" label="0" help="36414"> <level>4</level> diff --git a/xbmc/addons/AddonInstaller.h b/xbmc/addons/AddonInstaller.h index eb8ae11db9..c804af892a 100644 --- a/xbmc/addons/AddonInstaller.h +++ b/xbmc/addons/AddonInstaller.h @@ -26,6 +26,12 @@ class CAddonDatabase; +enum { + AUTO_UPDATES_ON = 0, + AUTO_UPDATES_NOTIFY, + AUTO_UPDATES_MAX +}; + class CAddonInstaller : public IJobCallback { public: diff --git a/xbmc/addons/GUIWindowAddonBrowser.cpp b/xbmc/addons/GUIWindowAddonBrowser.cpp index 39af35672f..0eaf8a507f 100644 --- a/xbmc/addons/GUIWindowAddonBrowser.cpp +++ b/xbmc/addons/GUIWindowAddonBrowser.cpp @@ -89,7 +89,12 @@ bool CGUIWindowAddonBrowser::OnMessage(CGUIMessage& message) int iControl = message.GetSenderId(); if (iControl == CONTROL_AUTOUPDATE) { - CSettings::Get().ToggleBool("general.addonautoupdate"); + const CGUIControl *control = GetControl(CONTROL_AUTOUPDATE); + if (control && control->GetControlType() == CGUIControl::GUICONTROL_BUTTON) + CSettings::Get().SetInt("general.addonupdates", (CSettings::Get().GetInt("general.addonupdates")+1) % AUTO_UPDATES_MAX); + else + CSettings::Get().SetInt("general.addonupdates", (CSettings::Get().GetInt("general.addonupdates") == 0) ? 1 : 0); + UpdateButtons(); return true; } else if (iControl == CONTROL_SHUTUP) @@ -271,7 +276,27 @@ bool CGUIWindowAddonBrowser::OnClick(int iItem) void CGUIWindowAddonBrowser::UpdateButtons() { - SET_CONTROL_SELECTED(GetID(),CONTROL_AUTOUPDATE, CSettings::Get().GetBool("general.addonautoupdate")); + const CGUIControl *control = GetControl(CONTROL_AUTOUPDATE); + if (control && control->GetControlType() == CGUIControl::GUICONTROL_BUTTON) + { // set label + CSettingInt *setting = (CSettingInt *)CSettings::Get().GetSetting("general.addonupdates"); + if (setting) + { + const StaticIntegerSettingOptions& options = setting->GetOptions(); + for (StaticIntegerSettingOptions::const_iterator it = options.begin(); it != options.end(); ++it) + { + if (it->second == setting->GetValue()) + { + SET_CONTROL_LABEL(CONTROL_AUTOUPDATE, it->first); + break; + } + } + } + } + else + { // old skin with toggle button - set on if auto updates are on + SET_CONTROL_SELECTED(GetID(),CONTROL_AUTOUPDATE, CSettings::Get().GetInt("general.addonupdates") == AUTO_UPDATES_ON); + } SET_CONTROL_SELECTED(GetID(),CONTROL_SHUTUP, CSettings::Get().GetBool("general.addonnotifications")); SET_CONTROL_SELECTED(GetID(),CONTROL_FOREIGNFILTER, CSettings::Get().GetBool("general.addonforeignfilter")); CGUIMediaWindow::UpdateButtons(); diff --git a/xbmc/addons/Repository.cpp b/xbmc/addons/Repository.cpp index d5a44823db..4ebc450ce5 100644 --- a/xbmc/addons/Repository.cpp +++ b/xbmc/addons/Repository.cpp @@ -276,7 +276,7 @@ bool CRepositoryUpdateJob::DoWork() !database.IsAddonBlacklisted(newAddon->ID(),newAddon->Version().asString()) && deps_met) { - if (CSettings::Get().GetBool("general.addonautoupdate") || addon->Type() >= ADDON_VIZ_LIBRARY) + if (CSettings::Get().GetInt("general.addonupdates") == AUTO_UPDATES_ON || addon->Type() >= ADDON_VIZ_LIBRARY) { string referer; if (URIUtils::IsInternetStream(newAddon->Path())) diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp index 0ba0382894..ac0de74e1f 100644 --- a/xbmc/pvr/PVRManager.cpp +++ b/xbmc/pvr/PVRManager.cpp @@ -208,7 +208,7 @@ bool CPVRManager::InstallAddonAllowed(const std::string& strAddonId) const void CPVRManager::MarkAsOutdated(const std::string& strAddonId, const std::string& strReferer) { - if (IsStarted() && CSettings::Get().GetBool("general.addonautoupdate")) + if (IsStarted() && CSettings::Get().GetInt("general.addonupdates") == AUTO_UPDATES_ON) { CSingleLock lock(m_critSection); m_outdatedAddons.insert(make_pair(strAddonId, strReferer)); |