Changeset 756 for trunk/geant4
- Timestamp:
- Mar 14, 2008, 10:23:29 AM (17 years ago)
- Location:
- trunk/geant4/visualization/OpenGL/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtMovieDialog.cc
r755 r756 25 25 // 26 26 // 27 // $Id: G4OpenGLQtMovieDialog.cc,v 1. 5 2008/03/11 17:35:11 lgarnier Exp $27 // $Id: G4OpenGLQtMovieDialog.cc,v 1.6 2008/03/14 09:22:31 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 325 325 #endif 326 326 327 if (fParentViewer->getEncoderPath() == "") {328 setRecordingInfos("mpeg_encode is needed to encode in video format. It is available here: http://bmrc.berkeley.edu/frame/research/mpeg/");329 }330 331 327 checkAllParameters(); 332 328 } -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r755 r756 25 25 // 26 26 // 27 // $Id: G4OpenGLQtViewer.cc,v 1. 17 2008/03/11 17:35:11 lgarnier Exp $27 // $Id: G4OpenGLQtViewer.cc,v 1.21 2008/03/14 09:22:31 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 1319 1319 1320 1320 #if QT_VERSION < 0x040000 1321 res = image.save(filePath," ppm");1321 res = image.save(filePath,"PPM"); 1322 1322 #else 1323 1323 res = image.save(filePath,0); … … 1472 1472 fMovieParametersDialog= new G4OpenGLQtMovieDialog(this,GLWindow); 1473 1473 displayRecordingStatus(); 1474 if (getEncoderPath() == "") { 1475 setRecordingInfos("mpeg_encode is needed to encode in video format. It is available here: http://bmrc.berkeley.edu/frame/research/mpeg/"); 1476 } 1474 1477 } 1475 1478 fMovieParametersDialog->show(); … … 2001 2004 void G4OpenGLQtViewer::G4keyPressEvent (QKeyEvent * event) 2002 2005 { 2003 #ifdef GEANT4_QT_DEBUG2004 printf("G4OpenGLQtViewer::G4keyPressEvent \n");2005 #endif2006 2006 if (fHoldKeyEvent) 2007 2007 return; … … 2078 2078 if (event->key() == Qt::Key_Escape) { // escaped from full screen 2079 2079 #if QT_VERSION >= 0x030200 2080 if (GLWindow->isFullScreen()) { 2081 #if QT_VERSION < 0x040000 2082 fFullScreenOn->activated(); 2083 #else 2084 fFullScreenOn->trigger(); 2085 #endif 2086 } 2080 toggleFullScreen(false); 2087 2081 #endif 2088 2082 } … … 2248 2242 2249 2243 #if QT_VERSION < 0x040000 2250 QObject ::connect(fProcess,SIGNAL( launchFinished ()),2244 QObject ::connect(fProcess,SIGNAL(processExited ()), 2251 2245 this,SLOT(processLookForFinished())); 2252 2246 fProcess->setCommunication(QProcess::DupStderr); … … 2368 2362 return "Path does not exist"; 2369 2363 } 2370 2364 2365 QFileInfo *file = new QFileInfo(path); 2366 QDir dir = file->dir(); 2371 2367 #if QT_VERSION < 0x040000 2372 2368 path = QDir::cleanDirPath(path); … … 2374 2370 path = QDir::cleanPath(path); 2375 2371 #endif 2376 QFileInfo *d = new QFileInfo(path); 2377 if (!d->exists()) { 2378 return "Path does not exist"; 2379 } else if (!d->isFile()) { 2380 return "This is not a file"; 2381 } else if (!d->isReadable()) { 2372 if (file->exists()) { 2373 return "File already exist, please choose a new one"; 2374 } else if (!dir.exists()) { 2375 return "Dir does not exist"; 2376 } else if (!dir.isReadable()) { 2382 2377 return path +" is read protected"; 2383 } else if (!d->isWritable()) {2384 return path +" is write protected";2385 2378 } 2386 2379 … … 2677 2670 void G4OpenGLQtViewer::encodeVideo() 2678 2671 { 2679 #ifdef GEANT4_QT_DEBUG2680 printf("G4OpenGLQtViewer::encodeVideo \n");2681 #endif2682 2672 if ((getEncoderPath() != "") && (getSaveFileName() != "")) { 2683 2673 setRecordingStatus(ENCODING); 2684 fProcess = new QProcess();2685 2674 2686 2675 #if QT_VERSION < 0x040000 2687 QObject ::connect(fProcess,SIGNAL(launchFinished ()), 2676 QStringList args = QStringList(fEncoderPath); 2677 args.push_back(fMovieTempFolderPath+fParameterFileName); 2678 fProcess = new QProcess(args); 2679 QObject ::connect(fProcess,SIGNAL(processExited ()), 2688 2680 this,SLOT(processEncodeFinished())); 2689 QObject ::connect(fProcess,SIGNAL(readyReadStd Out ()),2681 QObject ::connect(fProcess,SIGNAL(readyReadStdout ()), 2690 2682 this,SLOT(processEncodeStdout())); 2691 2683 fProcess->setCommunication(QProcess::DupStderr); 2692 fProcess->setArguments(QStringList(fEncoderPath)); 2693 fProcess->addArgument(fMovieTempFolderPath+fParameterFileName); 2694 fProcess->start(); 2695 #else 2684 fProcess->launch(""); 2685 #else 2686 fProcess = new QProcess(); 2696 2687 #if QT_VERSION > 0x040100 2697 2688 QObject ::connect(fProcess,SIGNAL(finished ( int,QProcess::ExitStatus)), … … 2709 2700 #endif 2710 2701 } 2711 #ifdef GEANT4_QT_DEBUG 2712 printf("G4OpenGLQtViewer::encodeVideo END\n"); 2713 #endif 2714 } 2715 2716 2702 } 2703 2704 2705 // FIXME : does not work on Qt3 2717 2706 void G4OpenGLQtViewer::processEncodeStdout() 2718 2707 { … … 2732 2721 void G4OpenGLQtViewer::processEncodeFinished() 2733 2722 { 2734 #ifdef GEANT4_QT_DEBUG2735 printf("processEncodeFinished \n");2736 #endif2737 2723 2738 2724 QString txt = ""; … … 2744 2730 } 2745 2731 setRecordingInfos(txt+removeTempFolder()); 2746 #ifdef GEANT4_QT_DEBUG2747 printf("processEncodeFinished END\n");2748 #endif2749 2732 } 2750 2733 … … 2781 2764 2782 2765 QString G4OpenGLQtViewer::getProcessErrorMsg() 2783 { 2784 QString txt = ""; 2785 #if QT_VERSION < 0x040000 2786 if (!fProcess->normalExit ()) { 2787 txt = "Exist status "+ fProcess->exitStatus (); 2788 } 2789 #else 2790 switch (fProcess->error()) { 2791 case QProcess::FailedToStart: 2792 txt = "The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.\n"; 2793 break; 2794 case QProcess::Crashed: 2795 txt = "The process crashed some time after starting successfully.\n"; 2796 break; 2797 case QProcess::Timedout: 2798 txt = "The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again.\n"; 2799 break; 2800 case QProcess::WriteError: 2801 txt = "An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.\n"; 2802 break; 2803 case QProcess::ReadError: 2804 txt = "An error occurred when attempting to read from the process. For example, the process may not be running.\n"; 2805 break; 2806 case QProcess::UnknownError: 2807 txt = "An unknown error occurred. This is the default return value of error().\n"; 2808 break; 2809 } 2766 { 2767 QString txt = ""; 2768 #if QT_VERSION < 0x040000 2769 if (!fProcess->normalExit ()) { 2770 txt = "Exist status "+ fProcess->exitStatus (); 2771 } 2772 #else 2773 if (fProcess->exitStatus() != QProcess::NormalExit) { 2774 switch (fProcess->error()) { 2775 case QProcess::FailedToStart: 2776 txt = "The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.\n"; 2777 break; 2778 case QProcess::Crashed: 2779 txt = "The process crashed some time after starting successfully.\n"; 2780 break; 2781 case QProcess::Timedout: 2782 txt = "The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again.\n"; 2783 break; 2784 case QProcess::WriteError: 2785 txt = "An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.\n"; 2786 break; 2787 case QProcess::ReadError: 2788 txt = "An error occurred when attempting to read from the process. For example, the process may not be running.\n"; 2789 break; 2790 case QProcess::UnknownError: 2791 txt = "An unknown error occurred. This is the default return value of error().\n"; 2792 break; 2793 } 2794 } 2810 2795 #endif 2811 2796 return txt;
Note: See TracChangeset
for help on using the changeset viewer.