gui2/tmp_cmd_wrapper: Regroup mod options into a grid that's hidden by default

This makes it so the grid and its children are only displayed when the
client has mod access to the sever, rather than keeping them visible at
all times and graying them out when not available.
This commit is contained in:
Ignacio R. Morelle 2015-06-01 22:59:15 -03:00
parent ea3f1786bb
commit 049d2afbb1
3 changed files with 180 additions and 170 deletions

View file

@ -29,6 +29,8 @@ Version 1.13.0+dev:
* Force uniform font rendering settings across X11 and Apple OS X, avoiding
color glitches resulting from incorrect applications of subpixel hinting
(bug #20337).
* Hide mod options from the user command prompt dialog in the MP lobby when
not authenticated as a mod.
* WML engine:
* Added support for [object] duration=turn end
* New or updated image path functions:

View file

@ -226,129 +226,6 @@
[/row]
[row]
grow_factor = 0
[column]
grow_factor = 1
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
definition = "title"
label = _ "Moderating"
[/label]
[/column]
[/row]
[row]
grow_factor = 0
[column]
grow_factor = 1
horizontal_grow = "true"
[grid]
[row]
grow_factor = 1
[column]
grow_factor = 0
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
definition = "default"
label = _ "Reason:"
[/label]
[/column]
[column]
grow_factor = 1
border = "all"
border_size = 5
horizontal_alignment = "right"
[text_box]
id = "reason"
definition = "default"
label = ""
[/text_box]
[/column]
[/row]
[/grid]
[/column]
[/row]
[row]
grow_factor = 0
[column]
grow_factor = 1
horizontal_grow = "true"
[grid]
[row]
grow_factor = 1
[column]
grow_factor = 0
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
definition = "default"
label = _ "Time:"
[/label]
[/column]
[column]
grow_factor = 1
border = "all"
border_size = 5
horizontal_alignment = "right"
[text_box]
id = "time"
definition = "default"
label = ""
[/text_box]
[/column]
[/row]
[/grid]
[/column]
[/row]
[row]
grow_factor = 0
@ -357,52 +234,206 @@
horizontal_grow = "true"
[grid]
id = "mod_options"
[row]
grow_factor = 0
[column]
horizontal_grow = "true"
grow_factor = 1
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
definition = "title"
[button]
definition = "default"
id = "status"
label = _ "Status"
[/button]
label = _ "Moderating"
[/label]
[/column]
[/row]
[row]
grow_factor = 0
[column]
grow_factor = 1
horizontal_grow = "true"
border = "all"
border_size = 5
[grid]
[button]
definition = "default"
id = "kick"
[row]
grow_factor = 1
label = _ "Kick"
[/button]
[column]
grow_factor = 0
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
definition = "default"
label = _ "Reason:"
[/label]
[/column]
[column]
grow_factor = 1
border = "all"
border_size = 5
horizontal_alignment = "right"
[text_box]
id = "reason"
definition = "default"
label = ""
[/text_box]
[/column]
[/row]
[/grid]
[/column]
[/row]
[row]
grow_factor = 0
[column]
grow_factor = 1
horizontal_grow = "true"
border = "all"
border_size = 5
[grid]
[button]
[row]
grow_factor = 1
[column]
grow_factor = 0
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
definition = "default"
label = _ "Time:"
[/label]
[/column]
[column]
grow_factor = 1
border = "all"
border_size = 5
horizontal_alignment = "right"
[text_box]
id = "time"
definition = "default"
label = ""
[/text_box]
[/column]
[/row]
[/grid]
[/column]
[/row]
[row]
grow_factor = 0
[column]
grow_factor = 1
horizontal_grow = "true"
[grid]
[row]
grow_factor = 0
[column]
horizontal_grow = "true"
border = "all"
border_size = 5
[button]
definition = "default"
id = "status"
label = _ "Status"
[/button]
[/column]
[column]
horizontal_grow = "true"
border = "all"
border_size = 5
[button]
definition = "default"
id = "kick"
label = _ "Kick"
[/button]
[/column]
[column]
horizontal_grow = "true"
border = "all"
border_size = 5
[button]
definition = "default"
id = "ban"
label = _ "Ban"
[/button]
[/column]
[/row]
[/grid]
[/column]
[/row]
[row]
grow_factor = 0
[column]
grow_factor = 1
border = "top"
border_size = 30
[spacer]
definition = "default"
id = "ban"
label = _ "Ban"
[/button]
[/spacer]
[/column]
@ -414,22 +445,6 @@
[/row]
[row]
grow_factor = 0
[column]
grow_factor = 1
border = "top"
border_size = 30
[spacer]
definition = "default"
[/spacer]
[/column]
[/row]
[row]
grow_factor = 0

View file

@ -105,16 +105,9 @@ void tmp_cmd_wrapper::pre_show(CVideo& /*video*/, twindow& window)
const bool authenticated = preferences::is_authenticated();
if(tbutton* b = find_widget<tbutton>(&window, "status", false, false)) {
b->set_active(authenticated);
}
if(tbutton* b = find_widget<tbutton>(&window, "kick", false, false)) {
b->set_active(authenticated);
}
if(tbutton* b = find_widget<tbutton>(&window, "ban", false, false)) {
b->set_active(authenticated);
if(tgrid* g = find_widget<tgrid>(&window, "mod_options", false, false)) {
g->set_active(authenticated);
g->set_visible(authenticated ? twidget::tvisible::visible : twidget::tvisible::invisible);
}
/**