mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Add network status text to the status bar
This commit is contained in:
		
							parent
							
								
									871196bc10
								
							
						
					
					
						commit
						ddbbab8fd6
					
				
					 2 changed files with 15 additions and 11 deletions
				
			
		|  | @ -224,8 +224,9 @@ void GMainWindow::InitializeWidgets() { | ||||||
|     announce_multiplayer_session->BindErrorCallback( |     announce_multiplayer_session->BindErrorCallback( | ||||||
|         [this](const Common::WebResult& result) { emit AnnounceFailed(result); }); |         [this](const Common::WebResult& result) { emit AnnounceFailed(result); }); | ||||||
|     connect(this, &GMainWindow::AnnounceFailed, this, &GMainWindow::OnAnnounceFailed); |     connect(this, &GMainWindow::AnnounceFailed, this, &GMainWindow::OnAnnounceFailed); | ||||||
|     network_status = new ClickableLabel(); |     network_status_text = new ClickableLabel(this); | ||||||
|     network_status->setToolTip(tr("Current connection status")); |     network_status_icon = new ClickableLabel(this); | ||||||
|  |     network_status_text->setToolTip(tr("Current connection status")); | ||||||
| 
 | 
 | ||||||
|     for (auto& label : {emu_speed_label, game_fps_label, emu_frametime_label}) { |     for (auto& label : {emu_speed_label, game_fps_label, emu_frametime_label}) { | ||||||
|         label->setVisible(false); |         label->setVisible(false); | ||||||
|  | @ -233,9 +234,10 @@ void GMainWindow::InitializeWidgets() { | ||||||
|         label->setContentsMargins(4, 0, 4, 0); |         label->setContentsMargins(4, 0, 4, 0); | ||||||
|         statusBar()->addPermanentWidget(label, 0); |         statusBar()->addPermanentWidget(label, 0); | ||||||
|     } |     } | ||||||
|     statusBar()->addPermanentWidget(network_status, 0); |     statusBar()->addPermanentWidget(network_status_text, 0); | ||||||
|     network_status->setPixmap(QIcon::fromTheme("disconnected").pixmap(16)); |     statusBar()->addPermanentWidget(network_status_icon, 0); | ||||||
|     network_status->setText(tr("Not Connected. Join a room for online play!")); |     network_status_icon->setPixmap(QIcon::fromTheme("disconnected").pixmap(16)); | ||||||
|  |     network_status_text->setText(tr("Not Connected. Click here to find a room!")); | ||||||
|     statusBar()->setVisible(true); |     statusBar()->setVisible(true); | ||||||
| 
 | 
 | ||||||
|     // Removes an ugly inner border from the status bar widgets under Linux
 |     // Removes an ugly inner border from the status bar widgets under Linux
 | ||||||
|  | @ -430,7 +432,8 @@ void GMainWindow::ConnectWidgetEvents() { | ||||||
|     connect(this, &GMainWindow::CIAInstallReport, this, &GMainWindow::OnCIAInstallReport); |     connect(this, &GMainWindow::CIAInstallReport, this, &GMainWindow::OnCIAInstallReport); | ||||||
|     connect(this, &GMainWindow::CIAInstallFinished, this, &GMainWindow::OnCIAInstallFinished); |     connect(this, &GMainWindow::CIAInstallFinished, this, &GMainWindow::OnCIAInstallFinished); | ||||||
| 
 | 
 | ||||||
|     connect(network_status, &ClickableLabel::clicked, this, &GMainWindow::OnOpenNetworkRoom); |     connect(network_status_text, &ClickableLabel::clicked, this, &GMainWindow::OnOpenNetworkRoom); | ||||||
|  |     connect(network_status_icon, &ClickableLabel::clicked, this, &GMainWindow::OnOpenNetworkRoom); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void GMainWindow::ConnectMenuEvents() { | void GMainWindow::ConnectMenuEvents() { | ||||||
|  | @ -931,13 +934,13 @@ void GMainWindow::OnMenuRecentFile() { | ||||||
| void GMainWindow::OnNetworkStateChanged(const Network::RoomMember::State& state) { | void GMainWindow::OnNetworkStateChanged(const Network::RoomMember::State& state) { | ||||||
|     LOG_INFO(Frontend, "network state change"); |     LOG_INFO(Frontend, "network state change"); | ||||||
|     if (state == Network::RoomMember::State::Joined) { |     if (state == Network::RoomMember::State::Joined) { | ||||||
|         network_status->setPixmap(QIcon::fromTheme("connected").pixmap(16)); |         network_status_icon->setPixmap(QIcon::fromTheme("connected").pixmap(16)); | ||||||
|         network_status->setText(tr("Connected")); |         network_status_text->setText(tr("Connected")); | ||||||
|         ui.action_Chat->setEnabled(true); |         ui.action_Chat->setEnabled(true); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     network_status->setPixmap(QIcon::fromTheme("disconnected").pixmap(16)); |     network_status_icon->setPixmap(QIcon::fromTheme("disconnected").pixmap(16)); | ||||||
|     network_status->setText(tr("Not Connected")); |     network_status_text->setText(tr("Not Connected")); | ||||||
|     ui.action_Chat->setDisabled(true); |     ui.action_Chat->setDisabled(true); | ||||||
| 
 | 
 | ||||||
|     ChangeRoomState(); |     ChangeRoomState(); | ||||||
|  |  | ||||||
|  | @ -211,7 +211,8 @@ private: | ||||||
|     QLabel* emu_speed_label = nullptr; |     QLabel* emu_speed_label = nullptr; | ||||||
|     QLabel* game_fps_label = nullptr; |     QLabel* game_fps_label = nullptr; | ||||||
|     QLabel* emu_frametime_label = nullptr; |     QLabel* emu_frametime_label = nullptr; | ||||||
|     ClickableLabel* network_status = nullptr; |     ClickableLabel* network_status_icon = nullptr; | ||||||
|  |     ClickableLabel* network_status_text = nullptr; | ||||||
|     QTimer status_bar_update_timer; |     QTimer status_bar_update_timer; | ||||||
| 
 | 
 | ||||||
|     std::unique_ptr<Config> config; |     std::unique_ptr<Config> config; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue