author | drw <drw> | 2005-04-05 22:38:32 (UTC) |
---|---|---|
committer | drw <drw> | 2005-04-05 22:38:32 (UTC) |
commit | 0f7b159f0a4972b6ffdc292f5eb4d2169c7fa75d (patch) (side-by-side diff) | |
tree | 27fb276e59b1eab586d029feaf21f45ddf1cb96a | |
parent | 327e938f58125a52482b9a6543dd1aa4243bb5d3 (diff) | |
download | opie-0f7b159f0a4972b6ffdc292f5eb4d2169c7fa75d.zip opie-0f7b159f0a4972b6ffdc292f5eb4d2169c7fa75d.tar.gz opie-0f7b159f0a4972b6ffdc292f5eb4d2169c7fa75d.tar.bz2 |
Use OResource for loading images
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 81 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.h | 46 | ||||
-rw-r--r-- | libopie2/opieui/otabwidget.cpp | 66 | ||||
-rw-r--r-- | libopie2/opieui/otabwidget.h | 52 | ||||
-rw-r--r-- | libopie2/opieui/owait.cpp | 50 | ||||
-rw-r--r-- | libopie2/opieui/owait.h | 47 |
6 files changed, 163 insertions, 179 deletions
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,67 +1,68 @@ - /* - =. This file is part of the OPIE Project - .=l. Copyright (C) 2002,2003 Holger Freyther <zecke@handhelds.org> - .>+-= - _;:, .> :=|. 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_,=:_. -<s. This library 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 file is part of the Opie Project + + Copyright (C) 2002,2003 Holger Freyther <zecke@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. 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 */ #define private public #include <qpe/fileselector.h> #undef private #include "ofileselector_p.h" /* OPIE */ -#include <opie2/ofileselector.h> #include <opie2/odebug.h> +#include <opie2/ofileselector.h> +#include <opie2/oresource.h> #include <qpe/qpeapplication.h> #include <qpe/mimetype.h> -#include <qpe/resource.h> #include <qpe/storage.h> /* QT */ #include <qcombobox.h> #include <qdir.h> #include <qhbox.h> #include <qheader.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qlistview.h> #include <qpopupmenu.h> #include <qwidgetstack.h> #include <qregexp.h> #include <qobjectlist.h> using namespace Opie::Ui::Internal; namespace Opie { namespace Ui { namespace Internal { /* * Create a path by adding a '/'/QDir::seperator in between * base and ending, but only if base is not empty @@ -313,89 +314,82 @@ QString OFileSelectorItem::key( int id, bool )const } OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) :QWidget( parent ), m_sel( sel ) { m_all = false; QVBoxLayout* lay = new QVBoxLayout( this ); m_currentDir = startDir; /* * now we add a special bar * One Button For Up * Home * Doc * And a dropdown menu with FileSystems * FUTURE: one to change dir with lineedit * Bookmarks * Create Dir */ QHBox* box = new QHBox(this ); 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 */ QPopupMenu* pop = new QPopupMenu(this); connect(pop, SIGNAL( activated(int) ), this, SLOT(slotFSActivated(int) ) ); StorageInfo storage; const QList<FileSystem> &fs = storage.fileSystems(); QListIterator<FileSystem> it(fs); for ( ; it.current(); ++it ) { const QString disk = (*it)->name(); const QString path = (*it)->path(); m_dev.insert( disk, path ); pop->insertItem( disk ); } m_fsPop = pop; connect(btn,SIGNAL(pressed()),this,SLOT(slotFSpressed())); lay->addWidget( box ); m_view = new QListView( this ); @@ -618,85 +612,86 @@ void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const } else { // file odebug << "slot Clicked" << oendl; selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace()); emit selector()->fileSelected( path ); DocLnk lnk( path ); emit selector()->fileSelected( lnk ); } } // not locked } void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) { MimeType type( info->absFilePath() ); if (!compliesMime( type.id() ) ) return; QPixmap pix = type.pixmap(); QString dir, name; bool locked; 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 ); } dir = info->dirPath( true ); locked = false; if ( symlink ) name = info->fileName() + " -> " + createNewPath(info->dirPath(),info->readLink()); else { name = info->fileName(); 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, info->lastModified().toString(), QString::number( info->size() ), dir, locked ); } void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) { bool locked = false; QString name; QPixmap pix; if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) { 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(); (void)new OFileSelectorItem( m_view, pix, name, info->lastModified().toString(), QString::number( info->size() ), info->dirPath( true ), locked, true ); } void OFileViewFileListView::addSymlink( QFileInfo* , bool ) { } void OFileViewFileListView::cdUP() { QDir dir( m_currentDir ); dir.cdUp(); if (!dir.exists() ) m_currentDir = "/"; else 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,50 +1,52 @@ /* - =. This file is part of the OPIE Project - .=l. Copyright (C) 2002,2003 Holger Freyther <zecke@handhelds.org> - .>+-= - _;:, .> :=|. 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_,=:_. -<s. This library 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 file is part of the Opie Project + + Copyright (C) 2002,2003 Holger Freyther <zecke@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. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ /* This is based on code and ideas of L. J. Potter ljp@llornkcor.com Thanks a lot */ #ifndef OFILESELECTOR_H #define OFILESELECTOR_H /* OPIE */ #include <qpe/applnk.h> /* QT */ #include <qlist.h> #include <qwidget.h> #include <qmap.h> #include <qvaluelist.h> #include <qstringlist.h> #include <qlist.h> class QLineEdit; class QComboBox; 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,62 +1,62 @@ /* - 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; OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) : QWidget( parent, name ) , m_currTab( 0l ) , m_tabBarStyle( Global ) , m_tabBarPosition( Top ) , m_usingTabs( true ) , m_tabBar( 0l ) , m_tabList( 0l ) { if ( s == Global ) { // Read Opie global settings for style and position Config config( "qpe" ); config.setGroup( "Appearance" ); // Style s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); @@ -76,60 +76,60 @@ OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPositi // Set initial selector control style and position setTabStyle( s ); setTabPosition( p ); } OTabWidget::~OTabWidget() { m_tabs.setAutoDelete( true ); m_tabs.clear(); } void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) { int tabid = -1; if ( m_usingTabs ) { // Create new tab in tab bar 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 ); m_widgetStack->raiseWidget( child ); m_widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); // Keep track of tab information OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); m_tabs.append( tabinfo ); // Make newly added tab the current one displayed selectTab( tabinfo ); } void OTabWidget::removePage( QWidget *childwidget ) { if ( childwidget ) { // Find tab information for desired widget OTabInfo *tab = m_tabs.first(); while ( tab && tab->control() != childwidget ) @@ -159,49 +159,49 @@ void OTabWidget::removePage( QWidget *childwidget ) // Get rid of tab information m_tabs.remove( tab ); delete tab; // Reset current tab m_currTab = m_tabs.current(); if ( !m_currTab ) m_widgetStack->setFrameStyle( QFrame::NoFrame ); // Redraw widget setUpLayout(); } } } void OTabWidget::changeTab( QWidget *widget, const QString &iconset, const QString &label) { // Find tab information for desired widget 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 ); if ( m_tabBarStyle == IconTab ) tab->setIconSet( icon ); } else { // Update entry label and icon (if necessary) int i = 0; while ( i < m_tabList->count() && m_tabList->text( i ) != currtab->label() ) i++; if ( i < m_tabList->count() && m_tabList->text( i ) == currtab->label() ) { if ( m_tabBarStyle == IconList ) m_tabList->changeItem( icon, label, i ); else m_tabList->changeItem( label, i ); } } @@ -277,122 +277,116 @@ void OTabWidget::setTabStyle( TabStyle s ) m_tabList = 0l; } // Set new style information m_tabBarStyle = s; m_usingTabs = ( m_tabBarStyle == TextTab || m_tabBarStyle == IconTab ); // Create new selector control and populate with tab information if ( m_usingTabs ) { // Create new tab bar selector m_tabBar = new OTabBar( this ); connect( m_tabBar, SIGNAL(selected(int)), this, SLOT(slotTabBarSelected(int)) ); // Add all current tabs to tab bar for ( OTabInfo *tabinfo = m_tabs.first(); tabinfo; tabinfo = m_tabs.next() ) { // Create new tab in tab bar 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 ); tabinfo->setId( tabid ); } } else { // Create new drop down list selector m_tabList = new QComboBox( false, this ); 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 setUpLayout(); } OTabWidget::TabPosition OTabWidget::tabPosition() const { return m_tabBarPosition; } void OTabWidget::setTabPosition( TabPosition p ) { m_tabBarPosition = p; // If using the tab bar selector, set its shape if ( m_usingTabs ) { ( m_tabBarPosition == Top ) ? m_tabBar->setShape( QTabBar::RoundedAbove ) : m_tabBar->setShape( QTabBar::RoundedBelow ); } // Redraw widget setUpLayout(); } void OTabWidget::slotTabBarSelected( int id ) { OTabInfo *newtab = m_tabs.first(); while ( newtab && newtab->id() != id ) newtab = m_tabs.next(); if ( newtab && newtab->id() == id ) selectTab( newtab ); } 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 ) { m_tabBar->tab( m_currTab->id() )->setText( QString::null ); //setUpLayout(); } // Set text label for newly selected tab m_tabBar->tab( tab->id() )->setText( tab->label() ); m_tabBar->setCurrentTab( tab->id() ); setUpLayout(); QSize t; t = m_tabBar->sizeHint(); if ( t.width() > width() ) t.setWidth( width() ); int lw = m_widgetStack->lineWidth(); if ( m_tabBarPosition == Bottom ) 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,52 +1,52 @@ /* - This file is part of the Opie Project - Copyright (C) 2002, 2005 Dan Williams <drw@handhelds.org> +         This file is part of the Opie Project + + 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. - */ #ifndef OTABWIDGET_H #define OTABWIDGET_H /* OPIE */ #include <opie2/otabinfo.h> /* QT */ #include <qwidget.h> #include <qlist.h> class QComboBox; class QPixmap; class QTabBar; class QWidgetStack; namespace Opie { namespace Ui { class OTabBar; /** @@ -210,56 +210,48 @@ protected: /** * @fn resizeEvent( QResizeEvent * ) * @brief Reimplemented for internal purposes. */ void resizeEvent( QResizeEvent * ); private: OTabInfoList m_tabs; // List of information for tabs OTabInfo *m_currTab; // Current tab displayed TabStyle m_tabBarStyle; // Current style of control TabPosition m_tabBarPosition; // Position of selector control bool m_usingTabs; // Indicates whether style is either TextTab or IconTab // (saves from having to always check for these 2 values) // UI components OTabBar *m_tabBar; QComboBox *m_tabList; QWidgetStack *m_widgetStack; class 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. * * @param tab Pointer to data for widget. */ void selectTab( OTabInfo * ); /** * @fn setUpLayout() * @brief Internal function to adjust layout. */ void setUpLayout(); signals: /** * @fn currentChanged( QWidget *widget ) * @brief This signal is emitted whenever the widget has changed. * * @param widget Pointer to new current widget. */ void currentChanged( QWidget * ); private slots: 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,92 +1,94 @@ /* - This file is part of the Opie Project - Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> +         This file is part of the Opie Project + + Copyright (C) 2003 Maximilian Reiss <harlekin@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 "owait.h" /* OPIE */ +#include <opie2/oresource.h> + + #include <qpe/qpeapplication.h> -#include <qpe/resource.h> /* QT */ #include <qlayout.h> #include <qpainter.h> using namespace Opie::Ui; static int frame = 0; /** * This will construct a modal dialog. * * The default timer length is 10. * * @param parent The parent of the widget * @param msg The name of the object * @param dispIcon Display Icon? */ OWait::OWait( QWidget *parent, const char* msg, bool dispIcon ) :QDialog( parent, msg, TRUE, WStyle_Customize ) { Q_UNUSED( dispIcon ) QHBoxLayout * hbox = new QHBoxLayout( this ); m_lb = new QLabel( this ); m_lb->setBackgroundMode ( NoBackground ); 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 ); m_timerLength = 10; m_waitTimer = new QTimer( this ); connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) ); } void OWait::timerEvent( QTimerEvent * ) { frame = ( ++frame ) % 4; repaint(); } void OWait::paintEvent( QPaintEvent * ) { QPainter p( m_lb ); p.drawPixmap( 0, 0, m_pix, m_aniSize * frame, 0, m_aniSize, m_aniSize ); } void OWait::show() { 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,73 +1,72 @@ /* - This file is part of the Opie Project - Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> +         This file is part of the Opie Project + + Copyright (C) 2003 Maximilian Reiss <harlekin@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. - */ #ifndef OWAIT_H #define OWAIT_H /* QT */ #include <qdialog.h> #include <qlabel.h> #include <qpixmap.h> #include <qtimer.h> namespace Opie { namespace Ui { /** * This class displays a animated waiting icon in the middle of the screen. * * @short modal hour glass dialog * @see QDialog - * @author Maximilian Reiß - */ + * @author Maximilian Rei� */ class OWait : public QDialog { Q_OBJECT public: OWait( QWidget *parent = 0, const char* name = 0, bool dispIcon = TRUE ); ~OWait(); /** * reimplemented for control reasons */ void show(); /** * Set the time before the icon will be automaticly hidden * The timer will be started once the widget will be shown. * @param length - time in seconds */ void setTimerLength( int length ); public slots: /** * reimplemented for control reasons */ |