mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 08:34:34 +02:00
Show different text for read-only playlists
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
#include <QtGui/qpaintengine.h>
|
#include <QtGui/qpaintengine.h>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#include "DynamicModel.h"
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ DynamicView::~DynamicView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DynamicView::setModel( PlaylistModel* model)
|
DynamicView::setModel( DynamicModel* model)
|
||||||
{
|
{
|
||||||
PlaylistView::setModel( model );
|
PlaylistView::setModel( model );
|
||||||
|
|
||||||
@@ -71,6 +72,12 @@ DynamicView::setOnDemand( bool onDemand )
|
|||||||
m_onDemand = onDemand;
|
m_onDemand = onDemand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DynamicView::setReadOnly( bool readOnly )
|
||||||
|
{
|
||||||
|
m_readOnly = readOnly;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DynamicView::showMessageTimeout( const QString& title, const QString& body )
|
DynamicView::showMessageTimeout( const QString& title, const QString& body )
|
||||||
{
|
{
|
||||||
@@ -94,10 +101,16 @@ DynamicView::onTrackCountChanged( unsigned int tracks )
|
|||||||
{
|
{
|
||||||
if ( tracks == 0 )
|
if ( tracks == 0 )
|
||||||
{
|
{
|
||||||
if( m_onDemand )
|
if( m_onDemand ) {
|
||||||
overlay()->setText( tr( "Add some filters above, and press Start to begin listening to this custom station!" ) );
|
if( m_readOnly )
|
||||||
else
|
overlay()->setText( tr( "Press Start to begin listening to this custom station!" ) );
|
||||||
overlay()->setText( tr( "Add some filters above, and press Generate to get started!" ) );
|
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() )
|
if( !overlay()->shown() )
|
||||||
overlay()->show();
|
overlay()->show();
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,9 @@ class PlaylistModel;
|
|||||||
class TrackModel;
|
class TrackModel;
|
||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class DynamicModel;
|
||||||
|
|
||||||
|
|
||||||
class DynamicView : public PlaylistView
|
class DynamicView : public PlaylistView
|
||||||
{
|
{
|
||||||
@@ -34,9 +37,10 @@ public:
|
|||||||
explicit DynamicView( QWidget* parent = 0 );
|
explicit DynamicView( QWidget* parent = 0 );
|
||||||
virtual ~DynamicView();
|
virtual ~DynamicView();
|
||||||
|
|
||||||
virtual void setModel( PlaylistModel* model );
|
virtual void setModel( DynamicModel* model );
|
||||||
|
|
||||||
void setOnDemand( bool onDemand );
|
void setOnDemand( bool onDemand );
|
||||||
|
void setReadOnly( bool readOnly );
|
||||||
|
|
||||||
virtual void paintEvent(QPaintEvent* event);
|
virtual void paintEvent(QPaintEvent* event);
|
||||||
|
|
||||||
@@ -57,6 +61,7 @@ private:
|
|||||||
QString m_body;
|
QString m_body;
|
||||||
|
|
||||||
bool m_onDemand;
|
bool m_onDemand;
|
||||||
|
bool m_readOnly;
|
||||||
|
|
||||||
// for collapsing animation
|
// for collapsing animation
|
||||||
QPoint m_fadingPointAnchor;
|
QPoint m_fadingPointAnchor;
|
||||||
|
@@ -148,6 +148,7 @@ DynamicWidget::loadDynamicPlaylist( const Tomahawk::dynplaylist_ptr& playlist )
|
|||||||
|
|
||||||
m_playlist = playlist;
|
m_playlist = playlist;
|
||||||
m_view->setOnDemand( m_playlist->mode() == OnDemand );
|
m_view->setOnDemand( m_playlist->mode() == OnDemand );
|
||||||
|
m_view->setReadOnly( !m_playlist->author()->isLocal() );
|
||||||
m_model->loadPlaylist( m_playlist );
|
m_model->loadPlaylist( m_playlist );
|
||||||
m_controlsChanged = false;
|
m_controlsChanged = false;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user