Index: /trunk/geant4/visualization/OpenGL/src/G4OpenGLQtMovieDialog.cc
===================================================================
--- /trunk/geant4/visualization/OpenGL/src/G4OpenGLQtMovieDialog.cc	(revision 755)
+++ /trunk/geant4/visualization/OpenGL/src/G4OpenGLQtMovieDialog.cc	(revision 756)
@@ -25,5 +25,5 @@
 //
 //
-// $Id: G4OpenGLQtMovieDialog.cc,v 1.5 2008/03/11 17:35:11 lgarnier Exp $
+// $Id: G4OpenGLQtMovieDialog.cc,v 1.6 2008/03/14 09:22:31 lgarnier Exp $
 // GEANT4 tag $Name:  $
 //
@@ -325,8 +325,4 @@
 #endif
 
-  if (fParentViewer->getEncoderPath() == "") {
-    setRecordingInfos("mpeg_encode is needed to encode in video format. It is available here: http://bmrc.berkeley.edu/frame/research/mpeg/");
-  }
-  
   checkAllParameters();
 }
Index: /trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
===================================================================
--- /trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc	(revision 755)
+++ /trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc	(revision 756)
@@ -25,5 +25,5 @@
 //
 //
-// $Id: G4OpenGLQtViewer.cc,v 1.17 2008/03/11 17:35:11 lgarnier Exp $
+// $Id: G4OpenGLQtViewer.cc,v 1.21 2008/03/14 09:22:31 lgarnier Exp $
 // GEANT4 tag $Name:  $
 //
@@ -1319,5 +1319,5 @@
   
 #if QT_VERSION < 0x040000
-  res = image.save(filePath,"ppm");
+  res = image.save(filePath,"PPM");
 #else
   res = image.save(filePath,0);
@@ -1472,4 +1472,7 @@
     fMovieParametersDialog= new G4OpenGLQtMovieDialog(this,GLWindow);
     displayRecordingStatus();
+    if (getEncoderPath() == "") {
+      setRecordingInfos("mpeg_encode is needed to encode in video format. It is available here: http://bmrc.berkeley.edu/frame/research/mpeg/");
+    }
   }
   fMovieParametersDialog->show();
