The Battle for Wesnoth  1.19.0+dev
game_version_dialog.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 - 2024
3  by Iris Morelle <shadowm2006@gmail.com>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
19 
20 #include "build_info.hpp"
21 
22 #include <map>
23 #include <array>
24 
25 namespace gui2
26 {
27 
28 namespace dialogs
29 {
30 
31 class game_version : public modal_dialog
32 {
33 public:
34  /**
35  * Constructor.
36  */
37  game_version(unsigned start_page = 0);
38 
39  /**
40  * The display function.
41  *
42  * See @ref modal_dialog for more information.
43  */
45 
46 private:
47  const std::string path_wid_stem_;
48  const std::string copy_wid_stem_;
49  const std::string browse_wid_stem_;
50 
51  std::map<std::string, std::string> path_map_;
52 
53  /** path to current log file */
54  const std::string log_path_;
55 
56  typedef std::array<std::string, 4> deplist_entry;
57  std::vector<deplist_entry> deps_;
58 
59  std::vector<game_config::optional_feature> opts_;
60 
61  std::string report_;
62 
63  unsigned start_page_;
64 
66 
67  virtual const std::string& window_id() const override;
68 
69  virtual void pre_show(window& window) override;
70 
71  //
72  // Widget event callbacks.
73  //
74 
75  /**
76  * Callback function called when switching tabs.
77  */
79 
80  /**
81  * Callback function for the dialog-wide copy-to-clipboard button.
82  */
83  void report_copy_callback();
84 
85  /**
86  * Callback function for copy-to-clipboard action buttons.
87  *
88  * @param path Filesystem path associated with the widget.
89  * @param btn_id Id of the button that calls this method
90  */
91  void copy_to_clipboard_callback(const std::string& path, const std::string btn_id);
92 
93  /**
94  * Callback function for browse-directory action buttons.
95  *
96  * @param path Filesystem path associated with the widget.
97  */
98  void browse_directory_callback(const std::string& path);
99 
100  /**
101  * Show credits dialogs
102  */
103  void show_credits_dialog();
104  /**
105  * Show license
106  */
107  void show_license();
108 
109  /**
110  * Open browser to report issue
111  */
112  void report_issue();
113 
114  /**
115  * Callback function to re-run the version migration dialog.
116  */
117  void run_migrator();
118 };
119 } // namespace dialogs
120 } // namespace gui2
const std::string path_wid_stem_
The display function.
void tab_switch_callback()
Callback function called when switching tabs.
void report_issue()
Open browser to report issue.
std::array< std::string, 4 > deplist_entry
virtual const std::string & window_id() const override
The ID of the window to build.
void report_copy_callback()
Callback function for the dialog-wide copy-to-clipboard button.
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
void copy_to_clipboard_callback(const std::string &path, const std::string btn_id)
Callback function for copy-to-clipboard action buttons.
std::map< std::string, std::string > path_map_
const std::string log_path_
path to current log file
void run_migrator()
Callback function to re-run the version migration dialog.
void show_credits_dialog()
Show credits dialogs.
std::vector< deplist_entry > deps_
void browse_directory_callback(const std::string &path)
Callback function for browse-directory action buttons.
std::vector< game_config::optional_feature > opts_
game_version(unsigned start_page=0)
Constructor.
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:61
#define DEFINE_SIMPLE_DISPLAY_WRAPPER(dialog)
Adds a bare-bones static display function to a dialog class that immediately invokes the dialogs's mo...
Various uncategorised dialogs.
std::string path
Definition: filesystem.cpp:84
Generic file dialog.