Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[Fix for 13160] Update supported settings types in AddonDll.h #1136

Merged
1 commit merged into from

1 participant

@PartialGestalt

Squash multiple commits for previous pull request (#1132) into a single commit.

@ghost

you don't have to close and open a new pr. a pr tracks a branch. just push -f the branch, and the pr updates.

@ghost ghost merged commit 5cf0afc into xbmc:master
@ghost

.. and thanks :)

@PartialGestalt

No worries -- you have done some amazing work here; just happy to help wherever I can.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 8, 2012
  1. Resync CAddonDll::TransferSettings types with core

    PartialGestalt authored
This page is out of date. Refresh to see the latest.
Showing with 32 additions and 7 deletions.
  1. +32 −7 xbmc/addons/AddonDll.h
View
39 xbmc/addons/AddonDll.h
@@ -398,19 +398,26 @@ ADDON_STATUS CAddonDll<TheDll, TheStruct, TheProps>::TransferSettings()
ADDON_STATUS status = ADDON_STATUS_OK;
const char *id = setting->Attribute("id");
const char *type = setting->Attribute("type");
+ const char *option = setting->Attribute("option");
if (type)
{
- if (strcmpi(type, "text") == 0 || strcmpi(type, "ipaddress") == 0 ||
- strcmpi(type, "folder") == 0 || strcmpi(type, "action") == 0 ||
- strcmpi(type, "music") == 0 || strcmpi(type, "pictures") == 0 ||
- strcmpi(type, "folder") == 0 || strcmpi(type, "programs") == 0 ||
- strcmpi(type, "files") == 0 || strcmpi(type, "fileenum") == 0)
+ if (strcmpi(type,"sep") == 0 || strcmpi(type,"lsep") == 0)
+ {
+ /* Don't propagate separators */
+ }
+ else if (strcmpi(type, "text") == 0 || strcmpi(type, "ipaddress") == 0 ||
+ strcmpi(type, "video") == 0 || strcmpi(type, "audio") == 0 ||
+ strcmpi(type, "image") == 0 || strcmpi(type, "folder") == 0 ||
+ strcmpi(type, "executable") == 0 || strcmpi(type, "file") == 0 ||
+ strcmpi(type, "action") == 0 || strcmpi(type, "date") == 0 ||
+ strcmpi(type, "time") == 0 || strcmpi(type, "select") == 0 ||
+ strcmpi(type, "addon") == 0 || strcmpi(type, "labelenum") == 0 ||
+ strcmpi(type, "fileenum") == 0 )
{
status = m_pDll->SetSetting(id, (const char*) GetSetting(id).c_str());
}
- else if (strcmpi(type, "integer") == 0 || strcmpi(type, "enum") == 0 ||
- strcmpi(type, "labelenum") == 0 || strcmpi(type, "rangeofnum") == 0)
+ else if (strcmpi(type, "enum") == 0)
{
int tmp = atoi(GetSetting(id));
status = m_pDll->SetSetting(id, (int*) &tmp);
@@ -420,9 +427,27 @@ ADDON_STATUS CAddonDll<TheDll, TheStruct, TheProps>::TransferSettings()
bool tmp = (GetSetting(id) == "true") ? true : false;
status = m_pDll->SetSetting(id, (bool*) &tmp);
}
+ else if (strcmpi(type, "rangeofnum") == 0 || strcmpi(type, "slider") == 0 ||
+ strcmpi(type, "number") == 0)
+ {
+ float tmpf = atof(GetSetting(id));
+ int tmpi;
+
+ if (option && strcmpi(option,"int") == 0)
+ {
+ tmpi = (int)floor(tmpf);
+ status = m_pDll->SetSetting(id, (int*) &tmpi);
+ }
+ else
+ {
+ status = m_pDll->SetSetting(id, (float*) &tmpf);
+ }
+ }
else
{
+ /* Log unknowns as an error, but go ahead and transfer the string */
CLog::Log(LOGERROR, "Unknown setting type '%s' for %s", type, Name().c_str());
+ status = m_pDll->SetSetting(id, (const char*) GetSetting(id).c_str());
}
if (status == ADDON_STATUS_NEED_RESTART)
Something went wrong with that request. Please try again.