kitchensync
overviewprogressentry.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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( const QString &text )
00063 {
00064 m_textLabel->setText( text );
00065 m_name = text;
00066 }
00067
00068 void OverViewProgressEntry::setProgress( int status )
00069 {
00070
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( const 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"
|