From 07ba35ff6d4d9d145c4b1cc8ac267e4a5806ab81 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Thu, 10 Jun 2010 17:04:40 +0000 Subject: [PATCH] Append a "Hz", "bpm", "kbps" etc. suffix to bit rate, sample rate and BPM columns in the playlist --- src/playlist/playlistdelegates.cpp | 26 +++++++++++++++++--------- src/playlist/playlistdelegates.h | 3 ++- src/playlist/playlistview.cpp | 3 +++ src/translations/ar.po | 6 ++++++ src/translations/cs.po | 6 ++++++ src/translations/da.po | 6 ++++++ src/translations/de.po | 6 ++++++ src/translations/el.po | 6 ++++++ src/translations/en_CA.po | 6 ++++++ src/translations/en_GB.po | 6 ++++++ src/translations/es.po | 6 ++++++ src/translations/fi.po | 6 ++++++ src/translations/fr.po | 6 ++++++ src/translations/gl.po | 6 ++++++ src/translations/it.po | 6 ++++++ src/translations/kk.po | 6 ++++++ src/translations/nb.po | 6 ++++++ src/translations/oc.po | 6 ++++++ src/translations/pl.po | 6 ++++++ src/translations/pt.po | 6 ++++++ src/translations/pt_BR.po | 6 ++++++ src/translations/ro.po | 6 ++++++ src/translations/ru.po | 6 ++++++ src/translations/sk.po | 6 ++++++ src/translations/sv.po | 6 ++++++ src/translations/tr.po | 6 ++++++ src/translations/zh_CN.po | 6 ++++++ src/translations/zh_TW.po | 6 ++++++ 28 files changed, 172 insertions(+), 10 deletions(-) diff --git a/src/playlist/playlistdelegates.cpp b/src/playlist/playlistdelegates.cpp index d1b838802..93b8dc4cd 100644 --- a/src/playlist/playlistdelegates.cpp +++ b/src/playlist/playlistdelegates.cpp @@ -30,32 +30,40 @@ const int PlaylistDelegateBase::kMinHeight = 19; -PlaylistDelegateBase::PlaylistDelegateBase(QTreeView* view) +PlaylistDelegateBase::PlaylistDelegateBase(QTreeView* view, const QString& suffix) : QStyledItemDelegate(view), - view_(view) + view_(view), + suffix_(suffix) { } QString PlaylistDelegateBase::displayText(const QVariant& value, const QLocale&) const { + QString text; + switch (value.type()) { case QVariant::Int: { int v = value.toInt(); - if (v <= 0) - return QString::null; - return QString::number(v); + if (v > 0) + text = QString::number(v); + break; } case QMetaType::Float: case QVariant::Double: { double v = value.toDouble(); - if (v <= 0) - return QString::null; - return QString::number(v); + if (v > 0) + text = QString::number(v); + break; } default: - return value.toString(); + text = value.toString(); + break; } + + if (!text.isNull() && !suffix_.isNull()) + text += " " + suffix_; + return text; } QSize PlaylistDelegateBase::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { diff --git a/src/playlist/playlistdelegates.h b/src/playlist/playlistdelegates.h index 2aff4d307..3047f07a7 100644 --- a/src/playlist/playlistdelegates.h +++ b/src/playlist/playlistdelegates.h @@ -28,7 +28,7 @@ class PlaylistDelegateBase : public QStyledItemDelegate { Q_OBJECT public: - PlaylistDelegateBase(QTreeView* view); + PlaylistDelegateBase(QTreeView* view, const QString& suffix = QString()); void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; QString displayText(const QVariant& value, const QLocale& locale) const; QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; @@ -43,6 +43,7 @@ class PlaylistDelegateBase : public QStyledItemDelegate { protected: QTreeView* view_; + QString suffix_; }; class LengthItemDelegate : public PlaylistDelegateBase { diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index 32c1fd732..3378d03fb 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -81,6 +81,9 @@ void PlaylistView::SetItemDelegates(LibraryBackend* backend) { setItemDelegateForColumn(Playlist::Column_Filetype, new FileTypeItemDelegate(this)); setItemDelegateForColumn(Playlist::Column_DateCreated, new DateItemDelegate(this)); setItemDelegateForColumn(Playlist::Column_DateModified, new DateItemDelegate(this)); + setItemDelegateForColumn(Playlist::Column_BPM, new PlaylistDelegateBase(this, tr("bpm"))); + setItemDelegateForColumn(Playlist::Column_Samplerate, new PlaylistDelegateBase(this, ("Hz"))); + setItemDelegateForColumn(Playlist::Column_Bitrate, new PlaylistDelegateBase(this, tr("kbps"))); } void PlaylistView::SetPlaylist(Playlist *playlist) { diff --git a/src/translations/ar.po b/src/translations/ar.po index d9495c929..fdd40cb7c 100644 --- a/src/translations/ar.po +++ b/src/translations/ar.po @@ -326,6 +326,12 @@ msgstr "أزِل %n أغاني\\أغنية" msgid "move songs" msgstr "انقل الأغاني" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/cs.po b/src/translations/cs.po index f403f2982..a516520bd 100644 --- a/src/translations/cs.po +++ b/src/translations/cs.po @@ -327,6 +327,12 @@ msgstr "Odeber %n skladeb" msgid "move songs" msgstr "Přesuň skladby" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/da.po b/src/translations/da.po index 642ae0d93..e5fd62da2 100644 --- a/src/translations/da.po +++ b/src/translations/da.po @@ -329,6 +329,12 @@ msgstr "fjern %n sange" msgid "move songs" msgstr "flyt sange" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/de.po b/src/translations/de.po index f534b4039..6202d7aa4 100644 --- a/src/translations/de.po +++ b/src/translations/de.po @@ -327,6 +327,12 @@ msgstr "%n Stücke entfernen" msgid "move songs" msgstr "Stücke verschieben" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 Wiedergabelisten (%2)" diff --git a/src/translations/el.po b/src/translations/el.po index 9e0a74087..50b8931ee 100644 --- a/src/translations/el.po +++ b/src/translations/el.po @@ -330,6 +330,12 @@ msgstr "αφαίρεση %n τραγουδιών" msgid "move songs" msgstr "μετακίνηση τραγουδιών" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 λίστες αναπαραγωγής (%2)" diff --git a/src/translations/en_CA.po b/src/translations/en_CA.po index 1014516d5..b8c1d886e 100644 --- a/src/translations/en_CA.po +++ b/src/translations/en_CA.po @@ -327,6 +327,12 @@ msgstr "remove %n songs" msgid "move songs" msgstr "move songs" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 playlists (%2)" diff --git a/src/translations/en_GB.po b/src/translations/en_GB.po index a3ff5a3d8..29cd3f498 100644 --- a/src/translations/en_GB.po +++ b/src/translations/en_GB.po @@ -326,6 +326,12 @@ msgstr "" msgid "move songs" msgstr "" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/es.po b/src/translations/es.po index e3d8a4983..1e7b1a8ba 100644 --- a/src/translations/es.po +++ b/src/translations/es.po @@ -329,6 +329,12 @@ msgstr "remover %n pistas" msgid "move songs" msgstr "mover pistas" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 listas de reproducción (%2)" diff --git a/src/translations/fi.po b/src/translations/fi.po index cc8b8eb2e..0280a75ff 100644 --- a/src/translations/fi.po +++ b/src/translations/fi.po @@ -326,6 +326,12 @@ msgstr "" msgid "move songs" msgstr "" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/fr.po b/src/translations/fr.po index 9f8923c8b..adb0dc892 100644 --- a/src/translations/fr.po +++ b/src/translations/fr.po @@ -327,6 +327,12 @@ msgstr "" msgid "move songs" msgstr "déplacer les chansons" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/gl.po b/src/translations/gl.po index 0cacdc258..040113629 100644 --- a/src/translations/gl.po +++ b/src/translations/gl.po @@ -326,6 +326,12 @@ msgstr "" msgid "move songs" msgstr "" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/it.po b/src/translations/it.po index a446e781c..a9d445630 100644 --- a/src/translations/it.po +++ b/src/translations/it.po @@ -329,6 +329,12 @@ msgstr "rimuovi %n brani" msgid "move songs" msgstr "sposta brani" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 scalette (%2)" diff --git a/src/translations/kk.po b/src/translations/kk.po index 4e4be2dc8..97a8fc50e 100644 --- a/src/translations/kk.po +++ b/src/translations/kk.po @@ -326,6 +326,12 @@ msgstr "" msgid "move songs" msgstr "" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/nb.po b/src/translations/nb.po index f7878f8c0..6f18caff9 100644 --- a/src/translations/nb.po +++ b/src/translations/nb.po @@ -326,6 +326,12 @@ msgstr "" msgid "move songs" msgstr "" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/oc.po b/src/translations/oc.po index 824a2e190..9387dcab2 100644 --- a/src/translations/oc.po +++ b/src/translations/oc.po @@ -326,6 +326,12 @@ msgstr "" msgid "move songs" msgstr "" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/pl.po b/src/translations/pl.po index 586ba791d..59e25bb2b 100644 --- a/src/translations/pl.po +++ b/src/translations/pl.po @@ -327,6 +327,12 @@ msgstr "" msgid "move songs" msgstr "" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/pt.po b/src/translations/pt.po index b86215aa0..97f80d75b 100644 --- a/src/translations/pt.po +++ b/src/translations/pt.po @@ -328,6 +328,12 @@ msgstr "remover %n canções" msgid "move songs" msgstr "mover canções" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 listas de reprodução (%2)" diff --git a/src/translations/pt_BR.po b/src/translations/pt_BR.po index 295ecfacd..70bf6d492 100644 --- a/src/translations/pt_BR.po +++ b/src/translations/pt_BR.po @@ -328,6 +328,12 @@ msgstr "Remover %n músicas" msgid "move songs" msgstr "mover músicas" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 listas de reprodução (%2)" diff --git a/src/translations/ro.po b/src/translations/ro.po index e3c00f3a6..f198f3f4c 100644 --- a/src/translations/ro.po +++ b/src/translations/ro.po @@ -326,6 +326,12 @@ msgstr "" msgid "move songs" msgstr "" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/ru.po b/src/translations/ru.po index 3f91ca777..7c339cf2d 100644 --- a/src/translations/ru.po +++ b/src/translations/ru.po @@ -327,6 +327,12 @@ msgstr "удалить %n композиций" msgid "move songs" msgstr "переместить композиции" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 списков воспроизведения (%2)" diff --git a/src/translations/sk.po b/src/translations/sk.po index 5e1084736..b52c661e3 100644 --- a/src/translations/sk.po +++ b/src/translations/sk.po @@ -328,6 +328,12 @@ msgstr "odstrániť %n piesní" msgid "move songs" msgstr "presunúť piesne" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "%1 playlisty (%2)" diff --git a/src/translations/sv.po b/src/translations/sv.po index ee726f2f7..8df58f094 100644 --- a/src/translations/sv.po +++ b/src/translations/sv.po @@ -326,6 +326,12 @@ msgstr "Ta bort %n songer" msgid "move songs" msgstr "Flytta songer" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/tr.po b/src/translations/tr.po index 52ab9a6a6..a0d1e2064 100644 --- a/src/translations/tr.po +++ b/src/translations/tr.po @@ -326,6 +326,12 @@ msgstr "" msgid "move songs" msgstr "" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/zh_CN.po b/src/translations/zh_CN.po index c50445656..0715719f3 100644 --- a/src/translations/zh_CN.po +++ b/src/translations/zh_CN.po @@ -326,6 +326,12 @@ msgstr "" msgid "move songs" msgstr "" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr "" diff --git a/src/translations/zh_TW.po b/src/translations/zh_TW.po index 67583deb7..dc7249668 100644 --- a/src/translations/zh_TW.po +++ b/src/translations/zh_TW.po @@ -326,6 +326,12 @@ msgstr "" msgid "move songs" msgstr "" +msgid "bpm" +msgstr "" + +msgid "kbps" +msgstr "" + #, qt-format msgid "%1 playlists (%2)" msgstr ""