From 0f7b159f0a4972b6ffdc292f5eb4d2169c7fa75d Mon Sep 17 00:00:00 2001 From: drw Date: Tue, 05 Apr 2005 22:38:32 +0000 Subject: Use OResource for loading images --- (limited to 'libopie2/opieui/otabwidget.cpp') diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp index 8d7806c..7333f5e 100644 --- a/libopie2/opieui/otabwidget.cpp +++ b/libopie2/opieui/otabwidget.cpp @@ -1,41 +1,41 @@ /* - This file is part of the Opie Project +                 This file is part of the Opie Project - Copyright (c) 2002, 2005 Dan Williams + Copyright (C) 2002, 2005 Dan Williams =. .=l. - .>+-= -_;:, .> :=|. This program is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU Library General Public -.="- .-=="i, .._ License as published by the Free Software -- . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -`: PARTICULAR PURPOSE. See the GNU -..}^=.= = ; Library General Public License for more -++= -. .` .: details. -: = ...= . :.=- --. .:....=;==+<; You should have received a copy of the GNU - -_. . . )=. = Library General Public License along with - -- :-=` this library; see the file COPYING.LIB. +           .>+-= + _;:,     .>    :=|. This program is free software; you can +.> <`_,   >  .   <= redistribute it and/or modify it under +:`=1 )Y*s>-.--   : the terms of the GNU Library General Public +.="- .-=="i,     .._ License as published by the Free Software + - .   .-<_>     .<> Foundation; either version 2 of the License, +     ._= =}       : or (at your option) any later version. +    .%`+i>       _;_. +    .i_,=:_.      -`: PARTICULAR PURPOSE. See the GNU +..}^=.=       =       ; Library General Public License for more +++=   -.     .`     .: details. + :     =  ...= . :.=- + -.   .:....=;==+<; You should have received a copy of the GNU +  -_. . .   )=.  = Library General Public License along with +    --        :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ #include /* OPIE */ +#include +#include + #include #include -#include -#include /* QT */ #include @@ -97,7 +97,7 @@ void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &lab if ( m_tabBarStyle == IconTab ) { tab->label = QString::null; - tab->iconset = new QIconSet( loadSmooth( icon ) ); + tab->iconset = new QIconSet( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) ); } else tab->label = label; @@ -108,7 +108,7 @@ void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &lab { // Insert entry (with icon if necessary) into drop down list if ( m_tabBarStyle == IconList ) - m_tabList->insertItem( loadSmooth( icon ), label, -1 ); + m_tabList->insertItem( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ), label, -1 ); else m_tabList->insertItem( label ); } @@ -180,7 +180,7 @@ void OTabWidget::changeTab( QWidget *widget, const QString &iconset, const QStri if ( currtab && currtab->control() == widget ) { - QPixmap icon( loadSmooth( iconset ) ); + QPixmap icon( Opie::Core::OResource::loadPixmap( iconset, Opie::Core::OResource::SmallIcon ) ); if ( m_usingTabs ) { @@ -298,7 +298,7 @@ void OTabWidget::setTabStyle( TabStyle s ) if ( m_tabBarStyle == IconTab ) { tab->label = QString::null; - tab->iconset = new QIconSet( loadSmooth( tabinfo->icon() ) ); + tab->iconset = new QIconSet( Opie::Core::OResource::loadPixmap( tabinfo->icon(), Opie::Core::OResource::SmallIcon ) ); } else tab->label = tabinfo->label(); @@ -318,7 +318,8 @@ void OTabWidget::setTabStyle( TabStyle s ) for ( OTabInfo *tabinfo = m_tabs.first(); tabinfo; tabinfo = m_tabs.next() ) { if ( m_tabBarStyle == IconList ) - m_tabList->insertItem( loadSmooth( tabinfo->icon() ), tabinfo->label() ); + m_tabList->insertItem( Opie::Core::OResource::loadPixmap( tabinfo->icon(), Opie::Core::OResource::SmallIcon ), + tabinfo->label() ); else m_tabList->insertItem( tabinfo->label() ); } @@ -365,13 +366,6 @@ void OTabWidget::slotTabListSelected( int index ) selectTab( newtab ); } -QPixmap OTabWidget::loadSmooth( const QString &name ) -{ - QPixmap p; - p.convertFromImage( Resource::loadImage( name ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - return p; -} - void OTabWidget::selectTab( OTabInfo *tab ) { if ( m_tabBarStyle == IconTab ) -- cgit v0.9.0.2