summaryrefslogtreecommitdiff
path: root/core/launcher/launchertab.cpp
Side-by-side diff
Diffstat (limited to 'core/launcher/launchertab.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launchertab.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/core/launcher/launchertab.cpp b/core/launcher/launchertab.cpp
index 710f259..72ebf59 100644
--- a/core/launcher/launchertab.cpp
+++ b/core/launcher/launchertab.cpp
@@ -88,77 +88,77 @@ void LauncherTabBar::layoutTabs()
QListIterator< LauncherTab > it( items );
int required = 0;
int eventabwidth = (width()-1)/count();
enum Mode { HideBackText, Pack, Even } mode=Even;
for (it.toFirst(); it.current(); ++it ) {
t = it.current();
if ( !t )
continue;
int iw = fm.width( t->text() ) + hframe - overlap;
if ( t != current ) {
available -= hiddenTabWidth + hframe - overlap;
if ( t->iconSet() != 0 )
- available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
+ available -= t->iconSet()->pixmap().width();
}
if ( t->iconSet() != 0 )
- iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
+ iw += t->iconSet()->pixmap().width();
required += iw;
// As space gets tight, packed looks better than even. "10" must be at least 0.
if ( iw >= eventabwidth-10 )
mode = Pack;
}
if ( mode == Pack && required > width()-1 )
mode = HideBackText;
for ( it.toFirst(); it.current(); ++it ) {
t = it.current();
if ( !t )
continue;
if ( mode != HideBackText ) {
int w = fm.width( t->text() );
int ih = 0;
if ( t->iconSet() != 0 ) {
- w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
- ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
+ w += t->iconSet()->pixmap().width();
+ ih = t->iconSet()->pixmap().height();
}
int h = QMAX( fm.height(), ih );
h = QMAX( h, QApplication::globalStrut().height() );
h += vframe;
w += hframe;
QRect totr(x, 0,
mode == Even ? eventabwidth : w * (width()-1)/required, h);
t->setRect(totr);
x += totr.width() - overlap;
r = r.unite(totr);
} else if ( t != current ) {
int w = hiddenTabWidth;
int ih = 0;
if ( t->iconSet() != 0 ) {
- w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
- ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
+ w += t->iconSet()->pixmap().width();
+ ih = t->iconSet()->pixmap().height();
}
int h = QMAX( fm.height(), ih );
h = QMAX( h, QApplication::globalStrut().height() );
h += vframe;
w += hframe;
t->setRect( QRect(x, 0, w, h) );
x += t->rect().width() - overlap;
r = r.unite( t->rect() );
} else {
int ih = 0;
if ( t->iconSet() != 0 ) {
- ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
+ ih = t->iconSet()->pixmap().height();
}
int h = QMAX( fm.height(), ih );
h = QMAX( h, QApplication::globalStrut().height() );
h += vframe;
t->setRect( QRect(x, 0, available, h) );
x += t->rect().width() - overlap;
r = r.unite( t->rect() );
}
}
@@ -211,26 +211,26 @@ void LauncherTabBar::paint( QPainter * p, QTab * t, bool selected ) const
p->setFont( f );
if ( ct->fgColor.isValid() ) {
pal.setColor( QPalette::Active, QColorGroup::Foreground, ct->fgColor );
pal.setColor( QPalette::Inactive, QColorGroup::Foreground, ct->fgColor );
that->setUpdatesEnabled( FALSE );
that->setPalette( pal );
setPal = TRUE;
}
int iw = 0;
int ih = 0;
if ( t->iconSet() != 0 ) {
- iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2;
- ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
+ iw = t->iconSet()->pixmap().width() + 2;
+ ih = t->iconSet()->pixmap().height();
}
int w = iw + p->fontMetrics().width( t->text() ) + 4;
int h = QMAX(p->fontMetrics().height() + 4, ih );
paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3,
r.top() + (r.height()-h)/2, w, h ), t,
#if QT_VERSION >= 0x030000
t->identifier() == keyboardFocusTab()
#else
t->identitifer() == keyboardFocusTab()
#endif
);
if ( setPal ) {
@@ -242,25 +242,29 @@ void LauncherTabBar::paint( QPainter * p, QTab * t, bool selected ) const
void LauncherTabBar::paintLabel( QPainter* p, const QRect&,
QTab* t, bool has_focus ) const
{
QRect r = t->rect();
// if ( t->id != currentTab() )
//r.moveBy( 1, 1 );
//
if ( t->iconSet() ) {
// the tab has an iconset, draw it in the right mode
QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled;
if ( mode == QIconSet::Normal && has_focus )
mode = QIconSet::Active;
- QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode );
+ QPixmap pixmap;
+ if ( mode == QIconSet::Disabled )
+ pixmap = t->iconSet()->pixmap( QIconSet::Automatic, mode );
+ else
+ pixmap = t->iconSet()->pixmap();
int pixw = pixmap.width();
int pixh = pixmap.height();
p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap );
r.setLeft( r.left() + pixw + 5 );
}
QRect tr = r;
if ( r.width() < 20 )
return;
if ( t->isEnabled() && isEnabled() ) {