SettingsDialog: Add translations to Session Table

This commit is contained in:
tt2468 2021-04-27 08:54:29 -07:00
parent aa0256611b
commit 927806a432
3 changed files with 15 additions and 5 deletions

View File

@ -8,6 +8,12 @@ OBSWebSocket.Settings.CopyPassword="Copy Password to Clipboard"
OBSWebSocket.Settings.ServerPort="Server Port"
OBSWebSocket.Settings.ConnectedSessionsTitle="Connected WebSocket Sessions"
OBSWebSocket.SessionTable.RemoteAddressColumnTitle="Remote Address"
OBSWebSocket.SessionTable.SessionDurationColumnTitle="Session Duration"
OBSWebSocket.SessionTable.MessagesInOutColumnTitle="Messages In/Out"
OBSWebSocket.SessionTable.KickButtonColumnTitle="Kick?"
OBSWebSocket.SessionTable.KickButtonText="Kick"
OBSWebSocket.NotifyConnect.Title="New WebSocket connection."
OBSWebSocket.NotifyConnect.Message="Client %1 connected."
OBSWebSocket.NotifyDisconnect.Title="WebSocket client disconnected."

View File

@ -55,6 +55,10 @@ void SettingsDialog::ToggleShowHide()
void SettingsDialog::FillSessionTable()
{
int rowCount = 5;
obs_frontend_push_ui_translation(obs_module_get_string);
QString kickButtonText = QObject::tr("OBSWebSocket.SessionTable.KickButtonText");
obs_frontend_pop_ui_translation();
ui->websocketSessionTable->setRowCount(rowCount);
for (int i = 0; i < 5; i++) {
QTableWidgetItem *addressItem = new QTableWidgetItem("test");
@ -66,7 +70,7 @@ void SettingsDialog::FillSessionTable()
QTableWidgetItem *statsItem = new QTableWidgetItem("test");
ui->websocketSessionTable->setItem(i, 2, statsItem);
QPushButton *invalidateButton = new QPushButton("Kick", this);
QPushButton *invalidateButton = new QPushButton(kickButtonText, this);
QWidget *invalidateButtonWidget = new QWidget();
QHBoxLayout *invalidateButtonLayout = new QHBoxLayout(invalidateButtonWidget);
invalidateButtonLayout->addWidget(invalidateButton);

View File

@ -162,22 +162,22 @@
</attribute>
<column>
<property name="text">
<string>Remote Address</string>
<string>OBSWebSocket.SessionTable.RemoteAddressColumnTitle</string>
</property>
</column>
<column>
<property name="text">
<string>Duration</string>
<string>OBSWebSocket.SessionTable.SessionDurationColumnTitle</string>
</property>
</column>
<column>
<property name="text">
<string>In/Out</string>
<string>OBSWebSocket.SessionTable.MessagesInOutColumnTitle</string>
</property>
</column>
<column>
<property name="text">
<string>Kick?</string>
<string>OBSWebSocket.SessionTable.KickButtonColumnTitle</string>
</property>
</column>
</widget>