|
|
@ -197,14 +197,6 @@ void QBtSession::preAllocateAllFiles(bool b) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ScanFoldersModel* QBtSession::getScanFoldersModel() const { |
|
|
|
|
|
|
|
return m_scanFolders; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool QBtSession::isPexEnabled() const { |
|
|
|
|
|
|
|
return PeXEnabled; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QBtSession::processBigRatios() { |
|
|
|
void QBtSession::processBigRatios() { |
|
|
|
if(ratio_limit < 0) return; |
|
|
|
if(ratio_limit < 0) return; |
|
|
|
qDebug("Process big ratios..."); |
|
|
|
qDebug("Process big ratios..."); |
|
|
@ -243,10 +235,6 @@ void QBtSession::setDownloadLimit(QString hash, long val) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool QBtSession::isQueueingEnabled() const { |
|
|
|
|
|
|
|
return queueingEnabled; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QBtSession::setUploadLimit(QString hash, long val) { |
|
|
|
void QBtSession::setUploadLimit(QString hash, long val) { |
|
|
|
qDebug("Set upload limit rate to %ld", val); |
|
|
|
qDebug("Set upload limit rate to %ld", val); |
|
|
|
QTorrentHandle h = getTorrentHandle(hash); |
|
|
|
QTorrentHandle h = getTorrentHandle(hash); |
|
|
@ -1358,15 +1346,6 @@ void QBtSession::setMaxUploadsPerTorrent(int max) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Return DHT state
|
|
|
|
|
|
|
|
bool QBtSession::isDHTEnabled() const{ |
|
|
|
|
|
|
|
return DHTEnabled; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool QBtSession::isLSDEnabled() const{ |
|
|
|
|
|
|
|
return LSDEnabled; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QBtSession::enableUPnP(bool b) { |
|
|
|
void QBtSession::enableUPnP(bool b) { |
|
|
|
if(b) { |
|
|
|
if(b) { |
|
|
|
if(!UPnPEnabled) { |
|
|
|
if(!UPnPEnabled) { |
|
|
@ -1605,14 +1584,6 @@ void QBtSession::saveFastResumeData() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QStringList QBtSession::getConsoleMessages() const { |
|
|
|
|
|
|
|
return consoleMessages; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QStringList QBtSession::getPeerBanMessages() const { |
|
|
|
|
|
|
|
return peerBanMessages; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DISABLE_GUI |
|
|
|
#ifdef DISABLE_GUI |
|
|
|
void QBtSession::addConsoleMessage(QString msg, QString) { |
|
|
|
void QBtSession::addConsoleMessage(QString msg, QString) { |
|
|
|
#else |
|
|
|
#else |
|
|
@ -1666,14 +1637,6 @@ void QBtSession::addTorrentsFromScanFolder(QStringList &pathList) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString QBtSession::getDefaultSavePath() const { |
|
|
|
|
|
|
|
return defaultSavePath; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool QBtSession::useTemporaryFolder() const { |
|
|
|
|
|
|
|
return !defaultTempPath.isEmpty(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QBtSession::setDefaultTempPath(QString temppath) { |
|
|
|
void QBtSession::setDefaultTempPath(QString temppath) { |
|
|
|
if(defaultTempPath == temppath) |
|
|
|
if(defaultTempPath == temppath) |
|
|
|
return; |
|
|
|
return; |
|
|
@ -1808,15 +1771,27 @@ void QBtSession::setListeningPort(int port) { |
|
|
|
} |
|
|
|
} |
|
|
|
QNetworkInterface network_iface = QNetworkInterface::interfaceFromName(iface_name); |
|
|
|
QNetworkInterface network_iface = QNetworkInterface::interfaceFromName(iface_name); |
|
|
|
if(!network_iface.isValid()) { |
|
|
|
if(!network_iface.isValid()) { |
|
|
|
|
|
|
|
qDebug("Invalid network interface: %s", qPrintable(iface_name)); |
|
|
|
|
|
|
|
addConsoleMessage(tr("The network interface defined is invalid: %1").arg(iface_name), "red"); |
|
|
|
|
|
|
|
addConsoleMessage(tr("Trying any other network interface available instead.")); |
|
|
|
s->listen_on(ports); |
|
|
|
s->listen_on(ports); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
QString ip = "127.0.0.1"; |
|
|
|
QString ip; |
|
|
|
if(!network_iface.addressEntries().isEmpty()) { |
|
|
|
qDebug("This network interface has %d IP addresses", network_iface.addressEntries().size()); |
|
|
|
ip = network_iface.addressEntries().first().ip().toString(); |
|
|
|
foreach(const QNetworkAddressEntry &entry, network_iface.addressEntries()) { |
|
|
|
|
|
|
|
qDebug("Trying to listen on IP %s (%s)", qPrintable(entry.ip().toString()), qPrintable(iface_name)); |
|
|
|
|
|
|
|
if(s->listen_on(ports, qPrintable(entry.ip().toString()))) { |
|
|
|
|
|
|
|
ip = entry.ip().toString(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(s->is_listening()) { |
|
|
|
|
|
|
|
addConsoleMessage(tr("Listening on IP address %1 on network interface %2...").arg(ip).arg(iface_name)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
qDebug("Failed to listen on any of the IP addresses"); |
|
|
|
|
|
|
|
addConsoleMessage(tr("Failed to listen on network interface %1").arg(iface_name), "red"); |
|
|
|
} |
|
|
|
} |
|
|
|
qDebug("Listening on interface %s with ip %s", qPrintable(iface_name), qPrintable(ip)); |
|
|
|
|
|
|
|
s->listen_on(ports, ip.toLocal8Bit().constData()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Set download rate limit
|
|
|
|
// Set download rate limit
|
|
|
@ -1827,10 +1802,6 @@ void QBtSession::setDownloadRateLimit(long rate) { |
|
|
|
s->set_download_rate_limit(rate); |
|
|
|
s->set_download_rate_limit(rate); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
session* QBtSession::getSession() const{ |
|
|
|
|
|
|
|
return s; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set upload rate limit
|
|
|
|
// Set upload rate limit
|
|
|
|
// -1 to disable
|
|
|
|
// -1 to disable
|
|
|
|
void QBtSession::setUploadRateLimit(long rate) { |
|
|
|
void QBtSession::setUploadRateLimit(long rate) { |
|
|
|