summaryrefslogtreecommitdiff
path: root/noncore/multimedia/camera/zcameraio.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/camera/zcameraio.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/camera/zcameraio.cpp44
1 files changed, 39 insertions, 5 deletions
diff --git a/noncore/multimedia/camera/zcameraio.cpp b/noncore/multimedia/camera/zcameraio.cpp
index b37ae8c..9af0c25 100644
--- a/noncore/multimedia/camera/zcameraio.cpp
+++ b/noncore/multimedia/camera/zcameraio.cpp
@@ -62,2 +62,3 @@ void ZCameraIO::init()
62 { 62 {
63 _timer = new QTime();
63 setReadMode( STATUS ); 64 setReadMode( STATUS );
@@ -85,4 +86,14 @@ bool ZCameraIO::isShutterPressed()
85{ 86{
86 return _status[0] == 'S'; 87 if ( _timer->elapsed() < 1000 ) //TODO: make this customizable?
87 clearShutterLatch(); 88 {
89 clearShutterLatch();
90 return false;
91 }
92 if ( _status[0] == 'S' )
93 {
94 _timer->restart();
95 clearShutterLatch();
96 return true;
97 }
98 else return false;
88} 99}
@@ -126,2 +137,8 @@ bool ZCameraIO::setCaptureFrame( int width, int height, int zoom, bool rot )
126 137
138bool ZCameraIO::setZoom( int zoom )
139{
140 return setCaptureFrame( _width, _height, zoom*256, _rot );
141}
142
143
127void ZCameraIO::setReadMode( int mode ) 144void ZCameraIO::setReadMode( int mode )
@@ -131,4 +148,7 @@ void ZCameraIO::setReadMode( int mode )
131 write( b, mode <= 9 ? 3 : 4 ); 148 write( b, mode <= 9 ? 3 : 4 );
132 if ( mode & 1 ) // STATUS bit is set 149 if ( mode & STATUS ) // STATUS bit is set
150 {
133 read( _status, 4 ); 151 read( _status, 4 );
152 if ( isShutterPressed() ) emit shutterClicked();
153 }
134} 154}
@@ -138,4 +158,3 @@ void ZCameraIO::clearShutterLatch()
138{ 158{
139 char b = 'B'; 159 write( "B", 1 );
140 write( &b, 1 );
141} 160}
@@ -214,2 +233,3 @@ bool ZCameraIO::snapshot( QImage* image )
214 233
234
215bool ZCameraIO::snapshot( unsigned char* buf ) 235bool ZCameraIO::snapshot( unsigned char* buf )
@@ -230 +250,15 @@ bool ZCameraIO::snapshot( unsigned char* buf )
230 250
251
252void ZCameraIO::captureFrame( int w, int h, int zoom, QImage* image )
253{
254 int pw = _width;
255 int ph = _height;
256 if ( _rot )
257 setCaptureFrame( h, w, zoom*256, true );
258 else
259 setCaptureFrame( w, h, zoom*256, false );
260 snapshot( image );
261 setCaptureFrame( pw, ph, _zoom, _rot );
262}
263
264