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.
This commit is contained in:
pentarctagon 2024-04-12 12:05:15 -05:00 committed by Pentarctagon
parent 0222fdad50
commit 39987cd1ca
14 changed files with 326 additions and 4 deletions

View File

@ -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

View File

@ -0,0 +1,2 @@
### Miscellaneous and Bug Fixes
* Add a Community button to the title screen to link to the forums, discord, etc.

View File

@ -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]

View File

@ -259,6 +259,7 @@ where
{_GUI_BUTTON "editor" _"Map Editor" _"Start the map editor"}
{_GUI_BUTTON "preferences" _"Preferences" _"Configure the games 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.

View File

@ -587,6 +587,8 @@
<Unit filename="../../src/gui/dialogs/campaign_selection.hpp" />
<Unit filename="../../src/gui/dialogs/chat_log.cpp" />
<Unit filename="../../src/gui/dialogs/chat_log.hpp" />
<Unit filename="../../src/gui/dialogs/community_dialog.cpp" />
<Unit filename="../../src/gui/dialogs/community_dialog.hpp" />
<Unit filename="../../src/gui/dialogs/core_selection.cpp" />
<Unit filename="../../src/gui/dialogs/core_selection.hpp" />
<Unit filename="../../src/gui/dialogs/debug_clock.cpp" />

View File

@ -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 = "<group>"; };
62D24F331519994300350848 /* palette_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = palette_manager.hpp; sourceTree = "<group>"; };
62D24F341519995200350848 /* palette_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = palette_manager.cpp; sourceTree = "<group>"; };
63B64397BB28593D879A67BE /* community_dialog.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = community_dialog.cpp; path = community_dialog.cpp; sourceTree = "<group>"; };
67044415B63F5888193BD7A6 /* prompt.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = prompt.cpp; sourceTree = "<group>"; };
6FA542D78393E8FF067775DA /* edit_pbl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = edit_pbl.cpp; sourceTree = "<group>"; };
755D4555A1DEA29125E7F338 /* scroll_text.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = scroll_text.cpp; path = scroll_text.cpp; sourceTree = "<group>"; };
@ -2719,6 +2724,7 @@
B5CE46F812A0417D00D665EE /* side_filter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = side_filter.hpp; sourceTree = "<group>"; };
C61F473D9AC43768A445E218 /* tod_new_schedule.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = tod_new_schedule.cpp; sourceTree = "<group>"; };
C679447D91FD3623CC852FF8 /* edit_pbl_translation.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = edit_pbl_translation.hpp; sourceTree = "<group>"; };
CD5045B9A988F034F8D17C85 /* community_dialog.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = community_dialog.hpp; path = community_dialog.hpp; sourceTree = "<group>"; };
D4594633BF3F8A06D6AE752F /* prompt.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = prompt.hpp; sourceTree = "<group>"; };
D911474D925FA88D5B856A0E /* test_sdl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = test_sdl.cpp; path = test_sdl.cpp; sourceTree = "<group>"; };
D9A141EAAE90E98B6F6171D6 /* choose_addon.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = choose_addon.hpp; sourceTree = "<group>"; };
@ -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 = "<group>";
@ -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;
};

View File

@ -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

View File

@ -1,6 +1,5 @@
/*
Copyright (C) 2003 - 2024
by David White <dave@whitevine.net>
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify

View File

@ -1,6 +1,5 @@
/*
Copyright (C) 2003 - 2024
by David White <dave@whitevine.net>
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.

View File

@ -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<button>(&window, "forums", false), std::bind(&desktop::open_object, "https://forums.wesnoth.org/"));
connect_signal_mouse_left_click(find_widget<button>(&window, "discord", false), std::bind(&desktop::open_object, "https://discord.gg/battleforwesnoth"));
connect_signal_mouse_left_click(find_widget<button>(&window, "irc", false), std::bind(&desktop::open_object, "https://web.libera.chat/#wesnoth"));
connect_signal_mouse_left_click(find_widget<button>(&window, "steam", false), std::bind(&desktop::open_object, "https://steamcommunity.com/app/599390/discussions/"));
connect_signal_mouse_left_click(find_widget<button>(&window, "reddit", false), std::bind(&desktop::open_object, "https://www.reddit.com/r/wesnoth/"));
connect_signal_mouse_left_click(find_widget<button>(&window, "donate", false), std::bind(&desktop::open_object, "https://www.spi-inc.org/projects/wesnoth/"));
}
void community_dialog::post_show(window&)
{
}
} // namespace gui2::dialogs

View File

@ -0,0 +1,52 @@
/*
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.
*/
#pragma once
#include "gui/dialogs/modal_dialog.hpp"
namespace gui2::dialogs
{
/**
* @ingroup GUIWindowDefinitionWML
*
* This shows a dialog displaying community links.
*
* Key |Type |Mandatory|Description
* -------|--------|---------|-----------
* forums |button |yes |Links to the Wesnoth forums
* discord|button |yes |Links to the Wesnoth Discord server
* irc |button |yes |Links to a web client for the Wesnoth IRC channels
* steam |button |yes |Links to the Wesnoth Steam forums
* reddit |button |yes |Links to the Wesnoth sub-reddit
* donate |button |yes |Links to the SPI donation page for Wesnoth
*/
class community_dialog : public modal_dialog
{
public:
DEFINE_SIMPLE_EXECUTE_WRAPPER(community_dialog)
community_dialog();
private:
virtual const std::string& window_id() const override;
virtual void pre_show(window& window) override;
virtual void post_show(window& window) override;
};
} // namespace gui2::dialogs

View File

@ -26,6 +26,7 @@
#include "gui/auxiliary/find_widget.hpp"
#include "gui/auxiliary/tips.hpp"
#include "gui/dialogs/achievements_dialog.hpp"
#include "gui/dialogs/community_dialog.hpp"
#include "gui/dialogs/core_selection.hpp"
#include "gui/dialogs/debug_clock.hpp"
#include "gui/dialogs/game_version_dialog.hpp"
@ -338,6 +339,12 @@ void title_screen::init_callbacks()
register_button(*this, "achievements", hotkey::HOTKEY_ACHIEVEMENTS,
std::bind(&title_screen::show_achievements, this));
//
// Community
//
register_button(*this, "community", hotkey::HOTKEY_NULL,
std::bind(&title_screen::show_community, this));
//
// Credits
//
@ -481,6 +488,12 @@ void title_screen::show_achievements()
ach.show();
}
void title_screen::show_community()
{
community_dialog dlg;
dlg.show();
}
void title_screen::button_callback_multiplayer()
{
while(true) {

View File

@ -113,6 +113,8 @@ private:
void show_achievements();
void show_community();
void button_callback_multiplayer();
void button_callback_cores();

View File

@ -42,6 +42,7 @@
#include "gui/dialogs/attack_predictions.hpp"
#include "gui/dialogs/campaign_difficulty.hpp"
#include "gui/dialogs/campaign_selection.hpp"
#include "gui/dialogs/community_dialog.hpp"
#include "gui/dialogs/chat_log.hpp"
#include "gui/dialogs/core_selection.hpp"
#include "gui/dialogs/debug_clock.hpp"
@ -623,6 +624,10 @@ BOOST_AUTO_TEST_CASE(modal_dialog_test_achievements_dialog)
{
test<achievements_dialog>();
}
BOOST_AUTO_TEST_CASE(modal_dialog_test_community_dialog)
{
test<community_dialog>();
}
BOOST_AUTO_TEST_CASE(modal_dialog_test_mp_match_history_dialog)
{
test<mp_match_history>();