Browse Source

Remove DISABLE_COUNTRIES_RESOLUTION define

adaptive-webui-19844
FranciscoPombal 4 years ago
parent
commit
8f8f7ebd15
  1. 2
      CMakeLists.txt
  2. 4
      src/app/application.cpp
  3. 2
      src/base/bittorrent/peerinfo.cpp
  4. 4
      src/base/bittorrent/peerinfo.h
  5. 1
      src/config.h.cmakein
  6. 6
      src/webui/api/synccontroller.cpp

2
CMakeLists.txt

@ -58,8 +58,6 @@ endif()
# we need options here, at the top level, because they are used not only in "src" subdir, but in the "dist" dir too # we need options here, at the top level, because they are used not only in "src" subdir, but in the "dist" dir too
include(CompileFeature) include(CompileFeature)
optional_compile_definitions(COUNTRIES_RESOLUTION FEATURE DESCRIPTION "Enable resolving peers IP addresses to countries"
DEFAULT ON DISABLED DISABLE_COUNTRIES_RESOLUTION)
optional_compile_definitions(STACKTRACE FEATURE DESCRIPTION "Enable stacktraces" optional_compile_definitions(STACKTRACE FEATURE DESCRIPTION "Enable stacktraces"
DEFAULT ON ENABLED STACKTRACE) DEFAULT ON ENABLED STACKTRACE)
optional_compile_definitions(GUI FEATURE DESCRIPTION "Build GUI application" optional_compile_definitions(GUI FEATURE DESCRIPTION "Build GUI application"

4
src/app/application.cpp

@ -566,9 +566,7 @@ int Application::exec(const QStringList &params)
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentFinished, this, &Application::torrentFinished); connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentFinished, this, &Application::torrentFinished);
connect(BitTorrent::Session::instance(), &BitTorrent::Session::allTorrentsFinished, this, &Application::allTorrentsFinished, Qt::QueuedConnection); connect(BitTorrent::Session::instance(), &BitTorrent::Session::allTorrentsFinished, this, &Application::allTorrentsFinished, Qt::QueuedConnection);
#ifndef DISABLE_COUNTRIES_RESOLUTION
Net::GeoIPManager::initInstance(); Net::GeoIPManager::initInstance();
#endif
ScanFoldersModel::initInstance(); ScanFoldersModel::initInstance();
#ifndef DISABLE_WEBUI #ifndef DISABLE_WEBUI
@ -760,9 +758,7 @@ void Application::cleanup()
ScanFoldersModel::freeInstance(); ScanFoldersModel::freeInstance();
BitTorrent::Session::freeInstance(); BitTorrent::Session::freeInstance();
#ifndef DISABLE_COUNTRIES_RESOLUTION
Net::GeoIPManager::freeInstance(); Net::GeoIPManager::freeInstance();
#endif
Net::DownloadManager::freeInstance(); Net::DownloadManager::freeInstance();
Net::ProxyConfigurationManager::freeInstance(); Net::ProxyConfigurationManager::freeInstance();
Preferences::freeInstance(); Preferences::freeInstance();

2
src/base/bittorrent/peerinfo.cpp

@ -59,14 +59,12 @@ bool PeerInfo::fromLSD() const
return static_cast<bool>(m_nativeInfo.source & lt::peer_info::lsd); return static_cast<bool>(m_nativeInfo.source & lt::peer_info::lsd);
} }
#ifndef DISABLE_COUNTRIES_RESOLUTION
QString PeerInfo::country() const QString PeerInfo::country() const
{ {
if (m_country.isEmpty()) if (m_country.isEmpty())
m_country = Net::GeoIPManager::instance()->lookup(address().ip); m_country = Net::GeoIPManager::instance()->lookup(address().ip);
return m_country; return m_country;
} }
#endif
bool PeerInfo::isInteresting() const bool PeerInfo::isInteresting() const
{ {

4
src/base/bittorrent/peerinfo.h

@ -89,9 +89,7 @@ namespace BitTorrent
qreal relevance() const; qreal relevance() const;
QString flags() const; QString flags() const;
QString flagsDescription() const; QString flagsDescription() const;
#ifndef DISABLE_COUNTRIES_RESOLUTION
QString country() const; QString country() const;
#endif
int downloadingPieceIndex() const; int downloadingPieceIndex() const;
private: private:
@ -103,9 +101,7 @@ namespace BitTorrent
QString m_flags; QString m_flags;
QString m_flagsDescription; QString m_flagsDescription;
#ifndef DISABLE_COUNTRIES_RESOLUTION
mutable QString m_country; mutable QString m_country;
#endif
}; };
} }

1
src/config.h.cmakein

@ -2,7 +2,6 @@
#ifndef QBT_USE_GUI #ifndef QBT_USE_GUI
#define DISABLE_GUI #define DISABLE_GUI
#define DISABLE_COUNTRIES_RESOLUTION
#endif #endif
#cmakedefine QBT_USE_WEBUI #cmakedefine QBT_USE_WEBUI

6
src/webui/api/synccontroller.cpp

@ -522,11 +522,7 @@ void SyncController::torrentPeersAction()
const QVector<BitTorrent::PeerInfo> peersList = torrent->peers(); const QVector<BitTorrent::PeerInfo> peersList = torrent->peers();
#ifndef DISABLE_COUNTRIES_RESOLUTION
bool resolvePeerCountries = Preferences::instance()->resolvePeerCountries(); bool resolvePeerCountries = Preferences::instance()->resolvePeerCountries();
#else
bool resolvePeerCountries = false;
#endif
data[KEY_SYNC_TORRENT_PEERS_SHOW_FLAGS] = resolvePeerCountries; data[KEY_SYNC_TORRENT_PEERS_SHOW_FLAGS] = resolvePeerCountries;
@ -549,12 +545,10 @@ void SyncController::torrentPeersAction()
{KEY_PEER_FILES, torrent->info().filesForPiece(pi.downloadingPieceIndex()).join('\n')} {KEY_PEER_FILES, torrent->info().filesForPiece(pi.downloadingPieceIndex()).join('\n')}
}; };
#ifndef DISABLE_COUNTRIES_RESOLUTION
if (resolvePeerCountries) { if (resolvePeerCountries) {
peer[KEY_PEER_COUNTRY_CODE] = pi.country().toLower(); peer[KEY_PEER_COUNTRY_CODE] = pi.country().toLower();
peer[KEY_PEER_COUNTRY] = Net::GeoIPManager::CountryName(pi.country()); peer[KEY_PEER_COUNTRY] = Net::GeoIPManager::CountryName(pi.country());
} }
#endif
peers[pi.address().ip.toString() + ':' + QString::number(pi.address().port)] = peer; peers[pi.address().ip.toString() + ':' + QString::number(pi.address().port)] = peer;
} }

Loading…
Cancel
Save