GUI2/Addon License Prompt: simplify implementation
This commit is contained in:
parent
243bc6de78
commit
206675050d
2 changed files with 16 additions and 34 deletions
|
@ -1,15 +1,15 @@
|
|||
/*
|
||||
Copyright (C) 2020 by Iris Morelle <shadowm@wesnoth.org>
|
||||
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
|
||||
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.
|
||||
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.
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#define GETTEXT_DOMAIN "wesnoth-lib"
|
||||
|
@ -17,26 +17,14 @@
|
|||
#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 {
|
||||
|
||||
namespace gui2::dialogs
|
||||
{
|
||||
REGISTER_DIALOG(addon_license_prompt)
|
||||
|
||||
addon_license_prompt::addon_license_prompt(const std::string& license_terms)
|
||||
: license_terms_(license_terms)
|
||||
{
|
||||
register_label("terms", true, license_terms, true);
|
||||
}
|
||||
|
||||
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
|
||||
} // end namespace gui2::dialogs
|
||||
|
|
|
@ -16,9 +16,8 @@
|
|||
|
||||
#include "gui/dialogs/modal_dialog.hpp"
|
||||
|
||||
namespace gui2 {
|
||||
namespace dialogs {
|
||||
|
||||
namespace gui2::dialogs
|
||||
{
|
||||
class addon_license_prompt : public modal_dialog
|
||||
{
|
||||
public:
|
||||
|
@ -35,11 +34,6 @@ public:
|
|||
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
|
||||
} // end namespace gui2::dialogs
|
||||
|
|
Loading…
Add table
Reference in a new issue