mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 00:09:47 +01:00
Fix collection page icons.
This commit is contained in:
parent
ad1e057078
commit
7f73c073be
@ -78,6 +78,15 @@ Collection::icon() const
|
||||
}
|
||||
|
||||
|
||||
QPixmap
|
||||
Collection::bigIcon() const
|
||||
{
|
||||
if ( !source()->avatar().isNull() )
|
||||
return source()->avatar( TomahawkUtils::RoundedCorners );
|
||||
return TomahawkUtils::defaultPixmap( TomahawkUtils::SuperCollection );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Collection::emptyText() const
|
||||
{
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
virtual QString itemName() const;
|
||||
virtual QString type() const { return QString(); }
|
||||
virtual QIcon icon() const;
|
||||
virtual QPixmap bigIcon() const; //for the ViewPage header
|
||||
virtual QString emptyText() const;
|
||||
|
||||
virtual void loadPlaylists() { qDebug() << Q_FUNC_INFO; }
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "SourceList.h"
|
||||
#include <TomahawkSettings.h>
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
#include "ViewManager.h"
|
||||
|
@ -259,8 +259,7 @@ TreeModel::addCollection( const collection_ptr& collection )
|
||||
|
||||
connect( collection.data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection );
|
||||
|
||||
if ( !collection->source()->avatar().isNull() )
|
||||
setIcon( collection->source()->avatar( TomahawkUtils::RoundedCorners ) );
|
||||
setIcon( collection->bigIcon() );
|
||||
|
||||
setTitle( collection->prettyName() );
|
||||
}
|
||||
|
@ -21,8 +21,10 @@
|
||||
|
||||
#include "Source.h"
|
||||
#include "ExternalResolverGui.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QPainter>
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@ -80,6 +82,31 @@ ScriptCollection::icon() const
|
||||
}
|
||||
|
||||
|
||||
QPixmap
|
||||
ScriptCollection::bigIcon() const
|
||||
{
|
||||
QPixmap big = Collection::bigIcon();
|
||||
QPixmap base = icon().pixmap( big.size() );
|
||||
|
||||
if ( !source()->isLocal() )
|
||||
{
|
||||
big = big.scaled( TomahawkUtils::defaultIconSize(),
|
||||
Qt::KeepAspectRatio,
|
||||
Qt::SmoothTransformation );
|
||||
|
||||
QPainter painter( &base );
|
||||
painter.drawPixmap( base.width() - big.width(),
|
||||
base.height() - big.height(),
|
||||
big.width(),
|
||||
big.height(),
|
||||
big );
|
||||
painter.end();
|
||||
}
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScriptCollection::artists()
|
||||
{
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
virtual QString itemName() const;
|
||||
virtual QString type() const { return "scriptcollection"; }
|
||||
virtual QIcon icon() const;
|
||||
virtual QPixmap bigIcon() const;
|
||||
|
||||
virtual ExternalResolver* resolver() { return m_resolver; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user