mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-02 23:07:36 +02:00
Improve online lobby visual
This commit is contained in:
parent
20573073c9
commit
179cdee424
BIN
launcher/icons/room-private.png
Normal file
BIN
launcher/icons/room-private.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 683 B |
@ -67,7 +67,11 @@ void Lobby::serverCommand(const ServerCommand & command) try
|
|||||||
QTableWidgetItem * sessionPlayerItem = new QTableWidgetItem(QString("%1/%2").arg(playersJoined).arg(playersTotal));
|
QTableWidgetItem * sessionPlayerItem = new QTableWidgetItem(QString("%1/%2").arg(playersJoined).arg(playersTotal));
|
||||||
ui->sessionsTable->setItem(i, 1, sessionPlayerItem);
|
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);
|
ui->sessionsTable->setItem(i, 2, sessionProtectedItem);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -236,8 +240,8 @@ void Lobby::on_joinButton_clicked()
|
|||||||
auto * item = ui->sessionsTable->item(ui->sessionsTable->currentRow(), 0);
|
auto * item = ui->sessionsTable->item(ui->sessionsTable->currentRow(), 0);
|
||||||
if(item)
|
if(item)
|
||||||
{
|
{
|
||||||
auto isPrivate = ui->sessionsTable->item(ui->sessionsTable->currentRow(), 2)->text(); //check if private
|
auto isPrivate = ui->sessionsTable->item(ui->sessionsTable->currentRow(), 2)->data(Qt::UserRole).toBool();
|
||||||
if(isPrivate == "True")
|
if(isPrivate)
|
||||||
new LobbyRoomRequest(socketLobby, item->text(), this);
|
new LobbyRoomRequest(socketLobby, item->text(), this);
|
||||||
else
|
else
|
||||||
socketLobby.requestJoinSession(item->text(), "");
|
socketLobby.requestJoinSession(item->text(), "");
|
||||||
|
@ -95,6 +95,24 @@
|
|||||||
<property name="selectionBehavior">
|
<property name="selectionBehavior">
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</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>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Session</string>
|
<string>Session</string>
|
||||||
@ -107,7 +125,7 @@
|
|||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Private</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user