Changeset 751 for trunk


Ignore:
Timestamp:
Mar 10, 2008, 4:41:42 PM (16 years ago)
Author:
garnier
Message:

corrections sur le removeTempFolder et autres

Location:
trunk/geant4/visualization/OpenGL
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLQtMovieDialog.hh

    r750 r751  
    9090  void encode();
    9191  void resetRecording();
     92  void enabledApplyButton();
    9293};
    9394
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh

    r750 r751  
    117117private:
    118118  enum mouseActions {STYLE1,STYLE2,STYLE3,STYLE4};
    119   enum RECORDING_STEP {WAIT,START,PAUSE,CONTINUE,STOP,READY_TO_ENCODE,ENCODE,FAILED,SUCCESS};
     119  enum RECORDING_STEP {WAIT,START,PAUSE,CONTINUE,STOP,READY_TO_ENCODE,ENCODING,FAILED,SUCCESS};
    120120
    121121  void createPopupMenu();
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtMovieDialog.cc

    r750 r751  
    244244  fButtonApply = new QPushButton( tr( "&Apply" ),buttonBox );
    245245  fButtonApply->setAutoDefault( TRUE );
    246   fButtonApply->setEnabled(true);
     246  enabledApplyButton();
    247247  buttonBoxLayout->addWidget(fButtonApply);
    248248
     
    275275
    276276  // connect line edit signals
    277   connect (fEncoderPath,SIGNAL(textEdited ( const QString&)),fButtonApply,SLOT(setEnabled(true)));
    278   connect (fTempFolderPath,SIGNAL(textEdited ( const QString&)),fButtonApply,SLOT(setEnabled(true)));
    279   connect (fSaveFileName,SIGNAL(textEdited ( const QString&)),fButtonApply,SLOT(setEnabled(true)));
     277  connect (fEncoderPath,SIGNAL(textEdited ( const QString&)),this,SLOT(enabledApplyButton()));
     278  connect (fTempFolderPath,SIGNAL(textEdited ( const QString&)),this,SLOT(enabledApplyButton()));
     279  connect (fSaveFileName,SIGNAL(textEdited ( const QString&)),this,SLOT(enabledApplyButton()));
     280
     281  connect (fEncoderPath,SIGNAL(editingFinished ()),this,SLOT(checkAllParameters()));
     282  connect (fTempFolderPath,SIGNAL(editingFinished ()),this,SLOT(checkAllParameters()));
     283  connect (fSaveFileName,SIGNAL(editingFinished ()),this,SLOT(checkAllParameters()));
    280284
    281285  if (fParentViewer->getEncoderPath() == "") {
     
    442446}
    443447
    444 #endif
     448
     449void G4OpenGLQtMovieDialog::enabledApplyButton() {
     450  fButtonApply->setEnabled(true);
     451}
     452
     453#endif
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r750 r751  
    21892189  } else if (step == READY_TO_ENCODE) {
    21902190    txt  = "Ready to Encode...";
    2191   } else if (step == ENCODE) {
     2191  } else if (step == ENCODING) {
    21922192    txt  = "Encoding...";
    21932193  } else if (step == FAILED) {
    21942194    txt  = "Failed to encode...";
     2195  } else if (step == SUCCESS) {
     2196    txt  = "File encoded successfully";
    21952197  } else {
    21962198  }
     
    24202422  }
    24212423
    2422   d->setFilter(QDir::Readable | QDir::Writable );
     2424  d->setFilter( QDir::Files );
    24232425  QStringList subDirList = d->entryList();
    24242426  int res = true;
     
    24262428  for (QStringList::ConstIterator it = subDirList.begin() ;(it != subDirList.end()) ; it++) {
    24272429    const QString currentFile = *it;
    2428     if (!d->remove(currentFile)) {
    2429       res = false;
    2430       QString file = fMovieTempFolderPath+currentFile;
    2431       error +="Removing file failed : "+file;
    2432     }
     2430      if (!d->remove(currentFile)) {
     2431        res = false;
     2432        QString file = fMovieTempFolderPath+currentFile;
     2433        error +="Removing file failed : "+file;
     2434      } else {
     2435      }
    24332436  }
    24342437  if (res) {
     
    25782581  fprintf (fp,"#\n");
    25792582  fprintf (fp,"#\n");
    2580   fprintf (fp,"Test*.ppm        [0-%d]\n",fRecordFrameNumber);
     2583  fprintf (fp,"Test*.ppm        [0-%d]\n",fRecordFrameNumber-1);
    25812584  fprintf (fp,"# can have more files here if you want...there is no limit on the number\n");
    25822585  fprintf (fp,"# of files\n");
     
    26532656#endif
    26542657  if ((getEncoderPath() != "") && (getSaveFileName() != "")) {
     2658    setRecordingStatus(ENCODING);
    26552659    fProcess = new QProcess();
    2656     fProcess->execute (fEncoderPath, QStringList(fMovieTempFolderPath+fParameterFileName));
     2660    fProcess->start (fEncoderPath, QStringList(fMovieTempFolderPath+fParameterFileName));
    26572661#if QT_VERSION > 0x040100
    26582662        QObject ::connect(fProcess,SIGNAL(finished ( int,QProcess::ExitStatus)),
    2659                       this,SLOT(processFinished( int));
     2663                      this,SLOT(processFinished( int)));
     2664        QObject ::connect(fProcess,SIGNAL(readyReadStandardOutput ()),
     2665                      this,SLOT(processStdout()));
    26602666#else
    26612667#if QT_VERSION > 0x040000
     
    26802686void G4OpenGLQtViewer::processStdout()
    26812687{
    2682 #ifdef GEANT4_QT_DEBUG
    2683   printf("processStdout \n");
    2684 #endif
    2685 #ifdef GEANT4_QT_DEBUG
    2686 #if QT_VERSION > 0x040100
    2687 #else
    26882688#if QT_VERSION > 0x040000
    2689   printf("processStdout %s\n",fProcess->readAllStandardOutput ().data());
    2690 #else
    2691   printf("processStdout %s\n",fProcess->readStdout ().data());
    2692 
    2693 #endif
    2694 #endif
    2695 #endif
    2696 #ifdef GEANT4_QT_DEBUG
    2697   printf("processStdout END\n");
    2698 #endif
     2689  QString tmp = fProcess->readAllStandardOutput ().data();
     2690#else
     2691  QString tmp = fProcess->readStdout ().data();
     2692#endif
     2693  int start = tmp.lastIndexOf("ESTIMATED TIME");
     2694  tmp = tmp.mid(start,tmp.indexOf("\n",start)-start);
     2695  setRecordingInfos(tmp);
    26992696}
    27002697
     
    27072704
    27082705  QString txt = "";
    2709   if (exitCode) {
     2706  if (!exitCode) {
    27102707    setRecordingStatus(SUCCESS);
    27112708  } else {
    2712     QString txt;
    27132709        switch (fProcess->error()) {
    27142710          case QProcess::FailedToStart:
    2715         txt = "The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.";
     2711        txt = "The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.\n";
    27162712                break;
    27172713          case QProcess::Crashed:
    2718         txt = "The process crashed some time after starting successfully.";
     2714        txt = "The process crashed some time after starting successfully.\n";
    27192715                break;
    27202716          case QProcess::Timedout:
    2721         txt = "The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again.";
     2717        txt = "The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again.\n";
    27222718                break;
    27232719          case QProcess::WriteError:
    2724         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.";
     2720        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";
    27252721            break;
    27262722          case QProcess::ReadError:
    2727         txt = "An error occurred when attempting to read from the process. For example, the process may not be running.";
     2723        txt = "An error occurred when attempting to read from the process. For example, the process may not be running.\n";
    27282724            break;
    27292725          case QProcess::UnknownError:
    2730         txt = "An unknown error occurred. This is the default return value of error().";
     2726        txt = "An unknown error occurred. This is the default return value of error().\n";
    27312727                break;
    27322728    }
    27332729    setRecordingStatus(FAILED);
    27342730  }
    2735   setRecordingInfos(txt+"\n"+removeTempFolder());
     2731  setRecordingInfos(txt+removeTempFolder());
    27362732#ifdef GEANT4_QT_DEBUG
    27372733  printf("processFinished END\n");
Note: See TracChangeset for help on using the changeset viewer.