The Battle for Wesnoth  1.15.2+dev
wml_error.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2018 by Iris Morelle <shadowm2006@gmail.com>
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 namespace dialogs
22 {
23 
24 /** WML preprocessor/parser error report dialog. */
25 class wml_error : public modal_dialog
26 {
27 public:
28  /**
29  * Constructor.
30  *
31  * @param summary Leading summary line for the report.
32  * @param post_summary Additional line with instructions for the user, may
33  * be empty.
34  * @param files List of WML files on which errors were detected.
35  * @param details Detailed WML preprocessor/parser error report.
36  */
37  wml_error(const std::string& summary,
38  const std::string& post_summary,
39  const std::vector<std::string>& files,
40  const std::string& details);
41 
42  /** The display function; see @ref modal_dialog for more information. */
43  static void display(const std::string& summary,
44  const std::string& post_summary,
45  const std::vector<std::string>& files,
46  const std::string& details)
47  {
48  wml_error(summary, post_summary, files, details).show();
49  }
50 
51  /** The display function; see @ref modal_dialog for more information. */
52  static void display(const std::string& summary,
53  const std::string& details)
54  {
55  display(summary, "", std::vector<std::string>(), details);
56  }
57 
58 private:
61  std::string report_; // Plain text report for copying to clipboard.
62 
63  /** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
64  virtual const std::string& window_id() const override;
65 
66  /** Inherited from modal_dialog. */
67  virtual void pre_show(window& window) override;
68 
69  void copy_report_callback();
70 };
71 
72 } // end namespace dialogs
73 } // end namespace gui2
static void display(const std::string &summary, const std::string &details)
The display function; see modal_dialog for more information.
Definition: wml_error.hpp:52
Generic file dialog.
Definition: field-fwd.hpp:22
WML preprocessor/parser error report dialog.
Definition: wml_error.hpp:25
Various uncategorised dialogs.
wml_error(const std::string &summary, const std::string &post_summary, const std::vector< std::string > &files, const std::string &details)
Constructor.
Definition: wml_error.cpp:174
static void display(const std::string &summary, const std::string &post_summary, const std::vector< std::string > &files, const std::string &details)
The display function; see modal_dialog for more information.
Definition: wml_error.hpp:43
virtual void pre_show(window &window) override
Inherited from modal_dialog.
Definition: wml_error.cpp:209
Abstract base class for all modal dialogs.
virtual const std::string & window_id() const override
Inherited from modal_dialog, implemented by REGISTER_DIALOG.
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62