summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-12-11 11:57:52 +0000
committeryexo <yexo@openttd.org>2011-12-11 11:57:52 +0000
commite0e5e51e2a015d6901730f8edcd4187161ce9901 (patch)
tree4bd02de4fcc16a4ecc8e0f284e7d78d2ebedbf14 /src/network
parent93b568469a9e3291c2c69b9cd95e4140dcaf9976 (diff)
downloadopenttd-e0e5e51e2a015d6901730f8edcd4187161ce9901.tar.xz
(svn r23492) -Feature: add 'view website' button to the online content window
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_content_gui.cpp37
1 files changed, 26 insertions, 11 deletions
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. */