The Battle for Wesnoth  1.19.0-dev
edit_pbl.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2023 - 2024
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
18 
19 namespace gui2
20 {
21 
22 namespace dialogs
23 {
24 
25 /**
26  * @ingroup GUIWindowDefinitionWML
27  *
28  * Dialog for editing an add-on's _server.pbl.
29  * Key |Type |Mandatory|Description
30  * ------------------|------------------|---------|-----------
31  * name | text_box |yes |The name of the add-on displayed on the UI.
32  * description | scroll_text |yes |The add-on's description.
33  * icon | text_box |yes |The add-on's icon.
34  * author | text_box |yes |The author of the add-on. When using forum_auth, this must be a forum username.
35  * version | text_box |yes |The add-on's version.
36  * dependencies | text_box |yes |Other add-on IDs which this add-on depends on.
37  * tags | multimenu_button |yes |Tags for the add-on for searching in the add-ons manager.
38  * type | menu_button |yes |The type of the add-on.
39  * forum_thread | text_box |yes |The topic ID of this add-on's forum feedback thread.
40  * forum_auth | toggle_button |yes |Whether to use forum authentication when uploading or deleting the add-on.
41  * secondary_authors | text_box |yes |Any other forum usernames of people who are also allowed to upload updates for this add-on. Only works with forum_auth being enabled.
42  * email | text_box |yes |A contact email address. Requred when not using forum_auth.
43  * password | text_box |yes |The password to use when uploading the add-on. Requred when not using forum_auth.
44  */
46 {
47 public:
48  editor_edit_pbl(const std::string& pbl, const std::string& current_addon);
49 
50  /** The execute function. See @ref modal_dialog for more information. */
52 
53 private:
54  virtual void pre_show(window& window) override;
55  virtual void post_show(window& window) override;
56 
57  virtual const std::string& window_id() const override;
58 
59  void toggle_auth();
60  void add_translation();
61  void delete_translation();
62  void validate();
63  void update_icon_preview();
64  void update_url_preview();
65  void select_icon_file();
67 
68  std::string pbl_;
69  std::string current_addon_;
70  std::vector<std::string> dirs_;
71 };
72 
73 } // namespace dialogs
74 } // namespace gui2
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:159
Dialog for editing an add-on's _server.pbl.
Definition: edit_pbl.hpp:46
editor_edit_pbl(const std::string &pbl, const std::string &current_addon)
Definition: edit_pbl.cpp:71
virtual const std::string & window_id() const override
The ID of the window to build.
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
Definition: edit_pbl.cpp:220
virtual void pre_show(window &window) override
The execute function.
Definition: edit_pbl.cpp:98
std::vector< std::string > dirs_
Definition: edit_pbl.hpp:70
Abstract base class for all modal dialogs.
base class of top level items, the only item which needs to store the final canvases to draw on.
Definition: window.hpp:63
#define DEFINE_SIMPLE_EXECUTE_WRAPPER(dialog)
Adds a bare-bonesstatic execute function to a dialog class that immediately invokes and return the re...
Various uncategorised dialogs.
Generic file dialog.