From 76465dd0f52c89a41fe7ab7baea2866e4d79d074 Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Tue, 24 Jul 2018 18:57:45 +0800 Subject: [PATCH] citra_qt: retranslate status bar --- src/citra_qt/main.cpp | 16 ++++++++++++++++ src/citra_qt/main.h | 1 + src/citra_qt/multiplayer/state.cpp | 14 ++++++++++++++ src/citra_qt/multiplayer/state.h | 3 +++ src/network/room_member.h | 9 +++++---- 5 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 0ff04e7f61..2d27192bd2 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -1415,6 +1415,7 @@ void GMainWindow::OnLanguageChanged(const QString& locale) { UISettings::values.language = locale; LoadTranslation(); ui.retranslateUi(this); + RetranslateStatusBar(); SetupUIStrings(); } @@ -1438,6 +1439,21 @@ void GMainWindow::SyncMenuUISettings() { ui.action_Screen_Layout_Swap_Screens->setChecked(Settings::values.swap_screen); } +void GMainWindow::RetranslateStatusBar() { + if (emu_thread) + UpdateStatusBar(); + + emu_speed_label->setToolTip(tr("Current emulation speed. Values higher or lower than 100% " + "indicate emulation is running faster or slower than a 3DS.")); + game_fps_label->setToolTip(tr("How many frames per second the game is currently displaying. " + "This will vary from game to game and scene to scene.")); + emu_frametime_label->setToolTip( + tr("Time taken to emulate a 3DS frame, not counting framelimiting or v-sync. For " + "full-speed emulation this should be at most 16.67 ms.")); + + multiplayer_state->retranslateUi(); +} + #ifdef main #undef main #endif diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 55879330ba..65c1b28606 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -181,6 +181,7 @@ private: void UpdateStatusBar(); void LoadTranslation(); void SetupUIStrings(); + void RetranslateStatusBar(); Ui::MainWindow ui; diff --git a/src/citra_qt/multiplayer/state.cpp b/src/citra_qt/multiplayer/state.cpp index bfe8255f9a..cb264b2a00 100644 --- a/src/citra_qt/multiplayer/state.cpp +++ b/src/citra_qt/multiplayer/state.cpp @@ -65,6 +65,18 @@ void MultiplayerState::Close() { lobby->close(); } +void MultiplayerState::retranslateUi() { + status_text->setToolTip(tr("Current connection status")); + + if (current_state == Network::RoomMember::State::Uninitialized) { + status_text->setText(tr("Not Connected. Click here to find a room!")); + } else if (current_state == Network::RoomMember::State::Joined) { + status_text->setText(tr("Connected")); + } else { + status_text->setText(tr("Not Connected")); + } +} + void MultiplayerState::OnNetworkStateChanged(const Network::RoomMember::State& state) { LOG_DEBUG(Frontend, "Network State: {}", Network::GetStateStr(state)); bool is_connected = false; @@ -106,6 +118,8 @@ void MultiplayerState::OnNetworkStateChanged(const Network::RoomMember::State& s leave_room->setEnabled(false); show_room->setEnabled(false); } + + current_state = state; } void MultiplayerState::OnAnnounceFailed(const Common::WebResult& result) { diff --git a/src/citra_qt/multiplayer/state.h b/src/citra_qt/multiplayer/state.h index a1e37ba2f3..5463cd4614 100644 --- a/src/citra_qt/multiplayer/state.h +++ b/src/citra_qt/multiplayer/state.h @@ -36,6 +36,8 @@ public: return status_icon; } + void retranslateUi(); + public slots: void OnNetworkStateChanged(const Network::RoomMember::State& state); void OnViewLobby(); @@ -60,6 +62,7 @@ private: QAction* leave_room; QAction* show_room; std::shared_ptr announce_multiplayer_session; + Network::RoomMember::State current_state = Network::RoomMember::State::Uninitialized; Network::RoomMember::CallbackHandle state_callback_handle; }; diff --git a/src/network/room_member.h b/src/network/room_member.h index d01eb7dcd0..12cff102ac 100644 --- a/src/network/room_member.h +++ b/src/network/room_member.h @@ -46,10 +46,11 @@ struct ChatEntry { class RoomMember final { public: enum class State : u8 { - Idle, ///< Default state - Error, ///< Some error [permissions to network device missing or something] - Joining, ///< The client is attempting to join a room. - Joined, ///< The client is connected to the room and is ready to send/receive packets. + Uninitialized, ///< Not initialized + Idle, ///< Default state + Error, ///< Some error [permissions to network device missing or something] + Joining, ///< The client is attempting to join a room. + Joined, ///< The client is connected to the room and is ready to send/receive packets. LostConnection, ///< Connection closed // Reasons why connection was rejected