void QMediaPlayerPrivate::loadPlaylist() { Q_Q(QMediaPlayer); Q_ASSERT(pendingPlaylist.isNull()); // Do not load a playlist if there are more than MAX_NESTED_PLAYLISTS in the chain already, // or if the playlist URL is already in the chain, i.e. do not allow recursive playlists and loops. if (nestedPlaylists < MAX_NESTED_PLAYLISTS && !q->currentMedia().canonicalUrl().isEmpty() && !isInChain(q->currentMedia().canonicalUrl())) { pendingPlaylist = QMediaContent(new QMediaPlaylist, q->currentMedia().canonicalUrl(), true); QObject::connect(pendingPlaylist.playlist(), SIGNAL(loaded()), q, SLOT(_q_handlePlaylistLoaded())); QObject::connect(pendingPlaylist.playlist(), SIGNAL(loadFailed()), q, SLOT(_q_handlePlaylistLoadFailed())); pendingPlaylist.playlist()->load(pendingPlaylist.canonicalRequest()); } else if (playlist) { playlist->next(); } }
void ossimQtIgenController::runIgen() { // Pointer sanity checks. if (!theWidget || !theWriter || !theDialog) { return; } // Make sure the output file name has been set. if (theOutputFile == ossimFilename::NIL) { QString caption("Notice:"); QString text = "You must specify an output file!"; // Give the user an already open QMessageBox::warning( theDialog, caption, text, QMessageBox::Ok, QMessageBox::NoButton); return; } // Check to see if file exist and prompt user for overrite. if (theOutputFile.exists()) { QString caption("Question:"); QString text = "Overwrite existing file: "; text += theOutputFile.c_str(); int answer = QMessageBox::question( theDialog, caption, text, QMessageBox::Yes, QMessageBox::No ); if (answer == QMessageBox::No) { theDialog->theOutputFileLineEdit->setText(""); return; } } #if 0 /* Temporarily commented out. (drb) */ //--- // Check to see if user wants batch mode in a separate process or to run // in this process with a progress dialog? //--- QString caption("Question:"); QString text = "Run in batch mode?\n"; text += "yes = Separtate process with no feed back.\n"; text += "no = In this process with a percent complete dialog."; int answer = QMessageBox::question( theDialog, caption, text, QMessageBox::Yes, QMessageBox::No); if (answer == QMessageBox::Yes) { runBatchIgen(); return; } #endif //--- // Check the chain to make sure the output file is not one of the input // files. //--- if ( isInChain(theOutputFile) ) { QString caption("Notice:"); QString text = "Your output file cannot be one of the input files!\n"; text += "Please select a new output file."; // Give the user a warning. QMessageBox::warning( theDialog, caption, text, QMessageBox::Ok, QMessageBox::NoButton); theDialog->theOutputFileLineEdit->setText(""); return; } // Make a spec file //--- ossimFilename spec_file = theOutputFile; spec_file.setExtension("spec"); if (theOutputFile == spec_file) { QString caption("Notice:"); QString text = "Your output file ends with \".spec\"\n"; text += "Please select a new output file."; // Give the user a warning. QMessageBox::warning( theDialog, caption, text, QMessageBox::Ok, QMessageBox::NoButton); theDialog->theOutputFileLineEdit->setText(""); return; } QString s = spec_file.c_str(); saveSpecFile(s); const ossimConnectableObject* widgetInput = theWidget->getInput(); if (!widgetInput) { return; } // Duplicate the widget's input ossimRefPtr<ossimConnectableObject> writerInput = duplicate(widgetInput); if (writerInput.valid() == false) { return; } // Set up the view(s) in the container and sync them by firing event. setContainerView(writerInput.get()); ossimPropertyEvent propEvt(writerInput.get()); writerInput->fireEvent(propEvt); writerInput->propagateEventToOutputs(propEvt); // Set the area of interest using a cutter. // ossimGeoPolyCutter* cutter = new ossimGeoPolyCutter; // cutter->setPolygon(theOutputGeoPolygon); // cutter->setView(theOutputView, false); // // Put the cutter into the chain at the end. // ossimImageChain* chain = PTR_CAST(ossimImageChain, writerInput.get()); // if (chain) // { // chain->addFirst(cutter); // } // else // { // return; // } // Connect writer to the cutter. theWriter->connectMyInputTo(0, writerInput.get()); // Set the output file. theWriter->setOutputName(theOutputFile); // Initialize. theWriter->initialize(); // Set the area of interest. ossimIrect aoi; if (getAreaOfInterest(aoi) == false) { return; } theWriter->setAreaOfInterest(aoi); // Make a progress dialog. ossimQtProgressDialog* pd = new ossimQtProgressDialog(""); pd->setMinimumDuration(250); // Update 4 times a second. //--- // Connect the progress dialog's signal "canceled()" up to our slot // "saveCanceled()" so that we can tell the writer to abort. //--- connect( pd, SIGNAL(canceled()), this, SLOT(abortClicked()) ); ossimProcessListener* pl = PTR_CAST(ossimProcessListener, pd); if (pl) { // Make the progress dialog a listener to the writer. theWriter->addListener(pl); } // Set up the progress dialog... QString qs = "Processing file "; qs += theOutputFile.c_str(); pd->setLabelText(qs); pd->show(); // Process the tile... bool exceptionCaught = false; try { theWriter->execute(); } catch(std::exception& e) { pd->close(); QString caption = "Exception caught!\n"; QString text = e.what(); QMessageBox::information( theDialog, caption, text, QMessageBox::Ok ); exceptionCaught = true; } catch (...) { pd->close(); QString caption = "Unknown exception caught!\n"; QString text = ""; QMessageBox::information( theDialog, caption, text, QMessageBox::Ok ); exceptionCaught = true; } // Close and disconnect for next run. theWriter->close(); theWriter->disconnectAllInputs(); // cutter = 0; writerInput = 0; if (exceptionCaught) { removeFile(); } else if (pd->wasCanceled()) { pd->close(); removeFile(); } if (pl) { theWriter->removeListener(pl); } // Cleanup... delete pd; pd = 0; if(theOutputFile.exists()) { ossimQtAddImageFileEvent event(theOutputFile); ossimQtApplicationUtility::sendEventToRoot(theDialog, &event); } }