From 19d9cf454e6c93a93bb273263fd4fcd18dc27edd Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Wed, 5 Dec 2012 02:17:39 +0100 Subject: [PATCH] * Added TomahawkUtilsGui::defaultIconSize(). --- src/libtomahawk/utils/TomahawkUtilsGui.cpp | 110 +++++++++++++++++---- src/libtomahawk/utils/TomahawkUtilsGui.h | 3 +- 2 files changed, 93 insertions(+), 20 deletions(-) diff --git a/src/libtomahawk/utils/TomahawkUtilsGui.cpp b/src/libtomahawk/utils/TomahawkUtilsGui.cpp index cd36461eb..0fb58dded 100644 --- a/src/libtomahawk/utils/TomahawkUtilsGui.cpp +++ b/src/libtomahawk/utils/TomahawkUtilsGui.cpp @@ -386,6 +386,14 @@ setDefaultFontSize( int points ) } +QSize +defaultIconSize() +{ + const int w = defaultFontHeight() * 1.6; + return QSize( w, w ); +} + + QColor alphaBlend( const QColor& colorFrom, const QColor& colorTo, float opacity ) { @@ -408,69 +416,133 @@ defaultPixmap( ImageType type, ImageMode mode, const QSize& size ) { case DefaultAlbumCover: if ( mode == CoverInCase ) - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/no-album-art-placeholder.png", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/no-album-art-placeholder.svg", size ); else if ( mode == Grid ) - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/album-placeholder-grid.png", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/album-placeholder-grid.svg", size ); else - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/no-album-no-case.png", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/no-album-no-case.svg", size ); break; case DefaultArtistImage: if ( mode == Grid ) - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/artist-placeholder-grid.png", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/artist-placeholder-grid.svg", size ); else - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/no-artist-image-placeholder.png", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/no-artist-image-placeholder.svg", size ); break; case DefaultTrackImage: - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/track-placeholder.png", size ); + if ( mode == Grid ) + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/track-placeholder-grid.svg", size ); + else + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/track-placeholder.png", size ); break; case DefaultSourceAvatar: if ( mode == RoundedCorners ) - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/user-avatar.png", size, TomahawkUtils::RoundedCorners ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/user-avatar.svg", size, TomahawkUtils::RoundedCorners ); else - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/user-avatar.png", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/user-avatar.svg", size ); + break; + + case DefaultResolver: + if ( mode == RoundedCorners ) + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/resolver-default.svg", size, TomahawkUtils::RoundedCorners ); + else + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/resolver-default.svg", size ); break; case NowPlayingSpeaker: - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/now-playing-speaker.png", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/now-playing-speaker.svg", size ); break; case NowPlayingSpeakerDark: - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/now-playing-speaker-dark.png", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/now-playing-speaker-dark.svg", size ); break; case InfoIcon: - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/info.png", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/info.svg", size ); break; case PlayButton: - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/play-rest.svg", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/play-rest.svg", size ); break; case PlayButtonPressed: - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/play-pressed.svg", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/play-pressed.svg", size ); break; case PauseButton: - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/pause-rest.svg", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/pause-rest.svg", size ); break; case PauseButtonPressed: - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/pause-pressed.svg", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/pause-pressed.svg", size ); break; case PrevButton: - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/back-rest.svg", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/back-rest.svg", size ); break; case PrevButtonPressed: - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/back-pressed.svg", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/back-pressed.svg", size ); break; case NextButton: - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/skip-rest.svg", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/skip-rest.svg", size ); break; case NextButtonPressed: - pixmap = ImageRegistry::instance()->getFromCache( RESPATH "images/skip-pressed.svg", size ); + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/skip-pressed.svg", size ); + break; + + case ShuffleOff: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/shuffle-off-rest.svg", size ); + break; + case ShuffleOffPressed: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/shuffle-off-pressed.svg", size ); + break; + case ShuffleOn: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/shuffle-on-rest.svg", size ); + break; + case ShuffleOnPressed: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/shuffle-on-pressed.svg", size ); + break; + + case RepeatOne: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/repeat-1-on-rest.svg", size ); + break; + case RepeatOnePressed: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/repeat-1-on-pressed.svg", size ); + break; + case RepeatAll: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/repeat-all-on-rest.svg", size ); + break; + case RepeatAllPressed: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/repeat-all-on-pressed.svg", size ); + break; + case RepeatOff: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/repeat-off-rest.svg", size ); + break; + case RepeatOffPressed: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/repeat-off-pressed.svg", size ); + break; + + case VolumeMuted: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/volume-icon-muted.svg", size ); + break; + case VolumeFull: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/volume-icon-full.svg", size ); + break; + + case Share: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/share.svg", size ); + break; + + case NotLoved: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/not-loved.svg", size ); + break; + case Loved: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/loved.svg", size ); + break; + + case Configure: + pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/configure.svg", size ); break; default: diff --git a/src/libtomahawk/utils/TomahawkUtilsGui.h b/src/libtomahawk/utils/TomahawkUtilsGui.h index a9673c46e..2f55679db 100644 --- a/src/libtomahawk/utils/TomahawkUtilsGui.h +++ b/src/libtomahawk/utils/TomahawkUtilsGui.h @@ -58,9 +58,10 @@ namespace TomahawkUtils DLLEXPORT void unmarginLayout( QLayout* layout ); + DLLEXPORT void setDefaultFontSize( int points ); DLLEXPORT int defaultFontSize(); DLLEXPORT int defaultFontHeight(); - DLLEXPORT void setDefaultFontSize( int points ); + DLLEXPORT QSize defaultIconSize(); DLLEXPORT QPixmap defaultPixmap( ImageType type, ImageMode mode = TomahawkUtils::Original, const QSize& size = QSize( 0, 0 ) );