diff --git a/models/playqueuemodel.cpp b/models/playqueuemodel.cpp
index 6c0e4f156..ee48fe2e2 100644
--- a/models/playqueuemodel.cpp
+++ b/models/playqueuemodel.cpp
@@ -213,6 +213,20 @@ int PlayQueueModel::rowCount(const QModelIndex &idx) const
return idx.isValid() ? 0 : songs.size();
}
+static QString basicPath(const Song &song)
+{
+ #ifdef ENABLE_HTTP_SERVER
+ if (song.isCantataStream()) {
+ Song mod=HttpServer::self()->decodeUrl(song.file);
+ if (!mod.file.isEmpty()) {
+ return mod.file;
+ }
+ }
+ #endif
+ int marker=song.file.indexOf(QLatin1Char('#'));
+ return -1==marker ? song.file : song.file.left(marker);
+}
+
QVariant PlayQueueModel::data(const QModelIndex &index, int role) const
{
if (Qt::SizeHintRole!=role && (!index.isValid() || index.row() >= songs.size())) {
@@ -348,7 +362,7 @@ QVariant PlayQueueModel::data(const QModelIndex &index, int role) const
const Song &song = songs.at(index.row());
switch (index.column()) {
case COL_TITLE:
- return song.title.isEmpty() ? song.file : song.title;
+ return song.title.isEmpty() ? Utils::getFile(basicPath(song)) : song.title;
case COL_ARTIST:
return song.artist.isEmpty() ? i18n("Unknown") : song.artist;
case COL_ALBUM:
@@ -379,14 +393,14 @@ QVariant PlayQueueModel::data(const QModelIndex &index, int role) const
case Qt::ToolTipRole: {
Song s=songs.at(index.row());
if (s.album.isEmpty() && s.isStream()) {
- return s.file;
+ return basicPath(s);
} else {
return s.albumArtist()+QLatin1String("
")+
s.album+(s.year>0 ? (QLatin1String(" (")+QString::number(s.year)+QChar(')')) : QString())+QLatin1String("
")+
s.trackAndTitleStr(Song::isVariousArtists(s.albumArtist()))+QLatin1String("
")+
Song::formattedTime(s.time)+QLatin1String("
")+
(s.priority>0 ? i18n("(Priority: %1)", s.priority)+QLatin1String("
") : QString())+
- QLatin1String("")+s.file+QLatin1String("");
+ QLatin1String("")+basicPath(s)+QLatin1String("");
}
}
case Qt::TextAlignmentRole:
@@ -510,7 +524,6 @@ QMimeData *PlayQueueModel::mimeData(const QModelIndexList &indexes) const
*
* @return bool if we accest the drop
*/
-#include
bool PlayQueueModel::dropMimeData(const QMimeData *data,
Qt::DropAction action, int row, int /*column*/, const QModelIndex & /*parent*/)
{
diff --git a/mpd/mpdparseutils.cpp b/mpd/mpdparseutils.cpp
index 6a9d58a10..4879e515f 100644
--- a/mpd/mpdparseutils.cpp
+++ b/mpd/mpdparseutils.cpp
@@ -251,6 +251,8 @@ Song MPDParseUtils::parseSong(const QByteArray &data, bool isPlayQueue)
song.genre = i18n("Unknown");
}
+ QString origFile=song.file;
+
#ifdef ENABLE_HTTP_SERVER
if (!song.file.isEmpty() && song.file.startsWith("http") && HttpServer::self()->isOurs(song.file)) {
song.type=Song::CantataStream;
@@ -297,6 +299,9 @@ Song MPDParseUtils::parseSong(const QByteArray &data, bool isPlayQueue)
}
}
if (isPlayQueue) {
+ // HTTP server, and OnlineServices, modify the path. But this then messes up
+ // undo/restore of playqueue. Therefore, set path back to original value...
+ song.file=origFile;
song.setKey();
}
return song;
diff --git a/mpd/song.h b/mpd/song.h
index 7dfb70c31..5046db3b9 100644
--- a/mpd/song.h
+++ b/mpd/song.h
@@ -116,6 +116,7 @@ struct Song
bool isCdda() const { return Cdda==type; }
QString albumKey() const { return albumArtist()+QLatin1Char(':')+album; }
bool isCueFile() const { return Playlist==type && file.endsWith(QLatin1String(".cue"), Qt::CaseInsensitive); }
+ QString basicArtist() const;
// We pass 'Song' around to cover requester. When we want the artist image, and not album image,
// then we blank certain fields to indicate this!
@@ -124,10 +125,12 @@ struct Song
album=artist=QString();
size=track=0;
}
-
bool isArtistImageRequest() const { return album.isEmpty() && artist.isEmpty() && !albumartist.isEmpty() && 0==size && 0==track; }
- QString basicArtist() const;
+ //
+ // The following sections contain various 'hacks' - where fields of Song are abused for other
+ // purposes. This is to kee the overall size of Song lower, as its used all over the place...
+ //
// podcast functions...
bool hasBeenPlayed() const { return 0!=id; }