Mercurial > hg > openttd
changeset 18645:7916e135df26 draft
(svn r23492) -Feature: add 'view website' button to the online content window
author | yexo <yexo@openttd.org> |
---|---|
date | Sun, 11 Dec 2011 11:57:52 +0000 |
parents | 1ce716d62115 |
children | 2c62497776ce |
files | src/lang/english.txt src/network/network_content_gui.cpp |
diffstat | 2 files changed, 28 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1855,6 +1855,8 @@ STR_CONTENT_UNSELECT_ALL_CAPTION :{BLACK}Unselect all STR_CONTENT_UNSELECT_ALL_CAPTION_TOOLTIP :{BLACK}Mark all content to be not downloaded STR_CONTENT_FILTER_TITLE :{BLACK}Tag/name filter: +STR_CONTENT_OPEN_URL :{BLACK}Visit website +STR_CONTENT_OPEN_URL_TOOLTIP :{BLACK}Visit the website for this content STR_CONTENT_DOWNLOAD_CAPTION :{BLACK}Download STR_CONTENT_DOWNLOAD_CAPTION_TOOLTIP :{BLACK}Start downloading the selected content STR_CONTENT_TOTAL_DOWNLOAD_SIZE :{SILVER}Total download size: {WHITE}{BYTES}
--- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -239,6 +239,7 @@ NCLWW_SELECT_ALL, ///< 'Select all' button NCLWW_SELECT_UPDATE, ///< 'Select updates' button NCLWW_UNSELECT, ///< 'Unselect all' button + NCLWW_OPEN_URL, ///< 'Open url' button NCLWW_CANCEL, ///< 'Cancel' button NCLWW_DOWNLOAD, ///< 'Download' button @@ -673,6 +674,13 @@ delete this; break; + case NCLWW_OPEN_URL: + if (this->selected != NULL) { + extern void OpenBrowser(const char *url); + OpenBrowser(this->selected->url); + } + break; + case NCLWW_DOWNLOAD: if (BringWindowToFrontById(WC_NETWORK_STATUS_WINDOW, 0) == NULL) new NetworkContentDownloadStatusWindow(); break; @@ -821,6 +829,7 @@ this->SetWidgetDisabledState(NCLWW_UNSELECT, this->filesize_sum == 0); this->SetWidgetDisabledState(NCLWW_SELECT_ALL, !show_select_all); this->SetWidgetDisabledState(NCLWW_SELECT_UPDATE, !show_select_upgrade); + this->SetWidgetDisabledState(NCLWW_OPEN_URL, this->selected == NULL || StrEmpty(this->selected->url)); this->GetWidget<NWidgetCore>(NCLWW_CANCEL)->widget_data = this->filesize_sum == 0 ? STR_AI_SETTINGS_CLOSE : STR_AI_LIST_CANCEL; } @@ -879,18 +888,24 @@ NWidget(NWID_SPACER), SetMinimalSize(0, 7), SetResize(1, 0), /* Bottom. */ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(8, 8, 8), - NWidget(NWID_SELECTION, INVALID_COLOUR, NCLWW_SEL_ALL_UPDATE), SetResize(1, 0), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_SELECT_UPDATE), SetResize(1, 0), SetFill(1, 0), - SetDataTip(STR_CONTENT_SELECT_UPDATES_CAPTION, STR_CONTENT_SELECT_UPDATES_CAPTION_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_SELECT_ALL), SetResize(1, 0), SetFill(1, 0), - SetDataTip(STR_CONTENT_SELECT_ALL_CAPTION, STR_CONTENT_SELECT_ALL_CAPTION_TOOLTIP), + NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(8, 8, 8), + NWidget(NWID_SELECTION, INVALID_COLOUR, NCLWW_SEL_ALL_UPDATE), SetResize(1, 0), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_SELECT_UPDATE), SetResize(1, 0), SetFill(1, 0), + SetDataTip(STR_CONTENT_SELECT_UPDATES_CAPTION, STR_CONTENT_SELECT_UPDATES_CAPTION_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_SELECT_ALL), SetResize(1, 0), SetFill(1, 0), + SetDataTip(STR_CONTENT_SELECT_ALL_CAPTION, STR_CONTENT_SELECT_ALL_CAPTION_TOOLTIP), + EndContainer(), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_UNSELECT), SetResize(1, 0), SetFill(1, 0), + SetDataTip(STR_CONTENT_UNSELECT_ALL_CAPTION, STR_CONTENT_UNSELECT_ALL_CAPTION_TOOLTIP), EndContainer(), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_UNSELECT), SetResize(1, 0), SetFill(1, 0), - SetDataTip(STR_CONTENT_UNSELECT_ALL_CAPTION, STR_CONTENT_UNSELECT_ALL_CAPTION_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_CANCEL), SetResize(1, 0), SetFill(1, 0), - SetDataTip(STR_BUTTON_CANCEL, STR_NULL), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_DOWNLOAD), SetResize(1, 0), SetFill(1, 0), - SetDataTip(STR_CONTENT_DOWNLOAD_CAPTION, STR_CONTENT_DOWNLOAD_CAPTION_TOOLTIP), + NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(8, 8, 8), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_OPEN_URL), SetResize(1, 0), SetFill(1, 0), + SetDataTip(STR_CONTENT_OPEN_URL, STR_CONTENT_OPEN_URL_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_CANCEL), SetResize(1, 0), SetFill(1, 0), + SetDataTip(STR_BUTTON_CANCEL, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_DOWNLOAD), SetResize(1, 0), SetFill(1, 0), + SetDataTip(STR_CONTENT_DOWNLOAD_CAPTION, STR_CONTENT_DOWNLOAD_CAPTION_TOOLTIP), + EndContainer(), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 2), SetResize(1, 0), /* Resize button. */