4 Copyright (c) 2005 by Matt Rogers <mattr@kde.org>
5 Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org>
7 *************************************************************************
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
14 *************************************************************************
17 #include "yahoowebcamdialog.h"
23 #include <QVBoxLayout>
28 #include <webcamwidget.h>
30 YahooWebcamDialog::YahooWebcamDialog( const QString
&contactId
, QWidget
* parent
)
33 setCaption( i18n( "Webcam for %1", contactId
) );
34 setButtons( KDialog::Close
);
35 setDefaultButton( KDialog::Close
);
36 showButtonSeparator( true );
38 setInitialSize( QSize(320,290) );
40 setEscapeButton( KDialog::Close
);
41 QObject::connect( this, SIGNAL( closeClicked() ), this, SIGNAL( closingWebcamDialog() ) );
43 contactName
= contactId
;
44 QWidget
*page
= new QWidget(this);
47 QVBoxLayout
*topLayout
= new QVBoxLayout( page
);
48 topLayout
->addSpacing( spacingHint() );
49 m_imageContainer
= new Kopete::WebcamWidget( page
);
50 m_imageContainer
->setText( i18n( "No webcam image received" ) );
51 m_imageContainer
->setMinimumSize(320,240);
52 m_imageContainer
->setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
53 topLayout
->addWidget( m_imageContainer
);
55 m_Viewer
= new QLabel( page
);
56 m_Viewer
->setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
58 topLayout
->addWidget( m_Viewer
);
63 YahooWebcamDialog::~ YahooWebcamDialog( )
68 void YahooWebcamDialog::newImage( const QPixmap
&image
)
70 m_imageContainer
->updatePixmap( image
);
73 void YahooWebcamDialog::webcamPaused()
75 m_imageContainer
->setText( QLatin1String("*** Webcam paused ***") );
78 void YahooWebcamDialog::webcamClosed( int reason
)
80 kDebug(14180) << "webcam closed with reason?? " << reason
;
85 closeReason
= i18n( "%1 has stopped broadcasting", contactName
); break;
87 closeReason
= i18n( "%1 has cancelled viewing permission", contactName
); break;
89 closeReason
= i18n( "%1 has declined permission to view webcam", contactName
); break;
91 closeReason
= i18n( "%1 does not have his/her webcam online", contactName
); break;
93 closeReason
= i18n( "Unable to view %1's webcam for an unknown reason", contactName
);
95 m_imageContainer
->clear();
97 m_imageContainer
->setText( closeReason
);
100 void YahooWebcamDialog::setViewer( const QStringList
&viewer
)
102 QString s
= i18np( "1 viewer", "%1 viewers", viewer
.size() );
103 if( !viewer
.empty() )
105 QStringList::ConstIterator it
= viewer
.begin();
106 const QStringList::ConstIterator itEnd
= viewer
.end();
110 for ( ; it
!= itEnd
; ++it
) {
114 m_Viewer
->setText( s
);
118 // kate: indent-mode csands; tab-width 4;
120 #include "yahoowebcamdialog.moc"