Diffstat (limited to 'noncore/multimedia/camera/previewwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/camera/previewwidget.cpp | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/noncore/multimedia/camera/previewwidget.cpp b/noncore/multimedia/camera/previewwidget.cpp deleted file mode 100644 index 08330d0..0000000 --- a/noncore/multimedia/camera/previewwidget.cpp +++ b/dev/null | |||
@@ -1,88 +0,0 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #include "previewwidget.h" | ||
17 | #include "zcameraio.h" | ||
18 | |||
19 | #include <opie2/odebug.h> | ||
20 | |||
21 | #include <assert.h> | ||
22 | |||
23 | PreviewWidget::PreviewWidget( QWidget * parent, const char * name, WFlags f ) | ||
24 | :QLabel( parent, name, f ) | ||
25 | { | ||
26 | #ifndef QT_NO_DEBUG | ||
27 | setBackgroundColor( QColor( 255, 0, 0 ) ); | ||
28 | #else | ||
29 | setBackgroundMode( NoBackground ); | ||
30 | #endif | ||
31 | |||
32 | #ifndef QT_NO_DEBUG | ||
33 | if ( ZCameraIO::instance()->isOpen() ) startTimer( 1500 ); | ||
34 | #else | ||
35 | if ( ZCameraIO::instance()->isOpen() ) startTimer( 200 ); | ||
36 | #endif | ||
37 | }; | ||
38 | |||
39 | |||
40 | PreviewWidget::~PreviewWidget() | ||
41 | { | ||
42 | } | ||
43 | |||
44 | |||
45 | void PreviewWidget::resizeEvent( QResizeEvent* e ) | ||
46 | { | ||
47 | QLabel::resizeEvent( e ); | ||
48 | int w = e->size().width(); | ||
49 | int h = e->size().height(); | ||
50 | ZCameraIO::instance()->setCaptureFrame( e->size().width(), | ||
51 | e->size().height(), | ||
52 | 256, | ||
53 | w < h ); | ||
54 | } | ||
55 | |||
56 | |||
57 | void PreviewWidget::timerEvent( QTimerEvent* ) | ||
58 | { | ||
59 | //QDirectPainter fb( this ); | ||
60 | //ZCameraIO::instance()->snapshot( fb.frameBuffer() ); | ||
61 | |||
62 | if ( ZCameraIO::instance()->snapshot( &i ) ) | ||
63 | { | ||
64 | p.convertFromImage( i ); | ||
65 | setPixmap( p ); | ||
66 | } | ||
67 | } | ||
68 | |||
69 | |||
70 | void PreviewWidget::mousePressEvent( QMouseEvent* ) | ||
71 | { | ||
72 | emit contextMenuRequested(); | ||
73 | } | ||
74 | |||
75 | |||
76 | void PreviewWidget::setRefreshingRate( int ms ) | ||
77 | { | ||
78 | killTimers(); | ||
79 | if ( ms ) | ||
80 | startTimer( ms ); | ||
81 | } | ||
82 | |||
83 | |||
84 | void PreviewWidget::refresh() | ||
85 | { | ||
86 | QTimerEvent t( 10 ); // event id is meaningless in this case | ||
87 | timerEvent( &t ); | ||
88 | } | ||