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) 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()); TorrentHandle *const torrent = m_torrents.value(p->handle.info_hash());
if (torrent) { if (!torrent)
const InfoHash hash = torrent->hash(); return;
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);
}
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) void Session::handlePortmapWarningAlert(libt::portmap_error_alert *p)

View file

@ -462,10 +462,10 @@ void PeerListWidget::handleSortColumnChanged(int col)
void PeerListWidget::wheelEvent(QWheelEvent *event) void PeerListWidget::wheelEvent(QWheelEvent *event)
{ {
event->accept();
if (event->modifiers() & Qt::ShiftModifier) { if (event->modifiers() & Qt::ShiftModifier) {
// Shift + scroll = horizontal scroll // Shift + scroll = horizontal scroll
event->accept();
QWheelEvent scrollHEvent(event->pos(), event->globalPos(), event->delta(), event->buttons(), event->modifiers(), Qt::Horizontal); QWheelEvent scrollHEvent(event->pos(), event->globalPos(), event->delta(), event->buttons(), event->modifiers(), Qt::Horizontal);
QTreeView::wheelEvent(&scrollHEvent); QTreeView::wheelEvent(&scrollHEvent);
return; 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) void TagFilterModel::torrentTagRemoved(BitTorrent::TorrentHandle *const torrent, const QString &tag)
{ {
Q_ASSERT(torrent->tags().count() >= 0); if (torrent->tags().empty())
if (torrent->tags().count() == 0)
untaggedItem()->increaseTorrentsCount(); untaggedItem()->increaseTorrentsCount();
const int row = findRow(tag); const int row = findRow(tag);
Q_ASSERT(isValidRow(row)); if (row < 0)
TagModelItem &item = m_tagItems[row]; return;
m_tagItems[row].decreaseTorrentsCount();
item.decreaseTorrentsCount();
const QModelIndex i = index(row, 0, QModelIndex()); const QModelIndex i = index(row, 0, QModelIndex());
emit dataChanged(i, i); emit dataChanged(i, i);
} }

View file

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