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;
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,6 +46,7 @@ struct ChatEntry {
class RoomMember final {
public:
enum class State : u8 {
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.