Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions xbmc/guilib/GUIBaseContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ using namespace KODI;
#define SCROLLING_GAP 200U
#define SCROLLING_THRESHOLD 300U

CGUIBaseContainer::CGUIBaseContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems)
CGUIBaseContainer::CGUIBaseContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems, bool unloadDelayed)
: IGUIContainer(parentID, controlID, posX, posY, width, height)
, m_scroller(scroller)
{
Expand All @@ -55,6 +55,7 @@ CGUIBaseContainer::CGUIBaseContainer(int parentID, int controlID, float posX, fl
m_layout = nullptr;
m_focusedLayout = nullptr;
m_cacheItems = preloadItems;
m_unloadDelayed = unloadDelayed;
m_scrollItemsPerFrame = 0.0f;
m_type = VIEW_TYPE_NONE;
m_autoScrollMoveTime = 0;
Expand Down Expand Up @@ -85,6 +86,7 @@ CGUIBaseContainer::CGUIBaseContainer(const CGUIBaseContainer& other)
m_cursor(other.m_cursor),
m_offset(other.m_offset),
m_cacheItems(other.m_cacheItems),
m_unloadDelayed(other.m_unloadDelayed),
m_scrollTimer(other.m_scrollTimer),
m_lastScrollStartTimer(other.m_lastScrollStartTimer),
m_pageChangeTimer(other.m_pageChangeTimer),
Expand Down Expand Up @@ -1480,18 +1482,18 @@ void CGUIBaseContainer::GetCacheOffsets(int &cacheBefore, int &cacheAfter) const
{
if (m_scroller.IsScrollingDown())
{
cacheBefore = 0;
cacheAfter = m_cacheItems;
cacheBefore = !m_unloadDelayed ? 0 : 1;
cacheAfter = m_cacheItems > 0 ? 1 : 0;
}
else if (m_scroller.IsScrollingUp())
{
cacheBefore = m_cacheItems;
cacheBefore = !m_unloadDelayed && m_cacheItems == 0 ? 0 : 1;
cacheAfter = 0;
}
else
{
cacheBefore = m_cacheItems / 2;
cacheAfter = m_cacheItems / 2;
cacheBefore = m_unloadDelayed && m_cacheItems == 0 ? 1 : m_cacheItems;
cacheAfter = m_cacheItems;
}
}

Expand Down
3 changes: 2 additions & 1 deletion xbmc/guilib/GUIBaseContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CGUIListItemLayout;
class CGUIBaseContainer : public IGUIContainer
{
public:
CGUIBaseContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems);
CGUIBaseContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems, bool unloadDelayed);
explicit CGUIBaseContainer(const CGUIBaseContainer& other);
~CGUIBaseContainer(void) override;

Expand Down Expand Up @@ -233,6 +233,7 @@ class CGUIBaseContainer : public IGUIContainer
int m_cursor;
int m_offset;
int m_cacheItems;
bool m_unloadDelayed;
CStopWatch m_scrollTimer;
CStopWatch m_lastScrollStartTimer;
CStopWatch m_pageChangeTimer;
Expand Down
6 changes: 4 additions & 2 deletions xbmc/guilib/GUIControlFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID,
bool showOnePage = true;
bool scrollOut = true;
int preloadItems = 0;
bool unloadDelayed = false;

CLabelInfo labelInfo, labelInfoMono;

Expand Down Expand Up @@ -1165,7 +1166,8 @@ CGUIControl* CGUIControlFactory::Create(int parentID,
XMLUtils::GetBoolean(pControlNode, "showonepage", showOnePage);
XMLUtils::GetInt(pControlNode, "focusposition", focusPosition);
XMLUtils::GetInt(pControlNode, "scrolltime", scrollTime);
XMLUtils::GetInt(pControlNode, "preloaditems", preloadItems, 0, 2);
XMLUtils::GetInt(pControlNode, "preloaditems", preloadItems, 0, 1);
XMLUtils::GetBoolean(pControlNode, "unloaddelayed", unloadDelayed);

XMLUtils::GetBoolean(pControlNode, "usecontrolcoords", useControlCoords);
XMLUtils::GetBoolean(pControlNode, "renderfocusedlast", renderFocusedLast);
Expand Down Expand Up @@ -1591,7 +1593,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID,
GetScroller(pControlNode, "scrolltime", scroller);

control = new CGUIPanelContainer(parentID, id, posX, posY, width, height, orientation,
scroller, preloadItems);
scroller, preloadItems, unloadDelayed);
auto pcontrol = static_cast<CGUIPanelContainer*>(control);
pcontrol->LoadLayout(pControlNode);
pcontrol->LoadListProvider(pControlNode, defaultControl, defaultAlways);
Expand Down
2 changes: 1 addition & 1 deletion xbmc/guilib/GUIFixedListContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "input/actions/ActionIDs.h"

CGUIFixedListContainer::CGUIFixedListContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems, int fixedPosition, int cursorRange)
: CGUIBaseContainer(parentID, controlID, posX, posY, width, height, orientation, scroller, preloadItems)
: CGUIBaseContainer(parentID, controlID, posX, posY, width, height, orientation, scroller, preloadItems, false)
{
ControlType = GUICONTAINER_FIXEDLIST;
m_type = VIEW_TYPE_LIST;
Expand Down
4 changes: 2 additions & 2 deletions xbmc/guilib/GUIListContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "utils/StringUtils.h"

CGUIListContainer::CGUIListContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems)
: CGUIBaseContainer(parentID, controlID, posX, posY, width, height, orientation, scroller, preloadItems)
: CGUIBaseContainer(parentID, controlID, posX, posY, width, height, orientation, scroller, preloadItems, false)
{
ControlType = GUICONTAINER_LIST;
m_type = VIEW_TYPE_LIST;
Expand Down Expand Up @@ -276,7 +276,7 @@ CGUIListContainer::CGUIListContainer(int parentID, int controlID, float posX, fl
const CLabelInfo& labelInfo, const CLabelInfo& labelInfo2,
const CTextureInfo& textureButton, const CTextureInfo& textureButtonFocus,
float textureHeight, float itemWidth, float itemHeight, float spaceBetweenItems)
: CGUIBaseContainer(parentID, controlID, posX, posY, width, height, VERTICAL, 200, 0)
: CGUIBaseContainer(parentID, controlID, posX, posY, width, height, VERTICAL, 200, 0, false)
{
m_layouts.emplace_back();
m_layouts.back().CreateListControlLayouts(width, textureHeight + spaceBetweenItems, false, labelInfo, labelInfo2, textureButton, textureButtonFocus, textureHeight, itemWidth, itemHeight, "", "");
Expand Down
4 changes: 2 additions & 2 deletions xbmc/guilib/GUIPanelContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

#include <cassert>

CGUIPanelContainer::CGUIPanelContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems)
: CGUIBaseContainer(parentID, controlID, posX, posY, width, height, orientation, scroller, preloadItems)
CGUIPanelContainer::CGUIPanelContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems, bool unloadDelayed)
: CGUIBaseContainer(parentID, controlID, posX, posY, width, height, orientation, scroller, preloadItems, unloadDelayed)
{
ControlType = GUICONTAINER_PANEL;
m_type = VIEW_TYPE_ICON;
Expand Down
2 changes: 1 addition & 1 deletion xbmc/guilib/GUIPanelContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class CGUIPanelContainer : public CGUIBaseContainer
{
public:
CGUIPanelContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems);
CGUIPanelContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems, bool unloadDelayed);
~CGUIPanelContainer(void) override;
CGUIPanelContainer* Clone() const override { return new CGUIPanelContainer(*this); }

Expand Down
2 changes: 1 addition & 1 deletion xbmc/guilib/GUIWrappingListContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "input/actions/ActionIDs.h"

CGUIWrappingListContainer::CGUIWrappingListContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems, int fixedPosition)
: CGUIBaseContainer(parentID, controlID, posX, posY, width, height, orientation, scroller, preloadItems)
: CGUIBaseContainer(parentID, controlID, posX, posY, width, height, orientation, scroller, preloadItems, false)
{
SetCursor(fixedPosition);
ControlType = GUICONTAINER_WRAPLIST;
Expand Down