@@ -2001,7 +2004,4 @@
 void G4OpenGLQtViewer::G4keyPressEvent (QKeyEvent * event) 
 {
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::G4keyPressEvent \n");
-#endif
   if (fHoldKeyEvent)
     return;
@@ -2078,11 +2078,5 @@
   if (event->key() == Qt::Key_Escape) { // escaped from full screen
 #if QT_VERSION >= 0x030200
-    if (GLWindow->isFullScreen()) {
-#if QT_VERSION < 0x040000
-      fFullScreenOn->activated();
-#else
-      fFullScreenOn->trigger();
-#endif
-    }
+      toggleFullScreen(false);
 #endif
   }
@@ -2248,5 +2242,5 @@
      
 #if QT_VERSION < 0x040000
-     QObject ::connect(fProcess,SIGNAL(launchFinished ()),
+     QObject ::connect(fProcess,SIGNAL(processExited ()),
 		       this,SLOT(processLookForFinished()));
      fProcess->setCommunication(QProcess::DupStderr);
@@ -2368,5 +2362,7 @@
     return "Path does not exist";
   }
-
+  
+  QFileInfo *file = new QFileInfo(path);
+  QDir dir = file->dir();
 #if QT_VERSION < 0x040000
   path =  QDir::cleanDirPath(path);
@@ -2374,13 +2370,10 @@
   path =  QDir::cleanPath(path);
 #endif
-  QFileInfo *d = new QFileInfo(path);
-  if (!d->exists()) {
-    return "Path does not exist";
-  } else if (!d->isFile()) {
-    return "This is not a file";
-  } else if (!d->isReadable()) {
+  if (file->exists()) {
+    return "File already exist, please choose a new one";
+  } else if (!dir.exists()) {
+    return "Dir does not exist";
+  } else if (!dir.isReadable()) {
     return path +" is read protected";
-  } else if (!d->isWritable()) {
-    return path +" is write protected";
   }
   
@@ -2677,21 +2670,19 @@
 void G4OpenGLQtViewer::encodeVideo()
 {
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::encodeVideo \n");
-#endif
   if ((getEncoderPath() != "") && (getSaveFileName() != "")) {
     setRecordingStatus(ENCODING);
-    fProcess = new QProcess();
     
 #if QT_VERSION < 0x040000
-    QObject ::connect(fProcess,SIGNAL(launchFinished ()),
+    QStringList args = QStringList(fEncoderPath);
+    args.push_back(fMovieTempFolderPath+fParameterFileName);
+    fProcess = new QProcess(args);
+    QObject ::connect(fProcess,SIGNAL(processExited ()),
                       this,SLOT(processEncodeFinished()));
-    QObject ::connect(fProcess,SIGNAL(readyReadStdOut ()),
+    QObject ::connect(fProcess,SIGNAL(readyReadStdout ()),
                       this,SLOT(processEncodeStdout()));
     fProcess->setCommunication(QProcess::DupStderr);
-    fProcess->setArguments(QStringList(fEncoderPath));
-    fProcess->addArgument(fMovieTempFolderPath+fParameterFileName);
-    fProcess->start();
-#else
+    fProcess->launch("");
+#else
+    fProcess = new QProcess();
 #if QT_VERSION > 0x040100
     QObject ::connect(fProcess,SIGNAL(finished ( int,QProcess::ExitStatus)),
@@ -2709,10 +2700,8 @@
 #endif
   }
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::encodeVideo END\n");
-#endif
-}
-
-
+}
+
+
+// FIXME : does not work on Qt3
 void G4OpenGLQtViewer::processEncodeStdout()
 {
@@ -2732,7 +2721,4 @@
 void G4OpenGLQtViewer::processEncodeFinished()
 {
-#ifdef GEANT4_QT_DEBUG
-  printf("processEncodeFinished \n");
-#endif
 
   QString txt = "";
@@ -2744,7 +2730,4 @@
   }
   setRecordingInfos(txt+removeTempFolder());
-#ifdef GEANT4_QT_DEBUG
-  printf("processEncodeFinished END\n");
-#endif
 }
 
@@ -2781,31 +2764,33 @@
 
 QString G4OpenGLQtViewer::getProcessErrorMsg()
- {
-   QString txt = "";
-#if QT_VERSION < 0x040000
-   if (!fProcess->normalExit ()) {
-     txt = "Exist status "+ fProcess->exitStatus ();
-   }
-#else
-   switch (fProcess->error()) {
-   case QProcess::FailedToStart:
-     txt = "The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.\n";
-     break;
-   case QProcess::Crashed:
-     txt = "The process crashed some time after starting successfully.\n";
-     break;
-   case QProcess::Timedout:
-     txt = "The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again.\n";
-     break;
-   case QProcess::WriteError:
-     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";
-     break;
-   case QProcess::ReadError:
-     txt = "An error occurred when attempting to read from the process. For example, the process may not be running.\n";
-     break;
-   case QProcess::UnknownError:
-     txt = "An unknown error occurred. This is the default return value of error().\n";
-     break;
-   }
+{
+  QString txt = "";
+#if QT_VERSION < 0x040000
+  if (!fProcess->normalExit ()) {
+    txt = "Exist status "+ fProcess->exitStatus ();
+  }
+#else
+  if (fProcess->exitStatus() != QProcess::NormalExit) {
+    switch (fProcess->error()) {
+    case QProcess::FailedToStart:
+      txt = "The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.\n";
+      break;
+    case QProcess::Crashed:
+      txt = "The process crashed some time after starting successfully.\n";
+      break;
+    case QProcess::Timedout:
+      txt = "The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again.\n";
+      break;
+    case QProcess::WriteError:
+      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";
+      break;
+    case QProcess::ReadError:
+      txt = "An error occurred when attempting to read from the process. For example, the process may not be running.\n";
+      break;
+    case QProcess::UnknownError:
+      txt = "An unknown error occurred. This is the default return value of error().\n";
+      break;
+    }
+  }
 #endif
    return txt;
