KMix: dock icon fallback algorithm

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Mavridis Philippe 3 years ago
parent cdc671aec1
commit dce72aa35a
No known key found for this signature in database
GPG Key ID: 93F66F98F906147D

@ -343,14 +343,32 @@ KMixDockWidget::updatePixmap(bool force)
TQPixmap origpixmap; TQPixmap origpixmap;
TQPixmap scaledpixmap; TQPixmap scaledpixmap;
TQImage newIcon; TQImage newIcon;
TQStringList fallback;
switch ( newPixmapType ) { switch ( newPixmapType ) {
// AFAIK no icon theme has an icon analogous to kmixdocked_error case 'm': fallback << "audio-volume-muted" << "kmixdocked_mute"; break;
case 'e': origpixmap = isShown() ? loadSizedIcon( "kmixdocked_error" , width() ) : loadIcon( "kmixdocked_error" ); break; case 'L': fallback << "audio-volume-low" << "kmixdocked"; break;
case 'm': origpixmap = isShown() ? loadSizedIcon( "audio-volume-muted" , width() ) : loadIcon( "audio-volume-muted" ); break; case 'M': fallback << "audio-volume-medium" << "kmixdocked"; break;
case 'L': origpixmap = isShown() ? loadSizedIcon( "audio-volume-low" , width() ) : loadIcon( "audio-volume-low" ); break; case 'H': fallback << "audio-volume-high" << "kmixdocked"; break;
case 'M': origpixmap = isShown() ? loadSizedIcon( "audio-volume-medium", width() ) : loadIcon( "audio-volume-medium" ); break; }
case 'H': origpixmap = isShown() ? loadSizedIcon( "audio-volume-high" , width() ) : loadIcon( "audio-volume-high" ); break;
TQString icon = TQString::null;
for(TQStringList::iterator it = fallback.begin(); it != fallback.end(); ++it)
{
/* Check if icon exists */
if(!kapp->iconLoader()->iconPath((*it), TDEIcon::User, true).isNull())
{
icon = (*it);
break;
} }
}
if(icon.isNull())
{
icon = "kmixdocked_error";
}
origpixmap = isShown() ? loadSizedIcon(icon, width()) : loadIcon(icon);
newIcon = origpixmap; newIcon = origpixmap;
if (isShown()) { if (isShown()) {
newIcon = newIcon.smoothScale(width(), height()); newIcon = newIcon.smoothScale(width(), height());

Loading…
Cancel
Save