Merge pull request #3989 from zhaowenlan1779/statusbar-retranslate

citra_qt: retranslate status bar
This commit is contained in:
James Rowe 2018-07-25 10:19:11 -06:00 committed by GitHub
commit 4a3c4f5f67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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;
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

View file

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

View file

@ -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) {

View file

@ -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<Core::AnnounceMultiplayerSession> announce_multiplayer_session;
Network::RoomMember::State current_state = Network::RoomMember::State::Uninitialized;
Network::RoomMember::CallbackHandle<Network::RoomMember::State> state_callback_handle;
};

View file

@ -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