-rw-r--r-- | noncore/multimedia/camera/imageio.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/camera/mainwindow.cpp | 46 | ||||
-rw-r--r-- | noncore/multimedia/camera/opie-camera.control | 2 |
3 files changed, 40 insertions, 12 deletions
diff --git a/noncore/multimedia/camera/imageio.cpp b/noncore/multimedia/camera/imageio.cpp index f8f5dd0..ed0d39f 100644 --- a/noncore/multimedia/camera/imageio.cpp +++ b/noncore/multimedia/camera/imageio.cpp | |||
@@ -45,11 +45,11 @@ void imageToFile( QImage* i, const QString& name, const QString& format, int qua | |||
45 | QImage im = i->convertDepth( 32 ); | 45 | QImage im = i->convertDepth( 32 ); |
46 | bool result = im.save( name, format, quality ); | 46 | bool result = im.save( name, format, quality ); |
47 | if ( !result ) | 47 | if ( !result ) |
48 | { | 48 | { |
49 | oerr << "imageio-Problem while writing." << oendl; | 49 | oerr << "imageio-Problem while writing to " << name << oendl; |
50 | } | 50 | } |
51 | else | 51 | else |
52 | { | 52 | { |
53 | odebug << format << "-image has been successfully captured" << oendl; | 53 | odebug << format << "-image has been successfully captured" << oendl; |
54 | } | 54 | } |
55 | } \ No newline at end of file | 55 | } |
diff --git a/noncore/multimedia/camera/mainwindow.cpp b/noncore/multimedia/camera/mainwindow.cpp index 16ee8bc..49c7cbf 100644 --- a/noncore/multimedia/camera/mainwindow.cpp +++ b/noncore/multimedia/camera/mainwindow.cpp | |||
@@ -157,11 +157,11 @@ void CameraMainWindow::init() | |||
157 | new QAction( "* (always both)", 0, 0, flipg, 0, true ); | 157 | new QAction( "* (always both)", 0, 0, flipg, 0, true ); |
158 | 158 | ||
159 | outputTog = new QActionGroup( 0, "output", true ); | 159 | outputTog = new QActionGroup( 0, "output", true ); |
160 | outputTog->setToggleAction( true ); | 160 | outputTog->setToggleAction( true ); |
161 | new QAction( "/tmp", 0, 0, outputTog, 0, true ); | 161 | new QAction( "/tmp/", 0, 0, outputTog, 0, true ); |
162 | new QAction( "/mnt/card/", 0, 0, outputTog, 0, true ); | 162 | new QAction( "/mnt/card/", 0, 0, outputTog, 0, true ); |
163 | new QAction( "/mnt/sd/", 0, 0, outputTog, 0, true ); | 163 | new QAction( "/mnt/cf/", 0, 0, outputTog, 0, true ); |
164 | docfolder = new QAction( "Documents Folder", 0, 0, outputTog, 0, true ); | 164 | docfolder = new QAction( "Documents Folder", 0, 0, outputTog, 0, true ); |
165 | docfolder->setOn( true ); | 165 | docfolder->setOn( true ); |
166 | custom = new QAction( "&Custom...", 0, 0, outputTog, 0, true ); | 166 | custom = new QAction( "&Custom...", 0, 0, outputTog, 0, true ); |
167 | 167 | ||
@@ -421,9 +421,17 @@ void CameraMainWindow::performCapture( const QString& format ) | |||
421 | { | 421 | { |
422 | QString name; | 422 | QString name; |
423 | 423 | ||
424 | if ( outputTo == "Documents Folder" ) | 424 | if ( outputTo == "Documents Folder" ) |
425 | name.sprintf( "%s/Documents/image/%s/", (const char*) QDir::homeDirPath(), (const char*) captureFormat.lower() ); | 425 | { |
426 | name.sprintf( "%s/Documents/image/%s/", (const char*) QDir::homeDirPath(), (const char*) captureFormat.lower() ); | ||
427 | if ( !QDir( name ).exists() ) | ||
428 | { | ||
429 | odebug << "creating directory " << name << oendl; | ||
430 | QString msg = "mkdir -p " + name; | ||
431 | system( msg.latin1() ); | ||
432 | } | ||
433 | } | ||
426 | else | 434 | else |
427 | name = outputTo; | 435 | name = outputTo; |
428 | 436 | ||
429 | name.append( prefix ); | 437 | name.append( prefix ); |
@@ -500,10 +508,24 @@ void CameraMainWindow::stopVideoCapture() | |||
500 | updateCaption(); | 508 | updateCaption(); |
501 | ::close( _capturefd ); | 509 | ::close( _capturefd ); |
502 | _framerate = 1000.0 / (_time.elapsed()/_videopics); | 510 | _framerate = 1000.0 / (_time.elapsed()/_videopics); |
503 | 511 | ||
504 | QString name( outputTo ); | 512 | QString name; |
505 | name.append( "/prefix" ); | 513 | if ( outputTo == "Documents Folder" ) |
514 | { | ||
515 | name.sprintf( "%s/Documents/video/%s/", (const char*) QDir::homeDirPath(), (const char*) captureFormat.lower() ); | ||
516 | if ( !QDir( name ).exists() ) | ||
517 | { | ||
518 | odebug << "creating directory " << name << oendl; | ||
519 | QString msg = "mkdir -p " + name; | ||
520 | system( msg.latin1() ); | ||
521 | } | ||
522 | } | ||
523 | else | ||
524 | name = outputTo; | ||
525 | |||
526 | name.append( "/" ); // sure is sure and safe is safe ;-) | ||
527 | name.append( prefix ); | ||
506 | if ( appendSettings ) | 528 | if ( appendSettings ) |
507 | name.append( QString().sprintf( "_%d_%d_q%d_%dfps", captureX, captureY, quality, _framerate ) ); | 529 | name.append( QString().sprintf( "_%d_%d_q%d_%dfps", captureX, captureY, quality, _framerate ) ); |
508 | name.append( QString().sprintf( "-%d.%s", _videos++, (const char*) captureFormat.lower() ) ); | 530 | name.append( QString().sprintf( "-%d.%s", _videos++, (const char*) captureFormat.lower() ) ); |
509 | postProcessVideo( CAPTUREFILE, name ); | 531 | postProcessVideo( CAPTUREFILE, name ); |
@@ -518,8 +540,10 @@ void CameraMainWindow::stopVideoCapture() | |||
518 | } | 540 | } |
519 | 541 | ||
520 | void CameraMainWindow::postProcessVideo( const QString& infile, const QString& outfile ) | 542 | void CameraMainWindow::postProcessVideo( const QString& infile, const QString& outfile ) |
521 | { | 543 | { |
544 | odebug << "post processing " << infile << " --> " << outfile << oendl; | ||
545 | |||
522 | preview->setRefreshingRate( 0 ); | 546 | preview->setRefreshingRate( 0 ); |
523 | 547 | ||
524 | /* | 548 | /* |
525 | unsigned char buf[153600]; | 549 | unsigned char buf[153600]; |
@@ -595,9 +619,9 @@ void CameraMainWindow::postProcessVideo( const QString& infile, const QString& o | |||
595 | preview->setPixmap( p ); | 619 | preview->setPixmap( p ); |
596 | preview->repaint(); | 620 | preview->repaint(); |
597 | qApp->processEvents(); | 621 | qApp->processEvents(); |
598 | 622 | ||
599 | #ifndef QT_NO_DEBUG | 623 | #ifdef CAMERA_EXTRA_DEBUG |
600 | QString tmpfilename; | 624 | QString tmpfilename; |
601 | tmpfilename.sprintf( "/tmp/test/%04d.jpg", i ); | 625 | tmpfilename.sprintf( "/tmp/test/%04d.jpg", i ); |
602 | #else | 626 | #else |
603 | QString tmpfilename( "/tmp/tempfile" ); | 627 | QString tmpfilename( "/tmp/tempfile" ); |
@@ -620,15 +644,18 @@ void CameraMainWindow::postProcessVideo( const QString& infile, const QString& o | |||
620 | avi_add( outfd, tempbuffer, filesize ); | 644 | avi_add( outfd, tempbuffer, filesize ); |
621 | delete tempbuffer; | 645 | delete tempbuffer; |
622 | framefile.close(); | 646 | framefile.close(); |
623 | 647 | ||
624 | odebug << "deleting temporary capturefile " << infile << oendl; | ||
625 | ::close( infd ); | ||
626 | QFile::remove( infile ); | ||
627 | } | 648 | } |
628 | 649 | ||
629 | avi_end( outfd, captureX, captureY, _framerate ); | 650 | avi_end( outfd, captureX, captureY, _framerate ); |
630 | ::close( outfd ); | 651 | ::close( outfd ); |
652 | ::close( infd ); | ||
653 | |||
654 | label->setText( "deleting temp files..." ); | ||
655 | qApp->processEvents(); | ||
656 | odebug << "deleting temporary capturefile " << infile << oendl; | ||
657 | QFile::remove( infile ); | ||
631 | 658 | ||
632 | fr->hide(); | 659 | fr->hide(); |
633 | delete fr; | 660 | delete fr; |
634 | 661 | ||
@@ -642,8 +669,9 @@ void CameraMainWindow::updateCaption() | |||
642 | if ( !_capturing ) | 669 | if ( !_capturing ) |
643 | setCaption( QString().sprintf( "Opie-Camera: %dx%d %s q%d z%d (%s)", captureX, captureY, (const char*) captureFormat.lower(), quality, zoom, (const char*) flip ) ); | 670 | setCaption( QString().sprintf( "Opie-Camera: %dx%d %s q%d z%d (%s)", captureX, captureY, (const char*) captureFormat.lower(), quality, zoom, (const char*) flip ) ); |
644 | else | 671 | else |
645 | setCaption( "Opie-Camera: => CAPTURING <=" ); | 672 | setCaption( "Opie-Camera: => CAPTURING <=" ); |
673 | qApp->processEvents(); | ||
646 | } | 674 | } |
647 | 675 | ||
648 | 676 | ||
649 | #ifndef QT_NO_DEBUG | 677 | #ifndef QT_NO_DEBUG |
diff --git a/noncore/multimedia/camera/opie-camera.control b/noncore/multimedia/camera/opie-camera.control index a33de38..1731ad2 100644 --- a/noncore/multimedia/camera/opie-camera.control +++ b/noncore/multimedia/camera/opie-camera.control | |||
@@ -3,8 +3,8 @@ Files: bin/opiecam pics/camera apps/Applications/camera.desktop | |||
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org> | 5 | Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: $QPE_VERSION-$SUB_VERSION | 7 | Version: 1.0 |
8 | Depends: task-opie-minimal, libopie2 (1.8.1) | 8 | Depends: task-opie-minimal, libopie2 (1.8.1) |
9 | Description: A Camera Application | 9 | Description: A Camera Application |
10 | A Camera Application to use with the Sharp CE-AG06. | 10 | A Camera Application to use with the Sharp CE-AG06. |