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 1df73b9e4c
commit dab5668e4d
3 changed files with 180 additions and 170 deletions

View file

@ -10,6 +10,8 @@ Version 1.12.2+dev:
* Fixed minimap buttons appearing without contents or in the wrong state
during WML start events until they are interacted with or control is given
to the player for the first time or some other unspecified thing happens.
* Hide mod options from the user command prompt dialog in the MP lobby when
not authenticated as a mod.
* Miscellaneous and bug fixes:
* Fixed bug #23445: set default build type in cmake to "Release" to ensure
that the game is not unoptimized

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);
}
/**