author | mickeyl <mickeyl> | 2003-04-13 00:52:15 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-13 00:52:15 (UTC) |
commit | 789046e40be9cbd91f22ebee67898ee1d6cc473a (patch) (unidiff) | |
tree | 5ada2d271c9a92e42abc08f35d9e5b3d85c1a5f3 | |
parent | e26dcc6893559ab0fab52c22b79226b40656ad3d (diff) | |
download | opie-789046e40be9cbd91f22ebee67898ee1d6cc473a.zip opie-789046e40be9cbd91f22ebee67898ee1d6cc473a.tar.gz opie-789046e40be9cbd91f22ebee67898ee1d6cc473a.tar.bz2 |
<tadaa>Change tab icon size to 14x14</tadaa>. Now most of our new icons
are no longer looking fuzzy because of scaling them up from 14x14 to 16x16
-rw-r--r-- | libopie/otabwidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp index 99bf067..a1fd2c0 100644 --- a/libopie/otabwidget.cpp +++ b/libopie/otabwidget.cpp | |||
@@ -234,176 +234,176 @@ void OTabWidget::setCurrentTab(int tabindex) { | |||
234 | 234 | ||
235 | 235 | ||
236 | OTabWidget::TabStyle OTabWidget::tabStyle() const | 236 | OTabWidget::TabStyle OTabWidget::tabStyle() const |
237 | { | 237 | { |
238 | return tabBarStyle; | 238 | return tabBarStyle; |
239 | } | 239 | } |
240 | 240 | ||
241 | void OTabWidget::setTabStyle( TabStyle s ) | 241 | void OTabWidget::setTabStyle( TabStyle s ) |
242 | { | 242 | { |
243 | tabBarStyle = s; | 243 | tabBarStyle = s; |
244 | if ( tabBarStyle == TextTab || tabBarStyle == IconTab ) | 244 | if ( tabBarStyle == TextTab || tabBarStyle == IconTab ) |
245 | { | 245 | { |
246 | QTab *currtab; | 246 | QTab *currtab; |
247 | for ( OTabInfo *tabinfo = tabs.first(); tabinfo; tabinfo = tabs.next() ) | 247 | for ( OTabInfo *tabinfo = tabs.first(); tabinfo; tabinfo = tabs.next() ) |
248 | { | 248 | { |
249 | currtab = tabBar->tab( tabinfo->id() ); | 249 | currtab = tabBar->tab( tabinfo->id() ); |
250 | if ( tabBarStyle == IconTab ) | 250 | if ( tabBarStyle == IconTab ) |
251 | { | 251 | { |
252 | currtab->iconset = new QIconSet( loadSmooth( tabinfo->icon() ) ); | 252 | currtab->iconset = new QIconSet( loadSmooth( tabinfo->icon() ) ); |
253 | if ( tabinfo == currentTab ) | 253 | if ( tabinfo == currentTab ) |
254 | currtab->setText( tabinfo->label() ); | 254 | currtab->setText( tabinfo->label() ); |
255 | else | 255 | else |
256 | currtab->setText( QString::null ); | 256 | currtab->setText( QString::null ); |
257 | } | 257 | } |
258 | else | 258 | else |
259 | { | 259 | { |
260 | currtab->iconset = 0x0; | 260 | currtab->iconset = 0x0; |
261 | currtab->setText( tabinfo->label() ); | 261 | currtab->setText( tabinfo->label() ); |
262 | } | 262 | } |
263 | } | 263 | } |
264 | tabBarStack->raiseWidget( tabBar ); | 264 | tabBarStack->raiseWidget( tabBar ); |
265 | } | 265 | } |
266 | else if ( tabBarStyle == TextList || tabBarStyle == IconList ) | 266 | else if ( tabBarStyle == TextList || tabBarStyle == IconList ) |
267 | { | 267 | { |
268 | tabList->clear(); | 268 | tabList->clear(); |
269 | for ( OTabInfo *tabinfo = tabs.first(); tabinfo; tabinfo = tabs.next() ) | 269 | for ( OTabInfo *tabinfo = tabs.first(); tabinfo; tabinfo = tabs.next() ) |
270 | { | 270 | { |
271 | if ( tabBarStyle == IconList ) | 271 | if ( tabBarStyle == IconList ) |
272 | { | 272 | { |
273 | tabList->insertItem( loadSmooth( tabinfo->icon() ), tabinfo->label() ); | 273 | tabList->insertItem( loadSmooth( tabinfo->icon() ), tabinfo->label() ); |
274 | } | 274 | } |
275 | else | 275 | else |
276 | { | 276 | { |
277 | tabList->insertItem( tabinfo->label() ); | 277 | tabList->insertItem( tabinfo->label() ); |
278 | } | 278 | } |
279 | } | 279 | } |
280 | tabBarStack->raiseWidget( tabList ); | 280 | tabBarStack->raiseWidget( tabList ); |
281 | } | 281 | } |
282 | setUpLayout(); | 282 | setUpLayout(); |
283 | } | 283 | } |
284 | 284 | ||
285 | OTabWidget::TabPosition OTabWidget::tabPosition() const | 285 | OTabWidget::TabPosition OTabWidget::tabPosition() const |
286 | { | 286 | { |
287 | return tabBarPosition; | 287 | return tabBarPosition; |
288 | } | 288 | } |
289 | 289 | ||
290 | void OTabWidget::setTabPosition( TabPosition p ) | 290 | void OTabWidget::setTabPosition( TabPosition p ) |
291 | { | 291 | { |
292 | tabBarPosition = p; | 292 | tabBarPosition = p; |
293 | if ( tabBarPosition == Top ) | 293 | if ( tabBarPosition == Top ) |
294 | { | 294 | { |
295 | tabBar->setShape( QTabBar::RoundedAbove ); | 295 | tabBar->setShape( QTabBar::RoundedAbove ); |
296 | } | 296 | } |
297 | else | 297 | else |
298 | { | 298 | { |
299 | tabBar->setShape( QTabBar::RoundedBelow ); | 299 | tabBar->setShape( QTabBar::RoundedBelow ); |
300 | } | 300 | } |
301 | setUpLayout(); | 301 | setUpLayout(); |
302 | } | 302 | } |
303 | 303 | ||
304 | void OTabWidget::slotTabBarSelected( int id ) | 304 | void OTabWidget::slotTabBarSelected( int id ) |
305 | { | 305 | { |
306 | OTabInfo *newtab = tabs.first(); | 306 | OTabInfo *newtab = tabs.first(); |
307 | while ( newtab && newtab->id() != id ) | 307 | while ( newtab && newtab->id() != id ) |
308 | { | 308 | { |
309 | newtab = tabs.next(); | 309 | newtab = tabs.next(); |
310 | } | 310 | } |
311 | if ( newtab && newtab->id() == id ) | 311 | if ( newtab && newtab->id() == id ) |
312 | { | 312 | { |
313 | selectTab( newtab ); | 313 | selectTab( newtab ); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | 316 | ||
317 | void OTabWidget::slotTabListSelected( int index ) | 317 | void OTabWidget::slotTabListSelected( int index ) |
318 | { | 318 | { |
319 | OTabInfo *newtab = tabs.at( index ); | 319 | OTabInfo *newtab = tabs.at( index ); |
320 | if ( newtab ) | 320 | if ( newtab ) |
321 | { | 321 | { |
322 | selectTab( newtab ); | 322 | selectTab( newtab ); |
323 | } | 323 | } |
324 | } | 324 | } |
325 | 325 | ||
326 | QPixmap OTabWidget::loadSmooth( const QString &name ) | 326 | QPixmap OTabWidget::loadSmooth( const QString &name ) |
327 | { | 327 | { |
328 | QImage image = Resource::loadImage( name ); | 328 | QImage image = Resource::loadImage( name ); |
329 | QPixmap pixmap; | 329 | QPixmap pixmap; |
330 | pixmap.convertFromImage( image.smoothScale( 16, 16 ) ); | 330 | pixmap.convertFromImage( image.smoothScale( 14, 14 ) ); |
331 | return pixmap; | 331 | return pixmap; |
332 | } | 332 | } |
333 | 333 | ||
334 | void OTabWidget::selectTab( OTabInfo *tab ) | 334 | void OTabWidget::selectTab( OTabInfo *tab ) |
335 | { | 335 | { |
336 | if ( tabBarStyle == IconTab ) | 336 | if ( tabBarStyle == IconTab ) |
337 | { | 337 | { |
338 | if ( currentTab ) | 338 | if ( currentTab ) |
339 | { | 339 | { |
340 | tabBar->tab( currentTab->id() )->setText( QString::null ); | 340 | tabBar->tab( currentTab->id() )->setText( QString::null ); |
341 | setUpLayout(); | 341 | setUpLayout(); |
342 | } | 342 | } |
343 | tabBar->tab( tab->id() )->setText( tab->label() ); | 343 | tabBar->tab( tab->id() )->setText( tab->label() ); |
344 | tabBar->setCurrentTab( tab->id() ); | 344 | tabBar->setCurrentTab( tab->id() ); |
345 | setUpLayout(); | 345 | setUpLayout(); |
346 | tabBar->update(); | 346 | tabBar->update(); |
347 | } | 347 | } |
348 | else | 348 | else |
349 | { | 349 | { |
350 | tabBar->setCurrentTab( tab->id() ); | 350 | tabBar->setCurrentTab( tab->id() ); |
351 | } | 351 | } |
352 | 352 | ||
353 | widgetStack->raiseWidget( tab->control() ); | 353 | widgetStack->raiseWidget( tab->control() ); |
354 | 354 | ||
355 | emit currentChanged( tab->control() ); | 355 | emit currentChanged( tab->control() ); |
356 | 356 | ||
357 | currentTab = tab; | 357 | currentTab = tab; |
358 | } | 358 | } |
359 | 359 | ||
360 | void OTabWidget::setUpLayout() | 360 | void OTabWidget::setUpLayout() |
361 | { | 361 | { |
362 | tabBar->layoutTabs(); | 362 | tabBar->layoutTabs(); |
363 | QSize t( tabBarStack->sizeHint() ); | 363 | QSize t( tabBarStack->sizeHint() ); |
364 | if ( tabBarStyle == IconTab ) | 364 | if ( tabBarStyle == IconTab ) |
365 | { | 365 | { |
366 | if ( t.width() > width() ) | 366 | if ( t.width() > width() ) |
367 | t.setWidth( width() ); | 367 | t.setWidth( width() ); |
368 | } | 368 | } |
369 | else | 369 | else |
370 | { | 370 | { |
371 | t.setWidth( width() ); | 371 | t.setWidth( width() ); |
372 | } | 372 | } |
373 | int lw = widgetStack->lineWidth(); | 373 | int lw = widgetStack->lineWidth(); |
374 | if ( tabBarPosition == Bottom ) | 374 | if ( tabBarPosition == Bottom ) |
375 | { | 375 | { |
376 | tabBarStack->setGeometry( QMAX(0, lw-2), height() - t.height() - lw, t.width(), t.height() ); | 376 | tabBarStack->setGeometry( QMAX(0, lw-2), height() - t.height() - lw, t.width(), t.height() ); |
377 | widgetStack->setGeometry( 0, 0, width(), height()-t.height()+QMAX(0, lw-2) ); | 377 | widgetStack->setGeometry( 0, 0, width(), height()-t.height()+QMAX(0, lw-2) ); |
378 | } | 378 | } |
379 | else | 379 | else |
380 | { | 380 | { |
381 | tabBarStack->setGeometry( QMAX(0, lw-2), 0, t.width(), t.height() ); | 381 | tabBarStack->setGeometry( QMAX(0, lw-2), 0, t.width(), t.height() ); |
382 | widgetStack->setGeometry( 0, t.height()-lw, width(), height()-t.height()+QMAX( 0, lw-2 ) ); | 382 | widgetStack->setGeometry( 0, t.height()-lw, width(), height()-t.height()+QMAX( 0, lw-2 ) ); |
383 | } | 383 | } |
384 | 384 | ||
385 | if ( autoMask() ) | 385 | if ( autoMask() ) |
386 | updateMask(); | 386 | updateMask(); |
387 | } | 387 | } |
388 | 388 | ||
389 | QSize OTabWidget::sizeHint() const | 389 | QSize OTabWidget::sizeHint() const |
390 | { | 390 | { |
391 | QSize s( widgetStack->sizeHint() ); | 391 | QSize s( widgetStack->sizeHint() ); |
392 | QSize t( tabBarStack->sizeHint() ); | 392 | QSize t( tabBarStack->sizeHint() ); |
393 | return QSize( QMAX( s.width(), t.width() ), s.height() + t.height() ); | 393 | return QSize( QMAX( s.width(), t.width() ), s.height() + t.height() ); |
394 | } | 394 | } |
395 | 395 | ||
396 | void OTabWidget::resizeEvent( QResizeEvent * ) | 396 | void OTabWidget::resizeEvent( QResizeEvent * ) |
397 | { | 397 | { |
398 | setUpLayout(); | 398 | setUpLayout(); |
399 | } | 399 | } |
400 | 400 | ||
401 | int OTabWidget::getCurrentTab() | 401 | int OTabWidget::getCurrentTab() |
402 | { | 402 | { |
403 | if ( currentTab ) | 403 | if ( currentTab ) |
404 | { | 404 | { |
405 | return currentTab->id(); | 405 | return currentTab->id(); |
406 | } | 406 | } |
407 | return -1; | 407 | return -1; |
408 | } | 408 | } |
409 | 409 | ||