Merge pull request #10869 from Chocobo1/backport

Backport to v4_1_x
This commit is contained in:
Mike Tzou 2019-07-06 12:17:33 +08:00 committed by GitHub
commit e954835579
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 3 deletions

View file

@ -101,6 +101,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
#endif
server = new QLocalServer(this);
server->setSocketOptions(QLocalServer::UserAccessOption);
QString lockName = QDir(QDir::tempPath()).absolutePath()
+ QLatin1Char('/') + socketName
+ QLatin1String("-lockfile");
@ -191,6 +192,12 @@ void QtLocalPeer::receiveConnection()
QByteArray uMsg;
quint32 remaining;
ds >> remaining;
if (remaining > 65535) {
// drop suspiciously large data
delete socket;
return;
}
uMsg.resize(remaining);
int got = 0;
char* uMsgBuf = uMsg.data();

View file

@ -4316,9 +4316,14 @@ void Session::handleTorrentDeleteFailedAlert(libt::torrent_delete_failed_alert *
// so we remove the directory ourselves
Utils::Fs::smartRemoveEmptyFolderTree(tmpRemovingTorrentData.savePathToRemove);
LogMsg(tr("'%1' was removed from the transfer list but the files couldn't be deleted. Error: %2", "'xxx.avi' was removed...")
.arg(tmpRemovingTorrentData.name, QString::fromLocal8Bit(p->error.message().c_str()))
, Log::CRITICAL);
if (p->error) {
LogMsg(tr("'%1' was removed from the transfer list but the files couldn't be deleted. Error: %2", "'xxx.avi' was removed...")
.arg(tmpRemovingTorrentData.name, QString::fromStdString(p->error.message()))
, Log::WARNING);
}
else {
LogMsg(tr("'%1' was removed from the transfer list.", "'xxx.avi' was removed...").arg(tmpRemovingTorrentData.name));
}
}
void Session::handleMetadataReceivedAlert(libt::metadata_received_alert *p)

View file

@ -1285,6 +1285,8 @@ void TorrentHandle::setSequentialDownload(bool b)
m_nativeHandle.set_sequential_download(b);
m_nativeStatus.sequential_download = b; // prevent return cached value
}
saveResumeData();
}
void TorrentHandle::toggleSequentialDownload()
@ -1331,6 +1333,8 @@ void TorrentHandle::setFirstLastPiecePriorityImpl(const bool enabled, const QVec
LogMsg(tr("Download first and last piece first: %1, torrent: '%2'")
.arg((enabled ? tr("On") : tr("Off")), name()));
saveResumeData();
}
void TorrentHandle::toggleFirstLastPiecePriority()