pid_t Monitor::getNextPID(QStringListIterator& iterator, int iteration) { if ( fProcessDetails > 0 ) { return iteration == 0 ? fProcessDetails : 0; } return iterator.hasNext() ? iterator.next().toInt() : 0; }
//--------------------------------------------------------------------------- // getWordItems // //! Construct a list of word items to be inserted into a word list, based on //! the results of a list of searches. // //! @param searchSpecs the list of search specifications //! @return a list of word items //--------------------------------------------------------------------------- QList<WordTableModel::WordItem> WordVariationDialog::getWordItems(const QList<SearchSpec>& searchSpecs) const { QList<WordTableModel::WordItem> wordItems; QMap<QString, QString> wordMap; QListIterator<SearchSpec> lit (searchSpecs); while (lit.hasNext()) { QStringList wordList = wordEngine->search(lexicon, lit.next(), false); QStringListIterator wit (wordList); while (wit.hasNext()) { QString str = wit.next(); wordMap.insert(str.toUpper(), str); } } QMapIterator<QString, QString> mit (wordMap); while (mit.hasNext()) { mit.next(); QString value = mit.value(); QList<QChar> wildcardChars; for (int i = 0; i < value.length(); ++i) { QChar c = value[i]; if (c.isLower()) wildcardChars.append(c); } QString wildcard; if (!wildcardChars.isEmpty()) { qSort(wildcardChars.begin(), wildcardChars.end(), Auxil::localeAwareLessThanQChar); foreach (const QChar& c, wildcardChars) wildcard.append(c.toUpper()); } wordItems.append(WordTableModel::WordItem( mit.key(), WordTableModel::WordNormal, wildcard)); }
bool parseRole( QStringListIterator& argIt ) { if( argIt.hasNext() ) { const QString role = argIt.next(); if( role == "teacher" ) { VeyonCore::instance()->setUserRole( VeyonCore::RoleTeacher ); } else if( role == "admin" ) { VeyonCore::instance()->setUserRole( VeyonCore::RoleAdmin ); } else if( role == "supporter" ) { VeyonCore::instance()->setUserRole( VeyonCore::RoleSupporter ); } } else { qCritical( "-role needs an argument:\n" " teacher\n" " admin\n" " supporter\n\n" ); return false; } return true; }
QString ApplicationHelper::cycle(const QStringList& values) { if(values.empty()) return ""; static QStringListIterator it = values; if(it.hasNext()) return it.next(); it.toFront(); return it.next(); }
void Python::refreshSettings() { QStringList lib_dirs; QSettings settings(m_targetFile, QSettings::IniFormat); lib_dirs = settings.value("Target/lib_dirs").toString().split(' ', QString::SkipEmptyParts); QStringListIterator i = lib_dirs; while(i.hasNext()) { QDir libPath(i.next()); if(libPath.isAbsolute()) m_lflags << "-L" + libPath.path(); else m_lflags << "-L" + QDir::currentPath() + "/" + libPath.path(); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void fixInitializerList(QStringListIterator& sourceLines, QStringList& outLines, const QString& hFile, const QString& cppFile) { bool isPointer = false; QMap<float, QString> orderedInitList; // get through the initializer list while(sourceLines.hasNext()) { QString line = sourceLines.next(); if(line.contains("{") ) { break; } int offset = line.indexOf("m_"); int offset2 = line.indexOf("("); QString var = line.mid(offset + 2, offset2 - offset - 2); if(line.contains("(NULL)") ) { isPointer = true; } else { isPointer = false; } float index = positionInHeader(hFile, var, isPointer); orderedInitList[index] = line; qDebug() << "index: " << index << " var:" << var; } //qDebug() << "--------------------------------"; QMapIterator<float, QString> i(orderedInitList); while (i.hasNext()) { i.next(); QString line = i.value(); if(line.trimmed().isEmpty()) { continue; } // Eat the blank line if(i.hasNext() && line.endsWith(",") == false) { line = line + ",";} if(i.hasNext() == false && line.endsWith(",") ) { line = line.mid(0, line.size() - 1 ); } outLines.push_back(line); qDebug() << "index: " << i.key() << " line:" << line; } outLines.push_back("{"); }
void Histogram::parseHistogram(const QString &histogram, float *kernelizedValues, int &countTotal) { QStringList tk1 = histogram.split(" "); QStringListIterator i (tk1); while (i.hasNext()) { QString value = i.next(); QStringList tk2 = value.split("="); QStringListIterator j (tk2); while (j.hasNext()) { float level = j.next().toFloat(); int count = j.next().toInt(); if (level >= MIN_HISTOGRAM_INDEX && level < MAX_HISTOGRAM_INDEX) { countTotal += count; for (int i = 0; i < count; ++i) addKernelizedValue(level, kernelizedValues); if (level < m_min) m_min = level; if (level > m_max) m_max = level; } } } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void checkConstructorForSetupFilterParameters(QStringListIterator& sourceLines, QStringList& outLines) { // get through the initializer list while(sourceLines.hasNext()) { QString line = sourceLines.next(); outLines.push_back(line); if(line.contains("{") ) { break; } } // Now walk the body of the constructor looking for the setupFilterParameters(); call bool foundFunction = false; while(sourceLines.hasNext()) { QString line = sourceLines.next(); if(line.contains("}")) { if (foundFunction == false ) { outLines.push_back(QString(" setupFilterParameters();") ); } outLines.push_back(line); break; } else if(line.contains("setupFilterParameters();")) { outLines.push_back(line); foundFunction = true; } else { outLines.push_back(line); } } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- QString createConstructorEntries(QStringListIterator& sourceLines, QStringList& outLines, QString name) { QString line = sourceLines.next(); // Eat up the entries already there while(line.contains(",") ) { outLines.push_back(line); line = sourceLines.next(); } outLines.push_back(line + ","); QString str; QTextStream out(&str); out << "/*[]*/m_" << name << "ArrayPath(DREAM3D::Defaults::SomePath)"; outLines.push_back(str); return ""; }
int importPublicKey( QStringListIterator& argIt ) { QString pubKeyFile; if( !argIt.hasNext() ) { QStringList l = QDir::current().entryList( QStringList() << "*.key.txt", QDir::Files | QDir::Readable ); if( l.size() != 1 ) { qCritical( "Please specify location of the public key " "to import" ); return -1; } pubKeyFile = QDir::currentPath() + QDir::separator() + l.first(); qWarning() << "No public key file specified. Trying to import " "the public key file found at" << pubKeyFile; } else { pubKeyFile = argIt.next(); } if( ConfiguratorCore::importPublicKey( VeyonCore::instance()->userRole(), pubKeyFile, QString() ) == false ) { qInfo( "Public key import failed" ); return -1; } qInfo( "Public key successfully imported" ); return 0; }
int createKeyPair( QStringListIterator& argIt ) { const QString destDir = argIt.hasNext() ? argIt.next() : QString(); ConfiguratorCore::createKeyPair( VeyonCore::instance()->userRole(), destDir ); return 0; }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void PipelineFilterWidget::linkConditionalWidgets(QVector<FilterParameter::Pointer>& filterParameters) { // Figure out if we have any "Linked Boolean Widgets" to hook up to other widgets for (QVector<FilterParameter::Pointer>::iterator iter = filterParameters.begin(); iter != filterParameters.end(); ++iter ) { FilterParameter::Pointer filterParameter = (*iter); LinkedBooleanFilterParameter::Pointer filterParameterPtr = boost::dynamic_pointer_cast<LinkedBooleanFilterParameter>(filterParameter); if(NULL != filterParameterPtr.get() ) { QStringList linkedProps = filterParameterPtr->getConditionalProperties(); QStringListIterator iter = QStringListIterator(linkedProps); QWidget* checkboxSource = m_PropertyToWidget[filterParameterPtr->getPropertyName()]; while(iter.hasNext()) { QString propName = iter.next(); QWidget* w = m_PropertyToWidget[propName]; if(w) { connect(checkboxSource, SIGNAL(conditionalPropertyChanged(int)), w, SLOT(setLinkedConditionalState(int) ) ); LinkedBooleanWidget* lbw = qobject_cast<LinkedBooleanWidget*>(checkboxSource); if(lbw && lbw->getLinkedState() != Qt::Checked) { w->hide(); } } } LinkedBooleanWidget* boolWidget = qobject_cast<LinkedBooleanWidget*>(checkboxSource); if(boolWidget) { boolWidget->updateLinkedWidgets(); } } // Figure out if we have any Linked ComboBox Widgets to hook up to other widgets LinkedChoicesFilterParameter::Pointer optionPtr2 = boost::dynamic_pointer_cast<LinkedChoicesFilterParameter>(filterParameter); if(NULL != optionPtr2.get()) { QStringList linkedProps = optionPtr2->getLinkedProperties(); QStringListIterator iter = QStringListIterator(linkedProps); QWidget* checkboxSource = m_PropertyToWidget[optionPtr2->getPropertyName()]; while(iter.hasNext()) { QString propName = iter.next(); QWidget* w = m_PropertyToWidget[propName]; if(w) { //qDebug() << "Connecting: " << optionPtr2->getPropertyName() << " to " << propName; connect(checkboxSource, SIGNAL(conditionalPropertyChanged(int)), w, SLOT(setLinkedComboBoxState(int) ) ); ChoiceWidget* choiceWidget = qobject_cast<ChoiceWidget*>(checkboxSource); if(choiceWidget) { choiceWidget->widgetChanged(choiceWidget->getCurrentIndex(), false); } } } } } }
QString functionwrapper(QString funcdecl, bool asInterface) { QString scope = "public"; if (getFirstLetter(funcdecl) == ".") { scope = "private"; funcdecl = ignoreFirstLetter(funcdecl); }; if (getFirstLetter(funcdecl) == "#") { scope = "protected"; funcdecl = ignoreFirstLetter(funcdecl); }; if (asInterface) { scope = "public"; }; QStringList formal_variables; QStringList declaration; QStringList comments; QString methodname = funcdecl; QString vars = ""; QStringList comments_for_vars; QString v; if (funcdecl.contains('@')) { formal_variables = funcdecl.split('@')[1].split('-'); methodname = funcdecl.split('@')[0]; QStringListIterator fv (formal_variables); while (fv.hasNext()) { v = fv.next(); declaration.append('$'+v); comments_for_vars.append("* @param $"+v); }; vars = declaration.join(','); }; comments.append("/**"); comments.append("*"); comments.append("* Autocomment for "+methodname); comments.append(comments_for_vars.join("\r\n")); comments.append("*\r\n"); comments.append("*/\r\n"); QString w = ";"; if (!asInterface) { w = "{ }"; }; return comments.join("\r\n")+"\t " + scope + " function "+methodname+"( " + vars + " )"+ w + ";\r\n"; }