citra_qt: retranslate status bar

This commit is contained in:
zhupengfei 2018-07-24 18:57:45 +08:00
parent 87872aa369
commit 76465dd0f5
No known key found for this signature in database
GPG key ID: 85B82A3E62174206
5 changed files with 39 additions and 4 deletions

View file

@ -1415,6 +1415,7 @@ void GMainWindow::OnLanguageChanged(const QString& locale) {
UISettings::values.language = locale; UISettings::values.language = locale;
LoadTranslation(); LoadTranslation();
ui.retranslateUi(this); ui.retranslateUi(this);
RetranslateStatusBar();
SetupUIStrings(); SetupUIStrings();
} }
@ -1438,6 +1439,21 @@ void GMainWindow::SyncMenuUISettings() {
ui.action_Screen_Layout_Swap_Screens->setChecked(Settings::values.swap_screen); 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 #ifdef main
#undef main #undef main
#endif #endif

View file

@ -181,6 +181,7 @@ private:
void UpdateStatusBar(); void UpdateStatusBar();
void LoadTranslation(); void LoadTranslation();
void SetupUIStrings(); void SetupUIStrings();
void RetranslateStatusBar();
Ui::MainWindow ui; Ui::MainWindow ui;

View file

@ -65,6 +65,18 @@ void MultiplayerState::Close() {
lobby->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) { void MultiplayerState::OnNetworkStateChanged(const Network::RoomMember::State& state) {
LOG_DEBUG(Frontend, "Network State: {}", Network::GetStateStr(state)); LOG_DEBUG(Frontend, "Network State: {}", Network::GetStateStr(state));
bool is_connected = false; bool is_connected = false;
@ -106,6 +118,8 @@ void MultiplayerState::OnNetworkStateChanged(const Network::RoomMember::State& s
leave_room->setEnabled(false); leave_room->setEnabled(false);
show_room->setEnabled(false); show_room->setEnabled(false);
} }
current_state = state;
} }
void MultiplayerState::OnAnnounceFailed(const Common::WebResult& result) { void MultiplayerState::OnAnnounceFailed(const Common::WebResult& result) {

View file

@ -36,6 +36,8 @@ public:
return status_icon; return status_icon;
} }
void retranslateUi();
public slots: public slots:
void OnNetworkStateChanged(const Network::RoomMember::State& state); void OnNetworkStateChanged(const Network::RoomMember::State& state);
void OnViewLobby(); void OnViewLobby();
@ -60,6 +62,7 @@ private:
QAction* leave_room; QAction* leave_room;
QAction* show_room; QAction* show_room;
std::shared_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session; std::shared_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session;
Network::RoomMember::State current_state = Network::RoomMember::State::Uninitialized;
Network::RoomMember::CallbackHandle<Network::RoomMember::State> state_callback_handle; Network::RoomMember::CallbackHandle<Network::RoomMember::State> state_callback_handle;
}; };

View file

@ -46,10 +46,11 @@ struct ChatEntry {
class RoomMember final { class RoomMember final {
public: public:
enum class State : u8 { enum class State : u8 {
Idle, ///< Default state Uninitialized, ///< Not initialized
Error, ///< Some error [permissions to network device missing or something] Idle, ///< Default state
Joining, ///< The client is attempting to join a room. Error, ///< Some error [permissions to network device missing or something]
Joined, ///< The client is connected to the room and is ready to send/receive packets. 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 LostConnection, ///< Connection closed
// Reasons why connection was rejected // Reasons why connection was rejected