mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
FEATURE: Optimized and improved the peer country resolution code
FEATURE: Optimized and improved the locale preferences code COSMETIC: Use country flags by Mark James (Thanks to Dmytro Pukha)
This commit is contained in:
parent
f5cf5c2176
commit
c77eb35f5b
314 changed files with 604 additions and 411 deletions
|
@ -33,7 +33,7 @@
|
|||
#include "reverseresolution.h"
|
||||
#include "preferences.h"
|
||||
#include "propertieswidget.h"
|
||||
#include "geoip.h"
|
||||
#include "geoipmanager.h"
|
||||
#include "peeraddition.h"
|
||||
#include "speedlimitdlg.h"
|
||||
#include <QStandardItemModel>
|
||||
|
@ -355,11 +355,10 @@ QStandardItem* PeerListWidget::addPeer(QString ip, peer_info peer) {
|
|||
if(resolver && host.isNull())
|
||||
resolver->resolve(peer.ip);
|
||||
if(display_flags) {
|
||||
QString country_name;
|
||||
const QIcon ico = GeoIP::CountryISOCodeToIcon(peer.country, country_name);
|
||||
const QIcon ico = GeoIPManager::CountryISOCodeToIcon(peer.country);
|
||||
if(!ico.isNull()) {
|
||||
listModel->setData(listModel->index(row, IP), ico, Qt::DecorationRole);
|
||||
Q_ASSERT(!country_name.isEmpty());
|
||||
const QString country_name = GeoIPManager::CountryISOCodeToName(peer.country);
|
||||
listModel->setData(listModel->index(row, IP), country_name, Qt::ToolTipRole);
|
||||
} else {
|
||||
missingFlags.insert(ip);
|
||||
|
@ -378,11 +377,10 @@ void PeerListWidget::updatePeer(QString ip, peer_info peer) {
|
|||
QStandardItem *item = peerItems.value(ip);
|
||||
int row = item->row();
|
||||
if(display_flags) {
|
||||
QString country_name;
|
||||
const QIcon ico = GeoIP::CountryISOCodeToIcon(peer.country, country_name);
|
||||
const QIcon ico = GeoIPManager::CountryISOCodeToIcon(peer.country);
|
||||
if(!ico.isNull()) {
|
||||
listModel->setData(listModel->index(row, IP), ico, Qt::DecorationRole);
|
||||
Q_ASSERT(!country_name.isEmpty());
|
||||
const QString country_name = GeoIPManager::CountryISOCodeToName(peer.country);
|
||||
listModel->setData(listModel->index(row, IP), country_name, Qt::ToolTipRole);
|
||||
missingFlags.remove(ip);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue