author | mickeyl <mickeyl> | 2003-04-06 14:38:18 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-06 14:38:18 (UTC) |
commit | 0b985ce87d6ce6d4110a50d5be48831d34794cd2 (patch) (side-by-side diff) | |
tree | da19d8dc2cd2b37d15220783940652e8e91f3843 /noncore/multimedia/camera/mainwindow.cpp | |
parent | 91d65a97c956963a24f418fadd7cd69f6a52f5d5 (diff) | |
download | opie-0b985ce87d6ce6d4110a50d5be48831d34794cd2.zip opie-0b985ce87d6ce6d4110a50d5be48831d34794cd2.tar.gz opie-0b985ce87d6ce6d4110a50d5be48831d34794cd2.tar.bz2 |
- add realtime preview widget with zoom control
The camera driver is damn slow. For a 240x160x16 image, it takes ~100ms. That gives approx. 10fps which is too slow for doing video. :(
Diffstat (limited to 'noncore/multimedia/camera/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/camera/mainwindow.cpp | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/noncore/multimedia/camera/mainwindow.cpp b/noncore/multimedia/camera/mainwindow.cpp index 4218232..8578bce 100644 --- a/noncore/multimedia/camera/mainwindow.cpp +++ b/noncore/multimedia/camera/mainwindow.cpp @@ -13,52 +13,48 @@ ** **********************************************************************/ #include "mainwindow.h" +#include "mainwindowbase.h" #include "zcameraio.h" #include <qvbox.h> +#include <qcombobox.h> #include <qpushbutton.h> #include <qlabel.h> - #include <qdirectpainter_qws.h> - #include <qpe/resource.h> #include <opie/ofiledialog.h> +#include <assert.h> + CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) :QMainWindow( parent, name, f ) { - QVBox* v = new QVBox( this ); - l = new QLabel( v ); - l->setFixedSize( QSize( 240, 160 ) ); - QPushButton* p = new QPushButton( "Snapshot", v ); - connect( p, SIGNAL( clicked() ), this, SLOT( clickedSnapShot() ) ); - v->show(); - l->show(); - p->show(); - setCentralWidget( v ); + mw = new MainWindowBase( this, "main widget" ); + ZCameraIO::instance()->setCaptureFrame( 240, 160, 256 ); + setCentralWidget( mw ); + mw->show(); + connect( mw->zoom, SIGNAL( activated( int ) ), this, SLOT( changeZoom(int) ) ); }; CameraMainWindow::~CameraMainWindow() { } -void CameraMainWindow::clickedSnapShot() +void CameraMainWindow::changeZoom( int zoom ) { - QDirectPainter fb( l ); - ZCameraIO::instance()->snapshot( fb.frameBuffer() ); - - /* - QImage i; - QPixmap p; - if ( ZCameraIO::instance()->snapshot( &i ) ) + int z; + switch ( zoom ) { - p.convertFromImage( i ); - l->setPixmap( p ); + case 0: z = 128; break; + case 1: z = 256; break; + case 2: z = 512; break; + default: assert( 0 ); break; } - */ + + ZCameraIO::instance()->setCaptureFrame( 240, 160, z ); } |