summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/otabwidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp
index 80a4c9b..d23b1c9 100644
--- a/libopie2/opieui/otabwidget.cpp
+++ b/libopie2/opieui/otabwidget.cpp
@@ -257,170 +257,170 @@ void OTabWidget::setTabStyle( TabStyle s )
257 { 257 {
258 currtab = tabBar->tab( tabinfo->id() ); 258 currtab = tabBar->tab( tabinfo->id() );
259 if ( tabBarStyle == IconTab ) 259 if ( tabBarStyle == IconTab )
260 { 260 {
261 currtab->iconset = new QIconSet( loadSmooth( tabinfo->icon() ) ); 261 currtab->iconset = new QIconSet( loadSmooth( tabinfo->icon() ) );
262 if ( tabinfo == currTab ) 262 if ( tabinfo == currTab )
263 currtab->setText( tabinfo->label() ); 263 currtab->setText( tabinfo->label() );
264 else 264 else
265 currtab->setText( QString::null ); 265 currtab->setText( QString::null );
266 } 266 }
267 else 267 else
268 { 268 {
269 currtab->iconset = 0x0; 269 currtab->iconset = 0x0;
270 currtab->setText( tabinfo->label() ); 270 currtab->setText( tabinfo->label() );
271 } 271 }
272 } 272 }
273 tabBarStack->raiseWidget( tabBar ); 273 tabBarStack->raiseWidget( tabBar );
274 } 274 }
275 else if ( tabBarStyle == TextList || tabBarStyle == IconList ) 275 else if ( tabBarStyle == TextList || tabBarStyle == IconList )
276 { 276 {
277 tabList->clear(); 277 tabList->clear();
278 for ( OTabInfo *tabinfo = tabs.first(); tabinfo; tabinfo = tabs.next() ) 278 for ( OTabInfo *tabinfo = tabs.first(); tabinfo; tabinfo = tabs.next() )
279 { 279 {
280 if ( tabBarStyle == IconList ) 280 if ( tabBarStyle == IconList )
281 { 281 {
282 tabList->insertItem( loadSmooth( tabinfo->icon() ), tabinfo->label() ); 282 tabList->insertItem( loadSmooth( tabinfo->icon() ), tabinfo->label() );
283 } 283 }
284 else 284 else
285 { 285 {
286 tabList->insertItem( tabinfo->label() ); 286 tabList->insertItem( tabinfo->label() );
287 } 287 }
288 } 288 }
289 tabBarStack->raiseWidget( tabList ); 289 tabBarStack->raiseWidget( tabList );
290 } 290 }
291 setUpLayout(); 291 setUpLayout();
292} 292}
293 293
294OTabWidget::TabPosition OTabWidget::tabPosition() const 294OTabWidget::TabPosition OTabWidget::tabPosition() const
295{ 295{
296 return tabBarPosition; 296 return tabBarPosition;
297} 297}
298 298
299void OTabWidget::setTabPosition( TabPosition p ) 299void OTabWidget::setTabPosition( TabPosition p )
300{ 300{
301 tabBarPosition = p; 301 tabBarPosition = p;
302 if ( tabBarPosition == Top ) 302 if ( tabBarPosition == Top )
303 { 303 {
304 tabBar->setShape( QTabBar::RoundedAbove ); 304 tabBar->setShape( QTabBar::RoundedAbove );
305 } 305 }
306 else 306 else
307 { 307 {
308 tabBar->setShape( QTabBar::RoundedBelow ); 308 tabBar->setShape( QTabBar::RoundedBelow );
309 } 309 }
310 setUpLayout(); 310 setUpLayout();
311} 311}
312 312
313void OTabWidget::slotTabBarSelected( int id ) 313void OTabWidget::slotTabBarSelected( int id )
314{ 314{
315 OTabInfo *newtab = tabs.first(); 315 OTabInfo *newtab = tabs.first();
316 while ( newtab && newtab->id() != id ) 316 while ( newtab && newtab->id() != id )
317 { 317 {
318 newtab = tabs.next(); 318 newtab = tabs.next();
319 } 319 }
320 if ( newtab && newtab->id() == id ) 320 if ( newtab && newtab->id() == id )
321 { 321 {
322 selectTab( newtab ); 322 selectTab( newtab );
323 } 323 }
324} 324}
325 325
326void OTabWidget::slotTabListSelected( int index ) 326void OTabWidget::slotTabListSelected( int index )
327{ 327{
328 OTabInfo *newtab = tabs.at( index ); 328 OTabInfo *newtab = tabs.at( index );
329 if ( newtab ) 329 if ( newtab )
330 { 330 {
331 selectTab( newtab ); 331 selectTab( newtab );
332 } 332 }
333} 333}
334 334
335QPixmap OTabWidget::loadSmooth( const QString &name ) 335QPixmap OTabWidget::loadSmooth( const QString &name )
336{ 336{
337 QPixmap p; 337 QPixmap p;
338 p.convertFromImage( Resource::loadImage( name ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 338 p.convertFromImage( Resource::loadImage( name ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
339 return p; 339 return p;
340} 340}
341 341
342void OTabWidget::selectTab( OTabInfo *tab ) 342void OTabWidget::selectTab( OTabInfo *tab )
343{ 343{
344 if ( tabBarStyle == IconTab ) 344 if ( tabBarStyle == IconTab )
345 { 345 {
346 if ( currTab ) 346 if ( currTab )
347 { 347 {
348 tabBar->tab( currTab->id() )->setText( QString::null ); 348 tabBar->tab( currTab->id() )->setText( QString::null );
349 setUpLayout(); 349 setUpLayout();
350 } 350 }
351 tabBar->tab( tab->id() )->setText( tab->label() ); 351 tabBar->tab( tab->id() )->setText( tab->label() );
352 tabBar->setCurrentTab( tab->id() ); 352 tabBar->setCurrentTab( tab->id() );
353// setUpLayout(); 353 setUpLayout();
354 tabBar->update(); 354 tabBar->update();
355 } 355 }
356 else 356 else
357 { 357 {
358 tabBar->setCurrentTab( tab->id() ); 358 tabBar->setCurrentTab( tab->id() );
359 } 359 }
360 360
361 widgetStack->raiseWidget( tab->control() ); 361 widgetStack->raiseWidget( tab->control() );
362 362
363 emit currentChanged( tab->control() ); 363 emit currentChanged( tab->control() );
364 364
365 currTab = tab; 365 currTab = tab;
366} 366}
367 367
368void OTabWidget::setUpLayout() 368void OTabWidget::setUpLayout()
369{ 369{
370 tabBar->layoutTabs(); 370 tabBar->layoutTabs();
371 QSize t( tabBarStack->sizeHint() ); 371 QSize t( tabBarStack->sizeHint() );
372 if ( tabBarStyle == IconTab ) 372 if ( tabBarStyle == IconTab )
373 { 373 {
374 if ( t.width() > width() ) 374 if ( t.width() > width() )
375 t.setWidth( width() ); 375 t.setWidth( width() );
376 } 376 }
377 else 377 else
378 { 378 {
379 t.setWidth( width() ); 379 t.setWidth( width() );
380 } 380 }
381 int lw = widgetStack->lineWidth(); 381 int lw = widgetStack->lineWidth();
382 if ( tabBarPosition == Bottom ) 382 if ( tabBarPosition == Bottom )
383 { 383 {
384 tabBarStack->setGeometry( QMAX(0, lw-2), height() - t.height() - lw, t.width(), t.height() ); 384 tabBarStack->setGeometry( QMAX(0, lw-2), height() - t.height() - lw, t.width(), t.height() );
385 widgetStack->setGeometry( 0, 0, width(), height()-t.height()+QMAX(0, lw-2) ); 385 widgetStack->setGeometry( 0, 0, width(), height()-t.height()+QMAX(0, lw-2) );
386 } 386 }
387 else 387 else
388 { 388 {
389 tabBarStack->setGeometry( QMAX(0, lw-2), 0, t.width(), t.height() ); 389 tabBarStack->setGeometry( QMAX(0, lw-2), 0, t.width(), t.height() );
390 widgetStack->setGeometry( 0, t.height()-lw, width(), height()-t.height()+QMAX( 0, lw-2 ) ); 390 widgetStack->setGeometry( 0, t.height()-lw, width(), height()-t.height()+QMAX( 0, lw-2 ) );
391 } 391 }
392 392
393 if ( autoMask() ) 393 if ( autoMask() )
394 updateMask(); 394 updateMask();
395} 395}
396 396
397QSize OTabWidget::sizeHint() const 397QSize OTabWidget::sizeHint() const
398{ 398{
399 QSize s( widgetStack->sizeHint() ); 399 QSize s( widgetStack->sizeHint() );
400 QSize t( tabBarStack->sizeHint() ); 400 QSize t( tabBarStack->sizeHint() );
401 return QSize( QMAX( s.width(), t.width() ), s.height() + t.height() ); 401 return QSize( QMAX( s.width(), t.width() ), s.height() + t.height() );
402} 402}
403 403
404void OTabWidget::resizeEvent( QResizeEvent * ) 404void OTabWidget::resizeEvent( QResizeEvent * )
405{ 405{
406 setUpLayout(); 406 setUpLayout();
407} 407}
408 408
409int OTabWidget::currentTab() 409int OTabWidget::currentTab()
410{ 410{
411 if ( currTab ) 411 if ( currTab )
412 { 412 {
413 return currTab->id(); 413 return currTab->id();
414 } 414 }
415 return -1; 415 return -1;
416} 416}
417 417
418QWidget* OTabWidget::currentWidget()const 418QWidget* OTabWidget::currentWidget()const
419{ 419{
420 if ( currTab ) 420 if ( currTab )
421 { 421 {
422 return currTab->control(); 422 return currTab->control();
423 } 423 }
424 424
425 return 0; 425 return 0;
426} 426}