author | mickeyl <mickeyl> | 2003-04-06 14:38:18 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-06 14:38:18 (UTC) |
commit | 0b985ce87d6ce6d4110a50d5be48831d34794cd2 (patch) (unidiff) | |
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) (show 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 | |||
@@ -5,60 +5,56 @@ | |||
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "mainwindow.h" | 16 | #include "mainwindow.h" |
17 | #include "mainwindowbase.h" | ||
17 | #include "zcameraio.h" | 18 | #include "zcameraio.h" |
18 | 19 | ||
19 | #include <qvbox.h> | 20 | #include <qvbox.h> |
21 | #include <qcombobox.h> | ||
20 | #include <qpushbutton.h> | 22 | #include <qpushbutton.h> |
21 | #include <qlabel.h> | 23 | #include <qlabel.h> |
22 | |||
23 | #include <qdirectpainter_qws.h> | 24 | #include <qdirectpainter_qws.h> |
24 | |||
25 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
26 | #include <opie/ofiledialog.h> | 26 | #include <opie/ofiledialog.h> |
27 | 27 | ||
28 | #include <assert.h> | ||
29 | |||
28 | CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) | 30 | CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) |
29 | :QMainWindow( parent, name, f ) | 31 | :QMainWindow( parent, name, f ) |
30 | { | 32 | { |
31 | QVBox* v = new QVBox( this ); | 33 | mw = new MainWindowBase( this, "main widget" ); |
32 | l = new QLabel( v ); | 34 | ZCameraIO::instance()->setCaptureFrame( 240, 160, 256 ); |
33 | l->setFixedSize( QSize( 240, 160 ) ); | 35 | setCentralWidget( mw ); |
34 | QPushButton* p = new QPushButton( "Snapshot", v ); | 36 | mw->show(); |
35 | connect( p, SIGNAL( clicked() ), this, SLOT( clickedSnapShot() ) ); | ||
36 | v->show(); | ||
37 | l->show(); | ||
38 | p->show(); | ||
39 | setCentralWidget( v ); | ||
40 | 37 | ||
38 | connect( mw->zoom, SIGNAL( activated( int ) ), this, SLOT( changeZoom(int) ) ); | ||
41 | }; | 39 | }; |
42 | 40 | ||
43 | 41 | ||
44 | CameraMainWindow::~CameraMainWindow() | 42 | CameraMainWindow::~CameraMainWindow() |
45 | { | 43 | { |
46 | } | 44 | } |
47 | 45 | ||
48 | 46 | ||
49 | void CameraMainWindow::clickedSnapShot() | 47 | void CameraMainWindow::changeZoom( int zoom ) |
50 | { | 48 | { |
51 | QDirectPainter fb( l ); | 49 | int z; |
52 | ZCameraIO::instance()->snapshot( fb.frameBuffer() ); | 50 | switch ( zoom ) |
53 | |||
54 | /* | ||
55 | QImage i; | ||
56 | QPixmap p; | ||
57 | if ( ZCameraIO::instance()->snapshot( &i ) ) | ||
58 | { | 51 | { |
59 | p.convertFromImage( i ); | 52 | case 0: z = 128; break; |
60 | l->setPixmap( p ); | 53 | case 1: z = 256; break; |
54 | case 2: z = 512; break; | ||
55 | default: assert( 0 ); break; | ||
61 | } | 56 | } |
62 | */ | 57 | |
58 | ZCameraIO::instance()->setCaptureFrame( 240, 160, z ); | ||
63 | } | 59 | } |
64 | 60 | ||