mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Merge pull request #17187 from Chocobo1/names
Fix wrong file names displayed in tooltip
This commit is contained in:
commit
5b0cbf9eb1
@ -134,19 +134,19 @@ void FileLogger::addLogMessage(const Log::Msg &msg)
|
||||
switch (msg.type)
|
||||
{
|
||||
case Log::INFO:
|
||||
stream << "(I) ";
|
||||
stream << u"(I) ";
|
||||
break;
|
||||
case Log::WARNING:
|
||||
stream << "(W) ";
|
||||
stream << u"(W) ";
|
||||
break;
|
||||
case Log::CRITICAL:
|
||||
stream << "(C) ";
|
||||
stream << u"(C) ";
|
||||
break;
|
||||
default:
|
||||
stream << "(N) ";
|
||||
stream << u"(N) ";
|
||||
}
|
||||
|
||||
stream << QDateTime::fromMSecsSinceEpoch(msg.timestamp).toString(Qt::ISODate) << " - " << msg.message << '\n';
|
||||
stream << QDateTime::fromMSecsSinceEpoch(msg.timestamp).toString(Qt::ISODate) << u" - " << msg.message << u'\n';
|
||||
|
||||
if (m_backup && (m_logFile.size() >= m_maxSize))
|
||||
{
|
||||
|
@ -265,30 +265,25 @@ void PiecesBar::showToolTip(const QHelpEvent *e)
|
||||
{
|
||||
const PieceIndexToImagePos transform {torrentInfo, m_image};
|
||||
const int pieceIndex = transform.pieceIndex(imagePos);
|
||||
const QVector<int> files {torrentInfo.fileIndicesForPiece(pieceIndex)};
|
||||
const QVector<int> fileIndexes = torrentInfo.fileIndicesForPiece(pieceIndex);
|
||||
|
||||
QString tooltipTitle;
|
||||
if (files.count() > 1)
|
||||
{
|
||||
if (fileIndexes.count() > 1)
|
||||
tooltipTitle = tr("Files in this piece:");
|
||||
}
|
||||
else if (torrentInfo.fileSize(fileIndexes.front()) == torrentInfo.pieceLength(pieceIndex))
|
||||
tooltipTitle = tr("File in this piece:");
|
||||
else
|
||||
{
|
||||
if (torrentInfo.fileSize(files.front()) == torrentInfo.pieceLength(pieceIndex))
|
||||
tooltipTitle = tr("File in this piece");
|
||||
else
|
||||
tooltipTitle = tr("File in these pieces");
|
||||
}
|
||||
tooltipTitle = tr("File in these pieces:");
|
||||
|
||||
toolTipText.reserve(files.size() * 128);
|
||||
toolTipText.reserve(fileIndexes.size() * 128);
|
||||
toolTipText += u"<html><body>";
|
||||
|
||||
DetailedTooltipRenderer renderer {toolTipText, tooltipTitle};
|
||||
|
||||
for (const int f : files)
|
||||
for (const int index : fileIndexes)
|
||||
{
|
||||
const Path filePath = torrentInfo.filePath(f);
|
||||
renderer(Utils::Misc::friendlyUnit(torrentInfo.fileSize(f)), filePath);
|
||||
const Path filePath = m_torrent->filePath(index);
|
||||
renderer(Utils::Misc::friendlyUnit(torrentInfo.fileSize(index)), filePath);
|
||||
}
|
||||
toolTipText += u"</body></html>";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user