Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gui/addon_manager: Add dedicated license prompt dialog
This allows using full markup for the license text and making it independently scrollable without messing up the dialog. It also enables URL parsing in it.
- Loading branch information
Showing
7 changed files
with
227 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
#textdomain wesnoth-lib | ||
### | ||
### Definition of the Add-ons Manager license promnpt dialog | ||
### | ||
|
||
[window] | ||
id = "addon_license_prompt" | ||
description = "Add-ons Manager content license prompt displayed during uploads." | ||
|
||
[resolution] | ||
definition = "default" | ||
|
||
automatic_placement = true | ||
vertical_placement = "center" | ||
horizontal_placement = "center" | ||
|
||
maximum_width = 800 | ||
#maximum_height = 600 | ||
|
||
[tooltip] | ||
id = "tooltip" | ||
[/tooltip] | ||
|
||
[helptip] | ||
id = "tooltip" | ||
[/helptip] | ||
|
||
[grid] | ||
[row] | ||
grow_factor = 0 | ||
[column] | ||
grow_factor = 1 | ||
horizontal_alignment = "left" | ||
border = "all" | ||
border_size = 5 | ||
|
||
[label] | ||
definition = "title" | ||
label = _ "addons_server^Server Rules" | ||
[/label] | ||
[/column] | ||
[/row] | ||
|
||
[row] | ||
grow_factor = 0 | ||
[column] | ||
grow_factor = 1 | ||
horizontal_alignment = "left" | ||
border = "all" | ||
border_size = 5 | ||
|
||
[label] | ||
id = "message" | ||
label = "Before uploading content to this server, you must accept the following distribution terms by choosing “I Agree”." | ||
wrap = true | ||
[/label] | ||
[/column] | ||
[/row] | ||
|
||
[row] | ||
grow_factor = 0 | ||
[column] | ||
horizontal_grow = true | ||
border = "all" | ||
border_size = 5 | ||
|
||
[panel] | ||
definition = "box_display_no_blur_no_border" | ||
[grid] | ||
[row] | ||
[column] | ||
horizontal_grow = true | ||
border = "all" | ||
border_size = 5 | ||
|
||
[scroll_label] | ||
id = "terms" | ||
definition = "description" | ||
label = "server terms placeholder" | ||
[/scroll_label] | ||
[/column] | ||
[/row] | ||
[/grid] | ||
[/panel] | ||
[/column] | ||
[/row] | ||
|
||
[row] | ||
grow_factor = 0 | ||
[column] | ||
horizontal_alignment = "right" | ||
|
||
[grid] | ||
[row] | ||
grow_factor = 0 | ||
[column] | ||
horizontal_alignment = "right" | ||
border = "all" | ||
border_size = 5 | ||
|
||
[button] | ||
id = "ok" | ||
label = _ "I Agree" | ||
[/button] | ||
[/column] | ||
|
||
[column] | ||
horizontal_alignment = "right" | ||
border = "all" | ||
border_size = 5 | ||
|
||
[button] | ||
id = "cancel" | ||
label = _ "Cancel" | ||
[/button] | ||
[/column] | ||
[/row] | ||
[/grid] | ||
[/column] | ||
[/row] | ||
[/grid] | ||
[/resolution] | ||
[/window] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
Copyright (C) 2020 by Iris Morelle <shadowm@wesnoth.org> | ||
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/addon/license_prompt.hpp" | ||
|
||
#include "gettext.hpp" | ||
#include "gui/auxiliary/find_widget.hpp" | ||
#include "gui/widgets/button.hpp" | ||
#include "gui/widgets/settings.hpp" | ||
#include "gui/widgets/window.hpp" | ||
|
||
namespace gui2 { | ||
namespace dialogs { | ||
|
||
REGISTER_DIALOG(addon_license_prompt) | ||
|
||
addon_license_prompt::addon_license_prompt(const std::string& license_terms) | ||
: license_terms_(license_terms) | ||
{ | ||
} | ||
|
||
void addon_license_prompt::pre_show(window& window) | ||
{ | ||
styled_widget& terms = find_widget<styled_widget>(&window, "terms", false); | ||
terms.set_use_markup(true); | ||
terms.set_label(license_terms_); | ||
} | ||
|
||
}} // end namespace gui2::dialogs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
Copyright (C) 2020 by Iris Morelle <shadowm@wesnoth.org> | ||
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 { | ||
namespace dialogs { | ||
|
||
class addon_license_prompt : public modal_dialog | ||
{ | ||
public: | ||
/** Constructor. */ | ||
explicit addon_license_prompt(const std::string& license_terms); | ||
|
||
/** | ||
* The execute function. | ||
* | ||
* See @ref modal_dialog for more information. | ||
*/ | ||
DEFINE_SIMPLE_EXECUTE_WRAPPER(addon_license_prompt) | ||
|
||
private: | ||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */ | ||
virtual const std::string& window_id() const override; | ||
|
||
/** Inherited from modal_dialog. */ | ||
virtual void pre_show(window& window) override; | ||
|
||
std::string license_terms_; | ||
}; | ||
|
||
}} // end namespace gui2::dialogs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters