Commit 9a1db0b8 authored by Scott Wheeler's avatar Scott Wheeler

Add a bitrate column (hidden by default).

CCMAIL:78665-done@bugs.kde.org

svn path=/trunk/kdemultimedia/juk/; revision=303184
parent cd085540
......@@ -169,6 +169,7 @@ Playlist::SharedSettings::SharedSettings()
for(int i = 0; i <= PlaylistItem::lastColumn(); i++) {
switch(i) {
case PlaylistItem::BitrateColumn:
case PlaylistItem::CommentColumn:
case PlaylistItem::FileNameColumn:
m_columnsVisible.append(false);
......@@ -867,6 +868,7 @@ void Playlist::polish()
addColumn(i18n("Genre"));
addColumn(i18n("Year"));
addColumn(i18n("Length"));
addColumn(i18n("Bitrate"));
addColumn(i18n("Comment"));
addColumn(i18n("File Name"));
......
......@@ -77,6 +77,8 @@ QString PlaylistItem::text(int column) const
: QString::null;
case LengthColumn:
return d->fileHandle.tag()->lengthString();
case BitrateColumn:
return QString::number(d->fileHandle.tag()->bitrate());
case CommentColumn:
return d->fileHandle.tag()->comment();
case FileNameColumn:
......@@ -259,25 +261,35 @@ int PlaylistItem::compare(const PlaylistItem *firstItem, const PlaylistItem *sec
return first.localeAwareCompare(second);
}
if(column == TrackNumberColumn + offset) {
switch(column - offset) {
case TrackNumberColumn:
if(firstItem->d->fileHandle.tag()->track() > secondItem->d->fileHandle.tag()->track())
return 1;
else if(firstItem->d->fileHandle.tag()->track() < secondItem->d->fileHandle.tag()->track())
return -1;
else
return 0;
}
else if(column == LengthColumn + offset) {
break;
case LengthColumn:
if(firstItem->d->fileHandle.tag()->seconds() > secondItem->d->fileHandle.tag()->seconds())
return 1;
else if(firstItem->d->fileHandle.tag()->seconds() < secondItem->d->fileHandle.tag()->seconds())
return -1;
else
return 0;
}
break;
case BitrateColumn:
if(firstItem->d->fileHandle.tag()->bitrate() > secondItem->d->fileHandle.tag()->bitrate())
return 1;
else if(firstItem->d->fileHandle.tag()->bitrate() < secondItem->d->fileHandle.tag()->bitrate())
return -1;
else
return 0;
break;
default:
return strcoll(firstItem->d->local8Bit[column - offset],
secondItem->d->local8Bit[column - offset]);
}
}
bool PlaylistItem::isValid() const
......
......@@ -57,8 +57,9 @@ public:
GenreColumn = 4,
YearColumn = 5,
LengthColumn = 6,
CommentColumn = 7,
FileNameColumn = 8 };
BitrateColumn = 7,
CommentColumn = 8,
FileNameColumn = 9 };
static int lastColumn() { return FileNameColumn; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment