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') diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index 8b53038..f3e7501 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp @@ -1,30 +1,31 @@ - /* -               =. This file is part of the OPIE Project -             .=l. Copyright (C) 2002,2003 Holger Freyther -           .>+-= - _;:,     .>    :=|. This library 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 file is part of the Opie Project + + Copyright (C) 2002,2003 Holger Freyther + =. + .=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. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ /* hacky but we need to get FileSelector::filter */ @@ -35,12 +36,12 @@ #include "ofileselector_p.h" /* OPIE */ -#include #include +#include +#include #include #include -#include #include /* QT */ @@ -334,47 +335,40 @@ OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& st box->setBackgroundMode( PaletteButton ); box->setSpacing( 0 ); - QPixmap pic; QToolButton *btn = new QToolButton( box ); btn->setUsesBigPixmap( true ); - pic.convertFromImage( Resource::loadImage( "up" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - btn->setPixmap( pic ); + btn->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) ); connect(btn, SIGNAL(clicked() ), this, SLOT( cdUP() ) ); btn = new QToolButton( box ); btn->setUsesBigPixmap( true ); - pic.convertFromImage( Resource::loadImage( "home" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - btn->setPixmap( pic ); + btn->setPixmap( Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon ) ); connect(btn, SIGNAL(clicked() ), this, SLOT( cdHome() ) ); btn = new QToolButton( box ); btn->setUsesBigPixmap( true ); - pic.convertFromImage( Resource::loadImage( "DocsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - btn->setPixmap( pic ); + btn->setPixmap( Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon ) ); connect(btn, SIGNAL(clicked() ), this, SLOT(cdDoc() ) ); m_btnNew = new QToolButton( box ); m_btnNew->setUsesBigPixmap( true ); - pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - m_btnNew->setPixmap( pic ); + m_btnNew->setPixmap( Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ) ); connect(m_btnNew, SIGNAL(clicked() ), this, SLOT(slotNew() ) ); m_btnClose = new QToolButton( box ); m_btnClose->setUsesBigPixmap( true ); - pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - m_btnClose->setPixmap( pic ); + m_btnClose->setPixmap( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) ); connect(m_btnClose, SIGNAL(clicked() ), selector(), SIGNAL(closeMe() ) ); btn = new QToolButton( box ); btn->setUsesBigPixmap( true ); - pic.convertFromImage( Resource::loadImage( "cardmon/pcmcia" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - btn->setPixmap( pic ); + btn->setPixmap( Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ) ); m_fsButton = btn; /* let's fill device parts */ @@ -639,7 +633,7 @@ void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) if ( pix.isNull() ) { QWMatrix matrix; - QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); + QPixmap pixer( Opie::Core::OResource::loadPixmap( "UnknownDocument" ) ); matrix.scale( .4, .4 ); pix = pixer.xForm( matrix ); } @@ -653,7 +647,8 @@ void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) { - locked = true; pix = Resource::loadPixmap("locked"); + locked = true; + pix = Opie::Core::OResource::loadPixmap( "locked" ); } } (void)new OFileSelectorItem( m_view, pix, name, @@ -670,12 +665,12 @@ void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) { locked = true; if ( symlink ) - pix = Resource::loadPixmap( "opie/symlink" ); + pix = Opie::Core::OResource::loadPixmap( "opie/symlink" ); else - pix = Resource::loadPixmap( "lockedfolder" ); + pix = Opie::Core::OResource::loadPixmap( "lockedfolder" ); } else - pix = symlink ? Resource::loadPixmap( "opie/symlink") : Resource::loadPixmap("folder"); + pix = symlink ? Opie::Core::OResource::loadPixmap( "opie/symlink" ) : Opie::Core::OResource::loadPixmap( "folder" ); name = symlink ? info->fileName() + " -> " + createNewPath(info->dirPath(true),info->readLink()) : info->fileName(); diff --git a/libopie2/opieui/fileselector/ofileselector.h b/libopie2/opieui/fileselector/ofileselector.h index d166afd..f32e3ed 100644 --- a/libopie2/opieui/fileselector/ofileselector.h +++ b/libopie2/opieui/fileselector/ofileselector.h @@ -1,29 +1,31 @@ /* -               =. This file is part of the OPIE Project -             .=l. Copyright (C) 2002,2003 Holger Freyther -           .>+-= - _;:,     .>    :=|. This library 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 file is part of the Opie Project + + Copyright (C) 2002,2003 Holger Freyther + =. + .=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. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ /* 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 ) diff --git a/libopie2/opieui/otabwidget.h b/libopie2/opieui/otabwidget.h index e925592..3af8fac 100644 --- a/libopie2/opieui/otabwidget.h +++ b/libopie2/opieui/otabwidget.h @@ -1,31 +1,31 @@ /* - This file is part of the Opie Project - Copyright (C) 2002, 2005 Dan Williams +                 This file is part of the Opie Project + + 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. - */ #ifndef OTABWIDGET_H @@ -231,14 +231,6 @@ private: Private* d; /** - * @fn loadSmooth( const QString &name ) - * @brief Loads icon for widget. - * - * @param name Name of icon image file. - */ - QPixmap loadSmooth( const QString & ); - -/** * @fn selectTab( OTabInfo *tab ) * @brief Internal function to select desired widget. * diff --git a/libopie2/opieui/owait.cpp b/libopie2/opieui/owait.cpp index ec1f25a..5f89ad2 100644 --- a/libopie2/opieui/owait.cpp +++ b/libopie2/opieui/owait.cpp @@ -1,38 +1,40 @@ /* -                This file is part of the Opie Project -              Copyright (C) 2003 Maximilian Reiss +                 This file is part of the Opie Project + + Copyright (C) 2003 Maximilian Reiss =. .=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 "owait.h" /* OPIE */ +#include + + #include -#include /* QT */ #include @@ -65,7 +67,7 @@ OWait::OWait( QWidget *parent, const char* msg, bool dispIcon ) hbox->addWidget( m_lb ); hbox->activate(); - m_pix = Resource::loadPixmap( "BigBusy" ); + m_pix = Opie::Core::OResource::loadPixmap( "BigBusy" ); m_aniSize = m_pix.height(); resize( m_aniSize, m_aniSize ); diff --git a/libopie2/opieui/owait.h b/libopie2/opieui/owait.h index 03c33e4..0036bb1 100644 --- a/libopie2/opieui/owait.h +++ b/libopie2/opieui/owait.h @@ -1,31 +1,31 @@ /* -                This file is part of the Opie Project -              Copyright (C) 2003 Maximilian Reiss +                 This file is part of the Opie Project + + Copyright (C) 2003 Maximilian Reiss =. .=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. - */ #ifndef OWAIT_H @@ -45,8 +45,7 @@ namespace Ui { * * @short modal hour glass dialog * @see QDialog - * @author Maximilian Reiß - */ + * @author Maximilian Rei� */ class OWait : public QDialog { Q_OBJECT -- cgit v0.9.0.2