From 39987cd1ca4c09ea2f5d9de08ecfa3c6b029fe5d Mon Sep 17 00:00:00 2001 From: pentarctagon Date: Fri, 12 Apr 2024 12:05:15 -0500 Subject: [PATCH] Add a Community button to the title screen. This opens a dialog with links to the forums, discord, etc, plus a donate button that links to Wesnoth's SPI page. --- boost_test_schedule | 1 + changelog_entries/community.md | 2 + data/gui/window/community_dialog.cfg | 184 ++++++++++++++++++ data/gui/window/title_screen.cfg | 1 + projectfiles/CodeBlocks/wesnoth.cbp | 2 + .../project.pbxproj | 14 +- source_lists/wesnoth | 1 + src/gui/dialogs/achievements_dialog.cpp | 1 - src/gui/dialogs/achievements_dialog.hpp | 3 +- src/gui/dialogs/community_dialog.cpp | 49 +++++ src/gui/dialogs/community_dialog.hpp | 52 +++++ src/gui/dialogs/title_screen.cpp | 13 ++ src/gui/dialogs/title_screen.hpp | 2 + src/tests/gui/test_gui2.cpp | 5 + 14 files changed, 326 insertions(+), 4 deletions(-) create mode 100644 changelog_entries/community.md create mode 100644 data/gui/window/community_dialog.cfg create mode 100644 src/gui/dialogs/community_dialog.cpp create mode 100644 src/gui/dialogs/community_dialog.hpp diff --git a/boost_test_schedule b/boost_test_schedule index 45d9e917760..fb1bbc20ec6 100644 --- a/boost_test_schedule +++ b/boost_test_schedule @@ -7,6 +7,7 @@ test_gui2/modal_dialog_test_addon_license_prompt test_gui2/modal_dialog_test_campaign_difficulty test_gui2/modal_dialog_test_chat_log test_gui2/modal_dialog_test_editor_choose_addon +test_gui2/modal_dialog_test_community_dialog test_gui2/modal_dialog_test_core_selection test_gui2/modal_dialog_test_custom_tod test_gui2/modal_dialog_test_depcheck_confirm_change diff --git a/changelog_entries/community.md b/changelog_entries/community.md new file mode 100644 index 00000000000..d296255cb93 --- /dev/null +++ b/changelog_entries/community.md @@ -0,0 +1,2 @@ +### Miscellaneous and Bug Fixes + * Add a Community button to the title screen to link to the forums, discord, etc. diff --git a/data/gui/window/community_dialog.cfg b/data/gui/window/community_dialog.cfg new file mode 100644 index 00000000000..2265d5a8e1d --- /dev/null +++ b/data/gui/window/community_dialog.cfg @@ -0,0 +1,184 @@ +[window] + id = "community_dialog" + description = "Dialog for links to different places related to Wesnoth's community" + + [resolution] + definition = "default" + + automatic_placement = true + vertical_placement = "center" + horizontal_placement = "center" + + maximum_width = 800 + + [tooltip] + id = "tooltip" + [/tooltip] + + [helptip] + id = "tooltip" + [/helptip] + + [grid] + + [row] + [column] + horizontal_grow = true + [grid] + [row] + [column] + grow_factor = 1 + + border = "all" + border_size = 5 + horizontal_alignment = "left" + [label] + definition = "title" + + #po: this is on a button that opens a dialog with links to various Wesnoth community websites + label = _ "Community" + [/label] + + [/column] + [/row] + [/grid] + [/column] + [/row] + + [row] + grow_factor = 1 + + [column] + border = "all" + border_size = 10 + + [button] + id = "forums" + definition = "default" + + #po: this is on a button that opens the Wesnoth forums webpage + label = _ "Forums" + [/button] + + [/column] + + [/row] + + [row] + grow_factor = 1 + + [column] + border = "all" + border_size = 10 + + [button] + id = "discord" + definition = "default" + + #po: this is on a button that opens the Wesnoth Discord server webpage + label = _ "Discord" + [/button] + + [/column] + + [/row] + + [row] + grow_factor = 1 + + [column] + border = "all" + border_size = 10 + + [button] + id = "irc" + definition = "default" + + #po: this is on a button that opens the Wesnoth IRC webpage. IRC is an acronym for Internet Relay Chat + label = _ "IRC" + [/button] + + [/column] + + [/row] + + [row] + grow_factor = 1 + + [column] + border = "all" + border_size = 10 + + [button] + id = "steam" + definition = "default" + + #po: this is on a button that opens the Wesnoth Steam forums webpage + label = _ "Steam" + [/button] + + [/column] + + [/row] + + [row] + grow_factor = 1 + + [column] + border = "all" + border_size = 10 + + [button] + id = "reddit" + definition = "default" + + #po: this is on a button that opens the Wesnoth Reddit webpage + label = _ "Reddit" + [/button] + + [/column] + + [/row] + + [row] + grow_factor = 1 + + [column] + border = "all" + border_size = 10 + + [button] + id = "donate" + definition = "default" + + #po: this is on a button that opens the Wesnoth SPI webpage for sending donations + label = _ "Donate" + [/button] + + [/column] + + [/row] + + [row] + grow_factor = 1 + + [column] + border = "all" + border_size = 10 + + [button] + id = "ok" + definition = "default" + + label = _ "Close" + [/button] + + [/column] + + [/row] + + [/grid] + + [/resolution] + +[/window] diff --git a/data/gui/window/title_screen.cfg b/data/gui/window/title_screen.cfg index b9698a86478..66d372614ea 100644 --- a/data/gui/window/title_screen.cfg +++ b/data/gui/window/title_screen.cfg @@ -259,6 +259,7 @@ where {_GUI_BUTTON "editor" _"Map Editor" _"Start the map editor"} {_GUI_BUTTON "preferences" _"Preferences" _"Configure the game’s settings"} {_GUI_BUTTON "achievements" _"Achievements" _"View achievements"} + {_GUI_BUTTON "community" _"Community" _"Places to talk about Wesnoth"} {_GUI_BUTTON "credits" _"Credits" _"View the credits"} {_GUI_BUTTON "quit" _"Quit" _"Quit the game"} # This debug feature doesn't need to be translated, so put it in the test textdomain. diff --git a/projectfiles/CodeBlocks/wesnoth.cbp b/projectfiles/CodeBlocks/wesnoth.cbp index 261a85ffa40..244871c28f8 100644 --- a/projectfiles/CodeBlocks/wesnoth.cbp +++ b/projectfiles/CodeBlocks/wesnoth.cbp @@ -587,6 +587,8 @@ + + diff --git a/projectfiles/Xcode/The Battle for Wesnoth.xcodeproj/project.pbxproj b/projectfiles/Xcode/The Battle for Wesnoth.xcodeproj/project.pbxproj index a7909603182..84e0a5ce871 100644 --- a/projectfiles/Xcode/The Battle for Wesnoth.xcodeproj/project.pbxproj +++ b/projectfiles/Xcode/The Battle for Wesnoth.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 000000000000000000000008 /* achievements_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 000000000000000000000003 /* achievements_dialog.cpp */; }; 000000000000000000000011 /* network_download_file.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 000000000000000000000009 /* network_download_file.cpp */; }; 000000000000000000000012 /* network_download_file.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 000000000000000000000009 /* network_download_file.cpp */; }; + 00324A11ACB0DB64FBD97896 /* community_dialog.hpp in Headers */ = {isa = PBXBuildFile; fileRef = CD5045B9A988F034F8D17C85 /* community_dialog.hpp */; }; 02A44BEAA567595C902031CF /* edit_pbl_translation.hpp in Headers */ = {isa = PBXBuildFile; fileRef = C679447D91FD3623CC852FF8 /* edit_pbl_translation.hpp */; }; 04C748F7835C62498D27442D /* edit_pbl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6FA542D78393E8FF067775DA /* edit_pbl.cpp */; }; 0554467DB5FE99D85ABCDCA0 /* edit_pbl_translation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00574699A982AA23F12B39E0 /* edit_pbl_translation.cpp */; }; @@ -618,6 +619,7 @@ 46F92F272175036700602C1C /* constants.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92F0E2174FEC000602C1C /* constants.cpp */; }; 4944F41B1354FBFF0027E614 /* teleport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4944F41A1354FBFF0027E614 /* teleport.cpp */; }; 49478714172FF6F8002B7ABA /* tristate_button.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49478712172FF6F8002B7ABA /* tristate_button.cpp */; }; + 4B5D4FBB98B2ADF26EC50D9D /* community_dialog.hpp in Headers */ = {isa = PBXBuildFile; fileRef = CD5045B9A988F034F8D17C85 /* community_dialog.hpp */; }; 4E19429E82899A42A73BBE91 /* choose_addon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 20E644DC98F26C756364EC2C /* choose_addon.cpp */; }; 508C40A885166B2E3F4245F4 /* general.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84234C54BB84519421FD4136 /* general.cpp */; }; 529242A8856DE8D00988B9BD /* test_schema_self_validator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A04033A9545CFE8A226FBD /* test_schema_self_validator.cpp */; }; @@ -662,8 +664,8 @@ 62D24F321519987400350848 /* context_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 62D24F311519987400350848 /* context_manager.cpp */; }; 62D24F351519995200350848 /* palette_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 62D24F341519995200350848 /* palette_manager.cpp */; }; 6D574EACA3483ABEE72819F0 /* statistics_record.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27764FB68F02032F1C0B6748 /* statistics_record.cpp */; }; - 7A7146D7893AA09891352019 /* test_schema_validator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CF14AB694764953E2CB3AF7 /* test_schema_validator.cpp */; }; 77D94146A5FA29849D1A9BD8 /* multiline_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0B0F48CE9CF65D9813BE6CDC /* multiline_text.cpp */; }; + 7A7146D7893AA09891352019 /* test_schema_validator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CF14AB694764953E2CB3AF7 /* test_schema_validator.cpp */; }; 7BFC4DF5BFF8CF75855BA662 /* prompt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 67044415B63F5888193BD7A6 /* prompt.cpp */; }; 7FDF4E8D9C94E7DA8F41F7BB /* tod_new_schedule.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 5D46466DBCD81B13621C7342 /* tod_new_schedule.hpp */; }; 867141839BDB89BFE876E310 /* carryover_show_gold.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09A440B1A671C45BE2924FB4 /* carryover_show_gold.cpp */; }; @@ -1428,7 +1430,9 @@ ECFB9FA8193BFAD900146ED0 /* carryover.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ECFB9FA7193BFAD900146ED0 /* carryover.cpp */; }; ECFB9FAA193BFB4B00146ED0 /* game_board.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ECFB9FA9193BFB4B00146ED0 /* game_board.cpp */; }; ECFB9FAC193BFB6E00146ED0 /* rect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ECFB9FAB193BFB6E00146ED0 /* rect.cpp */; }; + F0A74F75B197FC7C57528FF8 /* community_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 63B64397BB28593D879A67BE /* community_dialog.cpp */; }; F13D4C33BAA4CB9E9AACFCC2 /* spinner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4214F3DA80B54080C4B548F /* spinner.cpp */; }; + F213406695CCC6ECE7254B38 /* community_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 63B64397BB28593D879A67BE /* community_dialog.cpp */; }; F40A13BC1A3A88BA00C4D071 /* apple_notification.mm in Sources */ = {isa = PBXBuildFile; fileRef = F40A13BB1A3A88BA00C4D071 /* apple_notification.mm */; }; F419A1F414E21246002F9ADC /* game_end_exceptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F419A1F314E21246002F9ADC /* game_end_exceptions.cpp */; }; F419A2C314F5BCFE002F9ADC /* info.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F419A2C114F5BCFE002F9ADC /* info.cpp */; }; @@ -2193,6 +2197,7 @@ 62D24F311519987400350848 /* context_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = context_manager.cpp; sourceTree = ""; }; 62D24F331519994300350848 /* palette_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = palette_manager.hpp; sourceTree = ""; }; 62D24F341519995200350848 /* palette_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = palette_manager.cpp; sourceTree = ""; }; + 63B64397BB28593D879A67BE /* community_dialog.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = community_dialog.cpp; path = community_dialog.cpp; sourceTree = ""; }; 67044415B63F5888193BD7A6 /* prompt.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = prompt.cpp; sourceTree = ""; }; 6FA542D78393E8FF067775DA /* edit_pbl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = edit_pbl.cpp; sourceTree = ""; }; 755D4555A1DEA29125E7F338 /* scroll_text.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = scroll_text.cpp; path = scroll_text.cpp; sourceTree = ""; }; @@ -2719,6 +2724,7 @@ B5CE46F812A0417D00D665EE /* side_filter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = side_filter.hpp; sourceTree = ""; }; C61F473D9AC43768A445E218 /* tod_new_schedule.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = tod_new_schedule.cpp; sourceTree = ""; }; C679447D91FD3623CC852FF8 /* edit_pbl_translation.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = edit_pbl_translation.hpp; sourceTree = ""; }; + CD5045B9A988F034F8D17C85 /* community_dialog.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = community_dialog.hpp; path = community_dialog.hpp; sourceTree = ""; }; D4594633BF3F8A06D6AE752F /* prompt.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = prompt.hpp; sourceTree = ""; }; D911474D925FA88D5B856A0E /* test_sdl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = test_sdl.cpp; path = test_sdl.cpp; sourceTree = ""; }; D9A141EAAE90E98B6F6171D6 /* choose_addon.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = choose_addon.hpp; sourceTree = ""; }; @@ -3843,6 +3849,8 @@ 46F92CF62174F6A300602C1C /* wml_message.hpp */, 67044415B63F5888193BD7A6 /* prompt.cpp */, D4594633BF3F8A06D6AE752F /* prompt.hpp */, + 63B64397BB28593D879A67BE /* community_dialog.cpp */, + CD5045B9A988F034F8D17C85 /* community_dialog.hpp */, ); path = dialogs; sourceTree = ""; @@ -5131,6 +5139,7 @@ 44CA4F8598147FDAE871B7CB /* prompt.hpp in Headers */, FC66414CB2E3F0E8B0B747B6 /* tod_new_schedule.hpp in Headers */, 285C4E7A9E891E1DCB215683 /* back_edge_detector.hpp in Headers */, + 4B5D4FBB98B2ADF26EC50D9D /* community_dialog.hpp in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5144,6 +5153,7 @@ 172E48A5BD149999CE64EDF8 /* prompt.hpp in Headers */, 7FDF4E8D9C94E7DA8F41F7BB /* tod_new_schedule.hpp in Headers */, F96A40219A964A8022910D73 /* back_edge_detector.hpp in Headers */, + 00324A11ACB0DB64FBD97896 /* community_dialog.hpp in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5899,6 +5909,7 @@ 77D94146A5FA29849D1A9BD8 /* multiline_text.cpp in Sources */, E1DA41878F0C255769B8239D /* scroll_text.cpp in Sources */, AC4242F78B39C571E34AF48F /* edit_unit.cpp in Sources */, + F213406695CCC6ECE7254B38 /* community_dialog.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6582,6 +6593,7 @@ 393E4C9DAEE19E12B2B168B5 /* edit_unit.cpp in Sources */, 529242A8856DE8D00988B9BD /* test_schema_self_validator.cpp in Sources */, 7A7146D7893AA09891352019 /* test_schema_validator.cpp in Sources */, + F0A74F75B197FC7C57528FF8 /* community_dialog.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/source_lists/wesnoth b/source_lists/wesnoth index dac89519123..d49d3284bcc 100644 --- a/source_lists/wesnoth +++ b/source_lists/wesnoth @@ -179,6 +179,7 @@ gui/dialogs/attack_predictions.cpp gui/dialogs/campaign_difficulty.cpp gui/dialogs/campaign_selection.cpp gui/dialogs/chat_log.cpp +gui/dialogs/community_dialog.cpp gui/dialogs/core_selection.cpp gui/dialogs/debug_clock.cpp gui/dialogs/depcheck_confirm_change.cpp diff --git a/src/gui/dialogs/achievements_dialog.cpp b/src/gui/dialogs/achievements_dialog.cpp index 9661ac2eb37..9bf0b1e2c6c 100644 --- a/src/gui/dialogs/achievements_dialog.cpp +++ b/src/gui/dialogs/achievements_dialog.cpp @@ -1,6 +1,5 @@ /* Copyright (C) 2003 - 2024 - by David White Part of the Battle for Wesnoth Project https://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify diff --git a/src/gui/dialogs/achievements_dialog.hpp b/src/gui/dialogs/achievements_dialog.hpp index 3d5932e5d89..7bd09a50c4b 100644 --- a/src/gui/dialogs/achievements_dialog.hpp +++ b/src/gui/dialogs/achievements_dialog.hpp @@ -1,6 +1,5 @@ /* Copyright (C) 2003 - 2024 - by David White Part of the Battle for Wesnoth Project https://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify @@ -28,7 +27,7 @@ namespace gui2::dialogs * * This shows a dialog displaying achievements. * - * Key |Type |Mandatory|Description + * Key |Type |Mandatory|Description * --------------------------|-------------|---------|----------- * selected_achievements_list|menu_button |yes |Allows selecting achievements by what content they're for. * name |label |yes |The user displayed name of the achievement. diff --git a/src/gui/dialogs/community_dialog.cpp b/src/gui/dialogs/community_dialog.cpp new file mode 100644 index 00000000000..a0d71851ed2 --- /dev/null +++ b/src/gui/dialogs/community_dialog.cpp @@ -0,0 +1,49 @@ +/* + Copyright (C) 2003 - 2024 + Part of the Battle for Wesnoth Project https://www.wesnoth.org/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY. + + See the COPYING file for more details. +*/ + +#define GETTEXT_DOMAIN "wesnoth-lib" + +#include "gui/dialogs/community_dialog.hpp" + +#include "desktop/open.hpp" +#include "gui/auxiliary/find_widget.hpp" +#include "gui/widgets/button.hpp" +#include "gui/widgets/window.hpp" + +namespace gui2::dialogs +{ + +REGISTER_DIALOG(community_dialog) + +community_dialog::community_dialog() + : modal_dialog(window_id()) +{ +} + +void community_dialog::pre_show(window& window) +{ + connect_signal_mouse_left_click(find_widget