Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

disable rql sources which don't work for non-subscribers (with toolti…

…ps to explain)
  • Loading branch information...
commit 984dc7251b564e21afbba4fc4184c30c55d007d9 1 parent 09a7faa
@dougma authored
View
3  app/radio/widgets/MultiStarterWidget.cpp
@@ -193,6 +193,9 @@ MultiStarterWidget::onAddItem(QListWidgetItem* item)
void
MultiStarterWidget::onYouItemActivated(QTreeWidgetItem* i, int)
{
+ if (i->isDisabled())
+ return; // don't know how it gets activated, but it does...
+
QVariant vType = i->data(0, SourceListModel::SourceType);
if (vType.isNull())
return;
View
17 app/radio/widgets/YouListWidget.cpp
@@ -19,15 +19,24 @@
#include "YouListWidget.h"
#include "../SourceListModel.h"
+#include "lib/unicorn/UnicornSettings.h"
#include <lastfm.h>
YouListWidget::YouListWidget(const QString& username, QWidget* parent)
: QTreeWidget(parent)
, m_username(username)
+ , m_subscriber(false)
{
QString displayName = (username == lastfm::ws::Username) ? "Your " : username + "'s ";
+ // subscribers can listen to loved tracks and personal tags.
+ {
+ unicorn::UserSettings us;
+ QVariant v = us.value(unicorn::UserSettings::subscriptionKey(), false);
+ m_subscriber = v.toBool();
+ }
+
setAlternatingRowColors( true );
setHeaderHidden( true );
setIndentation( 10 );
@@ -44,6 +53,10 @@ YouListWidget::YouListWidget(const QString& username, QWidget* parent)
item = new QTreeWidgetItem(h, QStringList(displayName + "Loved Tracks"));
item->setData(0, SourceListModel::SourceType, RqlSource::Loved);
item->setData(0, SourceListModel::Arg1, username);
+ if (!m_subscriber) {
+ item->setDisabled(true);
+ item->setToolTip(0, tr("Loved tracks are playable by subscribers"));
+ }
item = new QTreeWidgetItem(h, QStringList(displayName + "Recommendations"));
item->setData(0, SourceListModel::SourceType, RqlSource::Rec);
item->setData(0, SourceListModel::Arg1, username);
@@ -113,6 +126,10 @@ YouListWidget::gotTopTags()
item->setData(0, SourceListModel::SourceType, RqlSource::PersonalTag);
item->setData(0, SourceListModel::Arg1, tag);
item->setData(0, SourceListModel::Arg2, m_username);
+ if (!m_subscriber) {
+ item->setDisabled(true);
+ item->setToolTip(0, tr("Personal tags are playable by subscribers"));
+ }
}
}
View
1  app/radio/widgets/YouListWidget.h
@@ -44,6 +44,7 @@ private slots:
QTreeWidgetItem* m_playlistsItem;
QString m_username;
+ bool m_subscriber;
};
#endif // YOU_LIST_WIDGET_H_
Please sign in to comment.
Something went wrong with that request. Please try again.