citra_qt/multiplayer: retranslate multiplayer dialogs

This commit is contained in:
zhupengfei 2018-10-09 23:08:33 +08:00
parent f405134913
commit 748a9849ec
No known key found for this signature in database
GPG Key ID: DD129E108BD09378
11 changed files with 39 additions and 0 deletions

View File

@ -110,6 +110,10 @@ ChatRoom::ChatRoom(QWidget* parent) : QWidget(parent), ui(std::make_unique<Ui::C
ChatRoom::~ChatRoom() = default; ChatRoom::~ChatRoom() = default;
void ChatRoom::RetranslateUi() {
ui->retranslateUi(this);
}
void ChatRoom::Clear() { void ChatRoom::Clear() {
ui->chat_history->clear(); ui->chat_history->clear();
block_list.clear(); block_list.clear();

View File

@ -30,6 +30,7 @@ class ChatRoom : public QWidget {
public: public:
explicit ChatRoom(QWidget* parent); explicit ChatRoom(QWidget* parent);
void RetranslateUi();
void SetPlayerList(const Network::RoomMember::MemberList& member_list); void SetPlayerList(const Network::RoomMember::MemberList& member_list);
void Clear(); void Clear();
void AppendStatusMessage(const QString& msg); void AppendStatusMessage(const QString& msg);

View File

@ -45,6 +45,11 @@ ClientRoomWindow::ClientRoomWindow(QWidget* parent)
ClientRoomWindow::~ClientRoomWindow() = default; ClientRoomWindow::~ClientRoomWindow() = default;
void ClientRoomWindow::RetranslateUi() {
ui->retranslateUi(this);
ui->chat->RetranslateUi();
}
void ClientRoomWindow::OnRoomUpdate(const Network::RoomInformation& info) { void ClientRoomWindow::OnRoomUpdate(const Network::RoomInformation& info) {
UpdateView(); UpdateView();
} }

View File

@ -17,6 +17,8 @@ public:
explicit ClientRoomWindow(QWidget* parent); explicit ClientRoomWindow(QWidget* parent);
~ClientRoomWindow(); ~ClientRoomWindow();
void RetranslateUi();
public slots: public slots:
void OnRoomUpdate(const Network::RoomInformation&); void OnRoomUpdate(const Network::RoomInformation&);
void OnStateChange(const Network::RoomMember::State&); void OnStateChange(const Network::RoomMember::State&);

View File

@ -49,6 +49,10 @@ DirectConnectWindow::DirectConnectWindow(QWidget* parent)
DirectConnectWindow::~DirectConnectWindow() = default; DirectConnectWindow::~DirectConnectWindow() = default;
void DirectConnectWindow::RetranslateUi() {
ui->retranslateUi(this);
}
void DirectConnectWindow::Connect() { void DirectConnectWindow::Connect() {
if (!ui->nickname->hasAcceptableInput()) { if (!ui->nickname->hasAcceptableInput()) {
NetworkMessage::ShowError(NetworkMessage::USERNAME_NOT_VALID); NetworkMessage::ShowError(NetworkMessage::USERNAME_NOT_VALID);

View File

@ -20,6 +20,8 @@ public:
explicit DirectConnectWindow(QWidget* parent = nullptr); explicit DirectConnectWindow(QWidget* parent = nullptr);
~DirectConnectWindow(); ~DirectConnectWindow();
void RetranslateUi();
signals: signals:
/** /**
* Signalled by this widget when it is closing itself and destroying any state such as * Signalled by this widget when it is closing itself and destroying any state such as

View File

@ -73,6 +73,10 @@ HostRoomWindow::HostRoomWindow(QWidget* parent, QStandardItemModel* list,
HostRoomWindow::~HostRoomWindow() = default; HostRoomWindow::~HostRoomWindow() = default;
void HostRoomWindow::RetranslateUi() {
ui->retranslateUi(this);
}
void HostRoomWindow::Host() { void HostRoomWindow::Host() {
if (!ui->username->hasAcceptableInput()) { if (!ui->username->hasAcceptableInput()) {
NetworkMessage::ShowError(NetworkMessage::USERNAME_NOT_VALID); NetworkMessage::ShowError(NetworkMessage::USERNAME_NOT_VALID);

View File

@ -34,6 +34,8 @@ public:
std::shared_ptr<Core::AnnounceMultiplayerSession> session); std::shared_ptr<Core::AnnounceMultiplayerSession> session);
~HostRoomWindow(); ~HostRoomWindow();
void RetranslateUi();
private slots: private slots:
/** /**
* Handler for connection status changes. Launches the chat window if successful or * Handler for connection status changes. Launches the chat window if successful or

View File

@ -84,6 +84,10 @@ Lobby::Lobby(QWidget* parent, QStandardItemModel* list,
RefreshLobby(); RefreshLobby();
} }
void Lobby::RetranslateUi() {
ui->retranslateUi(this);
}
QString Lobby::PasswordPrompt() { QString Lobby::PasswordPrompt() {
bool ok; bool ok;
const QString text = QInputDialog::getText(this, tr("Password Required to Join"), const QString text = QInputDialog::getText(this, tr("Password Required to Join"),

View File

@ -30,6 +30,8 @@ public:
std::shared_ptr<Core::AnnounceMultiplayerSession> session); std::shared_ptr<Core::AnnounceMultiplayerSession> session);
~Lobby() = default; ~Lobby() = default;
void RetranslateUi();
public slots: public slots:
/** /**
* Begin the process to pull the latest room list from web services. After the listing is * Begin the process to pull the latest room list from web services. After the listing is

View File

@ -75,6 +75,15 @@ void MultiplayerState::retranslateUi() {
} else { } else {
status_text->setText(tr("Not Connected")); status_text->setText(tr("Not Connected"));
} }
if (lobby)
lobby->RetranslateUi();
if (host_room)
host_room->RetranslateUi();
if (client_room)
client_room->RetranslateUi();
if (direct_connect)
direct_connect->RetranslateUi();
} }
void MultiplayerState::OnNetworkStateChanged(const Network::RoomMember::State& state) { void MultiplayerState::OnNetworkStateChanged(const Network::RoomMember::State& state) {