From bcb704366cb5e333a626c18c308c7e0448a8e69f Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/protocols/testbed/ui/Makefile.am | 7 ++ .../protocols/testbed/ui/testbedwebcamdialog.cpp | 80 ++++++++++++++++++++++ kopete/protocols/testbed/ui/testbedwebcamdialog.h | 60 ++++++++++++++++ 3 files changed, 147 insertions(+) create mode 100644 kopete/protocols/testbed/ui/Makefile.am create mode 100644 kopete/protocols/testbed/ui/testbedwebcamdialog.cpp create mode 100644 kopete/protocols/testbed/ui/testbedwebcamdialog.h (limited to 'kopete/protocols/testbed/ui') diff --git a/kopete/protocols/testbed/ui/Makefile.am b/kopete/protocols/testbed/ui/Makefile.am new file mode 100644 index 00000000..1bbf604c --- /dev/null +++ b/kopete/protocols/testbed/ui/Makefile.am @@ -0,0 +1,7 @@ +INCLUDES = +METASOURCES = AUTO +AM_CPPFLAGS = $(KOPETE_INCLUDES) -I$(srcdir)/.. $(all_includes) +libkopetetestbedui_la_LDFLAGS = $(all_libraries) +noinst_LTLIBRARIES = libkopetetestbedui.la +noinst_HEADERS = testbedwebcamdialog.h +libkopetetestbedui_la_SOURCES = testbedwebcamdialog.cpp diff --git a/kopete/protocols/testbed/ui/testbedwebcamdialog.cpp b/kopete/protocols/testbed/ui/testbedwebcamdialog.cpp new file mode 100644 index 00000000..22884036 --- /dev/null +++ b/kopete/protocols/testbed/ui/testbedwebcamdialog.cpp @@ -0,0 +1,80 @@ +/* + Kopete Testbed Protocol + + Copyright (c) 2006 by Cláudio da Silveira Pinheiro + Kopete (c) 2002-2006 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#include "testbedwebcamdialog.h" +#include +#include "avdevice/videodevicepool.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +TestbedWebcamDialog::TestbedWebcamDialog( const QString &contactId, QWidget * parent, const char * name ) +: KDialogBase( KDialogBase::Plain, Qt::WDestructiveClose, parent, name, false, i18n( "Webcam for %1" ).arg( contactId ), + KDialogBase::Close, KDialogBase::Close, true /*seperator*/ ) +{ + setInitialSize( QSize(320,290), false ); + + setEscapeButton( KDialogBase::Close ); +// QObject::connect( this, SIGNAL( closeClicked() ), this, SIGNAL( closingWebcamDialog() ) ); + + QWidget *page = plainPage(); + setMainWidget(page); + + QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); + mImageContainer = new Kopete::WebcamWidget( page ); + mImageContainer->setMinimumSize(320,240); + mImageContainer->setText( i18n( "No webcam image received" ) ); + mImageContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + topLayout->add( mImageContainer ); + + show(); + + mVideoDevicePool = Kopete::AV::VideoDevicePool::self(); + mVideoDevicePool->open(); + mVideoDevicePool->setSize(320, 240); + mVideoDevicePool->startCapturing(); + mVideoDevicePool->getFrame(); + mVideoDevicePool->getImage(&mImage); +kdDebug() << "Just captured 1st frame" << endl; + + mPixmap=QPixmap(320,240,-1, QPixmap::DefaultOptim); + if (mPixmap.convertFromImage(mImage,0) == true) + mImageContainer->updatePixmap(mPixmap); + connect(&qtimer, SIGNAL(timeout()), this, SLOT(slotUpdateImage()) ); + qtimer.start(0,FALSE); +} + +TestbedWebcamDialog::~ TestbedWebcamDialog( ) +{ + mVideoDevicePool->stopCapturing(); + mVideoDevicePool->close(); +} + +void TestbedWebcamDialog::slotUpdateImage() +{ + mVideoDevicePool->getFrame(); + mVideoDevicePool->getImage(&mImage); + mImageContainer->updatePixmap( QPixmap( mImage ) ); +} + + +#include "testbedwebcamdialog.moc" diff --git a/kopete/protocols/testbed/ui/testbedwebcamdialog.h b/kopete/protocols/testbed/ui/testbedwebcamdialog.h new file mode 100644 index 00000000..59f43e68 --- /dev/null +++ b/kopete/protocols/testbed/ui/testbedwebcamdialog.h @@ -0,0 +1,60 @@ +/* + Kopete Testbed Protocol + + Copyright (c) 2006 by Cláudio da Silveira Pinheiro + Kopete (c) 2002-2006 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#ifndef TESTBEDWEBCAMDIALOG_H +#define TESTBEDWEBCAMDIALOG_H + +#include +#include +#include +#include +#include + +/** + @author Kopete Developers +*/ +class QPixmap; +class QWidget; +class TestbedContact; + +namespace Kopete { + namespace AV { + class VideoDevicePool; + } + class WebcamWidget; +} + +class TestbedWebcamDialog : public KDialogBase +{ +Q_OBJECT +public: + TestbedWebcamDialog( const QString &, QWidget* parent = 0, const char* name = 0 ); + ~TestbedWebcamDialog(); + +public slots: + void slotUpdateImage(); +//signals: +// void closingWebcamDialog(); + +private: + Kopete::WebcamWidget *mImageContainer; + QImage mImage; + QTimer qtimer; + QPixmap mPixmap; + Kopete::AV::VideoDevicePool *mVideoDevicePool; +}; + +#endif -- cgit v1.2.1