OpenTTD Source: src/network/network_content_gui.cpp File Reference

OpenTTD Source 15.3

Data Structures | Enumerations | Functions | Variables
network_content_gui.cpp File Reference

Implementation of the Network Content related GUIs. More...

`#include "../stdafx.h"`
`#include "../strings_func.h"`
`#include "../gfx_func.h"`
`#include "../window_func.h"`
`#include "../error.h"`
`#include "../ai/ai.hpp"`
`#include "../game/game.hpp"`
`#include "../base_media_base.h"`
`#include "../base_media_graphics.h"`
`#include "../base_media_music.h"`
`#include "../base_media_sounds.h"`
`#include "../openttd.h"`
`#include "../sortlist_type.h"`
`#include "../stringfilter_type.h"`
`#include "../querystring_gui.h"`
`#include "../core/geometry_func.hpp"`
`#include "../textfile_gui.h"`
`#include "../fios.h"`
`#include "network_content_gui.h"`
`#include "table/strings.h"`
`#include "../table/sprites.h"`
`#include "../safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | ContentTextfileWindow
| Window for displaying the textfile of an item in the content list. More...
struct | NetworkContentDownloadStatusWindow
| Window for showing the download status of content. More...
struct | ContentListFilterData
| Filter data for NetworkContentListWindow. More...
class | NetworkContentListWindow
| Window that lists the content that's at the content server. More...

## Enumerations
enum | ContentListFilterCriteria : uint8_t { CONTENT_FILTER_TEXT = 0 , CONTENT_FILTER_TYPE_OR_SELECTED }
| Filter criteria for NetworkContentListWindow. More...

## Functions
static void | ShowContentTextfileWindow (Window *parent, TextfileType file_type, const ContentInfo *ci)
void | BuildContentTypeStringList ()
| Build array of all strings corresponding to the content types.
void | ShowNetworkContentListWindow (ContentVector *cv, ContentType type1, ContentType type2)
| Show the content list window with a given set of content.

## Variables
static bool | _accepted_external_search = false
| Whether the user accepted to enter external websites during this session.
static constexpr std::initializer_list< NWidgetPart > | _nested_network_content_download_status_window_widgets
| Nested widgets for the download window.
static WindowDesc | _network_content_download_status_window_desc (WDP_CENTER, {}, 0, 0, WC_NETWORK_STATUS_WINDOW, WC_NONE, WindowDefaultFlag::Modal, _nested_network_content_download_status_window_widgets)
| Window description for the download window.
static constexpr std::initializer_list< NWidgetPart > | _nested_network_content_list_widgets
| The widgets for the content list.
static WindowDesc | _network_content_list_desc (WDP_CENTER, "list_content", 630, 460, WC_NETWORK_WINDOW, WC_NONE, {}, _nested_network_content_list_widgets)
| Window description of the content list.

## Detailed Description

Implementation of the Network Content related GUIs.

Definition in file network_content_gui.cpp.

## Enumeration Type Documentation

## ◆ ContentListFilterCriteria

enum ContentListFilterCriteria : uint8_t

Filter criteria for NetworkContentListWindow.

Enumerator
CONTENT_FILTER_TEXT | Filter by query string.
CONTENT_FILTER_TYPE_OR_SELECTED | Filter by being of displayed type or selected for download.

Definition at line 318 of file network_content_gui.cpp.

## Function Documentation

## ◆ BuildContentTypeStringList()

void BuildContentTypeStringList | ( |  | ) |

Build array of all strings corresponding to the content types.

Definition at line 1020 of file network_content_gui.cpp.

Referenced by ReadLanguagePack().

## ◆ ShowContentTextfileWindow()

static void ShowContentTextfileWindow | ( | Window * | parent,
|  | TextfileType | file_type,
|  | const ContentInfo * | ci
| ) |  |
| static

Definition at line 80 of file network_content_gui.cpp.

## ◆ ShowNetworkContentListWindow()

void ShowNetworkContentListWindow | ( | ContentVector * | cv,
|  | ContentType | type1,
|  | ContentType | type2
| ) |  |

Show the content list window with a given set of content.

Parameters

  cv | the content to show, or nullptr when it has to search for itself
  type1 | the first type to (only) show or CONTENT_TYPE_END to show all.
  type2 | the second type to (only) show in addition to type1. If type2 is != CONTENT_TYPE_END, then also type1 should be != CONTENT_TYPE_END. If type2 != CONTENT_TYPE_END, then type1 != type2 must be true.

Definition at line 1117 of file network_content_gui.cpp.

References _network_content_client, _network_content_list_desc, ClientNetworkContentSocketHandler::Clear(), CloseWindowById(), CONTENT_TYPE_END, GetEncodedString(), ClientNetworkContentSocketHandler::RequestContentList(), ShowErrorMessage(), WC_NETWORK_WINDOW, WL_ERROR, and WN_NETWORK_WINDOW_CONTENT_LIST.

Referenced by AIConfigWindow::OnClick(), SaveLoadWindow::OnClick(), GSConfigWindow::OnClick(), SelectGameWindow::OnClick(), GameOptionsWindow::OnClick(), and ShowMissingContentWindow().

## Variable Documentation

## ◆ _accepted_external_search

bool _accepted_external_search = false
| static

Whether the user accepted to enter external websites during this session.

Definition at line 38 of file network_content_gui.cpp.

Referenced by NetworkContentListWindow::ExternalSearchDisclaimerCallback(), and NetworkContentListWindow::OnClick().

## ◆ _nested_network_content_download_status_window_widgets

constexpr std::initializer_list<NWidgetPart> _nested_network_content_download_status_window_widgets
| staticconstexpr

Initial value:
= {
NWidget(WWT_CAPTION, COLOUR_GREY), SetStringTip(STR_CONTENT_DOWNLOAD_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.modalpopup),
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NCDS_PROGRESS_BAR), SetFill(1, 0),
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NCDS_PROGRESS_TEXT), SetFill(1, 0), SetMinimalSize(350, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCDS_CANCELOK), SetStringTip(STR_BUTTON_CANCEL), SetFill(1, 0),
EndContainer(),
EndContainer(),
}
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition window_gui.h:93
SetFill
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
Definition widget_type.h:1222
SetPIP
constexpr NWidgetPart SetPIP(uint8_t pre, uint8_t inter, uint8_t post)
Widget part function for setting a pre/inter/post spaces.
Definition widget_type.h:1378
SetPadding
constexpr NWidgetPart SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_t left)
Widget part function for setting additional space around a widget.
Definition widget_type.h:1335
SetStringTip
constexpr NWidgetPart SetStringTip(StringID string, StringID tip={})
Widget part function for setting the string and tooltip.
Definition widget_type.h:1243
SetMinimalSize
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition widget_type.h:1159
EndContainer
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition widget_type.h:1232
NWidget
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=INVALID_WIDGET)
Widget part function for starting a new 'real' widget.
Definition widget_type.h:1427
WID_NCDS_CANCELOK
@ WID_NCDS_CANCELOK
(Optional) Cancel/OK button.
Definition network_content_widget.h:19
WID_NCDS_PROGRESS_TEXT
@ WID_NCDS_PROGRESS_TEXT
Text explaining what is happening.
Definition network_content_widget.h:18
WID_NCDS_PROGRESS_BAR
@ WID_NCDS_PROGRESS_BAR
Simple progress bar.
Definition network_content_widget.h:17
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition widget_type.h:105
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:39
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition widget_type.h:52
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition widget_type.h:68
WWT_EMPTY
@ WWT_EMPTY
Empty widget, place holder to reserve space in widget tree.
Definition widget_type.h:37

Nested widgets for the download window.

Definition at line 87 of file network_content_gui.cpp.

## ◆ _nested_network_content_list_widgets

constexpr std::initializer_list<NWidgetPart> _nested_network_content_list_widgets
| staticconstexpr

The widgets for the content list.

Definition at line 1028 of file network_content_gui.cpp.