The Battle for Wesnoth  1.19.5+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() 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  * Re-runs the version migration dialog.
116  */
117  void run_migrator();
118 
119  /**
120  * Opens the game manual in the platform's browser
121  */
122  void show_manual();
123 };
124 } // namespace dialogs
125 } // 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.
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...
Various uncategorised dialogs.
std::string path
Definition: filesystem.cpp:90
Generic file dialog.