summaryrefslogtreecommitdiff
path: root/libopie2/opieui/otabwidget.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opieui/otabwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opieui/otabwidget.cpp66
1 files changed, 30 insertions, 36 deletions
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,44 +1,44 @@
/*
- This file is part of the Opie Project
+                 This file is part of the Opie Project
- Copyright (c) 2002, 2005 Dan Williams <drw@handhelds.org>
+ Copyright (C) 2002, 2005 Dan Williams <drw@handhelds.org>
=.
.=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_,=:_. -<s. This program is distributed in the hope that
- + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
- : .. .:, . . . without even the implied warranty of
- =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
- _.=:. : :=>`: 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_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+ : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: 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 <opie2/otabwidget.h>
/* OPIE */
+#include <opie2/oresource.h>
+#include <opie2/otabbar.h>
+
#include <qpe/applnk.h>
#include <qpe/config.h>
-#include <qpe/resource.h>
-#include <opie2/otabbar.h>
/* QT */
#include <qcombobox.h>
#include <qwidgetstack.h>
using namespace Opie::Ui;
@@ -94,24 +94,24 @@ void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &lab
QTab *tab = new QTab();
// Set label (and icon if necessary)
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;
tabid = m_tabBar->addTab( tab );
}
else
{
// 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 );
}
// Add widget to stack
m_widgetStack->addWidget( child, tabid );
@@ -177,13 +177,13 @@ void OTabWidget::changeTab( QWidget *widget, const QString &iconset, const QStri
OTabInfo *currtab = m_tabs.first();
while ( currtab && currtab->control() != widget )
currtab = m_tabs.next();
if ( currtab && currtab->control() == widget )
{
- QPixmap icon( loadSmooth( iconset ) );
+ QPixmap icon( Opie::Core::OResource::loadPixmap( iconset, Opie::Core::OResource::SmallIcon ) );
if ( m_usingTabs )
{
// Update tab label and icon (if necessary)
QTab *tab = m_tabBar->tab( currtab->id() );
tab->setText( label );
@@ -295,13 +295,13 @@ void OTabWidget::setTabStyle( TabStyle s )
QTab *tab = new QTab();
// Set label (and icon if necessary)
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();
// Add tab and save its Id
int tabid = m_tabBar->addTab( tab );
@@ -315,13 +315,14 @@ void OTabWidget::setTabStyle( TabStyle s )
connect( m_tabList, SIGNAL(activated(int)), this, SLOT(slotTabListSelected(int)) );
// Add all current tabs to drop down list
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() );
}
}
// Redraw widget
@@ -362,19 +363,12 @@ void OTabWidget::slotTabListSelected( int index )
{
OTabInfo *newtab = m_tabs.at( index );
if ( newtab )
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 )
{
// Remove text label from currently selected tab
if ( m_currTab )