1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Improve online lobby visual

This commit is contained in:
nordsoft 2022-11-16 23:28:21 +04:00
parent 20573073c9
commit 179cdee424
3 changed files with 26 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

View File

@ -67,7 +67,11 @@ void Lobby::serverCommand(const ServerCommand & command) try
QTableWidgetItem * sessionPlayerItem = new QTableWidgetItem(QString("%1/%2").arg(playersJoined).arg(playersTotal));
ui->sessionsTable->setItem(i, 1, sessionPlayerItem);
QTableWidgetItem * sessionProtectedItem = new QTableWidgetItem(args[tagPoint++]);
QTableWidgetItem * sessionProtectedItem = new QTableWidgetItem();
bool isPrivate = (args[tagPoint++] == "True");
sessionProtectedItem->setData(Qt::UserRole, isPrivate);
if(isPrivate)
sessionProtectedItem->setIcon(QIcon("icons:room-private.png"));
ui->sessionsTable->setItem(i, 2, sessionProtectedItem);
}
break;
@ -236,8 +240,8 @@ void Lobby::on_joinButton_clicked()
auto * item = ui->sessionsTable->item(ui->sessionsTable->currentRow(), 0);
if(item)
{
auto isPrivate = ui->sessionsTable->item(ui->sessionsTable->currentRow(), 2)->text(); //check if private
if(isPrivate == "True")
auto isPrivate = ui->sessionsTable->item(ui->sessionsTable->currentRow(), 2)->data(Qt::UserRole).toBool();
if(isPrivate)
new LobbyRoomRequest(socketLobby, item->text(), this);
else
socketLobby.requestJoinSession(item->text(), "");

View File

@ -95,6 +95,24 @@
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>80</number>
</attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>20</number>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>20</number>
</attribute>
<column>
<property name="text">
<string>Session</string>
@ -107,7 +125,7 @@
</column>
<column>
<property name="text">
<string>Private</string>
<string/>
</property>
</column>
</widget>