/*QList<int>* LCSGenerator::_internal_detectLCSInIntLists(QList<int> *original, QList<int> *newList) { using namespace std; #if TEST_MEMIO static int times = 0; times++; cout << times << endl; #endif QList<int>* ret = new QList<int>; if(original->isEmpty() || newList->isEmpty()) { return ret; } QList<int>* shortenedOriginal = new QList<int>(*original); QList<int>* shortenedNew = new QList<int>(*newList); shortenedOriginal->removeLast(); shortenedNew->removeLast(); if(original->last() == newList->last()) { *ret += *detectLCSInIntLists(shortenedOriginal, shortenedNew); ret->append(original->last()); } else { QList<int>* lcsWithShortenedNew = detectLCSInIntLists(original, shortenedNew); QList<int>* lcsWithShortenedOriginal = detectLCSInIntLists(shortenedOriginal, newList); if(lcsWithShortenedNew->size() > lcsWithShortenedOriginal->size()) { *ret += *lcsWithShortenedNew; } else { *ret += *lcsWithShortenedOriginal; } } return ret; } QList<int>* LCSGenerator::detectLCSInIntLists(QList<int> *original, QList<int> *newList) { QList<int>* cat; cat = new QList<int>(*original+*newList); if(table->contains(*cat)) { return new QList<int>(table->value(*cat)); } else { QList<int>* ret = _internal_detectLCSInIntLists(original, newList); table->insert(*cat, *ret); return ret; } //return _internal_detectLCSInIntLists(original, newList); }*/ QList<QString*>* LCSGenerator::_internal_lcsForStringLists(QList<QString *> *original, QList<QString *> *newList){ #if TEST_MEMIO using namespace std; static int times = 0; times++; cout << times << endl; #endif if(original->isEmpty() || newList->isEmpty()) { return new QList<QString*>; } QList<QString*>* shortenedOriginal = new QList<QString*>(*original); QList<QString*>* shortenedNew = new QList<QString*>(*newList); shortenedOriginal->removeLast(); shortenedNew->removeLast(); QList<QString*>* ret = new QList<QString*>; if(*(original->last()) == *(newList->last())) { QList<QString*>* lcs = lcsForStringLists(shortenedOriginal, shortenedNew); *ret += *lcs; delete lcs; ret->append(original->last()); } else { QList<QString*>* lcsWithShortenedNew = lcsForStringLists(original, shortenedNew); QList<QString*>* lcsWithShortenedOriginal = lcsForStringLists(shortenedOriginal, newList); if(lcsWithShortenedNew->size() > lcsWithShortenedOriginal->size()) { *ret += *lcsWithShortenedNew; } else { *ret += *lcsWithShortenedOriginal; } delete lcsWithShortenedNew; delete lcsWithShortenedOriginal; } delete shortenedOriginal; delete shortenedNew; return ret; }
ParserTreeItem::ConstPtr Parser::findItemByRoot(const QStandardItem *item, bool skipRoot) const { if (!item) return ParserTreeItem::ConstPtr(); // go item by item to the root QList<const QStandardItem *> uiList; const QStandardItem *cur = item; while (cur) { uiList.append(cur); cur = cur->parent(); } if (skipRoot && uiList.count() > 0) uiList.removeLast(); QReadLocker locker(&d->rootItemLocker); // using internal root - search correct item ParserTreeItem::ConstPtr internal = d->rootItem; while (uiList.count() > 0) { cur = uiList.last(); uiList.removeLast(); const SymbolInformation &inf = Utils::symbolInformationFromItem(cur); internal = internal->child(inf); if (internal.isNull()) break; } return internal; }
void SchematicScene::clearAllItems() { clearSelection(); m_highlightedLinks.clear(); QList<SchematicWindowEditor *> editors; QList<SchematicNode *> nodes; QList<SchematicLink *> links; int i; QList<QGraphicsItem *> sceneItems = items(); int size = sceneItems.size(); //create nodes and links list for (i = 0; i < size; i++) { QGraphicsItem *item = sceneItems.at(i); SchematicWindowEditor *editor = dynamic_cast<SchematicWindowEditor *>(item); SchematicNode *node = dynamic_cast<SchematicNode *>(item); SchematicLink *link = dynamic_cast<SchematicLink *>(item); if (editor) editors.append(editor); if (node) nodes.append(node); if (link) links.append(link); } while (links.size() > 0) { SchematicLink *link = links.back(); removeItem(link); links.removeLast(); SchematicPort *startPort = link->getStartPort(); SchematicPort *endPort = link->getEndPort(); if (startPort) startPort->removeLink(link); if (endPort) endPort->removeLink(link); delete link; } while (editors.size() > 0) { SchematicWindowEditor *editor = editors.back(); removeItem(editor); editors.removeLast(); delete editor; } while (nodes.size() > 0) { SchematicNode *node = nodes.back(); removeItem(node); nodes.removeLast(); delete node; } assert(items().size() == 0); }
void AndroidRunnerWorker::logcatProcess(const QByteArray &text, QByteArray &buffer, bool onlyError) { QList<QByteArray> lines = text.split('\n'); // lines always contains at least one item lines[0].prepend(buffer); if (!lines.last().endsWith('\n')) { // incomplete line buffer = lines.last(); lines.removeLast(); } else { buffer.clear(); } QString pidString = QString::number(m_processPID); foreach (const QByteArray &msg, lines) { const QString line = QString::fromUtf8(msg).trimmed() + QLatin1Char('\n'); if (!line.contains(pidString)) continue; if (m_useCppDebugger) { switch (m_jdbState) { case JDBState::Idle: if (msg.trimmed().endsWith("Sending WAIT chunk")) { m_jdbState = JDBState::Waiting; handleJdbWaiting(); } break; case JDBState::Waiting: if (msg.indexOf("debugger has settled") > 0) { m_jdbState = JDBState::Settled; handleJdbSettled(); } break; default: break; } } if (m_logCatRegExp.exactMatch(line)) { // Android M if (m_logCatRegExp.cap(1) == pidString) { const QString &messagetype = m_logCatRegExp.cap(2); QString output = line.mid(m_logCatRegExp.pos(2)); if (onlyError || messagetype == QLatin1String("F") || messagetype == QLatin1String("E") || messagetype == QLatin1String("W")) emit remoteErrorOutput(output); else emit remoteOutput(output); } } else { if (onlyError || line.startsWith("F/") || line.startsWith("E/") || line.startsWith("W/")) emit remoteErrorOutput(line); else emit remoteOutput(line); } } }
void TestPointer::multiRef(int count) { QAtomicInt counter; PointerClass * ptrClass = new PointerClass(counter); QList<Pointer<PointerClass> > ptrList; QVERIFY(counter.fetchAndAddOrdered(0) == 1); // Create pointer for(int i = 0; i < count; i++) { ptrList.append(Pointer<PointerClass>(ptrClass)); QVERIFY(ptrList.last() != 0); QVERIFY(counter.fetchAndAddOrdered(0) == 1); QVERIFY(ptrList.last()->testFunc()); } // Remove pointer (all but one) for(int i = count - 1; i > 0; i--) { ptrList.removeLast(); QVERIFY(ptrList.last() != 0); QVERIFY(counter.fetchAndAddOrdered(0) == 1); QVERIFY(ptrList.last()->testFunc()); } Pointer<PointerClass> ptr(ptrList.takeLast()); ptr = 0; QVERIFY(ptr == 0); QVERIFY(counter.fetchAndAddOrdered(0) == 0); }
void TestPointer::multiVal(int count) { QAtomicInt counter; QList<Pointer<PointerClass> > ptrList; QVERIFY(counter == 0); // Create pointer for(int i = 0; i < count; i++) { ptrList.append(Pointer<PointerClass>(new PointerClass(counter))); QVERIFY(ptrList.last() != 0); QVERIFY(counter == i + 1); QVERIFY(ptrList.last()->testFunc()); } // Remove pointer (all but one) for(int i = count - 1; i > 0; i--) { ptrList.removeLast(); QVERIFY(ptrList.last() != 0); QVERIFY(counter == i); QVERIFY(ptrList.last()->testFunc()); } Pointer<PointerClass> ptr(ptrList.takeLast()); ptr = 0; QVERIFY(ptr == 0); QVERIFY(counter == 0); }
void thJeu::DonneesJoueurs(QString NomJoueur, QByteArray Donnees) { QList<QByteArray> TrameDonnees; QList<QByteArray> ListePoints; int I = 0; while (I < m_Joueurs.count() && NomJoueur != m_Joueurs[I]->m_Nom) I++; if (I != m_Joueurs.count()) { TrameDonnees = Donnees.split('\n'); if (TrameDonnees.count() > 2) { ListePoints = TrameDonnees[2].split('\t'); ListePoints.removeLast(); if (TrameDonnees[1].toInt() == 0) { m_Joueurs[I]->m_jBase->m_Commandes.clear(); for (int J = 0; J < ListePoints.count(); J+=2) m_Joueurs[I]->m_jBase->m_Commandes.append(QPoint(ListePoints[J].toInt(), ListePoints[J+1].toInt())); } else { m_Joueurs[I]->m_Armees[TrameDonnees[1].toInt()-1]->m_Commandes.clear(); for (int J = 0; J < ListePoints.count(); J+=2) m_Joueurs[I]->m_Armees[TrameDonnees[1].toInt()-1]->m_Commandes.append(QPoint(ListePoints[J].toInt(), ListePoints[J+1].toInt())); } } } }
QList<Person> PersonsTableModel::persons() const { QList<Person> persons = d_func()->persons; if(!persons.isEmpty() && persons.last().name().isEmpty()) persons.removeLast(); return persons; }
void Settings::setViewMode(int value) { int type = getSigninType(); if (getViewMode() != value) { if (type < 10) { // Netvibes, Forbidden modes: 6, 7 if (value == 6 || value == 7) { qWarning() << "Netvibes forbidden mode!"; return; } } else if (type >= 10 && type < 20) { // OldReader, Forbidden modes: none } else if (type >= 20 && type < 30) { // Feedly, Forbidden modes: 6, 7 if (value == 6 || value == 7) { qWarning() << "Old Reader forbidden mode!"; return; } } settings.setValue("viewmode", value); //update history QList<QVariant> list = settings.value("viewmodehistory").toList(); if (list.indexOf(value)==-1) list.prepend(value); if (list.length()>3) list.removeLast(); settings.setValue("viewmodehistory", list); emit viewModeChanged(); } }
void AndroidRunner::logcatProcess(const QByteArray &text, QByteArray &buffer, bool onlyError) { QList<QByteArray> lines = text.split('\n'); // lines always contains at least one item lines[0].prepend(buffer); if (!lines.last().endsWith('\n')) { // incomplete line buffer = lines.last(); lines.removeLast(); } else { buffer.clear(); } QByteArray pid(QString::fromLatin1("%1):").arg(m_processPID).toLatin1()); foreach (QByteArray line, lines) { if (!line.contains(pid)) continue; if (line.endsWith('\r')) line.chop(1); line.append('\n'); if (onlyError || line.startsWith("F/") || line.startsWith("E/") || line.startsWith("D/Qt") || line.startsWith("W/")) emit remoteErrorOutput(line); else emit remoteOutput(line); } }
void RouterItem::changeNumberPorts(int newSize){ if(numberPorts != newSize){ numberPorts = newSize; int oldSize = childItems().count(); if(oldSize < numberPorts){ for(int i=oldSize; i<numberPorts; ++i){ PortItem *port = new PortItem(this); port->setData(5, "Port"); } } if(oldSize > numberPorts){ QList<QGraphicsItem *> list = childItems(); while(list.size() != numberPorts){ //удаляем все связи PortItem* port = qgraphicsitem_cast<PortItem*>(list.last()); emit portDeleted(port); this->scene()->removeItem(list.last()); delete list.last(); list.removeLast(); } } setPortsPosition(); } }
void TCPBase::Start(bool couldCancelPreviousRequest) { if(srvsList.isEmpty()) { srvsList.push_back(this); RealStart(); } else { TCPBase * last = srvsList.last(); if(couldCancelPreviousRequest && last->couldBeRemoved() && (last->isConnected() || !last->hasStarted()) && (last->parent() == parent())) { srvsList.removeLast(); last->deleteLater(); Start(couldCancelPreviousRequest); } else { connect(last, SIGNAL(isReadyNow()), this, SLOT(tcpServerReady())); srvsList.push_back(this); } } }
void PanelPlot::parseMessage(QByteArray data) { double key = QDateTime::currentDateTime().toMSecsSinceEpoch()/1000.0; QString messages = data; messages.chop(1); // remove LF QList<QString> message = messages.split(','); if (message.last() == "") message.removeLast(); if (message.size() == plotSize) { for (int index=0; index < plotSize; index++) { if (ui->plotNames->item(index)->checkState() == Qt::Checked) { double dataValue = message[index].toDouble(); ui->plotWindow->graph(index)->addData(key, dataValue); ui->plotWindow->graph(index)->removeDataBefore(key-timeAxisLength); } } // make key axis range scroll with the data (at a constant range size of 10) ui->plotWindow->xAxis->setRange(key+0.25, timeAxisLength, Qt::AlignRight); ui->plotWindow->replot(); ui->plotWindow->rescaleAxes(true); } else if (message.size() > plotSize) emit panelStatus("Plot count (" + QString::number(message.size()) +") does not match plot count in XML configuration file (" + QString::number(plotSize) +")"); }
bool getAdmin1TranslationSubs(QString const &pathFile, QList<QString> &listAdmin1Subs) { QFile inputFile(pathFile); if(inputFile.open(QIODevice::ReadOnly)) { QString before = "\""; QString after = ""; QTextStream in(&inputFile); while(!in.atEnd()) { QString line = in.readLine(); // sometimes quotes are added in to // the translation substitutes file // so they should be removed line.replace(before,after); listAdmin1Subs.push_back(line); } listAdmin1Subs.removeFirst(); // should be 'BEGIN' listAdmin1Subs.removeLast(); // should be 'END' return true; } else { return false; } }
void MixerCurve::CurveMaxChanged(double value) { // the max changed so redraw the curve // mixercurvewidget::setCurve will trim any points above max QList<double> points = m_curve->getCurve(); points.removeLast(); points.append(value); setCurve(&points); }
void applistModel::Search() { LS("applistModel::Search =>>"); QList<AppEntry> results; QString s = m_searchString; if(m_appslist != NULL || m_searchString.isEmpty()) { int rank1results = 0; for(int i=0; i < m_appslist->count() ; i++) { QString appname = m_appslist->at(i).caption; if(appname.startsWith(s, Qt::CaseInsensitive)) { AppEntry p = m_appslist->at(i); p.iscontact = false; if(rank1results <= APPSMODELQUOTA) { rank1results++; p.rank = 1; } else { p.rank = 2; } results.prepend(p); } else if(appname.contains(s, Qt::CaseInsensitive)) { AppEntry p = m_appslist->at(i); p.iscontact = false; p.rank = 3; results.append(p); } else {//ignore } } } //sort and trim the results before sending. qSort(results.begin(), results.end(), appentrylessthan2); while(results.count() > MAXRESULTS) results.removeLast(); // for(int j=0;j<results.count();j++) // { // LS(results[j].caption); // LS(results[j].rank); // } emit HandleSearchResults(s, results, 0, false); LS("applistModel::Search << "<<QString::number(results.count())); }
void Account::StatusManagerRemove(QList<Status> &statusListRemoveOne, QMap<QString, Status> &RetwMap) { if(!statusListRemoveOne.isEmpty()) { Status status = statusListRemoveOne.last(); QString id = status.getRetweetedId(); RetwMap.remove(id); statusListRemoveOne.removeLast(); } }
void TcfEngine::handleResponse(const QByteArray &response) { static QTime lastTime; //emit tcfOutputAvailable(_(" "), currentTime()); QList<QByteArray> parts = response.split('\0'); if (parts.size() < 2 || !parts.last().isEmpty()) { SDEBUG("WRONG RESPONSE PACKET LAYOUT" << parts); //if (response.isEmpty()) acknowledgeResult(); return; } parts.removeLast(); // always empty QByteArray tag = parts.at(0); int n = parts.size(); if (n == 2 && tag == "N") { // unidentified command int token = parts.at(1).toInt(); TcfCommand tcf = m_cookieForToken[token]; SDEBUG("COMMAND NOT RECOGNIZED FOR TOKEN" << token << tcf.toString()); emit tcfOutputAvailable(LogOutput, QString::number(token) + "^" + "NOT RECOQNIZED: " + quoteUnprintableLatin1(response)); acknowledgeResult(); } else if (n == 2 && tag == "F") { // flow control m_congestion = parts.at(1).toInt(); SDEBUG("CONGESTION: " << m_congestion); } else if (n == 4 && tag == "R") { // result data acknowledgeResult(); int token = parts.at(1).toInt(); QByteArray message = parts.at(2); JsonValue data(parts.at(3)); emit tcfOutputAvailable(LogOutput, QString("%1^%2%3").arg(token) .arg(quoteUnprintableLatin1(response)) .arg(QString::fromUtf8(data.toString()))); TcfCommand tcf = m_cookieForToken[token]; JsonValue result(data); SDEBUG("GOOD RESPONSE: " << quoteUnprintableLatin1(response)); if (tcf.callback) (this->*(tcf.callback))(result, tcf.cookie); } else if (n == 3 && tag == "P") { // progress data (partial result) //int token = parts.at(1).toInt(); QByteArray data = parts.at(2); SDEBUG(_("\nTCF PARTIAL:") << quoteUnprintableLatin1(response)); } else if (n == 4 && tag == "E") { // an event QByteArray service = parts.at(1); QByteArray eventName = parts.at(2); JsonValue data(parts.at(3)); if (eventName != "peerHeartBeat") SDEBUG(_("\nTCF EVENT:") << quoteUnprintableLatin1(response) << data.toString()); if (service == "Locator" && eventName == "Hello") { m_services.clear(); foreach (const JsonValue &service, data.children()) m_services.append(service.data()); QTimer::singleShot(0, this, SLOT(startDebugging())); }
QList<LRelation> KnowledgeBase::evaluate(LRelation r){ specialDebug("\n\nKnowledgeBase::EVALUATE(). Relation is : ", r->toString()); LRelation relation = manageRelation(r); QList<LRelation> body; body.append(relation); LRule rule = LRule(new Logic_Rule(relation, body)); QList<LRelation> answer; QSet<QString> answerString; QList<LRule> possibleAnswers; possibleAnswers.append(rule); while (!possibleAnswers.isEmpty()) { LRule possibleRule = possibleAnswers.last(); possibleAnswers.removeLast(); specialDebug("KnowledgeBase::evaluate(). Possible Answer under scrutiny: ", possibleRule->toString()); // If the rule is fully grounded if(possibleRule->getHead()->isGround()){ // If we know it's already true for that grounding, we can discard it if(answerString.contains(possibleRule->getHead()->toString())){ specialDebug(" This possible answer leads to an already known answer. We stop there"); continue; } } // If the body is empty, we have an answer to our evaluation query if(possibleRule->isBodyEmpty()){ specialDebug(" We have a new answer : ", possibleRule->getHead()->toString()); answer.append(possibleRule->getHead()); answerString << possibleRule->getHead()->toString(); continue; } // Else, we take the first relation and process it QList<LRule> substitutions = ruleSubstitution(possibleRule); possibleAnswers.append(substitutions); } specialDebug("\n\nKnowledgeBase::EVALUATE() finished"); if(answer.isEmpty()){ specialDebug("No answer"); } else{ for(QString string : answerString){ specialDebug(" ", string); } } return answer; }
QList<QAction*> CustomDesktopMenu::contextualActions() { qDeleteAll(m_actions); m_actions.clear(); if (!menuconfig.isEmpty()) { QList<QMenu*> menuList; menuList.append(0); QMenu* curMenu = 0; QStringList configLines = menuconfig.split( "\n", QString::SkipEmptyParts ); foreach( QString cfgLine, configLines ) { if (!cfgLine.startsWith("#")) { if (cfgLine.startsWith("-")) { addSep(curMenu); } else if (cfgLine.endsWith(".desktop")) { addApp(curMenu, cfgLine); } else if (cfgLine.startsWith("[menu]")) { QStringList cfgParts = cfgLine.split( "\t", QString::SkipEmptyParts ); if (cfgParts.size() == 3) { curMenu = addMnu(curMenu, cfgParts[2], cfgParts[1]); menuList.append(curMenu); } else if (cfgParts.size() == 2) { curMenu = addMnu(curMenu, "", cfgParts[1]); menuList.append(curMenu); } } else if (cfgLine.startsWith("[end]")) { menuList.removeLast(); curMenu = menuList.last(); } else if (cfgLine == "{favorites}") { fillFavorites(curMenu); } else if (cfgLine.startsWith("{programs}")) { QStringList cfgParts = cfgLine.split( "\t", QString::SkipEmptyParts ); if (cfgParts.size() == 2) { fillPrograms(curMenu, cfgParts[1]); } else { fillPrograms(curMenu, "/"); } } else { QStringList cfgParts = cfgLine.split( "\t", QString::SkipEmptyParts ); if (cfgParts.size() == 3) { addCmd(curMenu, cfgParts[1], cfgParts[0], cfgParts[2]); } else if (cfgParts.size() == 2) { addCmd(curMenu, "", cfgParts[0], cfgParts[1]); } else { addItm(curMenu, "", cfgParts[0]); } } } } }
int BookViewPreview::GetSelectionOffset(const QMap<int, QString> &node_offsets, Searchable::Direction search_direction) { QList<ViewEditor::ElementIndex> cl = GetCaretLocation(); // remove final #text node if it exists if (cl.at(cl.count()-1).name == "#text") { cl.removeLast(); } QString caret_node = ConvertHierarchyToQWebPath(cl); bool searching_down = search_direction == Searchable::Direction_Down ? true : false; int local_offset = GetLocalSelectionOffset(!searching_down); int search_start = node_offsets.key(caret_node) + local_offset; return search_start; }
void DebugSession::locationUpdateReady(QByteArray data) { qCDebug(KDEV_PYTHON_DEBUGGER) << "Got where information: " << data; QList<QByteArray> lines = data.split('\n'); if ( lines.length() >= 3 ) { lines.removeLast(); // prompt lines.removeLast(); // source line QString where = lines.last(); // > /bar/baz/foo.py(123)<module>() QRegExp m("^> (/.*\\.py)\\((\\d*)\\).*$"); m.setMinimal(true); m.exactMatch(where); setCurrentPosition(QUrl::fromLocalFile(m.capturedTexts().at(1)), m.capturedTexts().at(2).toInt() - 1 , "<unknown>"); qCDebug(KDEV_PYTHON_DEBUGGER) << "New position: " << m.capturedTexts().at(1) << m.capturedTexts().at(2).toInt() - 1 << m.capturedTexts() << where; } }
void ProgressParser::processBufferedLines() { #ifdef Q_OS_WIN // On windows, avoid double-newlines when we replace '\r'->'\n' next. // If the buffer happens to end between and '\r' and an '\n', // we get an extra newline, which only makes the output slightly uglier. m_lineBuffer.replace("\r\n", "\n"); #endif m_lineBuffer.replace('\r', '\n'); // Progress lines end in a carriage return only QList<QByteArray> lines = m_lineBuffer.split('\n'); m_lineBuffer = lines.last(); lines.removeLast(); foreach (QByteArray line, lines) { processLine(QString::fromUtf8(line)); // yle-dl prints utf-8 when on a pipe also on Windows }
void EditStringCell::showEditColorsDialog() { EditColorsDialog dlg(this, colorStrings, colorCodes, colors); if (dlg.exec()) { // remove all custom colors that were before for (int i = colorsNum, n = colors.size(); i < n; i++) { colorCodes.removeLast(); colorStrings.removeLast(); colors.removeLast(); } foreach (const EditColorsDialog::ColorInfo &ci, dlg.colorsInfo()) { colorCodes.append(ci.Code); colorStrings.append(ci.Name); colors.append(ci.Color); } updateColorsMenu(); emit colorMenuChanged(); } }
QList<QStrVec> sorted_list(QString word,QList<QString> rhymes) { QList<QStrVec> list; while(!rhymes.isEmpty()) { list.append(get_overlaps(word,rhymes.takeFirst())); } qSort(list.begin(),list.end(),less_than); //number of items in list must be <= 1000: for(int to_del = list.size() - 1000;to_del > 0;to_del--) { list.removeLast(); } return list; }
QList<DependencyItem> DependencyInfo::parseDepends(const QString &field, DependencyType type) { string package; string version; unsigned int op; string fieldStr = field.toStdString(); const char *start = fieldStr.c_str(); const char *stop = start + strlen(start); QList<DependencyItem> depends; bool hadOr = false; while (start != stop) { DependencyItem depItem; start = debListParser::ParseDepends(start, stop, package, version, op, false); if (!start) { // Parsing error return depends; } if (hadOr) { depItem = depends.last(); depends.removeLast(); } if (op & pkgCache::Dep::Or) { hadOr = true; // Remove the Or bit from the op so we can assign to a RelationType op = (op & ~pkgCache::Dep::Or); } else { hadOr = false; } DependencyInfo info(QString::fromStdString(package), QString::fromStdString(version), (RelationType)op, type); depItem.append(info); depends.append(depItem); } return depends; }
int BookViewPreview::GetSelectionOffset(const QMap<int, QString> &node_offsets, Searchable::Direction search_direction) { QList<ViewEditor::ElementIndex> cl = GetCaretLocation(); // remove final #text node if it exists // Some BookView tabs with only SVG images report a cl.count of 0 // meaning there is no cursor, so test for that case if ((cl.count() > 0) && (cl.at(cl.count()-1).name == "#text")) { cl.removeLast(); } QString caret_node = ConvertHierarchyToQWebPath(cl); bool searching_down = search_direction == Searchable::Direction_Down ? true : false; int local_offset = GetLocalSelectionOffset(!searching_down); int search_start = node_offsets.key(caret_node) + local_offset; return search_start; }
double ReadWritePrioritizer::prioritize(QSharedPointer<const ExecutableConfiguration> configuration, AppModelConstPtr appmodel) { if (configuration->isInitial()) { return 0; } QList<QSharedPointer<const BaseInput> > inputSequence = configuration->getInputSequence()->toList(); QSharedPointer<const BaseInput> last = inputSequence.last(); inputSequence.removeLast(); QSet<QString> propertiesReadByLast = appmodel->getJavascriptStatistics()->getPropertiesRead(last); QSet<QString> properitesWrittenBeforeLast; foreach(QSharedPointer<const BaseInput> input, inputSequence) { properitesWrittenBeforeLast.unite(appmodel->getJavascriptStatistics()->getPropertiesWritten(input)); }
static void _writeByteArrayToFd(const QByteArray& data, const QByteArray& prefix, FILE *fh) { QList<QByteArray> lines = data.split('\n'); if (lines.isEmpty()) return; // If the last item was a separator, there will be an extra blank item at the end if (lines.last().isEmpty()) lines.removeLast(); if (!lines.isEmpty()) { QFile f; f.open(fh, QIODevice::WriteOnly); foreach (const QByteArray& line, lines) { f.write(prefix); f.write(line); f.write("\n"); }
void MainWindow::loadOptions() { //load the resolution and check the right action in the mainwindow Settings* s = Settings::instance(); QString resolutionString = QString(QString::number(s->cameraWidth(),10) + "x" + QString::number(s->cameraHeight(),10)); QList <QAction*> actionsToUncheck = m_ui->menuResolution->actions(); actionsToUncheck.removeLast(); for(int i = 0; i < actionsToUncheck.length(); i++){ if (actionsToUncheck.at(i)->text().compare(resolutionString) == 0) { qobject_cast <QAction*>(actionsToUncheck.at(i))->setChecked(true); } else { qobject_cast <QAction*>(actionsToUncheck.at(i))->setChecked(false); } } }