Diffstat (limited to 'noncore/multimedia/camera/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/camera/mainwindow.cpp | 46 |
1 files changed, 37 insertions, 9 deletions
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 | |||
@@ -158,9 +158,9 @@ void CameraMainWindow::init() | |||
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 ); |
@@ -422,7 +422,15 @@ void CameraMainWindow::performCapture( const QString& format ) | |||
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 | ||
@@ -501,8 +509,22 @@ void CameraMainWindow::stopVideoCapture() | |||
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() ) ); |
@@ -519,6 +541,8 @@ void CameraMainWindow::stopVideoCapture() | |||
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 | /* |
@@ -596,7 +620,7 @@ void CameraMainWindow::postProcessVideo( const QString& infile, const QString& o | |||
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 |
@@ -621,13 +645,16 @@ void CameraMainWindow::postProcessVideo( const QString& infile, const QString& o | |||
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; |
@@ -643,6 +670,7 @@ void CameraMainWindow::updateCaption() | |||
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 | ||