mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-20 16:02:07 +02:00
Added a frame to the avatars as requested in bug TWK-106.
The frame image must be in displayed size and the avatar takes 80% of the available space centered.
This commit is contained in:
parent
3af34a8581
commit
c29ce585a5
BIN
data/images/avatar_frame.png
Normal file
BIN
data/images/avatar_frame.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
211
resources.qrc
211
resources.qrc
@ -1,107 +1,108 @@
|
||||
<RCC>
|
||||
<qresource>
|
||||
<file>./data/images/avatar-dude-plus.png</file>
|
||||
<file>./data/images/avatar-dude.png</file>
|
||||
<file>./data/images/back-pressed.png</file>
|
||||
<file>./data/images/back-rest.png</file>
|
||||
<file>./data/images/cover-shadow.png</file>
|
||||
<file>./data/images/filter.png</file>
|
||||
<file>./data/images/loved.png</file>
|
||||
<file>./data/images/not-loved.png</file>
|
||||
<file>./data/images/no-album-art-placeholder.png</file>
|
||||
<file>./data/images/no-artist-image-placeholder.png</file>
|
||||
<file>./data/images/now-playing-panel.png</file>
|
||||
<file>./data/images/now-playing-speaker.png</file>
|
||||
<file>./data/images/pause-pressed.png</file>
|
||||
<file>./data/images/pause-rest.png</file>
|
||||
<file>./data/images/play-pressed.png</file>
|
||||
<file>./data/images/play-rest.png</file>
|
||||
<file>./data/images/sipplugin-add.png</file>
|
||||
<file>./data/images/sipplugin-remove.png</file>
|
||||
<file>./data/images/playlist-icon.png</file>
|
||||
<file>./data/images/repeat-1-on-pressed.png</file>
|
||||
<file>./data/images/repeat-1-on-rest.png</file>
|
||||
<file>./data/images/repeat-all-on-pressed.png</file>
|
||||
<file>./data/images/repeat-all-on-rest.png</file>
|
||||
<file>./data/images/repeat-off-pressed.png</file>
|
||||
<file>./data/images/repeat-off-rest.png</file>
|
||||
<file>./data/images/search-box-dismiss-x.png</file>
|
||||
<file>./data/images/seek-and-volume-knob-pressed.png</file>
|
||||
<file>./data/images/seek-and-volume-knob-rest.png</file>
|
||||
<file>./data/images/seek-slider-bkg.png</file>
|
||||
<file>./data/images/seek-slider-level.png</file>
|
||||
<file>./data/images/shuffle-off-pressed.png</file>
|
||||
<file>./data/images/shuffle-off-rest.png</file>
|
||||
<file>./data/images/shuffle-on-pressed.png</file>
|
||||
<file>./data/images/shuffle-on-rest.png</file>
|
||||
<file>./data/images/skip-pressed.png</file>
|
||||
<file>./data/images/skip-rest.png</file>
|
||||
<file>./data/images/user-avatar.png</file>
|
||||
<file>./data/images/view-toggle-active-centre.png</file>
|
||||
<file>./data/images/view-toggle-active-left.png</file>
|
||||
<file>./data/images/view-toggle-active-right.png</file>
|
||||
<file>./data/images/view-toggle-icon-artist-active.png</file>
|
||||
<file>./data/images/view-toggle-icon-artist-inactive.png</file>
|
||||
<file>./data/images/view-toggle-icon-cloud-active.png</file>
|
||||
<file>./data/images/view-toggle-icon-cloud-inactive.png</file>
|
||||
<file>./data/images/view-toggle-icon-list-active.png</file>
|
||||
<file>./data/images/view-toggle-icon-list-inactive.png</file>
|
||||
<file>./data/images/view-toggle-inactive-centre.png</file>
|
||||
<file>./data/images/view-toggle-inactive-left.png</file>
|
||||
<file>./data/images/view-toggle-inactive-right.png</file>
|
||||
<file>./data/images/view-toggle-pressed-centre.png</file>
|
||||
<file>./data/images/view-toggle-pressed-left.png</file>
|
||||
<file>./data/images/view-toggle-pressed-right.png</file>
|
||||
<file>./data/images/list-add.png</file>
|
||||
<file>./data/images/list-remove.png</file>
|
||||
<file>./data/images/arrow-up-double.png</file>
|
||||
<file>./data/images/arrow-down-double.png</file>
|
||||
<file>./data/images/volume-icon-full.png</file>
|
||||
<file>./data/images/arrow-right-double.png</file>
|
||||
<file>./data/images/view-refresh.png</file>
|
||||
<file>./data/images/volume-icon-muted.png</file>
|
||||
<file>./data/images/volume-slider-bkg.png</file>
|
||||
<file>./data/images/volume-slider-level.png</file>
|
||||
<file>./data/images/echonest_logo.png</file>
|
||||
<file>./data/images/loading-animation.gif</file>
|
||||
<file>./data/images/info.png</file>
|
||||
<file>./data/images/home.png</file>
|
||||
<file>./data/images/back.png</file>
|
||||
<file>./data/images/forward.png</file>
|
||||
<file>./data/images/music-icon.png</file>
|
||||
<file>./data/images/configure.png</file>
|
||||
<file>./data/images/create-playlist.png</file>
|
||||
<file>./data/images/add.png</file>
|
||||
<file>./data/images/recently-played.png</file>
|
||||
<file>./data/images/supercollection.png</file>
|
||||
<file>./data/images/sipplugin-online.png</file>
|
||||
<file>./data/images/sipplugin-offline.png</file>
|
||||
<file>./data/images/advanced-settings.png</file>
|
||||
<file>./data/images/account-settings.png</file>
|
||||
<file>./data/images/music-settings.png</file>
|
||||
<file>./data/images/resolvers-settings.png</file>
|
||||
<file>./data/images/lastfm-settings.png</file>
|
||||
<file>./data/images/automatic-playlist.png</file>
|
||||
<file>./data/images/station.png</file>
|
||||
<file>./data/images/new-additions.png</file>
|
||||
<file>./data/images/loved_playlist.png</file>
|
||||
<file>./data/stylesheets/topbar-radiobuttons.css</file>
|
||||
<file>./data/icons/tomahawk-icon-16x16.png</file>
|
||||
<file>./data/icons/tomahawk-icon-32x32.png</file>
|
||||
<file>./data/icons/tomahawk-icon-64x64.png</file>
|
||||
<file>./data/icons/tomahawk-icon-128x128.png</file>
|
||||
<file>./data/icons/tomahawk-icon-256x256.png</file>
|
||||
<file>./data/icons/tomahawk-icon-512x512.png</file>
|
||||
<file>./data/icons/audio-x-generic-22x22.png</file>
|
||||
<file>./data/icons/audio-x-generic-32x32.png</file>
|
||||
<file>./data/icons/audio-x-generic-16x16.png</file>
|
||||
<file>./data/www/auth.html</file>
|
||||
<file>./data/www/auth.na.html</file>
|
||||
<file>./data/www/tomahawk_banner_small.png</file>
|
||||
<file>./data/sql/dbmigrate-22_to_23.sql</file>
|
||||
<file>./data/sql/dbmigrate-23_to_24.sql</file>
|
||||
<file>./data/sql/dbmigrate-24_to_25.sql</file>
|
||||
<file>./data/sql/dbmigrate-25_to_26.sql</file>
|
||||
<file>./data/js/tomahawk.js</file>
|
||||
</qresource>
|
||||
<qresource prefix="/">
|
||||
<file>data/images/avatar-dude-plus.png</file>
|
||||
<file>data/images/avatar-dude.png</file>
|
||||
<file>data/images/back-pressed.png</file>
|
||||
<file>data/images/back-rest.png</file>
|
||||
<file>data/images/cover-shadow.png</file>
|
||||
<file>data/images/filter.png</file>
|
||||
<file>data/images/loved.png</file>
|
||||
<file>data/images/not-loved.png</file>
|
||||
<file>data/images/no-album-art-placeholder.png</file>
|
||||
<file>data/images/no-artist-image-placeholder.png</file>
|
||||
<file>data/images/now-playing-panel.png</file>
|
||||
<file>data/images/now-playing-speaker.png</file>
|
||||
<file>data/images/pause-pressed.png</file>
|
||||
<file>data/images/pause-rest.png</file>
|
||||
<file>data/images/play-pressed.png</file>
|
||||
<file>data/images/play-rest.png</file>
|
||||
<file>data/images/sipplugin-add.png</file>
|
||||
<file>data/images/sipplugin-remove.png</file>
|
||||
<file>data/images/playlist-icon.png</file>
|
||||
<file>data/images/repeat-1-on-pressed.png</file>
|
||||
<file>data/images/repeat-1-on-rest.png</file>
|
||||
<file>data/images/repeat-all-on-pressed.png</file>
|
||||
<file>data/images/repeat-all-on-rest.png</file>
|
||||
<file>data/images/repeat-off-pressed.png</file>
|
||||
<file>data/images/repeat-off-rest.png</file>
|
||||
<file>data/images/search-box-dismiss-x.png</file>
|
||||
<file>data/images/seek-and-volume-knob-pressed.png</file>
|
||||
<file>data/images/seek-and-volume-knob-rest.png</file>
|
||||
<file>data/images/seek-slider-bkg.png</file>
|
||||
<file>data/images/seek-slider-level.png</file>
|
||||
<file>data/images/shuffle-off-pressed.png</file>
|
||||
<file>data/images/shuffle-off-rest.png</file>
|
||||
<file>data/images/shuffle-on-pressed.png</file>
|
||||
<file>data/images/shuffle-on-rest.png</file>
|
||||
<file>data/images/skip-pressed.png</file>
|
||||
<file>data/images/skip-rest.png</file>
|
||||
<file>data/images/user-avatar.png</file>
|
||||
<file>data/images/view-toggle-active-centre.png</file>
|
||||
<file>data/images/view-toggle-active-left.png</file>
|
||||
<file>data/images/view-toggle-active-right.png</file>
|
||||
<file>data/images/view-toggle-icon-artist-active.png</file>
|
||||
<file>data/images/view-toggle-icon-artist-inactive.png</file>
|
||||
<file>data/images/view-toggle-icon-cloud-active.png</file>
|
||||
<file>data/images/view-toggle-icon-cloud-inactive.png</file>
|
||||
<file>data/images/view-toggle-icon-list-active.png</file>
|
||||
<file>data/images/view-toggle-icon-list-inactive.png</file>
|
||||
<file>data/images/view-toggle-inactive-centre.png</file>
|
||||
<file>data/images/view-toggle-inactive-left.png</file>
|
||||
<file>data/images/view-toggle-inactive-right.png</file>
|
||||
<file>data/images/view-toggle-pressed-centre.png</file>
|
||||
<file>data/images/view-toggle-pressed-left.png</file>
|
||||
<file>data/images/view-toggle-pressed-right.png</file>
|
||||
<file>data/images/list-add.png</file>
|
||||
<file>data/images/list-remove.png</file>
|
||||
<file>data/images/arrow-up-double.png</file>
|
||||
<file>data/images/arrow-down-double.png</file>
|
||||
<file>data/images/volume-icon-full.png</file>
|
||||
<file>data/images/arrow-right-double.png</file>
|
||||
<file>data/images/view-refresh.png</file>
|
||||
<file>data/images/volume-icon-muted.png</file>
|
||||
<file>data/images/volume-slider-bkg.png</file>
|
||||
<file>data/images/volume-slider-level.png</file>
|
||||
<file>data/images/echonest_logo.png</file>
|
||||
<file>data/images/loading-animation.gif</file>
|
||||
<file>data/images/info.png</file>
|
||||
<file>data/images/home.png</file>
|
||||
<file>data/images/back.png</file>
|
||||
<file>data/images/forward.png</file>
|
||||
<file>data/images/music-icon.png</file>
|
||||
<file>data/images/configure.png</file>
|
||||
<file>data/images/create-playlist.png</file>
|
||||
<file>data/images/add.png</file>
|
||||
<file>data/images/recently-played.png</file>
|
||||
<file>data/images/supercollection.png</file>
|
||||
<file>data/images/sipplugin-online.png</file>
|
||||
<file>data/images/sipplugin-offline.png</file>
|
||||
<file>data/images/advanced-settings.png</file>
|
||||
<file>data/images/account-settings.png</file>
|
||||
<file>data/images/music-settings.png</file>
|
||||
<file>data/images/resolvers-settings.png</file>
|
||||
<file>data/images/lastfm-settings.png</file>
|
||||
<file>data/images/automatic-playlist.png</file>
|
||||
<file>data/images/station.png</file>
|
||||
<file>data/images/new-additions.png</file>
|
||||
<file>data/images/loved_playlist.png</file>
|
||||
<file>data/stylesheets/topbar-radiobuttons.css</file>
|
||||
<file>data/icons/tomahawk-icon-16x16.png</file>
|
||||
<file>data/icons/tomahawk-icon-32x32.png</file>
|
||||
<file>data/icons/tomahawk-icon-64x64.png</file>
|
||||
<file>data/icons/tomahawk-icon-128x128.png</file>
|
||||
<file>data/icons/tomahawk-icon-256x256.png</file>
|
||||
<file>data/icons/tomahawk-icon-512x512.png</file>
|
||||
<file>data/icons/audio-x-generic-22x22.png</file>
|
||||
<file>data/icons/audio-x-generic-32x32.png</file>
|
||||
<file>data/icons/audio-x-generic-16x16.png</file>
|
||||
<file>data/www/auth.html</file>
|
||||
<file>data/www/auth.na.html</file>
|
||||
<file>data/www/tomahawk_banner_small.png</file>
|
||||
<file>data/sql/dbmigrate-22_to_23.sql</file>
|
||||
<file>data/sql/dbmigrate-23_to_24.sql</file>
|
||||
<file>data/sql/dbmigrate-24_to_25.sql</file>
|
||||
<file>data/sql/dbmigrate-25_to_26.sql</file>
|
||||
<file>data/js/tomahawk.js</file>
|
||||
<file>data/images/avatar_frame.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -124,7 +124,10 @@ ControlConnection::registerSource()
|
||||
Q_ASSERT( source == m_source.data() );
|
||||
|
||||
// qDebug() << Q_FUNC_INFO << "Setting avatar ... " << name() << !SipHandler::instance()->avatar( name() ).isNull();
|
||||
source->setAvatar( SipHandler::instance()->avatar( name() ) );
|
||||
if( !SipHandler::instance()->avatar( name() ).isNull() )
|
||||
{
|
||||
source->setAvatar( SipHandler::instance()->avatar( name() ) );
|
||||
}
|
||||
|
||||
m_registered = true;
|
||||
m_servent->registerControlConnection( this );
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "utils/logger.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@ -41,7 +42,6 @@ Source::Source( int id, const QString& username )
|
||||
, m_username( username )
|
||||
, m_id( id )
|
||||
, m_cc( 0 )
|
||||
, m_avatar( 0 )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << id << username;
|
||||
|
||||
@ -62,7 +62,6 @@ Source::Source( int id, const QString& username )
|
||||
Source::~Source()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << friendlyName();
|
||||
delete m_avatar;
|
||||
}
|
||||
|
||||
|
||||
@ -123,18 +122,15 @@ Source::friendlyName() const
|
||||
void
|
||||
Source::setAvatar( const QPixmap& avatar )
|
||||
{
|
||||
//FIXME: use a proper pixmap store that's thread-safe
|
||||
delete m_avatar;
|
||||
m_avatar = new QPixmap( avatar );
|
||||
m_avatar = avatar;
|
||||
}
|
||||
|
||||
|
||||
QPixmap
|
||||
Source::avatar() const
|
||||
{
|
||||
//FIXME: use a proper pixmap store that's thread-safe
|
||||
if ( m_avatar )
|
||||
return QPixmap( *m_avatar );
|
||||
if( !m_avatar.isNull() )
|
||||
return TomahawkUtils::createAvatarFrame( m_avatar );
|
||||
else
|
||||
return QPixmap();
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ private:
|
||||
|
||||
ControlConnection* m_cc;
|
||||
|
||||
QPixmap* m_avatar;
|
||||
QPixmap m_avatar;
|
||||
|
||||
Tomahawk::playlistinterface_ptr m_playlistInterface;
|
||||
};
|
||||
|
@ -472,4 +472,16 @@ bringToFront() {
|
||||
}
|
||||
#endif
|
||||
|
||||
QPixmap
|
||||
createAvatarFrame( const QPixmap &avatar )
|
||||
{
|
||||
QPixmap frame( ":/data/images/avatar_frame.png" );
|
||||
QPixmap scaledAvatar = avatar.scaled( frame.height() * 80 / 100, frame.width() * 80 / 100, Qt::KeepAspectRatio, Qt::SmoothTransformation );
|
||||
|
||||
QPainter painter( &frame );
|
||||
painter.drawPixmap( (frame.height() - scaledAvatar.height()) / 2, (frame.width() - scaledAvatar.width()) / 2, scaledAvatar );
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
@ -84,6 +84,8 @@ namespace TomahawkUtils
|
||||
|
||||
/// Platform-specific bringing tomahawk mainwindow to front, b/c qt's activate() and such don't seem to work well enough for us
|
||||
DLLEXPORT void bringToFront();
|
||||
|
||||
DLLEXPORT QPixmap createAvatarFrame(const QPixmap &avatar);
|
||||
}
|
||||
|
||||
#endif // TOMAHAWKUTILS_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user