Drop ".unwanted folder" feature

This commit is contained in:
Vladimir Golovnev (Glassez)
2020-05-11 19:08:27 +03:00
parent 17205802ec
commit 6a0a78f3f7
8 changed files with 35 additions and 137 deletions

View File

@@ -161,8 +161,3 @@ QString PieceAvailabilityBar::simpleToolTipText() const
return tr("White: Unavailable pieces") + '\n'
+ tr("Blue: Available pieces") + '\n';
}
bool PieceAvailabilityBar::isFileNameCorrectionNeeded() const
{
return true;
}

View File

@@ -48,7 +48,6 @@ public:
private:
bool updateImage(QImage &image) override;
QString simpleToolTipText() const override;
bool isFileNameCorrectionNeeded() const override;
// last used int vector, uses to better resize redraw
// TODO: make a diff pieces to new pieces and update only changed pixels, speedup when update > 20x faster

View File

@@ -276,12 +276,8 @@ void PiecesBar::showToolTip(const QHelpEvent *e)
DetailedTooltipRenderer renderer(stream, tooltipTitle);
const bool isFileNameCorrectionNeeded = this->isFileNameCorrectionNeeded();
for (int f : files) {
QString filePath {m_torrent->info().filePath(f)};
if (isFileNameCorrectionNeeded)
filePath.replace(QLatin1String("/.unwanted"), QString());
const QString filePath {m_torrent->info().filePath(f)};
renderer(Utils::Misc::friendlyUnit(m_torrent->info().fileSize(f)), filePath);
}
stream << "</body></html>";
@@ -333,8 +329,3 @@ void PiecesBar::updatePieceColors()
m_pieceColors[i] = mixTwoColors(backgroundColor().rgb(), m_pieceColor.rgb(), ratio);
}
}
bool PiecesBar::isFileNameCorrectionNeeded() const
{
return false;
}

View File

@@ -83,9 +83,6 @@ private:
virtual QString simpleToolTipText() const = 0;
/// whether to perform removing of ".unwanted" directory from paths
virtual bool isFileNameCorrectionNeeded() const;
// draw new image to replace the actual image
// returns true if image was successfully updated
virtual bool updateImage(QImage &image) = 0;