Merge pull request #7190 from Robyt3/Browser-Layout-Overhaul

Overhaul server browser filter, details and friends tabs
This commit is contained in:
Dennis Felsing 2023-09-16 22:17:38 +00:00 committed by GitHub
commit a598831361
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 795 additions and 842 deletions

View file

@ -91,6 +91,8 @@ MAYBE_UNUSED static const char *FONT_ICON_GEAR = "\xEF\x80\x93";
MAYBE_UNUSED static const char *FONT_ICON_PEN_TO_SQUARE = "\xEF\x81\x84";
MAYBE_UNUSED static const char *FONT_ICON_CLAPPERBOARD = "\xEE\x84\xB1";
MAYBE_UNUSED static const char *FONT_ICON_EARTH_AMERICAS = "\xEF\x95\xBD";
MAYBE_UNUSED static const char *FONT_ICON_LIST_UL = "\xEF\x83\x8A";
MAYBE_UNUSED static const char *FONT_ICON_INFO = "\xEF\x84\xA9";
MAYBE_UNUSED static const char *FONT_ICON_SLASH = "\xEF\x9C\x95";
MAYBE_UNUSED static const char *FONT_ICON_PLAY = "\xEF\x81\x8B";

View file

@ -409,8 +409,6 @@ protected:
std::vector<CFriendItem> m_avFriends[NUM_FRIEND_TYPES];
const CFriendItem *m_pRemoveFriend = nullptr;
void FriendlistOnUpdate();
// found in menus.cpp
int Render();
#if defined(CONF_VIDEORECORDER)
@ -454,11 +452,19 @@ protected:
// found in menus_browser.cpp
int m_SelectedIndex;
bool m_ServerBrowserShouldRevealSelection;
void RenderServerbrowserServerList(CUIRect View);
void RenderServerbrowserServerList(CUIRect View, bool &WasListboxItemActivated);
void RenderServerbrowserStatusBox(CUIRect StatusBox, bool WasListboxItemActivated);
void Connect(const char *pAddress);
void PopupConfirmSwitchServer();
void RenderServerbrowserServerDetail(CUIRect View);
void RenderServerbrowserFilters(CUIRect View);
void RenderServerbrowserDDNetFilter(CUIRect View,
char *pFilterExclude, int FilterExcludeSize,
float ItemHeight, int MaxItems, int ItemsPerRow,
CScrollRegion &ScrollRegion, std::vector<unsigned char> &vItemIds,
const std::function<const char *(int ItemIndex)> &GetItemName,
const std::function<void(int ItemIndex, CUIRect Item, const void *pItemId, bool Active)> &RenderItem);
void RenderServerbrowserCountriesFilter(CUIRect View, int Network);
void RenderServerbrowserTypesFilter(CUIRect View, int Network);
struct SPopupCountrySelectionContext
{
CMenus *m_pMenus;
@ -466,11 +472,17 @@ protected:
bool m_New;
};
static CUI::EPopupMenuFunctionResult PopupCountrySelection(void *pContext, CUIRect View, bool Active);
void RenderServerbrowserInfo(CUIRect View);
void RenderServerbrowserInfoScoreboard(CUIRect View, const CServerInfo *pSelectedServer);
void RenderServerbrowserFriends(CUIRect View);
void FriendlistOnUpdate();
void PopupConfirmRemoveFriend();
void RenderServerbrowserTabBar(CUIRect TabBar);
void RenderServerbrowserToolBox(CUIRect ToolBox);
void RenderServerbrowser(CUIRect MainView);
template<typename F>
bool PrintHighlighted(const char *pName, F &&PrintFn);
CTeeRenderInfo GetTeeRenderInfo(vec2 Size, const char *pSkinName, bool CustomSkinColors, int CustomSkinColorBody, int CustomSkinColorFeet) const;
static void ConchainFriendlistUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
static void ConchainServerbrowserUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
@ -583,6 +595,9 @@ public:
SMALL_TAB_EDITOR,
SMALL_TAB_DEMOBUTTON,
SMALL_TAB_SERVER,
SMALL_TAB_BROWSER_FILTER,
SMALL_TAB_BROWSER_INFO,
SMALL_TAB_BROWSER_FRIENDS,
SMALL_TAB_LENGTH,
};

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,8 @@ CListBox::CListBox()
{
m_ScrollOffset = vec2(0.0f, 0.0f);
m_ListBoxUpdateScroll = false;
m_FilterOffset = 0.0f;
m_ScrollbarWidth = 20.0f;
m_ScrollbarMargin = 5.0f;
m_HasHeader = false;
m_AutoSpacing = 0.0f;
m_ScrollbarShown = false;
@ -118,6 +119,7 @@ void CListBox::DoStart(float RowHeight, int NumItems, int ItemsPerRow, int RowsP
CScrollRegionParams ScrollParams;
ScrollParams.m_Active = m_Active;
ScrollParams.m_ScrollbarWidth = ScrollbarWidthMax();
ScrollParams.m_ScrollbarMargin = ScrollbarMargin();
ScrollParams.m_ScrollUnit = (m_ListBoxRowHeight + m_AutoSpacing) * RowsPerScroll;
ScrollParams.m_Flags = ForceShowScrollbar ? CScrollRegionParams::FLAG_CONTENT_STATIC_WIDTH : 0;
m_ScrollRegion.Begin(&m_ListBoxView, &m_ScrollOffset, &ScrollParams);

View file

@ -35,8 +35,9 @@ private:
float m_AutoSpacing;
CScrollRegion m_ScrollRegion;
vec2 m_ScrollOffset;
float m_FilterOffset;
int m_BackgroundCorners;
float m_ScrollbarWidth;
float m_ScrollbarMargin;
bool m_HasHeader;
bool m_Active;
@ -66,7 +67,10 @@ public:
bool ScrollbarShown() const { return m_ScrollbarShown; }
float ScrollbarWidth() const { return ScrollbarShown() ? ScrollbarWidthMax() : 0.0f; }
float ScrollbarWidthMax() const { return 20.0f; }
float ScrollbarWidthMax() const { return m_ScrollbarWidth; }
void SetScrollbarWidth(float Width) { m_ScrollbarWidth = Width; }
float ScrollbarMargin() const { return m_ScrollbarMargin; }
void SetScrollbarMargin(float Margin) { m_ScrollbarMargin = Margin; }
};
#endif