Fix #3852, several other improvements to the server info dialog

This commit is contained in:
Alayan
2019-04-18 19:40:55 +02:00
parent 5ec783db3d
commit 321404db9e
3 changed files with 19 additions and 14 deletions

View File

@@ -1,22 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<div x="2%" y="0%" width="96%" height="100%" layout="vertical-row" >
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true"/>
<spacer height="30"/>
<label id="server-info" width="90%" height="fit" align="left" text_align="left" text=""/>
<spacer height="10"/>
<box x="0%" width="90%" height="50%" align="center" layout="vertical-row">
<list id="player-list" x="0" y="0" width="100%" height="100%"/>
<header id="title" width="96%" proportion="4" text_align="center" word_wrap="true"/>
<spacer height="1%" width="5"/>
<label id="server-info" width="90%" proportion="4" align="left" text_align="left" text=""/>
<spacer height="1%"/>
<box x="0%" width="90%" proportion="12" align="center" layout="vertical-row">
<list id="player-list" x="0" y="0" width="100%" height="100%"
alternate_bg="true" line_height="small"/>
</box>
<div width="100%" height="fit" layout="horizontal-row" >
<spacer height="1%" width="5"/>
<div id="password-box" width="100%" proportion="2" layout="horizontal-row" >
<label id="label_password" text_align="left" proportion="1" text="Password"/>
<textbox id="password" proportion="2" height="fit"/>
<textbox id="password" proportion="3" height="fit"/>
</div>
<buttonbar id="options" width="90%" height="15%" align="center">
<icon-button id="join" width="64" height="64" icon="gui/icons/green_check.png"
<spacer height="1%" width="5"/>
<buttonbar id="options" width="90%" proportion="4" align="center">
<icon-button id="join" width="128" height="128" icon="gui/icons/green_check.png"
I18N="In the server info dialog" text="Join" label_location="bottom"/>
<icon-button id="cancel" width="64" height="64" icon="gui/icons/main_quit.png"
<icon-button id="cancel" width="128" height="128" icon="gui/icons/main_quit.png"
I18N="In the server info dialog" text="Cancel" label_location="bottom"/>
</buttonbar>
<spacer height="3%" width="5"/>
</div>
</stkgui>

View File

@@ -355,6 +355,7 @@ void Widget::setCollapsed(const bool collapsed, Screen* calling_screen)
}
// -----------------------------------------------------------------------------
//TODO : Support recalculating layout for dialogs
void Widget::setCollapsed(const bool collapsed, const int uncollapsed_height, Screen* calling_screen)
{

View File

@@ -46,7 +46,7 @@ using namespace Online;
* server (i.e. while it is being created).
*/
ServerInfoDialog::ServerInfoDialog(std::shared_ptr<Server> server)
: ModalDialog(0.8f,0.8f), m_server(server), m_password(NULL)
: ModalDialog(0.85f,0.85f), m_server(server), m_password(NULL)
{
Log::info("ServerInfoDialog", "Server id is %d, owner is %d",
server->getServerId(), server->getServerOwner());
@@ -71,8 +71,8 @@ ServerInfoDialog::ServerInfoDialog(std::shared_ptr<Server> server)
}
else
{
getWidget("label_password")->setVisible(false);
getWidget("password")->setVisible(false);
Widget* password_box = getWidget("password-box");
password_box->setCollapsed(true); // FIXME Doesn't reuse free space for other widgets
}
auto& players = m_server->getPlayers();