Add server description to favourites, if supported by server. (#648)
* Allow servers to directly set the server description * Hijack PN packet to add description. * Update lobby.cpp Apply suggested change
This commit is contained in:
		
							parent
							
								
									5e60f277e9
								
							
						
					
					
						commit
						e6f06d8959
					
				@ -35,6 +35,7 @@ public:
 | 
				
			|||||||
  void append_chatmessage(QString f_name, QString f_message);
 | 
					  void append_chatmessage(QString f_name, QString f_message);
 | 
				
			||||||
  void append_error(QString f_message);
 | 
					  void append_error(QString f_message);
 | 
				
			||||||
  void set_player_count(int players_online, int max_players);
 | 
					  void set_player_count(int players_online, int max_players);
 | 
				
			||||||
 | 
					  void set_server_description(const QString& server_description);
 | 
				
			||||||
  void set_stylesheet(QWidget *widget);
 | 
					  void set_stylesheet(QWidget *widget);
 | 
				
			||||||
  void set_stylesheets();
 | 
					  void set_stylesheets();
 | 
				
			||||||
  void set_fonts();
 | 
					  void set_fonts();
 | 
				
			||||||
 | 
				
			|||||||
@ -431,8 +431,7 @@ void Lobby::on_server_list_clicked(QTreeWidgetItem *p_item, int column)
 | 
				
			|||||||
      f_server = ao_app->get_favorite_list().at(n_server);
 | 
					      f_server = ao_app->get_favorite_list().at(n_server);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ui_description->clear();
 | 
					    set_server_description(f_server.desc);
 | 
				
			||||||
    ui_description->append_linked(f_server.desc);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ui_description->moveCursor(QTextCursor::Start);
 | 
					    ui_description->moveCursor(QTextCursor::Start);
 | 
				
			||||||
    ui_description->ensureCursorVisible();
 | 
					    ui_description->ensureCursorVisible();
 | 
				
			||||||
@ -563,6 +562,12 @@ void Lobby::set_player_count(int players_online, int max_players)
 | 
				
			|||||||
  ui_player_count->setText(f_string);
 | 
					  ui_player_count->setText(f_string);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Lobby::set_server_description(const QString& server_description)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ui_description->clear();
 | 
				
			||||||
 | 
					    ui_description->append_linked(server_description);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Lobby::enable_connect_button() { ui_connect->setEnabled(true); }
 | 
					void Lobby::enable_connect_button() { ui_connect->setEnabled(true); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Lobby::~Lobby() {}
 | 
					Lobby::~Lobby() {}
 | 
				
			||||||
 | 
				
			|||||||
@ -143,6 +143,10 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
 | 
				
			|||||||
    w_lobby->set_player_count(f_contents.at(0).toInt(),
 | 
					    w_lobby->set_player_count(f_contents.at(0).toInt(),
 | 
				
			||||||
                              f_contents.at(1).toInt());
 | 
					                              f_contents.at(1).toInt());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (f_contents.size() >= 3) {
 | 
				
			||||||
 | 
					        w_lobby->set_server_description(f_contents.at(2));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (w_lobby->doubleclicked) {
 | 
					    if (w_lobby->doubleclicked) {
 | 
				
			||||||
        send_server_packet(new AOPacket("askchaa#%"));
 | 
					        send_server_packet(new AOPacket("askchaa#%"));
 | 
				
			||||||
        w_lobby->doubleclicked = false;
 | 
					        w_lobby->doubleclicked = false;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user