diff options
author | yexo <yexo@openttd.org> | 2011-12-11 11:57:52 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2011-12-11 11:57:52 +0000 |
commit | e0e5e51e2a015d6901730f8edcd4187161ce9901 (patch) | |
tree | 4bd02de4fcc16a4ecc8e0f284e7d78d2ebedbf14 | |
parent | 93b568469a9e3291c2c69b9cd95e4140dcaf9976 (diff) | |
download | openttd-e0e5e51e2a015d6901730f8edcd4187161ce9901.tar.xz |
(svn r23492) -Feature: add 'view website' button to the online content window
-rw-r--r-- | src/lang/english.txt | 2 | ||||
-rw-r--r-- | src/network/network_content_gui.cpp | 37 |
2 files changed, 28 insertions, 11 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt index d3fb8e8d9..350cd166c 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1855,6 +1855,8 @@ STR_CONTENT_SELECT_UPDATES_CAPTION_TOOLTIP :{BLACK}Mark all 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} diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index fa16238b2..fd6b72b37 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -239,6 +239,7 @@ enum NetworkContentListWindowWidgets { 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 @@ public: 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 @@ public: 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 @@ static const NWidgetPart _nested_network_content_list_widgets[] = { 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(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(), - 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), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 2), SetResize(1, 0), /* Resize button. */ |