summaryrefslogtreecommitdiff
path: root/core/launcher/launchertab.cpp
Unidiff
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
@@ -94,16 +94,16 @@ void LauncherTabBar::layoutTabs()
94 if ( !t ) 94 if ( !t )
95 continue; 95 continue;
96 int iw = fm.width( t->text() ) + hframe - overlap; 96 int iw = fm.width( t->text() ) + hframe - overlap;
97 if ( t != current ) { 97 if ( t != current ) {
98 available -= hiddenTabWidth + hframe - overlap; 98 available -= hiddenTabWidth + hframe - overlap;
99 if ( t->iconSet() != 0 ) 99 if ( t->iconSet() != 0 )
100 available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 100 available -= t->iconSet()->pixmap().width();
101 } 101 }
102 if ( t->iconSet() != 0 ) 102 if ( t->iconSet() != 0 )
103 iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 103 iw += t->iconSet()->pixmap().width();
104 required += iw; 104 required += iw;
105 // As space gets tight, packed looks better than even. "10" must be at least 0. 105 // As space gets tight, packed looks better than even. "10" must be at least 0.
106 if ( iw >= eventabwidth-10 ) 106 if ( iw >= eventabwidth-10 )
107 mode = Pack; 107 mode = Pack;
108 } 108 }
109 if ( mode == Pack && required > width()-1 ) 109 if ( mode == Pack && required > width()-1 )
@@ -113,14 +113,14 @@ void LauncherTabBar::layoutTabs()
113 if ( !t ) 113 if ( !t )
114 continue; 114 continue;
115 if ( mode != HideBackText ) { 115 if ( mode != HideBackText ) {
116 int w = fm.width( t->text() ); 116 int w = fm.width( t->text() );
117 int ih = 0; 117 int ih = 0;
118 if ( t->iconSet() != 0 ) { 118 if ( t->iconSet() != 0 ) {
119 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 119 w += t->iconSet()->pixmap().width();
120 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 120 ih = t->iconSet()->pixmap().height();
121 } 121 }
122 int h = QMAX( fm.height(), ih ); 122 int h = QMAX( fm.height(), ih );
123 h = QMAX( h, QApplication::globalStrut().height() ); 123 h = QMAX( h, QApplication::globalStrut().height() );
124 124
125 h += vframe; 125 h += vframe;
126 w += hframe; 126 w += hframe;
@@ -131,14 +131,14 @@ void LauncherTabBar::layoutTabs()
131 x += totr.width() - overlap; 131 x += totr.width() - overlap;
132 r = r.unite(totr); 132 r = r.unite(totr);
133 } else if ( t != current ) { 133 } else if ( t != current ) {
134 int w = hiddenTabWidth; 134 int w = hiddenTabWidth;
135 int ih = 0; 135 int ih = 0;
136 if ( t->iconSet() != 0 ) { 136 if ( t->iconSet() != 0 ) {
137 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 137 w += t->iconSet()->pixmap().width();
138 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 138 ih = t->iconSet()->pixmap().height();
139 } 139 }
140 int h = QMAX( fm.height(), ih ); 140 int h = QMAX( fm.height(), ih );
141 h = QMAX( h, QApplication::globalStrut().height() ); 141 h = QMAX( h, QApplication::globalStrut().height() );
142 142
143 h += vframe; 143 h += vframe;
144 w += hframe; 144 w += hframe;
@@ -146,13 +146,13 @@ void LauncherTabBar::layoutTabs()
146 t->setRect( QRect(x, 0, w, h) ); 146 t->setRect( QRect(x, 0, w, h) );
147 x += t->rect().width() - overlap; 147 x += t->rect().width() - overlap;
148 r = r.unite( t->rect() ); 148 r = r.unite( t->rect() );
149 } else { 149 } else {
150 int ih = 0; 150 int ih = 0;
151 if ( t->iconSet() != 0 ) { 151 if ( t->iconSet() != 0 ) {
152 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 152 ih = t->iconSet()->pixmap().height();
153 } 153 }
154 int h = QMAX( fm.height(), ih ); 154 int h = QMAX( fm.height(), ih );
155 h = QMAX( h, QApplication::globalStrut().height() ); 155 h = QMAX( h, QApplication::globalStrut().height() );
156 156
157 h += vframe; 157 h += vframe;
158 158
@@ -217,14 +217,14 @@ void LauncherTabBar::paint( QPainter * p, QTab * t, bool selected ) const
217 that->setPalette( pal ); 217 that->setPalette( pal );
218 setPal = TRUE; 218 setPal = TRUE;
219 } 219 }
220 int iw = 0; 220 int iw = 0;
221 int ih = 0; 221 int ih = 0;
222 if ( t->iconSet() != 0 ) { 222 if ( t->iconSet() != 0 ) {
223 iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; 223 iw = t->iconSet()->pixmap().width() + 2;
224 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 224 ih = t->iconSet()->pixmap().height();
225 } 225 }
226 int w = iw + p->fontMetrics().width( t->text() ) + 4; 226 int w = iw + p->fontMetrics().width( t->text() ) + 4;
227 int h = QMAX(p->fontMetrics().height() + 4, ih ); 227 int h = QMAX(p->fontMetrics().height() + 4, ih );
228 paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, 228 paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3,
229 r.top() + (r.height()-h)/2, w, h ), t, 229 r.top() + (r.height()-h)/2, w, h ), t,
230#if QT_VERSION >= 0x030000 230#if QT_VERSION >= 0x030000
@@ -248,13 +248,17 @@ void LauncherTabBar::paintLabel( QPainter* p, const QRect&,
248 // 248 //
249 if ( t->iconSet() ) { 249 if ( t->iconSet() ) {
250 // the tab has an iconset, draw it in the right mode 250 // the tab has an iconset, draw it in the right mode
251 QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; 251 QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled;
252 if ( mode == QIconSet::Normal && has_focus ) 252 if ( mode == QIconSet::Normal && has_focus )
253 mode = QIconSet::Active; 253 mode = QIconSet::Active;
254 QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode ); 254 QPixmap pixmap;
255 if ( mode == QIconSet::Disabled )
256 pixmap = t->iconSet()->pixmap( QIconSet::Automatic, mode );
257 else
258 pixmap = t->iconSet()->pixmap();
255 int pixw = pixmap.width(); 259 int pixw = pixmap.width();
256 int pixh = pixmap.height(); 260 int pixh = pixmap.height();
257 p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); 261 p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap );
258 r.setLeft( r.left() + pixw + 5 ); 262 r.setLeft( r.left() + pixw + 5 );
259 } 263 }
260 264