summaryrefslogtreecommitdiff
path: root/core
authordrw <drw>2005-04-14 18:30:23 (UTC)
committer drw <drw>2005-04-14 18:30:23 (UTC)
commit5fd266a3a5a6d9a1acb9c38e4802ff06ba38beaf (patch) (unidiff)
treed4ba8a948d876db9bbff10cbd282fd16aab91feb /core
parent7a3b813cc3bfbb2f7c31f347c35405851e82aecf (diff)
downloadopie-5fd266a3a5a6d9a1acb9c38e4802ff06ba38beaf.zip
opie-5fd266a3a5a6d9a1acb9c38e4802ff06ba38beaf.tar.gz
opie-5fd266a3a5a6d9a1acb9c38e4802ff06ba38beaf.tar.bz2
More icon sizing updates
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launchertab.cpp24
-rw-r--r--core/settings/launcher/menusettings.cpp44
2 files changed, 36 insertions, 32 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
diff --git a/core/settings/launcher/menusettings.cpp b/core/settings/launcher/menusettings.cpp
index 55bf358..29ce841 100644
--- a/core/settings/launcher/menusettings.cpp
+++ b/core/settings/launcher/menusettings.cpp
@@ -1,29 +1,29 @@
1/* 1/*
2                This file is part of the OPIE Project 2 This file is part of the OPIE Project
3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> 3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4 .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5           .>+-= 5 .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6_;:, .> :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_, > . <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.-- : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i, .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10- . .-<_> .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11 ._= =} : or (at your option) any later version.
12    .%`+i>       _;_. 12 .%`+i> _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13 .i_,=:_. -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15 : .. .:, . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.= = ; Public License for more details.
19++=   -.     .`     .: 19++= -. .` .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20: = ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21-. .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22 -_. . . )=. = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23 -- :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "menusettings.h" 29#include "menusettings.h"
@@ -102,13 +102,13 @@ void MenuSettings::init ( )
102 QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm"; 102 QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm";
103 if ( trans-> load ( tfn )) 103 if ( trans-> load ( tfn ))
104 qApp-> installTranslator ( trans ); 104 qApp-> installTranslator ( trans );
105 else 105 else
106 delete trans; 106 delete trans;
107 name = iface-> name ( ); 107 name = iface-> name ( );
108 icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal ); 108 icon = iface-> icon ( ). pixmap ();
109 iface-> release ( ); 109 iface-> release ( );
110 lib-> unload ( ); 110 lib-> unload ( );
111 111
112 QCheckListItem *item; 112 QCheckListItem *item;
113 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 113 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
114 if ( !icon. isNull ( )) 114 if ( !icon. isNull ( ))