void AfterEffectsBurner::slotProcessOutputLine( const QString & line, QProcess::ProcessChannel channel ) { bool com = line.contains( mCompleteRE ); bool framecom = line.contains( mFrameCompleteRE ); #ifdef Q_OS_MAC bool fatalMachError = line.contains(QRegExp("failed to name Mach port")); if( fatalMachError ) { logMessage(line); jobErrored("the Host has fatal Mach Errors until AB restarts."); mSlave->setStatus("restart"); } #endif if( framecom ) { if( taskStarted() ) { bool frameCheckFailure = false; if( !mJob.outputPath().endsWith( ".avi" ) && !mJob.outputPath().endsWith( ".mov" ) ) { QString framePath = makeFramePath( mJob.outputPath(), mFrame ); QFileInfo fi( framePath ); frameCheckFailure = !(fi.exists() && fi.isFile() && fi.size() > 0); if( !frameCheckFailure ) emit fileGenerated(framePath); QString log = QString("Frame %1 %2").arg(framePath).arg(frameCheckFailure ? "missing" : "found"); logMessage(log); } if( frameCheckFailure ) { jobErrored("AE: Got frame complete message, but frame doesn't exist or is zero bytes"); return; } logMessage("AE: Completed frame: " + QString::number(mFrame)); taskDone( mFrame ); mFrame++; if( !com && mFrame <= mFrameEnd ) taskStart( mFrame ); } } if( com ) { if( mJob.outputPath().endsWith( ".avi" ) || mJob.outputPath().endsWith( ".mov" ) ) emit fileGenerated(mJob.outputPath()); LOG_3("AEB::slotReadOutput emit'ing jobFinished()"); jobFinished(); return; } JobBurner::slotProcessOutputLine( line, channel ); }
bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { Q_UNUSED(errorMessage) Utils::MimeDatabase::addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml")); addAutoReleasedObject(new CppEditorFactory); addAutoReleasedObject(new CppOutlineWidgetFactory); addAutoReleasedObject(new CppTypeHierarchyFactory); addAutoReleasedObject(new CppIncludeHierarchyFactory); addAutoReleasedObject(new CppSnippetProvider); m_quickFixProvider = new CppQuickFixAssistProvider; addAutoReleasedObject(m_quickFixProvider); registerQuickFixes(this); Context context(Constants::CPPEDITOR_ID); ActionContainer *contextMenu = ActionManager::createMenu(Constants::M_CONTEXT); Command *cmd; ActionContainer *cppToolsMenu = ActionManager::actionContainer(CppTools::Constants::M_TOOLS_CPP); cmd = ActionManager::command(CppTools::Constants::SWITCH_HEADER_SOURCE); contextMenu->addAction(cmd); cmd = ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR); contextMenu->addAction(cmd); cppToolsMenu->addAction(cmd); QAction *openPreprocessorDialog = new QAction(tr("Additional Preprocessor Directives..."), this); cmd = ActionManager::registerAction(openPreprocessorDialog, Constants::OPEN_PREPROCESSOR_DIALOG, context); cmd->setDefaultKeySequence(QKeySequence()); connect(openPreprocessorDialog, SIGNAL(triggered()), this, SLOT(showPreProcessorDialog())); cppToolsMenu->addAction(cmd); QAction *switchDeclarationDefinition = new QAction(tr("Switch Between Function Declaration/Definition"), this); cmd = ActionManager::registerAction(switchDeclarationDefinition, Constants::SWITCH_DECLARATION_DEFINITION, context, true); cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F2"))); connect(switchDeclarationDefinition, SIGNAL(triggered()), this, SLOT(switchDeclarationDefinition())); contextMenu->addAction(cmd); cppToolsMenu->addAction(cmd); cmd = ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR_IN_NEXT_SPLIT); cppToolsMenu->addAction(cmd); QAction *openDeclarationDefinitionInNextSplit = new QAction(tr("Open Function Declaration/Definition in Next Split"), this); cmd = ActionManager::registerAction(openDeclarationDefinitionInNextSplit, Constants::OPEN_DECLARATION_DEFINITION_IN_NEXT_SPLIT, context, true); cmd->setDefaultKeySequence(QKeySequence(HostOsInfo::isMacHost() ? tr("Meta+E, Shift+F2") : tr("Ctrl+E, Shift+F2"))); connect(openDeclarationDefinitionInNextSplit, SIGNAL(triggered()), this, SLOT(openDeclarationDefinitionInNextSplit())); cppToolsMenu->addAction(cmd); m_findUsagesAction = new QAction(tr("Find Usages"), this); cmd = ActionManager::registerAction(m_findUsagesAction, Constants::FIND_USAGES, context); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U"))); connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages())); contextMenu->addAction(cmd); cppToolsMenu->addAction(cmd); m_openTypeHierarchyAction = new QAction(tr("Open Type Hierarchy"), this); cmd = ActionManager::registerAction(m_openTypeHierarchyAction, Constants::OPEN_TYPE_HIERARCHY, context); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+Shift+T") : tr("Ctrl+Shift+T"))); connect(m_openTypeHierarchyAction, SIGNAL(triggered()), this, SLOT(openTypeHierarchy())); contextMenu->addAction(cmd); cppToolsMenu->addAction(cmd); m_openIncludeHierarchyAction = new QAction(tr("Open Include Hierarchy"), this); cmd = ActionManager::registerAction(m_openIncludeHierarchyAction, Constants::OPEN_INCLUDE_HIERARCHY, context); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+Shift+I") : tr("Ctrl+Shift+I"))); connect(m_openIncludeHierarchyAction, SIGNAL(triggered()), this, SLOT(openIncludeHierarchy())); contextMenu->addAction(cmd); cppToolsMenu->addAction(cmd); // Refactoring sub-menu Command *sep = contextMenu->addSeparator(); sep->action()->setObjectName(QLatin1String(Constants::M_REFACTORING_MENU_INSERTION_POINT)); contextMenu->addSeparator(); m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol Under Cursor"), this); cmd = ActionManager::registerAction(m_renameSymbolUnderCursorAction, Constants::RENAME_SYMBOL_UNDER_CURSOR, context); cmd->setDefaultKeySequence(QKeySequence(tr("CTRL+SHIFT+R"))); connect(m_renameSymbolUnderCursorAction, SIGNAL(triggered()), this, SLOT(renameSymbolUnderCursor())); cppToolsMenu->addAction(cmd); // Update context in global context cppToolsMenu->addSeparator(); m_reparseExternallyChangedFiles = new QAction(tr("Reparse Externally Changed Files"), this); cmd = ActionManager::registerAction(m_reparseExternallyChangedFiles, Constants::UPDATE_CODEMODEL); CppTools::CppModelManager *cppModelManager = CppTools::CppModelManager::instance(); connect(m_reparseExternallyChangedFiles, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles())); cppToolsMenu->addAction(cmd); cppToolsMenu->addSeparator(); QAction *inspectCppCodeModel = new QAction(tr("Inspect C++ Code Model..."), this); cmd = ActionManager::registerAction(inspectCppCodeModel, Constants::INSPECT_CPP_CODEMODEL); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+Shift+F12") : tr("Ctrl+Shift+F12"))); connect(inspectCppCodeModel, SIGNAL(triggered()), this, SLOT(inspectCppCodeModel())); cppToolsMenu->addAction(cmd); contextMenu->addSeparator(context); cmd = ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION); contextMenu->addAction(cmd); cmd = ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION); contextMenu->addAction(cmd); connect(ProgressManager::instance(), SIGNAL(taskStarted(Core::Id)), this, SLOT(onTaskStarted(Core::Id))); connect(ProgressManager::instance(), SIGNAL(allTasksFinished(Core::Id)), this, SLOT(onAllTasksFinished(Core::Id))); return true; }
void AudioFileCopyConvert::process_task(CopyTask task) { emit taskStarted(task.readsource->get_name()); uint buffersize = 16384; DecodeBuffer decodebuffer; task.spec->startLocation = TimeRef(); task.spec->endLocation = task.readsource->get_length(); task.spec->totalTime = task.spec->endLocation; task.spec->pos = TimeRef(); task.spec->isRecording = false; task.spec->exportdir = task.dir; task.spec->writerType = "sndfile"; task.spec->extraFormat["filetype"] = "wav"; task.spec->data_width = 1; // 1 means float task.spec->channels = task.readsource->get_channel_count(); task.spec->sample_rate = task.readsource->get_rate(); task.spec->blocksize = buffersize; task.spec->name = task.outFileName; task.spec->dataF = new audio_sample_t[buffersize * 2]; WriteSource* writesource = new WriteSource(task.spec); bool failedToPrepareWritesource = false; int oldprogress = 0; if (writesource->prepare_export() == -1) { failedToPrepareWritesource = true; goto out; } // Enable on the fly generation of peak data to speedup conversion // (no need to re-read all the audio files to generate peaks) writesource->set_process_peaks(true); do { // if the user asked to stop processing, jump out of this // loop, and cleanup any resources in use. if (m_stopProcessing) { goto out; } nframes_t diff = (task.spec->endLocation - task.spec->pos).to_frame(task.readsource->get_rate()); nframes_t this_nframes = std::min(diff, buffersize); nframes_t nframes = this_nframes; memset (task.spec->dataF, 0, sizeof (task.spec->dataF[0]) * nframes * task.spec->channels); task.readsource->file_read(&decodebuffer, task.spec->pos, nframes); for (uint x = 0; x < nframes; ++x) { for (int y = 0; y < task.spec->channels; ++y) { task.spec->dataF[y + x*task.spec->channels] = decodebuffer.destination[y][x]; } } // due the fact peak generating does _not_ happen in writesource->process // but in a function used by DiskIO, we have to hack the peak processing // in here. for (int y = 0; y < task.spec->channels; ++y) { writesource->get_peak()->process(y, decodebuffer.destination[y], nframes); } // Process the data, and write to disk writesource->process(buffersize); task.spec->pos.add_frames(nframes, task.readsource->get_rate()); int currentprogress = int(double(task.spec->pos.universal_frame()) / double(task.spec->totalTime.universal_frame()) * 100); if (currentprogress > oldprogress) { oldprogress = currentprogress; emit progress(currentprogress); } } while (task.spec->pos != task.spec->totalTime); out: if (!failedToPrepareWritesource) { writesource->finish_export(); } delete writesource; delete [] task.spec->dataF; resources_manager()->remove_source(task.readsource); // The user asked to stop processing, exit the event loop // and signal we're done. if (m_stopProcessing) { exit(0); wait(1000); m_tasks.clear(); emit processingStopped(); return; } emit taskFinished(task.dir + "/" + task.outFileName + ".wav", task.tracknumber, task.trackname); }