Changeset 751 for trunk/geant4
- Timestamp:
- Mar 10, 2008, 4:41:42 PM (17 years ago)
- Location:
- trunk/geant4/visualization/OpenGL
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtMovieDialog.hh
r750 r751 90 90 void encode(); 91 91 void resetRecording(); 92 void enabledApplyButton(); 92 93 }; 93 94 -
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh
r750 r751 117 117 private: 118 118 enum mouseActions {STYLE1,STYLE2,STYLE3,STYLE4}; 119 enum RECORDING_STEP {WAIT,START,PAUSE,CONTINUE,STOP,READY_TO_ENCODE,ENCOD E,FAILED,SUCCESS};119 enum RECORDING_STEP {WAIT,START,PAUSE,CONTINUE,STOP,READY_TO_ENCODE,ENCODING,FAILED,SUCCESS}; 120 120 121 121 void createPopupMenu(); -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtMovieDialog.cc
r750 r751 244 244 fButtonApply = new QPushButton( tr( "&Apply" ),buttonBox ); 245 245 fButtonApply->setAutoDefault( TRUE ); 246 fButtonApply->setEnabled(true);246 enabledApplyButton(); 247 247 buttonBoxLayout->addWidget(fButtonApply); 248 248 … … 275 275 276 276 // 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())); 280 284 281 285 if (fParentViewer->getEncoderPath() == "") { … … 442 446 } 443 447 444 #endif 448 449 void G4OpenGLQtMovieDialog::enabledApplyButton() { 450 fButtonApply->setEnabled(true); 451 } 452 453 #endif -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r750 r751 2189 2189 } else if (step == READY_TO_ENCODE) { 2190 2190 txt = "Ready to Encode..."; 2191 } else if (step == ENCOD E) {2191 } else if (step == ENCODING) { 2192 2192 txt = "Encoding..."; 2193 2193 } else if (step == FAILED) { 2194 2194 txt = "Failed to encode..."; 2195 } else if (step == SUCCESS) { 2196 txt = "File encoded successfully"; 2195 2197 } else { 2196 2198 } … … 2420 2422 } 2421 2423 2422 d->setFilter( QDir::Readable | QDir::Writable);2424 d->setFilter( QDir::Files ); 2423 2425 QStringList subDirList = d->entryList(); 2424 2426 int res = true; … … 2426 2428 for (QStringList::ConstIterator it = subDirList.begin() ;(it != subDirList.end()) ; it++) { 2427 2429 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 } 2433 2436 } 2434 2437 if (res) { … … 2578 2581 fprintf (fp,"#\n"); 2579 2582 fprintf (fp,"#\n"); 2580 fprintf (fp,"Test*.ppm [0-%d]\n",fRecordFrameNumber );2583 fprintf (fp,"Test*.ppm [0-%d]\n",fRecordFrameNumber-1); 2581 2584 fprintf (fp,"# can have more files here if you want...there is no limit on the number\n"); 2582 2585 fprintf (fp,"# of files\n"); … … 2653 2656 #endif 2654 2657 if ((getEncoderPath() != "") && (getSaveFileName() != "")) { 2658 setRecordingStatus(ENCODING); 2655 2659 fProcess = new QProcess(); 2656 fProcess-> execute(fEncoderPath, QStringList(fMovieTempFolderPath+fParameterFileName));2660 fProcess->start (fEncoderPath, QStringList(fMovieTempFolderPath+fParameterFileName)); 2657 2661 #if QT_VERSION > 0x040100 2658 2662 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())); 2660 2666 #else 2661 2667 #if QT_VERSION > 0x040000 … … 2680 2686 void G4OpenGLQtViewer::processStdout() 2681 2687 { 2682 #ifdef GEANT4_QT_DEBUG2683 printf("processStdout \n");2684 #endif2685 #ifdef GEANT4_QT_DEBUG2686 #if QT_VERSION > 0x0401002687 #else2688 2688 #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); 2699 2696 } 2700 2697 … … 2707 2704 2708 2705 QString txt = ""; 2709 if ( exitCode) {2706 if (!exitCode) { 2710 2707 setRecordingStatus(SUCCESS); 2711 2708 } else { 2712 QString txt;2713 2709 switch (fProcess->error()) { 2714 2710 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"; 2716 2712 break; 2717 2713 case QProcess::Crashed: 2718 txt = "The process crashed some time after starting successfully. ";2714 txt = "The process crashed some time after starting successfully.\n"; 2719 2715 break; 2720 2716 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"; 2722 2718 break; 2723 2719 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"; 2725 2721 break; 2726 2722 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"; 2728 2724 break; 2729 2725 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"; 2731 2727 break; 2732 2728 } 2733 2729 setRecordingStatus(FAILED); 2734 2730 } 2735 setRecordingInfos(txt+ "\n"+removeTempFolder());2731 setRecordingInfos(txt+removeTempFolder()); 2736 2732 #ifdef GEANT4_QT_DEBUG 2737 2733 printf("processFinished END\n");
Note: See TracChangeset
for help on using the changeset viewer.