From dd4afe9b067ac010c2997649b1ed592d8b4b7485 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sun, 17 Oct 2010 17:10:19 +0000 Subject: [PATCH] Add rating and play count columns to the playlist --- data/data.qrc | 3 ++ data/icons/22x22/rating.png | Bin 0 -> 2763 bytes data/icons/32x32/rating.png | Bin 0 -> 2763 bytes data/icons/48x48/rating.png | Bin 0 -> 2763 bytes src/playlist/playlist.cpp | 10 ++++++ src/playlist/playlist.h | 4 +++ src/playlist/playlistdelegates.cpp | 55 ++++++++++++++++++++++++++++- src/playlist/playlistdelegates.h | 13 +++++++ src/playlist/playlistview.cpp | 3 ++ src/translations/ar.po | 6 ++++ src/translations/bg.po | 6 ++++ src/translations/ca.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/hu.po | 6 ++++ src/translations/it.po | 6 ++++ src/translations/kk.po | 6 ++++ src/translations/lt.po | 6 ++++ src/translations/nb.po | 6 ++++ src/translations/nl.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/sl.po | 6 ++++ src/translations/sr.po | 6 ++++ src/translations/sv.po | 6 ++++ src/translations/tr.po | 6 ++++ src/translations/translations.pot | 6 ++++ src/translations/uk.po | 6 ++++ src/translations/zh_CN.po | 6 ++++ src/translations/zh_TW.po | 6 ++++ 43 files changed, 291 insertions(+), 1 deletion(-) create mode 100644 data/icons/22x22/rating.png create mode 100644 data/icons/32x32/rating.png create mode 100644 data/icons/48x48/rating.png diff --git a/data/data.qrc b/data/data.qrc index b687bd2bd..caffdb6fd 100644 --- a/data/data.qrc +++ b/data/data.qrc @@ -275,5 +275,8 @@ providers/cdbaby.png providers/echonest.png lumberjacksong.txt + icons/22x22/rating.png + icons/32x32/rating.png + icons/48x48/rating.png diff --git a/data/icons/22x22/rating.png b/data/icons/22x22/rating.png new file mode 100644 index 0000000000000000000000000000000000000000..5ef37a6116d375a9792ee7fe063a27a8deddd590 GIT binary patch literal 2763 zcmV;+3N-bJP){8z8x?{O;?-87X&@>=1=K%U+x??eE45XU(u!6Uk79+^6e$k_0Zbl%0xStmLhV4D zIM`dSz3aXExO-nSbIz}8cB9E%c{f>mr8qz7tC=}7cjoswzw`T@GqWqI%A45?Z*uct zMk%!cq~S8P#UC{0$qF)%oYbQ;$uthkNuNj>)02fKL=VDaRkIv+TmMmj!y=~Z3J&whrgze zuzVeHjyr>je>I4?XaSBNpyFmYV8g%^E`Kl9oSxMga+lqPhB@(P z0FlFc36f0&&Jy@jWHPWrt$&yGxIW5A)|h~eJMO|SXMp7wMmwXt^rQQ*QJpZ>*pGSI zsr-kQ;)f^ev|UWxpCj5=CEmST-D?6owpaYpAYo|9m>PY7@&3%gF7;R+dy-2$5rE#c z+o-I2C)rgSz)b))z2kBqR1kkP(Zn#*C!XT;u_pkV%i4j-Isrcjs0>^|Y4w$4^1b+#RTw`&lj+o1 zVfg^Muo&l2Jd)`%v};uw)fcFa{G7NsgD8ZF#=g@Ns_Yxj+51inP`&+jwW514LjhZJ zp8rHMkP5zG)w-*w^j%G+yc)mM4>m%R8i*pDPM;ryE^@5tzL+8!&7y2v%UaGUNc z=`%WH0;2jaIdl9dlIVZ0Y0(r_<>22+Z&zfFHbcMb>KoogkiQ&xb z4=ZWABR%I{xkk`(KZo}3C2YpiHImJ{_AqV$Zi<*_H{DLtvdQy5{Q=Gnqw0PwShyCL zlgx|rkvL$H`=!t9km-60zc~2M(1;RCvTG+)b=C|3yVXTG{x?+nk!H1}FFpG>Q0*8p zouQv^$HGEM=YFcCuhp|!W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PkOxYjM8es74Hyw z2Q2DHZHX1B=R@39X(z}91GEw(7h^mhaA_G72WV$ov+eQAA?3)^@Z66qwHhQ2!T`4X zhH&+D!rN~YDg_IU^tVdKvF}6FLIS%20Ir2ee8lrfowtAoYC$|`h{wn=`2PKl(GyCp zhvM{%wGn?M005F0 znKg*hYU2W7Ch!;?h9~zWL~ZC=!~bpE%%>*LaL^m4na|Qb0PGm%fi911Pd{(V_VW3m zuh~n7zJmPbM?BVECY19IX}a`H(+F_{b|nB3ht1`^IC5dA149Seu~W1z{ODyZPQhlSq7|002ovPDHLkV1lJYKF9z7 literal 0 HcmV?d00001 diff --git a/data/icons/32x32/rating.png b/data/icons/32x32/rating.png new file mode 100644 index 0000000000000000000000000000000000000000..5ef37a6116d375a9792ee7fe063a27a8deddd590 GIT binary patch literal 2763 zcmV;+3N-bJP){8z8x?{O;?-87X&@>=1=K%U+x??eE45XU(u!6Uk79+^6e$k_0Zbl%0xStmLhV4D zIM`dSz3aXExO-nSbIz}8cB9E%c{f>mr8qz7tC=}7cjoswzw`T@GqWqI%A45?Z*uct zMk%!cq~S8P#UC{0$qF)%oYbQ;$uthkNuNj>)02fKL=VDaRkIv+TmMmj!y=~Z3J&whrgze zuzVeHjyr>je>I4?XaSBNpyFmYV8g%^E`Kl9oSxMga+lqPhB@(P z0FlFc36f0&&Jy@jWHPWrt$&yGxIW5A)|h~eJMO|SXMp7wMmwXt^rQQ*QJpZ>*pGSI zsr-kQ;)f^ev|UWxpCj5=CEmST-D?6owpaYpAYo|9m>PY7@&3%gF7;R+dy-2$5rE#c z+o-I2C)rgSz)b))z2kBqR1kkP(Zn#*C!XT;u_pkV%i4j-Isrcjs0>^|Y4w$4^1b+#RTw`&lj+o1 zVfg^Muo&l2Jd)`%v};uw)fcFa{G7NsgD8ZF#=g@Ns_Yxj+51inP`&+jwW514LjhZJ zp8rHMkP5zG)w-*w^j%G+yc)mM4>m%R8i*pDPM;ryE^@5tzL+8!&7y2v%UaGUNc z=`%WH0;2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^$IW~(AexT3>koo_(}MCKt} z=iCyYR8|}8G=pQ{t;BaB&n66(`wW2sat@hPX->>Zf>ijOaFRwTP5xM^3<^mk-9C61 zo&(@z6Y1(*3))mtTUh%S$q55Un!HMy3ka!5BbCW3QJX?BSb-sA8<;pESLg;8DdLlw za&92AU?@pi=OwK^sp!0Cn1yzmV5YVL5eV~$jnxY>fCF?9K}TjzPkOxYjM8es74Hyw z2Q2DHZHX1B=R@39X(z}91GEw(7h^mhaA_G72WV$ov+eQAA?3)^@Z66qwHhQ2!T`4X zhH&+D!rN~YDg_IU^tVdKvF}6FLIS%20Ir2ee8lrfowtAoYC$|`h{wn=`2PKl(GyCp zhvM{%wGn?M005F0 znKg*hYU2W7Ch!;?h9~zWL~ZC=!~bpE%%>*LaL^m4na|Qb0PGm%fi911Pd{(V_VW3m zuh~n7zJmPbM?BVECY19IX}a`H(+F_{b|nB3ht1`^IC5dA149Seu~W1z{ODyZPQhlSq7|002ovPDHLkV1lJYKF9z7 literal 0 HcmV?d00001 diff --git a/data/icons/48x48/rating.png b/data/icons/48x48/rating.png new file mode 100644 index 0000000000000000000000000000000000000000..5ef37a6116d375a9792ee7fe063a27a8deddd590 GIT binary patch literal 2763 zcmV;+3N-bJP){8z8x?{O;?-87X&@>=1=K%U+x??eE45XU(u!6Uk79+^6e$k_0Zbl%0xStmLhV4D zIM`dSz3aXExO-nSbIz}8cB9E%c{f>mr8qz7tC=}7cjoswzw`T@GqWqI%A45?Z*uct zMk%!cq~S8P#UC{0$qF)%oYbQ;$uthkNuNj>)02fKL=VDaRkIv+TmMmj!y=~Z3J&whrgze zuzVeHjyr>je>I4?XaSBNpyFmYV8g%^E`Kl9oSxMga+lqPhB@(P z0FlFc36f0&&Jy@jWHPWrt$&yGxIW5A)|h~eJMO|SXMp7wMmwXt^rQQ*QJpZ>*pGSI zsr-kQ;)f^ev|UWxpCj5=CEmST-D?6owpaYpAYo|9m>PY7@&3%gF7;R+dy-2$5rE#c z+o-I2C)rgSz)b))z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bcnDyg!mr#ig*dm1N`~k^8f>4Kwn*{=GxPW;{caNN+r#6=Lt~@!hqqKQ^YIsaaYyV zU1CsVzLyiksvrtZAZjXVXw(bn1p`cUqdh{yS+EM2 zPDu*U31m7GT1WxZ0XFS*G?jXgv_Olr`%5bT&_02o%vx&|-xo+0K%|bRQSe9s(@K;M z9SaHoY41Bw14h7PL9OebIfc1kfPo^$IW~(AexT3>koo_(}MCKt} z=iCyYR8|}8G=pQ{t;BaB&n66(`wW2sat@hPX->>Zf>ijOaFRwTP5xM^3<^mk-9C61 zo&(@z6Y1(*3))mtTUh%S$q55Un!HMy3ka!5BbCW3QJX?BSb-sA8<;pESLg;8DdLlw za&92AU?@pi=OwK^sp!0Cn1yzmV5YVL5eV~$jnxY>fCF?9K}TjzPkOxYjM8es74Hyw z2Q2DHZHX1B=R@39X(z}91GEw(7h^mhaA_G72WV$ov+eQAA?3)^@Z66qwHhQ2!T`4X zhH&+D!rN~YDg_IU^tVdKvF}6FLIS%20Ir2ee8lrfowtAoYC$|`h{wn=`2PKl(GyCp zhvM{%wGn?M005F0 znKg*hYU2W7Ch!;?h9~zWL~ZC=!~bpE%%>*LaL^m4na|Qb0PGm%fi911Pd{(V_VW3m zuh~n7zJmPbM?BVECY19IX}a`H(+F_{b|nB3ht1`^IC5dA149Seu~W1z{ODyZPQhlSq7|002ovPDHLkV1lJYKF9z7 literal 0 HcmV?d00001 diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 37f9a136e..f116a2b67 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -202,6 +202,9 @@ QVariant Playlist::data(const QModelIndex& index, int role) const { case Column_AlbumArtist: return song.albumartist(); case Column_Composer: return song.composer(); + case Column_Rating: return song.rating(); + case Column_PlayCount:return song.playcount(); + case Column_BPM: return song.bpm(); case Column_Bitrate: return song.bitrate(); case Column_Samplerate: return song.samplerate(); @@ -224,6 +227,7 @@ QVariant Playlist::data(const QModelIndex& index, int role) const { case Column_Bitrate: case Column_Samplerate: case Column_Filesize: + case Column_PlayCount: return QVariant(Qt::AlignRight | Qt::AlignVCenter); default: @@ -792,6 +796,9 @@ bool Playlist::CompareItems(int column, Qt::SortOrder order, case Column_AlbumArtist: strcmp(albumartist); case Column_Composer: strcmp(composer); + case Column_Rating: cmp(rating); + case Column_PlayCount: cmp(playcount); + case Column_BPM: cmp(bpm); case Column_Bitrate: cmp(bitrate); case Column_Samplerate: cmp(samplerate); @@ -822,6 +829,9 @@ QString Playlist::column_name(Column column) { case Column_AlbumArtist: return tr("Album artist"); case Column_Composer: return tr("Composer"); + case Column_Rating: return tr("Rating"); + case Column_PlayCount:return tr("Play count"); + case Column_BPM: return tr("BPM"); case Column_Bitrate: return tr("Bit rate"); case Column_Samplerate: return tr("Sample rate"); diff --git a/src/playlist/playlist.h b/src/playlist/playlist.h index 14cc13b28..fc4606aa8 100644 --- a/src/playlist/playlist.h +++ b/src/playlist/playlist.h @@ -58,6 +58,7 @@ class Playlist : public QAbstractListModel { QObject* parent = 0); ~Playlist(); + // Always add new columns to the end of this enum - the values are persisted enum Column { Column_Title = 0, Column_Artist, @@ -80,6 +81,9 @@ class Playlist : public QAbstractListModel { Column_DateCreated, Column_DateModified, + Column_Rating, + Column_PlayCount, + ColumnCount }; diff --git a/src/playlist/playlistdelegates.cpp b/src/playlist/playlistdelegates.cpp index 7dde10e41..70e6bfdd5 100644 --- a/src/playlist/playlistdelegates.cpp +++ b/src/playlist/playlistdelegates.cpp @@ -19,6 +19,7 @@ #include "core/utilities.h" #include "library/librarybackend.h" #include "widgets/trackslider.h" +#include "ui/iconloader.h" #include #include @@ -39,7 +40,9 @@ const QRgb QueuedItemDelegate::kQueueBoxGradientColor2 = qRgb(77, 121, 200); const int QueuedItemDelegate::kQueueOpacitySteps = 10; const float QueuedItemDelegate::kQueueOpacityLowerBound = 0.4; -const int PlaylistDelegateBase::kMinHeight = 19; +const int PlaylistDelegateBase::kMinHeight = 19; + +const int RatingItemDelegate::kStarCount = 5; // There are 4 stars QueuedItemDelegate::QueuedItemDelegate(QObject *parent, int indicator_column) : QStyledItemDelegate(parent), @@ -275,6 +278,56 @@ QWidget* TextItemDelegate::createEditor( return new QLineEdit(parent); } +RatingItemDelegate::RatingItemDelegate(QObject* parent) + : PlaylistDelegateBase(parent), + star_(IconLoader::Load("rating")) +{ +} + +void RatingItemDelegate::paint( + QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { + const double rating = index.data().toDouble() * kStarCount; + const int star_size = option.rect.height(); + const int width = star_size * kStarCount; + + const QPixmap empty(star_.pixmap(star_size, QIcon::Disabled)); + const QPixmap full(star_.pixmap(star_size)); + + int x = option.rect.x() + (option.rect.width() - width) / 2; + for (int i=0 ; idrawPixmap(rect, empty); + } else if (rating - 0.75 <= i) { + // Half full + const QRect target_left(rect.x(), rect.y(), rect.width()/2, rect.height()); + const QRect target_right(rect.x() + rect.width()/2, rect.y(), rect.width()/2, rect.height()); + const QRect source_left(0, 0, empty.width()/2, empty.height()); + const QRect source_right(empty.width()/2, 0, empty.width()/2, empty.height()); + painter->drawPixmap(target_left, full, source_left); + painter->drawPixmap(target_right, empty, source_right); + } else { + // Totally full + painter->drawPixmap(rect, full); + } + } +} + +QSize RatingItemDelegate::sizeHint( + const QStyleOptionViewItem& option, const QModelIndex& index) const { + QSize size = PlaylistDelegateBase::sizeHint(option, index); + size.setWidth(size.height() * kStarCount); + return size; +} + +QString RatingItemDelegate::displayText( + const QVariant& value, const QLocale&) const { + // Round to the nearest .5 + const float rating = float(int(value.toDouble() * kStarCount * 2 + 0.5)) / 2; + return QString::number(rating, 'f', 1); +} TagCompletionModel::TagCompletionModel(LibraryBackend* backend, Playlist::Column column) : QStringListModel() { diff --git a/src/playlist/playlistdelegates.h b/src/playlist/playlistdelegates.h index b4a848fda..7e413ccd6 100644 --- a/src/playlist/playlistdelegates.h +++ b/src/playlist/playlistdelegates.h @@ -98,6 +98,19 @@ class TextItemDelegate : public PlaylistDelegateBase { const QModelIndex& index) const; }; +class RatingItemDelegate : public PlaylistDelegateBase { +public: + RatingItemDelegate(QObject* parent); + void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; + QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; + QString displayText(const QVariant& value, const QLocale& locale) const; + + static const int kStarCount; + +private: + QIcon star_; +}; + class TagCompletionModel : public QStringListModel { public: TagCompletionModel(LibraryBackend* backend, Playlist::Column column); diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index 3e66f59d4..662f6fb8f 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -123,6 +123,7 @@ void PlaylistView::SetItemDelegates(LibraryBackend* backend) { setItemDelegateForColumn(Playlist::Column_Samplerate, new PlaylistDelegateBase(this, ("Hz"))); setItemDelegateForColumn(Playlist::Column_Bitrate, new PlaylistDelegateBase(this, tr("kbps"))); setItemDelegateForColumn(Playlist::Column_Filename, new NativeSeparatorsDelegate(this)); + setItemDelegateForColumn(Playlist::Column_Rating, new RatingItemDelegate(this)); } void PlaylistView::SetPlaylist(Playlist *playlist) { @@ -170,6 +171,8 @@ void PlaylistView::LoadGeometry() { header_->HideSection(Playlist::Column_DateModified); header_->HideSection(Playlist::Column_AlbumArtist); header_->HideSection(Playlist::Column_Composer); + header_->HideSection(Playlist::Column_PlayCount); + header_->HideSection(Playlist::Column_Rating); header_->moveSection(header_->visualIndex(Playlist::Column_Track), 0); setting_initial_header_layout_ = true; diff --git a/src/translations/ar.po b/src/translations/ar.po index 5a39bb469..355971fbf 100644 --- a/src/translations/ar.po +++ b/src/translations/ar.po @@ -1370,6 +1370,9 @@ msgstr "" msgid "Play artist radio..." msgstr "" +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1479,6 +1482,9 @@ msgstr "" msgid "Random visualization" msgstr "" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/bg.po b/src/translations/bg.po index 727827e07..ff64588de 100644 --- a/src/translations/bg.po +++ b/src/translations/bg.po @@ -1371,6 +1371,9 @@ msgstr "" msgid "Play artist radio..." msgstr "" +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1480,6 +1483,9 @@ msgstr "" msgid "Random visualization" msgstr "" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/ca.po b/src/translations/ca.po index 2fcf577ed..4a22c81b8 100644 --- a/src/translations/ca.po +++ b/src/translations/ca.po @@ -1400,6 +1400,9 @@ msgstr "Reprodueix Artista o Etiqueta" msgid "Play artist radio..." msgstr "Reprodueix la radio de l'artista" +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1509,6 +1512,9 @@ msgstr "Pluja" msgid "Random visualization" msgstr "Visualització al.leatòria" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Realment vol cancel·lar?" diff --git a/src/translations/cs.po b/src/translations/cs.po index 2f2289e3f..bf039bb8d 100644 --- a/src/translations/cs.po +++ b/src/translations/cs.po @@ -1375,6 +1375,9 @@ msgstr "Přehrát umělce nebo značku" msgid "Play artist radio..." msgstr "Přehávat umělcovo rádio..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1484,6 +1487,9 @@ msgstr "Déšť" msgid "Random visualization" msgstr "" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/da.po b/src/translations/da.po index 37b9435d8..d0be6338c 100644 --- a/src/translations/da.po +++ b/src/translations/da.po @@ -1376,6 +1376,9 @@ msgstr "Spil kunstner eller mærke" msgid "Play artist radio..." msgstr "Spil kunstnerradio..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1485,6 +1488,9 @@ msgstr "" msgid "Random visualization" msgstr "" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/de.po b/src/translations/de.po index d3f517047..2fc21e517 100644 --- a/src/translations/de.po +++ b/src/translations/de.po @@ -1401,6 +1401,9 @@ msgstr "Spiele Künstler oder Stichwort" msgid "Play artist radio..." msgstr "Spiele Interpreten-Radio...." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1510,6 +1513,9 @@ msgstr "Regen" msgid "Random visualization" msgstr "Zufällige Visualisierung" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Wirklich abbrechen?" diff --git a/src/translations/el.po b/src/translations/el.po index cddcfb101..4249d23d8 100644 --- a/src/translations/el.po +++ b/src/translations/el.po @@ -1404,6 +1404,9 @@ msgstr "Αναπαραγωγή καλλιτέχνη ή ετικέτας" msgid "Play artist radio..." msgstr "Αναπαραγωγή ραδιοφώνου καλλιτέχνη..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1513,6 +1516,9 @@ msgstr "Βροχή" msgid "Random visualization" msgstr "Τυχαίο οπτικό εφέ" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Ακύρωση στ' αλήθεια;" diff --git a/src/translations/en_CA.po b/src/translations/en_CA.po index d2cf38786..97b3419b8 100644 --- a/src/translations/en_CA.po +++ b/src/translations/en_CA.po @@ -1375,6 +1375,9 @@ msgstr "Play Artist or Tag" msgid "Play artist radio..." msgstr "Play artist radio..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1484,6 +1487,9 @@ msgstr "" msgid "Random visualization" msgstr "Random visualisation" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/en_GB.po b/src/translations/en_GB.po index f764912b5..601fd3f5b 100644 --- a/src/translations/en_GB.po +++ b/src/translations/en_GB.po @@ -1372,6 +1372,9 @@ msgstr "Play Artist or Tag" msgid "Play artist radio..." msgstr "Play artist radio..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1481,6 +1484,9 @@ msgstr "" msgid "Random visualization" msgstr "Random visualisation" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/es.po b/src/translations/es.po index ca83a091c..dc51ac5f9 100644 --- a/src/translations/es.po +++ b/src/translations/es.po @@ -1405,6 +1405,9 @@ msgstr "Reproducir Artista o Etiqueta" msgid "Play artist radio..." msgstr "Reproducir radio del artista..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1514,6 +1517,9 @@ msgstr "Lluvia" msgid "Random visualization" msgstr "Visualización al azar" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "¿Desea cancelar realmente?" diff --git a/src/translations/fi.po b/src/translations/fi.po index e3395b2a1..853fbc163 100644 --- a/src/translations/fi.po +++ b/src/translations/fi.po @@ -1373,6 +1373,9 @@ msgstr "" msgid "Play artist radio..." msgstr "" +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1482,6 +1485,9 @@ msgstr "" msgid "Random visualization" msgstr "" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/fr.po b/src/translations/fr.po index f4ba3c55b..bd32c5e5c 100644 --- a/src/translations/fr.po +++ b/src/translations/fr.po @@ -1409,6 +1409,9 @@ msgstr "Écouter une radio par artiste ou par tag" msgid "Play artist radio..." msgstr "Écouter la radio d'un artiste..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1518,6 +1521,9 @@ msgstr "Pluie" msgid "Random visualization" msgstr "Visualisation aléatoire" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Êtes-vous sûr de vouloir annuler ?" diff --git a/src/translations/gl.po b/src/translations/gl.po index d03d2302b..8e9caa369 100644 --- a/src/translations/gl.po +++ b/src/translations/gl.po @@ -1377,6 +1377,9 @@ msgstr "" msgid "Play artist radio..." msgstr "Reproduzir un artista na rádio..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1486,6 +1489,9 @@ msgstr "" msgid "Random visualization" msgstr "" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/hu.po b/src/translations/hu.po index f15f789af..04795357c 100644 --- a/src/translations/hu.po +++ b/src/translations/hu.po @@ -1398,6 +1398,9 @@ msgstr "Előadó vagy Címke lejátszása" msgid "Play artist radio..." msgstr "Előadó rádió lejátszása" +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1507,6 +1510,9 @@ msgstr "Eső" msgid "Random visualization" msgstr "Véletlenszerű megjelenítés" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Tényleg mégse?" diff --git a/src/translations/it.po b/src/translations/it.po index 7501a9abd..1696c9d44 100644 --- a/src/translations/it.po +++ b/src/translations/it.po @@ -1409,6 +1409,9 @@ msgstr "Riproduci artista o tag" msgid "Play artist radio..." msgstr "Riproduci radio dell'artista..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1518,6 +1521,9 @@ msgstr "Pioggia" msgid "Random visualization" msgstr "Visualizzazione casuale" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Vuo davvero annullare?" diff --git a/src/translations/kk.po b/src/translations/kk.po index b0229ddc5..4a81ff946 100644 --- a/src/translations/kk.po +++ b/src/translations/kk.po @@ -1372,6 +1372,9 @@ msgstr "" msgid "Play artist radio..." msgstr "" +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1481,6 +1484,9 @@ msgstr "" msgid "Random visualization" msgstr "" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/lt.po b/src/translations/lt.po index 409aa0735..c53b2e522 100644 --- a/src/translations/lt.po +++ b/src/translations/lt.po @@ -1371,6 +1371,9 @@ msgstr "" msgid "Play artist radio..." msgstr "" +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1480,6 +1483,9 @@ msgstr "" msgid "Random visualization" msgstr "" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/nb.po b/src/translations/nb.po index d397daed1..a07e2c06a 100644 --- a/src/translations/nb.po +++ b/src/translations/nb.po @@ -1374,6 +1374,9 @@ msgstr "Spill artist eller merkelapp" msgid "Play artist radio..." msgstr "Spill artistradio..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1483,6 +1486,9 @@ msgstr "" msgid "Random visualization" msgstr "" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/nl.po b/src/translations/nl.po index 5d7ed33d7..b47b9f047 100644 --- a/src/translations/nl.po +++ b/src/translations/nl.po @@ -1404,6 +1404,9 @@ msgstr "Artiest of tag afspelen" msgid "Play artist radio..." msgstr "Artiestradio afspelen" +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1513,6 +1516,9 @@ msgstr "Regen" msgid "Random visualization" msgstr "Willekeurige visualisatie" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Werkelijk annuleren?" diff --git a/src/translations/oc.po b/src/translations/oc.po index e3a307b78..41a504a7d 100644 --- a/src/translations/oc.po +++ b/src/translations/oc.po @@ -1370,6 +1370,9 @@ msgstr "" msgid "Play artist radio..." msgstr "" +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1479,6 +1482,9 @@ msgstr "" msgid "Random visualization" msgstr "" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/pl.po b/src/translations/pl.po index 9275ba0b5..8cfe3341b 100644 --- a/src/translations/pl.po +++ b/src/translations/pl.po @@ -1400,6 +1400,9 @@ msgstr "Odtwarzaj Wykonawcę lub Znacznik" msgid "Play artist radio..." msgstr "Odtwarzaj radio wykonawcy..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1509,6 +1512,9 @@ msgstr "Deszcz" msgid "Random visualization" msgstr "Losowa wizualizacja" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Na pewno anulować?" diff --git a/src/translations/pt.po b/src/translations/pt.po index a562d72c8..c4b71205f 100644 --- a/src/translations/pt.po +++ b/src/translations/pt.po @@ -1401,6 +1401,9 @@ msgstr "Reproduzir artista ou etiqueta" msgid "Play artist radio..." msgstr "Reproduzir rádio do artista..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1510,6 +1513,9 @@ msgstr "Chuva" msgid "Random visualization" msgstr "Visualização aleatória" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Realmente cancelar?" diff --git a/src/translations/pt_BR.po b/src/translations/pt_BR.po index 2e34d0edf..1562431f6 100644 --- a/src/translations/pt_BR.po +++ b/src/translations/pt_BR.po @@ -1389,6 +1389,9 @@ msgstr "Reproduzir Artista ou Marcador" msgid "Play artist radio..." msgstr "Reproduzir rádio do artista..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1498,6 +1501,9 @@ msgstr "Chuva" msgid "Random visualization" msgstr "Visualização aleatória" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Deseja realmente cancelar?" diff --git a/src/translations/ro.po b/src/translations/ro.po index 7df6fdfb9..7acb3b9ff 100644 --- a/src/translations/ro.po +++ b/src/translations/ro.po @@ -1371,6 +1371,9 @@ msgstr "" msgid "Play artist radio..." msgstr "" +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1480,6 +1483,9 @@ msgstr "" msgid "Random visualization" msgstr "" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/ru.po b/src/translations/ru.po index a3bbbd080..e9caa7760 100644 --- a/src/translations/ru.po +++ b/src/translations/ru.po @@ -1393,6 +1393,9 @@ msgstr "Проиграть исполнителя или тег" msgid "Play artist radio..." msgstr "Проиграть радио артиста..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1502,6 +1505,9 @@ msgstr "Дождь" msgid "Random visualization" msgstr "Случайная визуализация" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Действительно отменить?" diff --git a/src/translations/sk.po b/src/translations/sk.po index 2c075c875..3e7f15d4a 100644 --- a/src/translations/sk.po +++ b/src/translations/sk.po @@ -1394,6 +1394,9 @@ msgstr "Hrať interpréta alebo tag" msgid "Play artist radio..." msgstr "Hrať rádio interpréta..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1503,6 +1506,9 @@ msgstr "Dážď" msgid "Random visualization" msgstr "Náhodná vizualizácia" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Naozaj zrušiť?" diff --git a/src/translations/sl.po b/src/translations/sl.po index 9dd62dd13..5c6e8acf0 100644 --- a/src/translations/sl.po +++ b/src/translations/sl.po @@ -1394,6 +1394,9 @@ msgstr "Predvajaj izvajalca ali oznako" msgid "Play artist radio..." msgstr "Predvajaj radio izvajalca ..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1503,6 +1506,9 @@ msgstr "Dež" msgid "Random visualization" msgstr "Naključno predočenje" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Ali naj bo dejanje resnično preklicano?" diff --git a/src/translations/sr.po b/src/translations/sr.po index 232b89c0d..5219fe091 100644 --- a/src/translations/sr.po +++ b/src/translations/sr.po @@ -1376,6 +1376,9 @@ msgstr "" msgid "Play artist radio..." msgstr "" +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1485,6 +1488,9 @@ msgstr "Киша" msgid "Random visualization" msgstr "" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Заиста одустајете?" diff --git a/src/translations/sv.po b/src/translations/sv.po index 55dbc85aa..93d9c59fc 100644 --- a/src/translations/sv.po +++ b/src/translations/sv.po @@ -1380,6 +1380,9 @@ msgstr "Spela upp artist eller tagg" msgid "Play artist radio..." msgstr "Spela upp artistradio..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1489,6 +1492,9 @@ msgstr "Regn" msgid "Random visualization" msgstr "Slumpmässig visualisering" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Verkligen avbryta?" diff --git a/src/translations/tr.po b/src/translations/tr.po index 71855391b..78f6d7740 100644 --- a/src/translations/tr.po +++ b/src/translations/tr.po @@ -1397,6 +1397,9 @@ msgstr "Sanatçı veya Etiket Çal" msgid "Play artist radio..." msgstr "Sanatçı radyosu çal..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1506,6 +1509,9 @@ msgstr "Yağmur" msgid "Random visualization" msgstr "Rastgele görseller" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Gerçekten iptal edeyim mi?" diff --git a/src/translations/translations.pot b/src/translations/translations.pot index 25d85c304..7bd64254b 100644 --- a/src/translations/translations.pot +++ b/src/translations/translations.pot @@ -1361,6 +1361,9 @@ msgstr "" msgid "Play artist radio..." msgstr "" +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1470,6 +1473,9 @@ msgstr "" msgid "Random visualization" msgstr "" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/uk.po b/src/translations/uk.po index 1c3e512ff..9d1de70b1 100644 --- a/src/translations/uk.po +++ b/src/translations/uk.po @@ -1394,6 +1394,9 @@ msgstr "Відтворити «Виконавця» або «Позначку»" msgid "Play artist radio..." msgstr "Відтворити радіо виконавця..." +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1503,6 +1506,9 @@ msgstr "Дощ" msgid "Random visualization" msgstr "Випадкова візуалізація" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "Дійсно скасувати?" diff --git a/src/translations/zh_CN.po b/src/translations/zh_CN.po index e1ffc9bb9..01a6fb785 100644 --- a/src/translations/zh_CN.po +++ b/src/translations/zh_CN.po @@ -1370,6 +1370,9 @@ msgstr "" msgid "Play artist radio..." msgstr "" +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1479,6 +1482,9 @@ msgstr "" msgid "Random visualization" msgstr "" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "" diff --git a/src/translations/zh_TW.po b/src/translations/zh_TW.po index c69bb43e4..620e64687 100644 --- a/src/translations/zh_TW.po +++ b/src/translations/zh_TW.po @@ -1376,6 +1376,9 @@ msgstr "" msgid "Play artist radio..." msgstr "" +msgid "Play count" +msgstr "" + msgid "Play custom radio..." msgstr "" @@ -1485,6 +1488,9 @@ msgstr "下雨" msgid "Random visualization" msgstr "隨機視覺化" +msgid "Rating" +msgstr "" + msgid "Really cancel?" msgstr "真的要取消?"