Ignore:
Timestamp:
Mar 14, 2008, 10:23:29 AM (16 years ago)
Author:
garnier
Message:

error correct on Qt3.3. Improvement for movie

Location:
trunk/geant4/visualization/OpenGL/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtMovieDialog.cc

    r755 r756  
    2525//
    2626//
    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 $
    2828// GEANT4 tag $Name:  $
    2929//
     
    325325#endif
    326326
    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  
    331327  checkAllParameters();
    332328}
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r755 r756  
    2525//
    2626//
    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 $
    2828// GEANT4 tag $Name:  $
    2929//
     
    13191319 
    13201320#if QT_VERSION < 0x040000
    1321   res = image.save(filePath,"ppm");
     1321  res = image.save(filePath,"PPM");
    13221322#else
    13231323  res = image.save(filePath,0);
     
    14721472    fMovieParametersDialog= new G4OpenGLQtMovieDialog(this,GLWindow);
    14731473    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    }
    14741477  }
    14751478  fMovieParametersDialog->show();
     
    20012004void G4OpenGLQtViewer::G4keyPressEvent (QKeyEvent * event)
    20022005{
    2003 #ifdef GEANT4_QT_DEBUG
    2004   printf("G4OpenGLQtViewer::G4keyPressEvent \n");
    2005 #endif
    20062006  if (fHoldKeyEvent)
    20072007    return;
     
    20782078  if (event->key() == Qt::Key_Escape) { // escaped from full screen
    20792079#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);
    20872081#endif
    20882082  }
     
    22482242     
    22492243#if QT_VERSION < 0x040000
    2250      QObject ::connect(fProcess,SIGNAL(launchFinished ()),
     2244     QObject ::connect(fProcess,SIGNAL(processExited ()),
    22512245                       this,SLOT(processLookForFinished()));
    22522246     fProcess->setCommunication(QProcess::DupStderr);
     
    23682362    return "Path does not exist";
    23692363  }
    2370 
     2364 
     2365  QFileInfo *file = new QFileInfo(path);
     2366  QDir dir = file->dir();
    23712367#if QT_VERSION < 0x040000
    23722368  path =  QDir::cleanDirPath(path);
     
    23742370  path =  QDir::cleanPath(path);
    23752371#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()) {
    23822377    return path +" is read protected";
    2383   } else if (!d->isWritable()) {
    2384     return path +" is write protected";
    23852378  }
    23862379 
     
    26772670void G4OpenGLQtViewer::encodeVideo()
    26782671{
    2679 #ifdef GEANT4_QT_DEBUG
    2680   printf("G4OpenGLQtViewer::encodeVideo \n");
    2681 #endif
    26822672  if ((getEncoderPath() != "") && (getSaveFileName() != "")) {
    26832673    setRecordingStatus(ENCODING);
    2684     fProcess = new QProcess();
    26852674   
    26862675#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 ()),
    26882680                      this,SLOT(processEncodeFinished()));
    2689     QObject ::connect(fProcess,SIGNAL(readyReadStdOut ()),
     2681    QObject ::connect(fProcess,SIGNAL(readyReadStdout ()),
    26902682                      this,SLOT(processEncodeStdout()));
    26912683    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();
    26962687#if QT_VERSION > 0x040100
    26972688    QObject ::connect(fProcess,SIGNAL(finished ( int,QProcess::ExitStatus)),
     
    27092700#endif
    27102701  }
    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
    27172706void G4OpenGLQtViewer::processEncodeStdout()
    27182707{
     
    27322721void G4OpenGLQtViewer::processEncodeFinished()
    27332722{
    2734 #ifdef GEANT4_QT_DEBUG
    2735   printf("processEncodeFinished \n");
    2736 #endif
    27372723
    27382724  QString txt = "";
     
    27442730  }
    27452731  setRecordingInfos(txt+removeTempFolder());
    2746 #ifdef GEANT4_QT_DEBUG
    2747   printf("processEncodeFinished END\n");
    2748 #endif
    27492732}
    27502733
     
    27812764
    27822765QString 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  }
    28102795#endif
    28112796   return txt;
Note: See TracChangeset for help on using the changeset viewer.