mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 03:45:56 +01:00
Handle URL QVariants properly when displaying filenames in the playlist view. Fixes issue 3127
This commit is contained in:
parent
78d473512d
commit
75a057a47d
@ -426,15 +426,21 @@ QWidget* TagCompletionItemDelegate::createEditor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString NativeSeparatorsDelegate::displayText(const QVariant& value, const QLocale&) const {
|
QString NativeSeparatorsDelegate::displayText(const QVariant& value, const QLocale&) const {
|
||||||
const QString text = value.toString();
|
const QString string_value = value.toString();
|
||||||
if (text.contains("://")) {
|
|
||||||
const QUrl url = QUrl::fromEncoded(text.toAscii());
|
QUrl url;
|
||||||
|
if (value.type() == QVariant::Url) {
|
||||||
|
url = value.toUrl();
|
||||||
|
} else if (string_value.contains("://")) {
|
||||||
|
url = QUrl::fromEncoded(string_value.toAscii());
|
||||||
|
} else {
|
||||||
|
return QDir::toNativeSeparators(string_value);
|
||||||
|
}
|
||||||
|
|
||||||
if (url.scheme() == "file") {
|
if (url.scheme() == "file") {
|
||||||
return QDir::toNativeSeparators(url.toLocalFile());
|
return QDir::toNativeSeparators(url.toLocalFile());
|
||||||
}
|
}
|
||||||
return text;
|
return string_value;
|
||||||
}
|
|
||||||
return QDir::toNativeSeparators(text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SongSourceDelegate::SongSourceDelegate(QObject* parent, Player* player)
|
SongSourceDelegate::SongSourceDelegate(QObject* parent, Player* player)
|
||||||
|
Loading…
Reference in New Issue
Block a user