summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/camera/cmd/cmd.pro2
-rw-r--r--noncore/multimedia/camera/config.in6
-rw-r--r--noncore/multimedia/camera/gui/gui.pro4
-rw-r--r--noncore/multimedia/camera/gui/mainwindow.cpp28
-rw-r--r--noncore/multimedia/camera/lib/lib.pro4
5 files changed, 21 insertions, 23 deletions
diff --git a/noncore/multimedia/camera/cmd/cmd.pro b/noncore/multimedia/camera/cmd/cmd.pro
index 7981e82..b90289b 100644
--- a/noncore/multimedia/camera/cmd/cmd.pro
+++ b/noncore/multimedia/camera/cmd/cmd.pro
@@ -1,18 +1,16 @@
1MOC_DIR = ./moc
2OBJECTS_DIR = ./obj
3DESTDIR = $(OPIEDIR)/bin 1DESTDIR = $(OPIEDIR)/bin
4TEMPLATE = app 2TEMPLATE = app
5CONFIG += qt warn_on debug 3CONFIG += qt warn_on debug
6 4
7HEADERS = capture.h 5HEADERS = capture.h
8 6
9SOURCES = capture.cpp 7SOURCES = capture.cpp
10 8
11INCLUDEPATH += $(OPIEDIR)/include ../lib 9INCLUDEPATH += $(OPIEDIR)/include ../lib
12DEPENDPATH += $(OPIEDIR)/include ../lib 10DEPENDPATH += $(OPIEDIR)/include ../lib
13LIBS += -lqpe -lopiecore2 -lopiecam 11LIBS += -lqpe -lopiecore2 -lopiecam
14INTERFACES = 12INTERFACES =
15TARGET = capture 13TARGET = capture
16 14
17include ( $(OPIEDIR)/include.pro ) 15include ( $(OPIEDIR)/include.pro )
18 16
diff --git a/noncore/multimedia/camera/config.in b/noncore/multimedia/camera/config.in
index 861abcb..cfd71ad 100644
--- a/noncore/multimedia/camera/config.in
+++ b/noncore/multimedia/camera/config.in
@@ -1,7 +1,7 @@
1 config CAMERA 1 config CAMERA
2 boolean "opie-camera (camera app to use with the Sharp CE-AG06)" 2 boolean "opie-camera (camera app to use with the Sharp CE-AG06)"
3 default "n" 3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LIBOPIE2CORE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
5 comment "opie-camera needs a libqpe, libopie and libopie2core" 5 comment "opie-camera needs a libqpe, libopie2core"
6 depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LIBOPIE2CORE) 6 depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE)
7 7
diff --git a/noncore/multimedia/camera/gui/gui.pro b/noncore/multimedia/camera/gui/gui.pro
index f587b57..d74f4b6 100644
--- a/noncore/multimedia/camera/gui/gui.pro
+++ b/noncore/multimedia/camera/gui/gui.pro
@@ -1,21 +1,19 @@
1MOC_DIR = ./moc
2OBJECTS_DIR = ./obj
3DESTDIR = $(OPIEDIR)/bin 1DESTDIR = $(OPIEDIR)/bin
4TEMPLATE = app 2TEMPLATE = app
5CONFIG += qt warn_on debug 3CONFIG += qt warn_on debug
6 4
7HEADERS = previewwidget.h \ 5HEADERS = previewwidget.h \
8 mainwindow.h 6 mainwindow.h
9 7
10SOURCES = previewwidget.cpp \ 8SOURCES = previewwidget.cpp \
11 mainwindow.cpp \ 9 mainwindow.cpp \
12 main.cpp 10 main.cpp
13 11
14INCLUDEPATH += $(OPIEDIR)/include ../lib 12INCLUDEPATH += $(OPIEDIR)/include ../lib
15DEPENDPATH += $(OPIEDIR)/include ../lib 13DEPENDPATH += $(OPIEDIR)/include ../lib
16LIBS += -lqpe -lopie -lopiecore2 -lopiecam 14LIBS += -lopiecore2 -lopieui2 -lopiecam
17INTERFACES = 15INTERFACES =
18TARGET = opiecam 16TARGET = opiecam
19 17
20include ( $(OPIEDIR)/include.pro ) 18include ( $(OPIEDIR)/include.pro )
21 19
diff --git a/noncore/multimedia/camera/gui/mainwindow.cpp b/noncore/multimedia/camera/gui/mainwindow.cpp
index 5da3757..2f42049 100644
--- a/noncore/multimedia/camera/gui/mainwindow.cpp
+++ b/noncore/multimedia/camera/gui/mainwindow.cpp
@@ -1,72 +1,76 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
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 "previewwidget.h" 17#include "previewwidget.h"
18#include "zcameraio.h" 18#include "zcameraio.h"
19#include "imageio.h" 19#include "imageio.h"
20#include "avi.h" 20#include "avi.h"
21 21
22/* OPIE */
23#include <opie2/ofiledialog.h>
24#include <opie2/odevice.h>
25#include <opie2/oapplication.h>
26#include <opie2/oconfig.h>
27#include <opie2/odebug.h>
28#include <qpe/global.h>
29#include <qpe/resource.h>
30#include <qpe/qcopenvelope_qws.h>
31using namespace Opie;
32
33/* QT */
22#include <qapplication.h> 34#include <qapplication.h>
23#include <qaction.h> 35#include <qaction.h>
24#include <qvbox.h> 36#include <qvbox.h>
25#include <qcombobox.h> 37#include <qcombobox.h>
26#include <qcursor.h> 38#include <qcursor.h>
27#include <qdatastream.h> 39#include <qdatastream.h>
28#include <qdir.h> 40#include <qdir.h>
29#include <qfile.h> 41#include <qfile.h>
30#include <qimage.h> 42#include <qimage.h>
31#include <qlabel.h> 43#include <qlabel.h>
32#include <qlineedit.h> 44#include <qlineedit.h>
33#include <qpopupmenu.h> 45#include <qpopupmenu.h>
34#include <qprogressbar.h> 46#include <qprogressbar.h>
35#include <qpushbutton.h> 47#include <qpushbutton.h>
36#include <qmessagebox.h> 48#include <qmessagebox.h>
37#include <qlayout.h> 49#include <qlayout.h>
38#include <qdirectpainter_qws.h> 50#include <qdirectpainter_qws.h>
39#include <qpe/global.h>
40#include <qpe/resource.h>
41#include <qpe/qcopenvelope_qws.h>
42#include <opie/ofiledialog.h>
43#include <opie/odevice.h>
44using namespace Opie;
45#include <opie2/oapplication.h>
46#include <opie2/oconfig.h>
47#include <opie2/odebug.h>
48 51
52/* STD */
49#include <assert.h> 53#include <assert.h>
50#include <sys/types.h> 54#include <sys/types.h>
51#include <sys/stat.h> 55#include <sys/stat.h>
52#include <fcntl.h> 56#include <fcntl.h>
53#include <string.h> 57#include <string.h>
54#include <errno.h> 58#include <errno.h>
55#include <unistd.h> 59#include <unistd.h>
56 60
57#define CAPTUREFILE "/tmp/capture.dat" 61#define CAPTUREFILE "/tmp/capture.dat"
58#define OUTPUTFILE "/tmp/output.avi" 62#define OUTPUTFILE "/tmp/output.avi"
59 63
60#define OUTPUT_TO_CUSTOM 250 64#define OUTPUT_TO_CUSTOM 250
61#define OUTPUT_TO_DOCFOLDER 251 65#define OUTPUT_TO_DOCFOLDER 251
62 66
63CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) 67CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f )
64 :QMainWindow( parent, name, f ), 68 :QMainWindow( parent, name, f ),
65 _rotation( 270 ), // FIXME: get this from current settings (ODevice?) 69 _rotation( 270 ), // FIXME: get this from current settings (ODevice?)
66 _capturing( false ), 70 _capturing( false ),
67 _pics( 1 ), _videos( 1 ) 71 _pics( 1 ), _videos( 1 )
68{ 72{
69 #ifdef QT_NO_DEBUG 73 #ifdef QT_NO_DEBUG
70 if ( !ZCameraIO::instance()->isOpen() ) 74 if ( !ZCameraIO::instance()->isOpen() )
71 { 75 {
72 QVBox* v = new QVBox( this ); 76 QVBox* v = new QVBox( this );
@@ -417,49 +421,49 @@ void CameraMainWindow::prefixItemChoosen()
417 QLineEdit* le = new QLineEdit( prefix, d ); 421 QLineEdit* le = new QLineEdit( prefix, d );
418 v->addWidget( le ); 422 v->addWidget( le );
419 le->setFixedWidth( 150 ); //FIXME: 'tis a bit dirty 423 le->setFixedWidth( 150 ); //FIXME: 'tis a bit dirty
420 if ( d->exec() == QDialog::Accepted ) 424 if ( d->exec() == QDialog::Accepted )
421 prefix = le->text(); 425 prefix = le->text();
422 odebug << "Prefix now: " << prefix << oendl; 426 odebug << "Prefix now: " << prefix << oendl;
423} 427}
424 428
425 429
426void CameraMainWindow::appendSettingsChoosen() 430void CameraMainWindow::appendSettingsChoosen()
427{ 431{
428 appendSettings = !appendSettings; 432 appendSettings = !appendSettings;
429 odebug << "appendSettings now: " << appendSettings << oendl; 433 odebug << "appendSettings now: " << appendSettings << oendl;
430} 434}
431 435
432 436
433void CameraMainWindow::shutterClicked() 437void CameraMainWindow::shutterClicked()
434{ 438{
435 if ( captureFormat != "AVI" ) // capture one photo per shutterClick 439 if ( captureFormat != "AVI" ) // capture one photo per shutterClick
436 { 440 {
437 Global::statusMessage( "CAPTURING..." ); 441 Global::statusMessage( "CAPTURING..." );
438 qApp->processEvents(); 442 qApp->processEvents();
439 443
440 odebug << "Shutter has been pressed" << oendl; 444 odebug << "Shutter has been pressed" << oendl;
441 ODevice::inst()->touchSound(); 445 ODevice::inst()->playTouchSound();
442 446
443 performCapture( captureFormat ); 447 performCapture( captureFormat );
444 } 448 }
445 else // capture video! start with one shutter click and stop with the next 449 else // capture video! start with one shutter click and stop with the next
446 { 450 {
447 !_capturing ? startVideoCapture() : stopVideoCapture(); 451 !_capturing ? startVideoCapture() : stopVideoCapture();
448 } 452 }
449} 453}
450 454
451 455
452void CameraMainWindow::performCapture( const QString& format ) 456void CameraMainWindow::performCapture( const QString& format )
453{ 457{
454 QString name; 458 QString name;
455 459
456 if ( outputTo == "Documents Folder" ) 460 if ( outputTo == "Documents Folder" )
457 { 461 {
458 name.sprintf( "%s/Documents/image/%s/", (const char*) QDir::homeDirPath(), (const char*) captureFormat.lower() ); 462 name.sprintf( "%s/Documents/image/%s/", (const char*) QDir::homeDirPath(), (const char*) captureFormat.lower() );
459 if ( !QDir( name ).exists() ) 463 if ( !QDir( name ).exists() )
460 { 464 {
461 odebug << "creating directory " << name << oendl; 465 odebug << "creating directory " << name << oendl;
462 QString msg = "mkdir -p " + name; 466 QString msg = "mkdir -p " + name;
463 system( msg.latin1() ); 467 system( msg.latin1() );
464 } 468 }
465 } 469 }
@@ -471,91 +475,91 @@ void CameraMainWindow::performCapture( const QString& format )
471 { 475 {
472 name.append( QString().sprintf( "_%d_%d_q%d", captureX, captureY, quality ) ); 476 name.append( QString().sprintf( "_%d_%d_q%d", captureX, captureY, quality ) );
473 } 477 }
474 name.append( QString().sprintf( "-%d.%s", _pics++, (const char*) captureFormat.lower() ) ); 478 name.append( QString().sprintf( "-%d.%s", _pics++, (const char*) captureFormat.lower() ) );
475 479
476 QImage i; 480 QImage i;
477 ZCameraIO::instance()->captureFrame( captureX, captureY, zoom, &i ); 481 ZCameraIO::instance()->captureFrame( captureX, captureY, zoom, &i );
478 QImage im = i.convertDepth( 32 ); 482 QImage im = i.convertDepth( 32 );
479 bool result = im.save( name, format, quality ); 483 bool result = im.save( name, format, quality );
480 if ( !result ) 484 if ( !result )
481 { 485 {
482 oerr << "imageio-Problem while writing." << oendl; 486 oerr << "imageio-Problem while writing." << oendl;
483 Global::statusMessage( "Error!" ); 487 Global::statusMessage( "Error!" );
484 } 488 }
485 else 489 else
486 { 490 {
487 odebug << captureFormat << "-image has been successfully captured" << oendl; 491 odebug << captureFormat << "-image has been successfully captured" << oendl;
488 Global::statusMessage( "Ok." ); 492 Global::statusMessage( "Ok." );
489 } 493 }
490} 494}
491 495
492 496
493void CameraMainWindow::startVideoCapture() 497void CameraMainWindow::startVideoCapture()
494{ 498{
495 ODevice::inst()->touchSound(); 499 ODevice::inst()->playTouchSound();
496 ODevice::inst()->setLedState( Led_Mail, Led_BlinkSlow ); 500 ODevice::inst()->setLedState( Led_Mail, Led_BlinkSlow );
497 501
498 _capturefd = ::open( CAPTUREFILE, O_WRONLY | O_CREAT | O_TRUNC ); 502 _capturefd = ::open( CAPTUREFILE, O_WRONLY | O_CREAT | O_TRUNC );
499 if ( _capturefd == -1 ) 503 if ( _capturefd == -1 )
500 { 504 {
501 owarn << "can't open capture file: " << strerror(errno) << oendl; 505 owarn << "can't open capture file: " << strerror(errno) << oendl;
502 return; 506 return;
503 } 507 }
504 508
505 _capturebuf = new unsigned char[captureX*captureY*2]; 509 _capturebuf = new unsigned char[captureX*captureY*2];
506 _capturing = true; 510 _capturing = true;
507 _videopics = 0; 511 _videopics = 0;
508 _framerate = 0; 512 _framerate = 0;
509 updateCaption(); 513 updateCaption();
510 _time.start(); 514 _time.start();
511 preview->setRefreshingRate( 1000 ); 515 preview->setRefreshingRate( 1000 );
512 startTimer( 100 ); // too fast but that is ok 516 startTimer( 100 ); // too fast but that is ok
513} 517}
514 518
515 519
516void CameraMainWindow::timerEvent( QTimerEvent* ) 520void CameraMainWindow::timerEvent( QTimerEvent* )
517{ 521{
518 if ( !_capturing ) 522 if ( !_capturing )
519 { 523 {
520 odebug << "timer event in CameraMainWindow without capturing video ?" << oendl; 524 odebug << "timer event in CameraMainWindow without capturing video ?" << oendl;
521 return; 525 return;
522 } 526 }
523 527
524 odebug << "timer event during video - now capturing frame #" << _videopics+1 << oendl; 528 odebug << "timer event during video - now capturing frame #" << _videopics+1 << oendl;
525 529
526 ZCameraIO::instance()->captureFrame( captureX, captureY, zoom, _capturebuf ); 530 ZCameraIO::instance()->captureFrame( captureX, captureY, zoom, _capturebuf );
527 _videopics++; 531 _videopics++;
528 ::write( _capturefd, _capturebuf, captureX*captureY*2 ); 532 ::write( _capturefd, _capturebuf, captureX*captureY*2 );
529 setCaption( QString().sprintf( "Capturing %dx%d @ %.2f fps %d", 533 setCaption( QString().sprintf( "Capturing %dx%d @ %.2f fps %d",
530 captureX, captureY, 1000.0 / (_time.elapsed()/_videopics), _videopics ) ); 534 captureX, captureY, 1000.0 / (_time.elapsed()/_videopics), _videopics ) );
531} 535}
532 536
533 537
534void CameraMainWindow::stopVideoCapture() 538void CameraMainWindow::stopVideoCapture()
535{ 539{
536 killTimers(); 540 killTimers();
537 ODevice::inst()->touchSound(); 541 ODevice::inst()->playTouchSound();
538 ODevice::inst()->setLedState( Led_Mail, Led_Off ); 542 ODevice::inst()->setLedState( Led_Mail, Led_Off );
539 _capturing = false; 543 _capturing = false;
540 updateCaption(); 544 updateCaption();
541 ::close( _capturefd ); 545 ::close( _capturefd );
542 _framerate = 1000.0 / (_time.elapsed()/_videopics); 546 _framerate = 1000.0 / (_time.elapsed()/_videopics);
543 547
544 QString name; 548 QString name;
545 if ( outputTo == "Documents Folder" ) 549 if ( outputTo == "Documents Folder" )
546 { 550 {
547 name.sprintf( "%s/Documents/video/%s/", (const char*) QDir::homeDirPath(), (const char*) captureFormat.lower() ); 551 name.sprintf( "%s/Documents/video/%s/", (const char*) QDir::homeDirPath(), (const char*) captureFormat.lower() );
548 if ( !QDir( name ).exists() ) 552 if ( !QDir( name ).exists() )
549 { 553 {
550 odebug << "creating directory " << name << oendl; 554 odebug << "creating directory " << name << oendl;
551 QString msg = "mkdir -p " + name; 555 QString msg = "mkdir -p " + name;
552 system( msg.latin1() ); 556 system( msg.latin1() );
553 } 557 }
554 } 558 }
555 else 559 else
556 name = outputTo; 560 name = outputTo;
557 561
558 name.append( "/" ); // sure is sure and safe is safe ;-) 562 name.append( "/" ); // sure is sure and safe is safe ;-)
559 name.append( prefix ); 563 name.append( prefix );
560 if ( appendSettings ) 564 if ( appendSettings )
561 name.append( QString().sprintf( "_%d_%d_q%d_%dfps", captureX, captureY, quality, _framerate ) ); 565 name.append( QString().sprintf( "_%d_%d_q%d_%dfps", captureX, captureY, quality, _framerate ) );
diff --git a/noncore/multimedia/camera/lib/lib.pro b/noncore/multimedia/camera/lib/lib.pro
index 3d2c59b..1e7346f 100644
--- a/noncore/multimedia/camera/lib/lib.pro
+++ b/noncore/multimedia/camera/lib/lib.pro
@@ -1,24 +1,22 @@
1MOC_DIR = ./moc
2OBJECTS_DIR = ./obj
3DESTDIR = $(OPIEDIR)/lib 1DESTDIR = $(OPIEDIR)/lib
4TEMPLATE = lib 2TEMPLATE = lib
5CONFIG += qt warn_on debug 3CONFIG += qt warn_on debug
6 4
7HEADERS = avi.h \ 5HEADERS = avi.h \
8 imageio.h \ 6 imageio.h \
9 zcameraio.h \ 7 zcameraio.h \
10 8
11SOURCES = avi.c \ 9SOURCES = avi.c \
12 imageio.cpp \ 10 imageio.cpp \
13 zcameraio.cpp \ 11 zcameraio.cpp \
14 12
15INCLUDEPATH += $(OPIEDIR)/include 13INCLUDEPATH += $(OPIEDIR)/include
16DEPENDPATH += $(OPIEDIR)/include 14DEPENDPATH += $(OPIEDIR)/include
17LIBS += -lqpe -lopie -lopiecore2 15LIBS += -lopiecore2
18INTERFACES = 16INTERFACES =
19VERSION = 1.0.0 17VERSION = 1.0.0
20TARGET = opiecam 18TARGET = opiecam
21 19
22 20
23include ( $(OPIEDIR)/include.pro ) 21include ( $(OPIEDIR)/include.pro )
24 22