Merge pull request #10829 from Chocobo1/backport

Backport to v4_1_x
This commit is contained in:
Mike Tzou 2019-06-21 11:02:54 +08:00 committed by GitHub
commit 2f15ea9b54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 20 deletions

View file

@ -4337,20 +4337,23 @@ void Session::handleMetadataReceivedAlert(libt::metadata_received_alert *p)
void Session::handleFileErrorAlert(libt::file_error_alert *p)
{
qDebug() << Q_FUNC_INFO;
// NOTE: Check this function!
TorrentHandle *const torrent = m_torrents.value(p->handle.info_hash());
if (torrent) {
const InfoHash hash = torrent->hash();
if (!m_recentErroredTorrents.contains(hash)) {
m_recentErroredTorrents.insert(hash);
const QString msg = QString::fromStdString(p->message());
LogMsg(tr("An I/O error occurred, '%1' paused. %2").arg(torrent->name(), msg));
emit fullDiskError(torrent, msg);
}
if (!torrent)
return;
m_recentErroredTorrentsTimer->start();
const InfoHash hash = torrent->hash();
if (!m_recentErroredTorrents.contains(hash)) {
m_recentErroredTorrents.insert(hash);
const QString msg = QString::fromStdString(p->message());
LogMsg(tr("File error alert. Torrent: \"%1\". File: \"%2\". Reason: %3")
.arg(torrent->name(), p->filename(), msg)
, Log::WARNING);
emit fullDiskError(torrent, msg);
}
m_recentErroredTorrentsTimer->start();
}
void Session::handlePortmapWarningAlert(libt::portmap_error_alert *p)

View file

@ -462,10 +462,10 @@ void PeerListWidget::handleSortColumnChanged(int col)
void PeerListWidget::wheelEvent(QWheelEvent *event)
{
event->accept();
if (event->modifiers() & Qt::ShiftModifier) {
// Shift + scroll = horizontal scroll
event->accept();
QWheelEvent scrollHEvent(event->pos(), event->globalPos(), event->delta(), event->buttons(), event->modifiers(), Qt::Horizontal);
QTreeView::wheelEvent(&scrollHEvent);
return;

View file

@ -216,15 +216,15 @@ void TagFilterModel::torrentTagAdded(BitTorrent::TorrentHandle *const torrent, c
void TagFilterModel::torrentTagRemoved(BitTorrent::TorrentHandle *const torrent, const QString &tag)
{
Q_ASSERT(torrent->tags().count() >= 0);
if (torrent->tags().count() == 0)
if (torrent->tags().empty())
untaggedItem()->increaseTorrentsCount();
const int row = findRow(tag);
Q_ASSERT(isValidRow(row));
TagModelItem &item = m_tagItems[row];
if (row < 0)
return;
m_tagItems[row].decreaseTorrentsCount();
item.decreaseTorrentsCount();
const QModelIndex i = index(row, 0, QModelIndex());
emit dataChanged(i, i);
}

View file

@ -1212,10 +1212,10 @@ bool TransferListWidget::loadSettings()
void TransferListWidget::wheelEvent(QWheelEvent *event)
{
event->accept();
if (event->modifiers() & Qt::ShiftModifier) {
// Shift + scroll = horizontal scroll
event->accept();
QWheelEvent scrollHEvent(event->pos(), event->globalPos(), event->delta(), event->buttons(), event->modifiers(), Qt::Horizontal);
QTreeView::wheelEvent(&scrollHEvent);
return;