2009-12-07 23:54:47 +03:00
|
|
|
/*
|
|
|
|
-----BEGIN QCMOD-----
|
|
|
|
name: geoip-database
|
|
|
|
arg: with-geoip-database-embedded, Geoip Database will be embedded in qBittorrent executable (please follow instructions in src/geoip/README)
|
|
|
|
-----END QCMOD-----
|
|
|
|
*/
|
|
|
|
// see Conf::findPkgConfig
|
|
|
|
class qc_geoip_database : public ConfObj
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
qc_geoip_database(Conf *c) : ConfObj(c) {}
|
|
|
|
QString name() const { return "GeoIP Database (optional)"; }
|
|
|
|
QString shortname() const { return "GeoIP Database"; }
|
2010-01-20 02:12:13 +03:00
|
|
|
QString checkString() const {
|
|
|
|
if(!conf->getenv("QC_DISABLE_geoip_database").isEmpty() || !conf->getenv("QC_DISABLE_GUI").isEmpty())
|
|
|
|
return "";
|
|
|
|
return ConfObj::checkString();
|
|
|
|
}
|
2009-12-07 23:54:47 +03:00
|
|
|
bool exec() {
|
2010-01-20 02:12:13 +03:00
|
|
|
if(!conf->getenv("QC_DISABLE_geoip_database").isEmpty() || !conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
|
|
|
return false;
|
2009-12-15 13:36:18 +03:00
|
|
|
}
|
2009-12-07 23:54:47 +03:00
|
|
|
#ifdef Q_WS_X11
|
|
|
|
if(!conf->getenv("QC_WITH_GEOIP_DATABASE_EMBEDDED").isEmpty()) {
|
|
|
|
#endif
|
|
|
|
conf->addDefine("WITH_GEOIP_EMBEDDED");
|
|
|
|
printf(" embedded and");
|
|
|
|
return true;
|
|
|
|
#ifdef Q_WS_X11
|
|
|
|
}
|
2009-12-08 10:55:08 +03:00
|
|
|
if(QFile::exists("/usr/share/GeoIP/GeoIP.dat") || QFile::exists("/usr/local/share/GeoIP/GeoIP.dat") || QFile::exists("/var/lib/GeoIP/GeoIP.dat"))
|
2009-12-07 23:54:47 +03:00
|
|
|
return true;
|
2009-12-08 10:55:08 +03:00
|
|
|
printf("\nWarning: GeoIP database was not found at /usr/share/GeoIP/GeoIP.dat or /var/lib/GeoIP/GeoIP.dat\nCountry resolution will be slow.");
|
2009-12-07 23:54:47 +03:00
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
};
|