Ignore:
Timestamp:
Feb 27, 2008, 11:49:37 AM (17 years ago)
Author:
garnier
Message:

debut de la boite de dialog pour les param video

File:
1 edited

Legend:

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

    r731 r732  
    301301  ,fHoldRotateEvent(false)
    302302  ,fAutoMove(false)
     303  ,fEncoderPath("")
     304  ,fTempFolderPath("/temp")
     305  ,fMovieParametersDialog(NULL)
    303306{
    304307#ifdef GEANT4_QT_DEBUG
    305   fEncoderPath = "";
    306308  printf("G4OpenGLQtViewer::G4OpenGLQtViewer \n");
    307309#endif
     
    14581460
    14591461void G4OpenGLQtViewer::showMovieParametersDialog() {
    1460   if (!movieParametersDialog) {
    1461     movieParametersDialog= new G4OpenGLQtMovieDialog(this,GLWindow);
    1462   }
    1463   movieParametersDialog->show();
     1462  if (!fMovieParametersDialog) {
     1463    fMovieParametersDialog= new G4OpenGLQtMovieDialog(this,GLWindow);
     1464  }
     1465  fMovieParametersDialog->show();
    14641466}
    14651467
     
    20742076
    20752077  if ((event->key() == Qt::Key_Return) || (event->key() == Qt::Key_Enter)){ // end of video
    2076     GLWidget->setCaption( tr( " Stop Recording " ));
    20772078    G4cout << "Stop Recording \n" << G4endl;
    20782079    G4cout << "Saving /temp/output.mpg \n" << G4endl;
     
    20892090    fRecordFrames = !fRecordFrames;
    20902091    if (fRecordFrames) {
    2091       GLWidget->setCaption( tr( " Start Recording " ));
    20922092      G4cout << " Start Recording \n" << G4endl;
    20932093    } else {
    2094       GLWidget->setCaption( tr( " Pause Recording" ));
    20952094      G4cout << "Pause Recording \n" << G4endl;
    20962095    }
     
    21352134 
    21362135     if (search.waitForFinished()) {
    2137        fEncoderPath = QString::fromLocal8Bit(search.readAll());
     2136       fEncoderPath = QString(QString::fromLocal8Bit(search.readAll())).trimmed();
    21382137       // if not found, return "not found"
    21392138       if (fEncoderPath.contains(" ")) {
     
    21502149/**
    21512150 * set the new encoder path
     2151 * @return true if the path exist and file is executable, false otherwise
    21522152*/
    2153 void G4OpenGLQtViewer::setEncoderPath(QString path) {
     2153bool G4OpenGLQtViewer::setEncoderPath(QString path) {
     2154  QFile *f = new QFile(path);
     2155  if (!f->exists()) {
     2156#ifdef GEANT4_QT_DEBUG
     2157  printf("G4OpenGLQtViewer::setEncoderPath NOT E        XIST\n");
     2158#endif
     2159    return false;
     2160  }
     2161  if (!(f->permissions() & QFile::ExeUser)) {
     2162#ifdef GEANT4_QT_DEBUG
     2163  printf("G4OpenGLQtViewer::setEncoderPath No WRITE ACCES\n");
     2164#endif
     2165    return false;
     2166  }
    21542167  fEncoderPath = path;
    2155 }
     2168  return true;
     2169}
     2170
     2171/**
     2172 * set the temp folder path
     2173 * @return true if the path exist and we could write in, false otherwise
     2174*/
     2175bool G4OpenGLQtViewer::setTempFolderPath(QString path) {
     2176
     2177  QDir *d = new QDir(path);
     2178  if (!d->exists(path)) {
     2179    return false;
     2180  }
     2181
     2182  d->setFilter( QDir::Dirs | QDir::Readable | QDir::Writable );
     2183  QStringList subDirList = d->entryList();
     2184  bool found = false;
     2185
     2186  for (QStringList::ConstIterator it = subDirList.begin() ;(it != subDirList.end()) ; it++) {
     2187    const QString currentDir = *it;
     2188   
     2189    if (currentDir == ".") { // we found it
     2190      found = true;
     2191    }
     2192  }
     2193
     2194  if (!found)
     2195    return false;
     2196 
     2197  fTempFolderPath = path;
     2198  return true;
     2199}
     2200
     2201/** @return the temp folder path
     2202 */
     2203QString G4OpenGLQtViewer::getTempFolderPath() {
     2204  return fTempFolderPath ;
     2205}
     2206 
     2207
    21562208 
    21572209
Note: See TracChangeset for help on using the changeset viewer.