QWidget *DlgSettingsPointMatch::createSubPanel () { LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsPointMatch::createSubPanel"; QWidget *subPanel = new QWidget (); QGridLayout *layout = new QGridLayout (subPanel); subPanel->setLayout (layout); layout->setColumnStretch(0, 1); // Empty column layout->setColumnStretch(1, 0); // Labels layout->setColumnStretch(2, 0); // Controls layout->setColumnStretch(3, 1); // Empty column int row = 0; createControls (layout, row); createPreview (layout, row); createTemplate (); return subPanel; }
void FileAnalyzer::run() { m_abortFlag = false; m_bAborted = false; m_bSuccess = false; int nFiles = m_inputFiles.count(); emit progressMaxChanged(nFiles); emit progressValChanged(0); lamexp_natural_string_sort(m_inputFiles, true); //.sort(); if(!m_templateFile) { if(!createTemplate()) { qWarning("Failed to create template file!"); return; } } AnalyzeTask::reset(); QThreadPool *pool = new QThreadPool(); QThread::msleep(333); pool->setMaxThreadCount(qBound(2, ((QThread::idealThreadCount() * 3) / 2), 12)); while(!(m_inputFiles.isEmpty() || m_bAborted)) { while(!(m_inputFiles.isEmpty() || m_bAborted)) { if(!AnalyzeTask::waitForFreeSlot(&m_abortFlag)) { qWarning("Timeout in AnalyzeTask::waitForFreeSlot() !!!"); } if(m_abortFlag) { MessageBeep(MB_ICONERROR); m_bAborted = true; break; } if(!m_bAborted) { const QString currentFile = QDir::fromNativeSeparators(m_inputFiles.takeFirst()); AnalyzeTask *task = new AnalyzeTask(currentFile, m_templateFile->filePath(), &m_abortFlag); connect(task, SIGNAL(fileSelected(QString)), this, SIGNAL(fileSelected(QString)), Qt::DirectConnection); connect(task, SIGNAL(progressValChanged(unsigned int)), this, SIGNAL(progressValChanged(unsigned int)), Qt::DirectConnection); connect(task, SIGNAL(progressMaxChanged(unsigned int)), this, SIGNAL(progressMaxChanged(unsigned int)), Qt::DirectConnection); connect(task, SIGNAL(fileAnalyzed(AudioFileModel)), this, SIGNAL(fileAnalyzed(AudioFileModel)), Qt::DirectConnection); pool->start(task); if(int count = AnalyzeTask::getAdditionalFiles(m_inputFiles)) { emit progressMaxChanged(nFiles += count); } } } //One of the Analyze tasks may have gathered additional files from a playlist! if(!m_bAborted) { pool->waitForDone(); if(int count = AnalyzeTask::getAdditionalFiles(m_inputFiles)) { emit progressMaxChanged(nFiles += count); } } } pool->waitForDone(); LAMEXP_DELETE(pool); if(m_bAborted) { qWarning("Operation cancelled by user!"); return; } qDebug("All files added.\n"); m_bSuccess = true; }
std::unique_ptr<GameObject> GameObjectFactory::createGameObject(const std::string& name) { if (templates.find(name) == templates.end()) createTemplate(name); return templates.find(name)->second->clone(m_game.getCurrentState(), ++m_last_ID); }
//----------------------------------------------------------------------- void ParticleSystemManager::parseScript(DataStreamPtr& stream, const String& groupName) { #if OGRE_USE_NEW_COMPILERS == 1 ScriptCompilerManager::getSingleton().parseScript(stream, groupName); #else // OGRE_USE_NEW_COMPILERS String line; ParticleSystem* pSys; std::vector<String> vecparams; pSys = 0; while(!stream->eof()) { line = stream->getLine(); // Ignore comments & blanks if (!(line.length() == 0 || line.substr(0,2) == "//")) { if (pSys == 0) { // No current system // So first valid data should be a system name if (StringUtil::startsWith(line, "particle_system ")) { // chop off the 'particle_system ' needed by new compilers line = line.substr(16); } pSys = createTemplate(line, groupName); pSys->_notifyOrigin(stream->getName()); // Skip to and over next { skipToNextOpenBrace(stream); } else { // Already in a system if (line == "}") { // Finished system pSys = 0; } else if (line.substr(0,7) == "emitter") { // new emitter // Get typename vecparams = StringUtil::split(line, "\t "); if (vecparams.size() < 2) { // Oops, bad emitter LogManager::getSingleton().logMessage("Bad particle system emitter line: '" + line + "' in " + pSys->getName()); skipToNextCloseBrace(stream); } skipToNextOpenBrace(stream); parseNewEmitter(vecparams[1], stream, pSys); } else if (line.substr(0,8) == "affector") { // new affector // Get typename vecparams = StringUtil::split(line, "\t "); if (vecparams.size() < 2) { // Oops, bad affector LogManager::getSingleton().logMessage("Bad particle system affector line: '" + line + "' in " + pSys->getName()); skipToNextCloseBrace(stream); } skipToNextOpenBrace(stream); parseNewAffector(vecparams[1],stream, pSys); } else { // Attribute parseAttrib(line, pSys); } } } } #endif // OGRE_USE_NEW_COMPILERS }
void FileAnalyzer::run() { m_bSuccess = false; m_tasksCounterNext = 0; m_tasksCounterDone = 0; m_completedCounter = 0; m_completedFiles.clear(); m_completedTaskIds.clear(); m_runningTaskIds.clear(); m_filesAccepted = 0; m_filesRejected = 0; m_filesDenied = 0; m_filesDummyCDDA = 0; m_filesCueSheet = 0; m_timer->invalidate(); //Create MediaInfo template file if(!m_templateFile) { if(!createTemplate()) { qWarning("Failed to create template file!"); return; } } //Sort files MUtils::natural_string_sort(m_inputFiles, true); //Handle playlist files first! handlePlaylistFiles(); const unsigned int nFiles = m_inputFiles.count(); if(nFiles < 1) { qWarning("File list is empty, nothing to do!"); return; } //Update progress emit progressMaxChanged(nFiles); emit progressValChanged(0); //Create thread pool if(!m_pool) m_pool = new QThreadPool(); const int idealThreadCount = QThread::idealThreadCount(); if(idealThreadCount > 0) { m_pool->setMaxThreadCount(qBound(2, ((idealThreadCount * 3) / 2), 12)); } //Start first N threads QTimer::singleShot(0, this, SLOT(initializeTasks())); //Start event processing this->exec(); //Wait for pending tasks to complete m_pool->waitForDone(); //Was opertaion aborted? if(m_bAborted) { qWarning("Operation cancelled by user!"); return; } //Update progress emit progressValChanged(nFiles); //Emit pending files (this should not be required though!) if(!m_completedFiles.isEmpty()) { qWarning("FileAnalyzer: Pending file information found after last thread terminated!"); QList<unsigned int> keys = m_completedFiles.keys(); qSort(keys); while(!keys.isEmpty()) { emit fileAnalyzed(m_completedFiles.take(keys.takeFirst())); } } qDebug("All files added.\n"); m_bSuccess = true; QThread::msleep(333); }