/* * headerwidget.cc * * Copyright (c) 2002, 2003 Frerich Raabe * * 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. For licensing and distribution details, check the * accompanying file 'COPYING'. */ #include "headerwidget.h" #include #include #include #include #include #include #include using namespace Barry; HeaderWidget::HeaderWidget( QWidget *parent ): QWidget( parent, "HeaderWidget" ) { QHBoxLayout *layout = new QHBoxLayout( this ); layout->setMargin( 0 ); layout->setSpacing( KDialog::spacingHint() ); m_statusIcon = new QLabel( this ); m_statusIcon->setFixedSize( QSize( 48, 48 ) ); layout->addWidget( m_statusIcon ); m_portName = new QLabel( this ); QFont nameFont( QString::fromLatin1( "verdana" ), 20 ); m_portName->setFont( nameFont ); layout->addWidget( m_portName ); m_link = new KURLLabel( this ); connect( m_link, SIGNAL( leftClickedURL( const QString & ) ), this, SLOT( openURL( const QString & ) ) ); m_link->setFont( KGlobalSettings::fixedFont() ); layout->addWidget( m_link, 0, AlignRight | AlignBottom ); } void HeaderWidget::setPort( const Port &port ) { if ( m_port == port ) return; m_port = port; QString pixmapName; if ( port.installed() ) pixmapName = QString::fromLatin1( "port-installed.png" ); else pixmapName = QString::fromLatin1( "port-not-installed.png" ); pixmapName = ::locate( "appdata", QString::fromLatin1( "%1" ) .arg( pixmapName ) ); m_statusIcon->setPixmap( QPixmap( pixmapName ) ); m_portName->setText( port.name() ); m_link->setText( port.link().stripWhiteSpace() ); m_link->setURL( m_link->text() ); } void HeaderWidget::openURL( const QString &url ) { ( void )new KRun( url ); } #include "headerwidget.moc" // vim:ts=4:sw=4:noet:list