From 927806a432271d5b71d9f217c4ef4848e90e8a56 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Tue, 27 Apr 2021 08:54:29 -0700 Subject: [PATCH] SettingsDialog: Add translations to Session Table --- data/locale/en-US.ini | 6 ++++++ src/forms/SettingsDialog.cpp | 6 +++++- src/forms/SettingsDialog.ui | 8 ++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/data/locale/en-US.ini b/data/locale/en-US.ini index 0e12ed28..88ee3528 100644 --- a/data/locale/en-US.ini +++ b/data/locale/en-US.ini @@ -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." diff --git a/src/forms/SettingsDialog.cpp b/src/forms/SettingsDialog.cpp index e4594c5b..0d4b3ca5 100644 --- a/src/forms/SettingsDialog.cpp +++ b/src/forms/SettingsDialog.cpp @@ -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); diff --git a/src/forms/SettingsDialog.ui b/src/forms/SettingsDialog.ui index f33ef9f6..6df800f8 100644 --- a/src/forms/SettingsDialog.ui +++ b/src/forms/SettingsDialog.ui @@ -162,22 +162,22 @@ - Remote Address + OBSWebSocket.SessionTable.RemoteAddressColumnTitle - Duration + OBSWebSocket.SessionTable.SessionDurationColumnTitle - In/Out + OBSWebSocket.SessionTable.MessagesInOutColumnTitle - Kick? + OBSWebSocket.SessionTable.KickButtonColumnTitle