gui2/twml_error: New GUI2 dialog to be used for WML parser/pp errors
This dialog features separate summary and detail sections along with a small heading for the latter in bold face. More features may be added later as part of my work on improving WML diagnostics, but for now we have the bare minimum for better message formatting with a content structure more or less identical to the current one.
This commit is contained in:
parent
a30c50d567
commit
d5a34a1460
5 changed files with 206 additions and 0 deletions
113
data/gui/default/window/wml_error.cfg
Normal file
113
data/gui/default/window/wml_error.cfg
Normal file
|
@ -0,0 +1,113 @@
|
|||
#textdomain wesnoth-lib
|
||||
###
|
||||
### Dialog used to report WML parser or preprocessor errors.
|
||||
###
|
||||
|
||||
[window]
|
||||
id = "wml_error"
|
||||
description = "WML preprocessor/parser error report dialog."
|
||||
|
||||
[resolution]
|
||||
definition = "default"
|
||||
|
||||
#click_dismiss = "true"
|
||||
maximum_width = 800
|
||||
|
||||
automatic_placement = "true"
|
||||
vertical_placement = "center"
|
||||
horizontal_placement = "center"
|
||||
|
||||
[tooltip]
|
||||
id = "tooltip_large"
|
||||
[/tooltip]
|
||||
|
||||
[helptip]
|
||||
id = "tooltip_large"
|
||||
[/helptip]
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[label]
|
||||
definition = "title"
|
||||
label = _ "Error"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[label]
|
||||
id = "summary"
|
||||
definition = "default"
|
||||
wrap = true
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[label]
|
||||
id = "details_heading"
|
||||
definition = "default_bold"
|
||||
label = _ "Details:"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_grow = "true"
|
||||
|
||||
[scroll_label]
|
||||
id = "details"
|
||||
definition = "default"
|
||||
[/scroll_label]
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "right"
|
||||
|
||||
[button]
|
||||
id = "ok"
|
||||
definition = "default"
|
||||
label = _ "OK"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/resolution]
|
||||
|
||||
[/window]
|
|
@ -769,6 +769,7 @@ set(wesnoth-main_SRC
|
|||
gui/dialogs/transient_message.cpp
|
||||
gui/dialogs/unit_attack.cpp
|
||||
gui/dialogs/unit_create.cpp
|
||||
gui/dialogs/wml_error.cpp
|
||||
gui/dialogs/wml_message.cpp
|
||||
halo.cpp
|
||||
help.cpp
|
||||
|
|
|
@ -395,6 +395,7 @@ wesnoth_sources = Split("""
|
|||
gui/dialogs/transient_message.cpp
|
||||
gui/dialogs/unit_attack.cpp
|
||||
gui/dialogs/unit_create.cpp
|
||||
gui/dialogs/wml_error.cpp
|
||||
gui/dialogs/wml_message.cpp
|
||||
gui/lib/types/point.cpp
|
||||
gui/widgets/button.cpp
|
||||
|
|
49
src/gui/dialogs/wml_error.cpp
Normal file
49
src/gui/dialogs/wml_error.cpp
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
Copyright (C) 2014 by Ignacio R. Morelle <shadowm2006@gmail.com>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#include "gui/dialogs/wml_error.hpp"
|
||||
|
||||
#include "gui/widgets/settings.hpp"
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWindowDefinitionWML
|
||||
* @order = 2_wml_error
|
||||
*
|
||||
* == WML error ==
|
||||
*
|
||||
* Dialog used to report WML parser or preprocessor errors.
|
||||
*
|
||||
* @begin{table}{dialog_widgets}
|
||||
*
|
||||
* summary & & control & m &
|
||||
* Label used for displaying a brief summary of the error(s). $
|
||||
*
|
||||
* details & & control & m &
|
||||
* Full report of the parser or preprocessor error(s) found. $
|
||||
*
|
||||
* @end{table}
|
||||
*/
|
||||
|
||||
REGISTER_DIALOG(wml_error)
|
||||
|
||||
twml_error::twml_error(const std::string& summary, const std::string& details)
|
||||
{
|
||||
register_label("summary", true, summary);
|
||||
register_label("details", true, details);
|
||||
}
|
||||
|
||||
} // end namespace gui2
|
42
src/gui/dialogs/wml_error.hpp
Normal file
42
src/gui/dialogs/wml_error.hpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
Copyright (C) 2014 by Ignacio R. Morelle <shadowm2006@gmail.com>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#ifndef GUI_DIALOGS_WML_ERROR_HPP_INCLUDED
|
||||
#define GUI_DIALOGS_WML_ERROR_HPP_INCLUDED
|
||||
|
||||
#include "gui/dialogs/dialog.hpp"
|
||||
|
||||
namespace gui2 {
|
||||
|
||||
class twml_error : public tdialog
|
||||
{
|
||||
public:
|
||||
twml_error(const std::string& summary, const std::string& details);
|
||||
|
||||
/** The display function; see @ref tdialog for more information. */
|
||||
static void display(const std::string& summary,
|
||||
const std::string& details,
|
||||
CVideo& video)
|
||||
{
|
||||
twml_error(summary, details).show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
};
|
||||
|
||||
} // end namespace gui2
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue