Changeset 735 for trunk/geant4/visualization/OpenGL
- Timestamp:
- Mar 4, 2008, 5:27:31 PM (17 years ago)
- Location:
- trunk/geant4/visualization/OpenGL
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh
r733 r735 118 118 bool generatePS_PDF(QString,int,QImage); 119 119 void showMovieParametersDialog(); 120 void initMovieParameters(); 120 121 121 122 #if QT_VERSION < 0x040000 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtMovieDialog.cc
r734 r735 103 103 encoderVGroupBoxLayout->add(encoderHBox); 104 104 encoderVGroupBoxLayout->add(fEncoderStatus); 105 106 globalVLayout->add(encoderGroupBox); 105 107 #else 106 108 encoderHBoxLayout->addWidget(fEncoderPath); … … 108 110 encoderVGroupBoxLayout->addWidget(encoderHBox); 109 111 encoderVGroupBoxLayout->addWidget(fEncoderStatus); 110 #endif 111 112 #if QT_VERSION >= 0x040000 112 113 113 encoderGroupBox->setLayout(encoderVGroupBoxLayout); 114 #endif 114 globalVLayout->addWidget(encoderGroupBox); 115 #endif 116 115 117 connect( encoderButton, SIGNAL( clicked( ) ), this, SLOT(selectEncoderPathAction() ) ); 116 117 #if QT_VERSION < 0x040000118 globalVLayout->add(encoderGroupBox);119 #else120 globalVLayout->addWidget(encoderGroupBox);121 #endif122 118 123 119 fEncoderPath->setText(fParentViewer->getEncoderPath()); … … 145 141 tempFolderVGroupBoxLayout->add(tempFolderHBox); 146 142 tempFolderVGroupBoxLayout->add(fTempFolderStatus); 143 144 globalVLayout->add(tempFolderGroupBox); 147 145 #else 148 146 tempFolderHBoxLayout->addWidget(fTempFolderPath); … … 150 148 tempFolderVGroupBoxLayout->addWidget(tempFolderHBox); 151 149 tempFolderVGroupBoxLayout->addWidget(fTempFolderStatus); 152 #endif 153 154 #if QT_VERSION >= 0x040000 150 155 151 tempFolderGroupBox->setLayout(tempFolderVGroupBoxLayout); 156 #endif 152 globalVLayout->addWidget(tempFolderGroupBox); 153 #endif 154 157 155 connect( tempButton, SIGNAL( clicked( ) ), this, SLOT(selectTempPathAction() ) ); 158 159 #if QT_VERSION < 0x040000160 globalVLayout->add(tempFolderGroupBox);161 #else162 globalVLayout->addWidget(tempFolderGroupBox);163 #endif164 156 165 157 fTempFolderPath->setText(fParentViewer->getTempFolderPath()); … … 188 180 saveFileVGroupBoxLayout->add(saveFileHBox); 189 181 saveFileVGroupBoxLayout->add(fSaveFileStatus); 182 183 globalVLayout->add(saveFileGroupBox); 190 184 #else 191 185 saveFileHBoxLayout->addWidget(fSaveFileName); … … 193 187 saveFileVGroupBoxLayout->addWidget(saveFileHBox); 194 188 saveFileVGroupBoxLayout->addWidget(fSaveFileStatus); 195 #endif 196 197 #if QT_VERSION >= 0x040000 189 198 190 saveFileGroupBox->setLayout(saveFileVGroupBoxLayout); 199 #endif 191 globalVLayout->addWidget(saveFileGroupBox); 192 #endif 193 200 194 connect( saveButton, SIGNAL( clicked( ) ), this, SLOT(selectSaveFileNameAction() ) ); 201 195 202 #if QT_VERSION < 0x040000203 globalVLayout->add(saveFileGroupBox);204 #else205 globalVLayout->addWidget(saveFileGroupBox);206 #endif207 196 208 197 … … 212 201 213 202 // global status 214 fGlobalStatus = new QLabel(""); 215 216 #if QT_VERSION < 0x040000 203 QGroupBox *statusGroupBox = new QGroupBox(tr("Status")); 204 QVBoxLayout *statusVGroupBoxLayout = new QVBoxLayout(statusGroupBox); 205 fGlobalStatus = new QLabel(statusGroupBox); 206 fGlobalStatus->setText(""); 207 208 #if QT_VERSION < 0x040000 209 statusVGroupBoxLayout->add(fGlobalStatus); 210 217 211 globalVLayout->add(infoLabel); 218 globalVLayout->add(fGlobalStatus); 219 #else 212 globalVLayout->add(statusGroupBox); 213 #else 214 statusVGroupBoxLayout->addWidget(fGlobalStatus); 215 216 statusGroupBox->setLayout(statusVGroupBoxLayout); 220 217 globalVLayout->addWidget(infoLabel); 221 globalVLayout->addWidget( fGlobalStatus);218 globalVLayout->addWidget(statusGroupBox); 222 219 #endif 223 220 … … 236 233 237 234 QPushButton * buttonEncode = new QPushButton( tr( "&Encode" ),buttonBox ); 235 buttonEncode->setEnabled(false); 238 236 buttonEncode->setAutoDefault( TRUE ); 239 237 buttonEncode->setDefault( TRUE ); … … 320 318 if (temp != "") { 321 319 palette.setColor( QPalette::Base, Qt::red); 322 fGlobalStatus->setText("If no valid encode defined, screnn /ncapture files will be saved in /nthetemp folder in ppm format.");320 fGlobalStatus->setText("If no valid encode defined, screnn \ncapture files will be saved in the\ntemp folder in ppm format."); 323 321 } else { 324 322 palette.setColor( QPalette::Base, Qt::white); -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r733 r735 301 301 ,fHoldRotateEvent(false) 302 302 ,fAutoMove(false) 303 ,fEncoderPath("")304 ,fTempFolderPath("/temp")305 303 ,fMovieParametersDialog(NULL) 306 304 { 305 initMovieParameters(); 307 306 #ifdef GEANT4_QT_DEBUG 308 307 printf("G4OpenGLQtViewer::G4OpenGLQtViewer \n"); … … 2145 2144 2146 2145 2147 /** @return if encoder path was not specified, try to guess it. 2148 * if path was already specified, return it.Else return "" 2146 /** @return encoder path or "" if it does not exist 2149 2147 */ 2150 2148 QString G4OpenGLQtViewer::getEncoderPath() { 2151 2149 2152 if (fEncoderPath.isNull()) 2153 fEncoderPath =""; 2154 if (fEncoderPath.isEmpty()) { 2155 2156 //look for encoderPath 2150 if (!fEncoderPath.isNull()) 2151 return fEncoderPath ; 2152 return ""; 2153 } 2154 2155 2156 /** 2157 * set the new encoder path 2158 * @return "" if correct. The error otherwise 2159 */ 2160 QString G4OpenGLQtViewer::setEncoderPath(QString path) { 2161 if (path == "") { 2162 return "Path does not exist"; 2163 } 2164 QFile *f = new QFile(path); 2165 if (!f->exists()) { 2166 return "Path does not exist"; 2167 } 2168 if (!(f->permissions() & QFile::ExeUser)) { 2169 return "File exist but is not executable"; 2170 } 2171 fEncoderPath = path; 2172 return ""; 2173 } 2174 2175 /** 2176 * set the temp folder path 2177 * @return "" if correct. The error otherwise 2178 */ 2179 QString G4OpenGLQtViewer::setTempFolderPath(QString path) { 2180 2181 if (path == "") { 2182 return "Path does not exist"; 2183 } 2184 QDir *d = new QDir(path); 2185 if (!d->exists(path)) { 2186 return "Path does not exist"; 2187 } 2188 2189 d->setFilter( QDir::Dirs | QDir::Readable | QDir::Writable ); 2190 QStringList subDirList = d->entryList(); 2191 bool found = false; 2192 2193 for (QStringList::ConstIterator it = subDirList.begin() ;(it != subDirList.end()) ; it++) { 2194 const QString currentDir = *it; 2195 2196 if (currentDir == ".") { // we found it 2197 found = true; 2198 } 2199 } 2200 2201 if (!found) 2202 return "Path exist, but is not write accessible"; 2203 2204 fTempFolderPath = path; 2205 return ""; 2206 } 2207 2208 /** @return the temp folder path or "" if it does not exist 2209 */ 2210 QString G4OpenGLQtViewer::getTempFolderPath() { 2211 if (!fTempFolderPath.isNull()) 2212 return fTempFolderPath ; 2213 return ""; 2214 } 2215 2216 /** 2217 * set the save file name path 2218 * @return "" if correct. The error otherwise 2219 */ 2220 QString G4OpenGLQtViewer::setSaveFileName(QString path) { 2221 2222 if (path == "") { 2223 return "Path does not exist"; 2224 } 2225 QDir *d = new QDir(path); 2226 if (!d->exists(path)) { 2227 return "Path does not exist"; 2228 } 2229 2230 d->setFilter( QDir::Dirs | QDir::Readable | QDir::Writable ); 2231 QStringList subDirList = d->entryList(); 2232 bool found = false; 2233 2234 for (QStringList::ConstIterator it = subDirList.begin() ;(it != subDirList.end()) ; it++) { 2235 const QString currentDir = *it; 2236 2237 if (currentDir == ".") { // we found it 2238 found = true; 2239 } 2240 } 2241 2242 if (!found) 2243 return "Path exist, but is not write accessible"; 2244 2245 fSaveFileName = path; 2246 return ""; 2247 } 2248 2249 /** @return the save file path 2250 */ 2251 QString G4OpenGLQtViewer::getSaveFileName() { 2252 return fSaveFileName ; 2253 } 2254 2255 /** Init the movie parameters. Temp dir and encoder path 2256 */ 2257 void G4OpenGLQtViewer::initMovieParameters() { 2258 #ifdef GEANT4_QT_DEBUG 2259 printf("G4OpenGLQtViewer::--------\n"); 2260 #endif 2261 //init encoder 2262 2263 //look for encoderPath 2157 2264 QProcess search; 2158 2265 search.setReadChannelMode(QProcess::MergedChannels); … … 2168 2275 } 2169 2276 } 2170 } 2171 return fEncoderPath ; 2172 } 2173 2174 2175 /** 2176 * set the new encoder path 2177 * @return "" if correct. The error otherwise 2178 */ 2179 QString G4OpenGLQtViewer::setEncoderPath(QString path) { 2180 QFile *f = new QFile(path); 2181 if (!f->exists()) { 2182 #ifdef GEANT4_QT_DEBUG 2183 printf("G4OpenGLQtViewer::setEncoderPath NOT EXIST\n"); 2184 #endif 2185 return "Path does not exist"; 2186 } 2187 if (!(f->permissions() & QFile::ExeUser)) { 2188 #ifdef GEANT4_QT_DEBUG 2189 printf("G4OpenGLQtViewer::setEncoderPath No WRITE ACCES\n"); 2190 #endif 2191 return "File exist but is not executable"; 2192 } 2193 fEncoderPath = path; 2194 return ""; 2195 } 2196 2197 /** 2198 * set the temp folder path 2199 * @return "" if correct. The error otherwise 2200 */ 2201 QString G4OpenGLQtViewer::setTempFolderPath(QString path) { 2202 2203 QDir *d = new QDir(path); 2204 if (!d->exists(path)) { 2205 return "Path does not exist"; 2206 } 2207 2208 d->setFilter( QDir::Dirs | QDir::Readable | QDir::Writable ); 2209 QStringList subDirList = d->entryList(); 2210 bool found = false; 2211 2212 for (QStringList::ConstIterator it = subDirList.begin() ;(it != subDirList.end()) ; it++) { 2213 const QString currentDir = *it; 2214 2215 if (currentDir == ".") { // we found it 2216 found = true; 2217 } 2218 } 2219 2220 if (!found) 2221 return "Path exist, but is not write accessible"; 2222 2223 fTempFolderPath = path; 2224 return ""; 2225 } 2226 2227 /** @return the temp folder path 2228 */ 2229 QString G4OpenGLQtViewer::getTempFolderPath() { 2230 return fTempFolderPath ; 2231 } 2232 2233 /** 2234 * set the save file name path 2235 * @return "" if correct. The error otherwise 2236 */ 2237 QString G4OpenGLQtViewer::setSaveFileName(QString path) { 2238 2239 QDir *d = new QDir(path); 2240 if (!d->exists(path)) { 2241 return "Path does not exist"; 2242 } 2243 2244 d->setFilter( QDir::Dirs | QDir::Readable | QDir::Writable ); 2245 QStringList subDirList = d->entryList(); 2246 bool found = false; 2247 2248 for (QStringList::ConstIterator it = subDirList.begin() ;(it != subDirList.end()) ; it++) { 2249 const QString currentDir = *it; 2250 2251 if (currentDir == ".") { // we found it 2252 found = true; 2253 } 2254 } 2255 2256 if (!found) 2257 return "Path exist, but is not write accessible"; 2258 2259 fSaveFileName = path; 2260 return ""; 2261 } 2262 2263 /** @return the save file path 2264 */ 2265 QString G4OpenGLQtViewer::getSaveFileName() { 2266 return fSaveFileName ; 2267 } 2268 2269 2277 setEncoderPath(fEncoderPath); 2278 // init temp folder 2279 setTempFolderPath(QDir::temp ().absolutePath ()); 2280 #ifdef GEANT4_QT_DEBUG 2281 printf("G4OpenGLQtViewer::--------\n"); 2282 #endif 2283 } 2270 2284 2271 2285
Note: See TracChangeset
for help on using the changeset viewer.