1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-10 16:14:40 +02:00

Show different text for read-only playlists

This commit is contained in:
Leo Franchi
2011-02-09 19:09:18 -05:00
parent f2b324e4a9
commit 9091abcf9a
3 changed files with 25 additions and 6 deletions

View File

@@ -25,6 +25,7 @@
#include <QPaintEvent>
#include <QtGui/qpaintengine.h>
#include <QScrollBar>
#include "DynamicModel.h"
using namespace Tomahawk;
@@ -58,7 +59,7 @@ DynamicView::~DynamicView()
}
void
DynamicView::setModel( PlaylistModel* model)
DynamicView::setModel( DynamicModel* model)
{
PlaylistView::setModel( model );
@@ -71,6 +72,12 @@ DynamicView::setOnDemand( bool onDemand )
m_onDemand = onDemand;
}
void
DynamicView::setReadOnly( bool readOnly )
{
m_readOnly = readOnly;
}
void
DynamicView::showMessageTimeout( const QString& title, const QString& body )
{
@@ -94,10 +101,16 @@ DynamicView::onTrackCountChanged( unsigned int tracks )
{
if ( tracks == 0 )
{
if( m_onDemand )
overlay()->setText( tr( "Add some filters above, and press Start to begin listening to this custom station!" ) );
else
overlay()->setText( tr( "Add some filters above, and press Generate to get started!" ) );
if( m_onDemand ) {
if( m_readOnly )
overlay()->setText( tr( "Press Start to begin listening to this custom station!" ) );
else
overlay()->setText( tr( "Add some filters above, and press Start to begin listening to this custom station!" ) );
} else
if( m_readOnly )
overlay()->setText( tr( "Press Generate to get started!" ) );
else
overlay()->setText( tr( "Add some filters above, and press Generate to get started!" ) );
if( !overlay()->shown() )
overlay()->show();
}

View File

@@ -26,6 +26,9 @@ class PlaylistModel;
class TrackModel;
namespace Tomahawk
{
class DynamicModel;
class DynamicView : public PlaylistView
{
@@ -34,9 +37,10 @@ public:
explicit DynamicView( QWidget* parent = 0 );
virtual ~DynamicView();
virtual void setModel( PlaylistModel* model );
virtual void setModel( DynamicModel* model );
void setOnDemand( bool onDemand );
void setReadOnly( bool readOnly );
virtual void paintEvent(QPaintEvent* event);
@@ -57,6 +61,7 @@ private:
QString m_body;
bool m_onDemand;
bool m_readOnly;
// for collapsing animation
QPoint m_fadingPointAnchor;

View File

@@ -148,6 +148,7 @@ DynamicWidget::loadDynamicPlaylist( const Tomahawk::dynplaylist_ptr& playlist )
m_playlist = playlist;
m_view->setOnDemand( m_playlist->mode() == OnDemand );
m_view->setReadOnly( !m_playlist->author()->isLocal() );
m_model->loadPlaylist( m_playlist );
m_controlsChanged = false;