diff options
author | BigNoid <big.noid@kodi.tv> | 2015-09-15 22:01:56 +0200 |
---|---|---|
committer | BigNoid <big.noid@kodi.tv> | 2015-09-17 16:48:41 +0200 |
commit | 3568379751e0982ad33f148243075874775223d2 (patch) | |
tree | a9a593fdef41fa271a3a502a1731c470f194d0ee | |
parent | 00c3034824a79933e338483532321d556c9c94b4 (diff) |
[guilib] reduce duplicate code
-rw-r--r-- | xbmc/GUIInfoManager.cpp | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index 566b5df7e7..26214ac00a 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -1203,44 +1203,24 @@ int CGUIInfoManager::TranslateSingleString(const std::string &strCondition, bool return AddMultiInfo(GUIInfo(CONTAINER_SORT_DIRECTION, order)); } } - else if (cat.name == "listitem") + else if (cat.name == "listitem" || cat.name == "listitemposition" + || cat.name == "listitemnowrap" || cat.name == "listitemabsolute") { int offset = atoi(cat.param().c_str()); int ret = TranslateListItem(prop); if (ret) listItemDependent = true; if (offset) - return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_WRAP)); - return ret; - } - else if (cat.name == "listitemposition") - { - int offset = atoi(cat.param().c_str()); - int ret = TranslateListItem(prop); - if (ret) - listItemDependent = true; - if (offset) - return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_POSITION)); - return ret; - } - else if (cat.name == "listitemnowrap") - { - int offset = atoi(cat.param().c_str()); - int ret = TranslateListItem(prop); - if (ret) - listItemDependent = true; - if (offset) - return AddMultiInfo(GUIInfo(ret, 0, offset)); - return ret; - } - else if (cat.name == "listitemabsolute") - { - int offset = atoi(cat.param().c_str()); - int ret = TranslateListItem(prop); - if (ret) - listItemDependent = true; - if (offset) - return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_ABSOLUTE)); + { + if (cat.name == "listitem") + return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_WRAP)); + else if (cat.name == "listitemposition") + return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_POSITION)); + else if (cat.name == "listitemabsolute") + return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_ABSOLUTE)); + else if (cat.name == "listitemnowrap") + return AddMultiInfo(GUIInfo(ret, 0, offset)); + } return ret; } else if (cat.name == "visualisation") |