The Battle for Wesnoth  1.19.7+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::dialogs
26 {
27 class game_version : public modal_dialog
28 {
29 public:
30  /**
31  * Constructor.
32  */
33  game_version(unsigned start_page = 0);
34 
35  /**
36  * The display function.
37  *
38  * See @ref modal_dialog for more information.
39  */
41 
42 private:
43  const std::string path_wid_stem_;
44  const std::string copy_wid_stem_;
45  const std::string browse_wid_stem_;
46 
47  std::map<std::string, std::string> path_map_;
48 
49  /** path to current log file */
50  const std::string log_path_;
51 
52  typedef std::array<std::string, 4> deplist_entry;
53  std::vector<deplist_entry> deps_;
54 
55  std::vector<game_config::optional_feature> opts_;
56 
57  std::string report_;
58 
59  unsigned start_page_;
60 
62 
63  virtual const std::string& window_id() const override;
64 
65  virtual void pre_show() override;
66 
67  //
68  // Widget event callbacks.
69  //
70 
71  /**
72  * Callback function called when switching tabs.
73  */
75 
76  /**
77  * Callback function for the dialog-wide copy-to-clipboard button.
78  */
79  void report_copy_callback();
80 
81  /**
82  * Callback function for copy-to-clipboard action buttons.
83  *
84  * @param path Filesystem path associated with the widget.
85  * @param btn_id Id of the button that calls this method
86  */
87  void copy_to_clipboard_callback(const std::string& path, const std::string& btn_id);
88 
89  /**
90  * Callback function for browse-directory action buttons.
91  *
92  * @param path Filesystem path associated with the widget.
93  */
94  void browse_directory_callback(const std::string& path);
95 
96  /**
97  * Show credits dialogs
98  */
99  void show_credits_dialog();
100  /**
101  * Show license
102  */
103  void show_license();
104 
105  /**
106  * Open browser to report issue
107  */
108  void report_issue();
109 
110  /**
111  * Re-runs the version migration dialog.
112  */
113  void run_migrator();
114 
115  /**
116  * Opens the game manual in the platform's browser
117  */
118  void show_manual();
119 };
120 
121 } // namespace gui2::dialogs
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.
std::map< std::string, std::string > path_map_
const std::string log_path_
path to current log file
void run_migrator()
Re-runs the version migration dialog.
void show_credits_dialog()
Show credits dialogs.
std::vector< deplist_entry > deps_
void copy_to_clipboard_callback(const std::string &path, const std::string &btn_id)
Callback function for copy-to-clipboard action buttons.
void browse_directory_callback(const std::string &path)
Callback function for browse-directory action buttons.
std::vector< game_config::optional_feature > opts_
virtual void pre_show() override
Actions to be taken before showing the window.
void show_manual()
Opens the game manual in the platform's browser.
game_version(unsigned start_page=0)
Constructor.
Abstract base class for all modal dialogs.
#define DEFINE_SIMPLE_DISPLAY_WRAPPER(dialog)
Adds a bare-bones static display function to a dialog class that immediately invokes the dialogs's mo...
std::string path
Definition: filesystem.cpp:91