kitchensync Library API Documentation

overviewprogressentry.cpp

00001 /* 00002 This file is part of KitchenSync. 00003 00004 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 00005     Copyright (c) 2002 Maximilian Reiß <harlekin@handhelds.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00020 Boston, MA 02111-1307, USA. 00021 */ 00022 00023 #include <kiconloader.h> 00024 00025 #include <qimage.h> 00026 00027 #include "overviewprogressentry.h" 00028 00029 using namespace KSync; 00030 using namespace KSync::OverView; 00031 00032 OverViewProgressEntry::OverViewProgressEntry( QWidget* parent, const char* name ) 00033 : QWidget( parent, name ) 00034 { 00035 QHBoxLayout *layout = new QHBoxLayout( this, QBoxLayout::LeftToRight ); 00036 layout->setSpacing( 5 ); 00037 00038 QWidget* spacer = new QWidget( this ); 00039 spacer->setMinimumWidth( 5 ); 00040 00041 layout->addWidget( spacer, 0, AlignLeft ); 00042 00043 m_pixmapLabel = new QLabel( this ); 00044 m_pixmapLabel->setFixedWidth( 16 ); 00045 m_textLabel = new QLabel( this ); 00046 m_progressField = new QLabel( this ); 00047 00048 spacer = new QWidget( this ); 00049 spacer->setMinimumWidth( 10 ); 00050 00051 layout->addWidget( m_pixmapLabel, 0, AlignLeft ); 00052 layout->addWidget( m_textLabel, 5, AlignLeft ); 00053 layout->addStretch( 0 ); 00054 layout->addWidget( m_progressField, 0, AlignLeft ); 00055 layout->addWidget( spacer, 0, AlignRight ); 00056 } 00057 00058 OverViewProgressEntry::~OverViewProgressEntry() 00059 { 00060 } 00061 00062 void OverViewProgressEntry::setText( QString text ) 00063 { 00064 m_textLabel->setText( text ); 00065 m_name = text; 00066 } 00067 00068 void OverViewProgressEntry::setProgress( int status ) 00069 { 00070 // SyncStatus { SYNC_START=0, SYNC_PROGRESS=1, SYNC_DONE=2, SYNC_FAIL }; 00071 00072 if ( status == 0 ) { 00073 m_progressField->setPixmap( KGlobal::iconLoader()->loadIcon( "player_play", KIcon::Desktop, 16 ) ); 00074 } else if ( status == 1 ) { 00075 m_progressField->setPixmap( KGlobal::iconLoader()->loadIcon( "reload", KIcon::Desktop, 16 ) ); 00076 } else if ( status == 2 ) { 00077 m_progressField->setPixmap( KGlobal::iconLoader()->loadIcon( "ok", KIcon::Desktop, 16 ) ); 00078 } else { 00079 m_progressField->setPixmap( KGlobal::iconLoader()->loadIcon( "no", KIcon::Desktop, 16 ) ); 00080 } 00081 } 00082 00083 void OverViewProgressEntry::setPixmap( QPixmap pixmap ) 00084 { 00085 QImage test = pixmap.convertToImage(); 00086 m_pixmapLabel->setPixmap( test.smoothScale( 16, 16, QImage::ScaleMin ) ); 00087 } 00088 00089 QString OverViewProgressEntry::name() 00090 { 00091 return m_name; 00092 } 00093 00094 #include "overviewprogressentry.moc"
KDE Logo
This file is part of the documentation for kitchensync Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Oct 1 15:18:59 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003