Пример #1
0
void TestEITFixups::testUnitymedia()
{
    EITFixUp fixup;

    DBEventEIT *event = SimpleDBEventEIT (EITFixUp::kFixUnitymedia,
                                         "Titel",
                                         "Beschreib",
                                         "Beschreibung ... IMDb Rating: 8.9 /10");
    QMap<QString,QString> cast;
    cast.insertMulti ("Role Player", "Great Actor");
    cast.insertMulti ("Role Player", "Other Actor");
    cast.insertMulti ("Director", "Great Director");
    cast.insertMulti ("Unhandled", "lets fix it up");
    event->items = cast;

    QVERIFY(!event->HasCredits());
    QCOMPARE(event->items.count(), 4);

    PRINT_EVENT(*event);
    fixup.Fix(*event);
    PRINT_EVENT(*event);

    QVERIFY(event->HasCredits());
    QCOMPARE(event->credits->size(), (size_t)3);
    QVERIFY(event->subtitle.isEmpty());
    QCOMPARE(event->description, QString("Beschreibung ..."));
    QCOMPARE(event->stars, 0.89f);
    QCOMPARE(event->items.count(), 1);
    delete event;
}
Пример #2
0
void tst_QMap::keys_values_uniqueKeys()
{
    QMap<QString, int> map;
    QVERIFY(map.uniqueKeys().isEmpty());
    QVERIFY(map.keys().isEmpty());
    QVERIFY(map.values().isEmpty());

    map.insertMulti("alpha", 1);
    QVERIFY(map.keys() == (QList<QString>() << "alpha"));
    QVERIFY(map.uniqueKeys() == map.keys());
    QVERIFY(map.values() == (QList<int>() << 1));

    map.insertMulti("beta", -2);
    QVERIFY(map.keys() == (QList<QString>() << "alpha" << "beta"));
    QVERIFY(map.keys() == map.uniqueKeys());
    QVERIFY(map.values() == (QList<int>() << 1 << -2));

    map.insertMulti("alpha", 2);
    QVERIFY(map.uniqueKeys() == (QList<QString>() << "alpha" << "beta"));
    QVERIFY(map.keys() == (QList<QString>() << "alpha" << "alpha" << "beta"));
    QVERIFY(map.values() == (QList<int>() << 2 << 1 << -2));

    map.insertMulti("beta", 4);
    QVERIFY(map.uniqueKeys() == (QList<QString>() << "alpha" << "beta"));
    QVERIFY(map.keys() == (QList<QString>() << "alpha" << "alpha" << "beta" << "beta"));
    QVERIFY(map.values() == (QList<int>() << 2 << 1 << 4 << -2));
}
void xmlWriter::RemoveBuildToBeUpdated(int buildID){

    QMap <QString,QString> tmpID;
    QMap <QString,QString> tmpName;
    QMap <QString,QString> tmpDesc;
    QMap <QString,QString> tmpDir;

    QMapIterator<QString, QString> i(buildUniqueID);
    QMapIterator<QString, QString> j(buildName);
    QMapIterator<QString, QString> k(buildDescription);
    QMapIterator<QString, QString> l(buildDirectory);

    int m = 0;

    while (i.hasNext() && j.hasNext() && k.hasNext() && l.hasNext())
    {
        i.next(); j.next(); k.next(); l.next();

        if(buildUniqueID.values().at(m).compare(QString::number(buildID))){
            tmpID.insertMulti("buildUniqueID",buildUniqueID.values().at(m));
            tmpName.insertMulti("buildName",buildName.values().at(m));
            tmpDesc.insertMulti("buildDescription",buildDescription.values().at(m));
            tmpDir.insertMulti("buildDirectory",buildDirectory.values().at(m));
        }
        m++;
    }
    buildUniqueID = tmpID;
    buildName = tmpName;
    buildDescription = tmpDesc;
    buildDirectory = tmpDir;
}
void xmlWriter::removeBuild(int buildID){
    QMap <QString,QString> tmpID;
    QMap <QString,QString> tmpName;
    QMap <QString,QString> tmpDesc;
    QMap <QString,QString> tmpDir;

    QMapIterator<QString, QString> i(buildUniqueID);
    QMapIterator<QString, QString> j(buildName);
    QMapIterator<QString, QString> k(buildDescription);
    QMapIterator<QString, QString> l(buildDirectory);

    int m = 0;

    while (i.hasNext() && j.hasNext() && k.hasNext() && l.hasNext())
    {
        i.next(); j.next(); k.next(); l.next();

        if(buildUniqueID.values().at(m).compare(QString::number(buildID))){
            //if the build is not the same include the build
            tmpID.insertMulti("buildUniqueID",buildUniqueID.values().at(m));
            tmpName.insertMulti("buildName",buildName.values().at(m));
            tmpDesc.insertMulti("buildDescription",buildDescription.values().at(m));
            tmpDir.insertMulti("buildDirectory",buildDirectory.values().at(m));
        }
        m++;
    }

    //replace the current values
    buildUniqueID = tmpID;
    buildName = tmpName;
    buildDescription = tmpDesc;
    buildDirectory = tmpDir;

    createXMLFile();
}
Пример #5
0
void QHelpDBReader::linksForKeyword(const QString &keyword, const QStringList &filterAttributes,
                                    QMap<QString, QUrl> &linkMap) const
{
    if (!m_query)
        return;

    QString query;
    if (filterAttributes.isEmpty()) {
        query = QString(QLatin1String("SELECT d.Title, f.Name, e.Name, d.Name, a.Anchor "
            "FROM IndexTable a, FileNameTable d, "
            "FolderTable e, NamespaceTable f WHERE "
            "a.FileId=d.FileId AND d.FolderId=e.Id AND a.NamespaceId=f.Id "
            "AND a.Name='%1'")).arg(quote(keyword));
    } else if (m_useAttributesCache) {
        query = QString(QLatin1String("SELECT d.Title, f.Name, e.Name, d.Name, a.Anchor, a.Id "
            "FROM IndexTable a, "
            "FileNameTable d, FolderTable e, NamespaceTable f WHERE "
            "a.FileId=d.FileId AND d.FolderId=e.Id "
            "AND a.NamespaceId=f.Id AND a.Name='%1'"))
            .arg(quote(keyword));
        m_query->exec(query);
        while (m_query->next()) {
            if (m_indicesCache.contains(m_query->value(5).toInt())) {
                linkMap.insertMulti(m_query->value(0).toString(), buildQUrl(m_query->value(1).toString(),
                    m_query->value(2).toString(), m_query->value(3).toString(),
                    m_query->value(4).toString()));
            }
        }
        return;
    } else {
        query = QString(QLatin1String("SELECT d.Title, f.Name, e.Name, d.Name, a.Anchor "
            "FROM IndexTable a, IndexFilterTable b, FilterAttributeTable c, "
            "FileNameTable d, FolderTable e, NamespaceTable f "
            "WHERE a.FileId=d.FileId AND d.FolderId=e.Id "
            "AND a.NamespaceId=f.Id AND b.IndexId=a.Id AND b.FilterAttributeId=c.Id "
            "AND a.Name='%1' AND c.Name='%2'")).arg(quote(keyword))
            .arg(quote(filterAttributes.first()));
        for (int i=1; i<filterAttributes.count(); ++i) {
            query.append(QString(QLatin1String(" INTERSECT SELECT d.Title, f.Name, e.Name, d.Name, a.Anchor "
                "FROM IndexTable a, IndexFilterTable b, FilterAttributeTable c, "
                "FileNameTable d, FolderTable e, NamespaceTable f "
                "WHERE a.FileId=d.FileId AND d.FolderId=e.Id "
                "AND a.NamespaceId=f.Id AND b.IndexId=a.Id AND b.FilterAttributeId=c.Id "
                "AND a.Name='%1' AND c.Name='%2'")).arg(quote(keyword))
                .arg(quote(filterAttributes.at(i))));
        }
    }

    QString title;
    m_query->exec(query);
    while (m_query->next()) {
        title = m_query->value(0).toString();
        if (title.isEmpty()) // generate a title + corresponding path
            title = keyword + QLatin1String(" : ") + m_query->value(3).toString();
        linkMap.insertMulti(title, buildQUrl(m_query->value(1).toString(),
            m_query->value(2).toString(), m_query->value(3).toString(),
            m_query->value(4).toString()));
    }
}
Пример #6
0
void DNASequenceGenerator::evaluateBaseContent(const MultipleSequenceAlignment& ma, QMap<char, qreal>& result) {
    QList< QMap<char, qreal> > rowsContents;
    foreach(const MultipleSequenceAlignmentRow& row, ma->getMsaRows()) {
        QMap<char, qreal> rowContent;
        evaluate(row->getData(), rowContent);
        rowsContents.append(rowContent);
    }

    QListIterator< QMap<char, qreal> > listIter(rowsContents);
    while (listIter.hasNext()) {
        const QMap<char, qreal>& cm = listIter.next();
        QMapIterator<char, qreal> mapIter(cm);
        while (mapIter.hasNext()) {
            mapIter.next();
            char ch = mapIter.key();
            qreal freq = mapIter.value();
            if (!result.keys().contains(ch)) {
                result.insertMulti(ch, freq);
            } else {
                result[ch] += freq;
            }
        }
    }

    int rowsNum = ma->getNumRows();
    QMutableMapIterator<char, qreal> i(result);
    while (i.hasNext()) {
        i.next();
        i.value() /= rowsNum;
    }
}
Пример #7
0
void neuron_branch_tip_count(V3DLONG &n_branch, V3DLONG &n_tip, const vector<V_NeuronSWC> & segment_list)
{
	QMap <V_NeuronSWC_coord, V_NeuronSWC_unit> map;
	map.clear();

	for (V3DLONG i=0; i<segment_list.size(); i++)
	{
		const V_NeuronSWC & seg = segment_list.at(i);
		for (V3DLONG j=0; j<seg.row.size(); j++)
		{
			V_NeuronSWC_unit node = seg.row.at(j);
			V_NeuronSWC_coord key = node;
			map.insertMulti(key, node);
		}
	}

	n_branch = 0;
	n_tip = 2*segment_list.size();

	QList <V_NeuronSWC_coord> keys = map.uniqueKeys();
	for (V3DLONG i=0; i<keys.size(); i++)
	{
		V_NeuronSWC_coord key = keys.at(i);
		int nkey = map.count(key);
		if (nkey >= 3)
		{
			n_branch ++;
		}
		if (nkey >= 2)
		{
			n_tip -= nkey;
		}
	}
}
Пример #8
0
// This should go into Qt 4.8 once we start using it for Qt Creator
QMap<QString, QUrl> HelpManager::linksForKeyword(const QString &key)
{
    QMap<QString, QUrl> links;
    if (d->m_needsSetup)
        return links;

    const QLatin1String sqlite("QSQLITE");
    const QLatin1String name("HelpManager::linksForKeyword");

    DbCleaner cleaner(name);
    QSqlDatabase db = QSqlDatabase::addDatabase(sqlite, name);
    if (db.driver() && db.driver()->lastError().type() == QSqlError::NoError) {
        const QStringList &registeredDocs = d->m_helpEngine->registeredDocumentations();
        foreach (const QString &nameSpace, registeredDocs) {
            db.setDatabaseName(d->m_helpEngine->documentationFileName(nameSpace));
            if (db.open()) {
                QSqlQuery query = QSqlQuery(db);
                query.setForwardOnly(true);
                query.exec(QString::fromLatin1(linksForKeyQuery).arg(key));
                while (query.next()) {
                    QString title = query.value(0).toString();
                    if (title.isEmpty()) // generate a title + corresponding path
                        title = key + QLatin1String(" : ") + query.value(3).toString();
                    links.insertMulti(title, buildQUrl(query.value(1).toString(),
                                                       query.value(2).toString(), query.value(3).toString(),
                                                       query.value(4).toString()));
                }
            }
        }
    }
Пример #9
0
  foreach ( QString key, providersList )
  {
    QLibrary *library = QgsProviderRegistry::instance()->providerLibrary( key );
    if ( !library )
      continue;

    dataCapabilities_t * dataCapabilities = ( dataCapabilities_t * ) cast_to_fptr( library->resolve( "dataCapabilities" ) );
    if ( !dataCapabilities )
    {
      QgsDebugMsg( library->fileName() + " does not have dataCapabilities" );
      continue;
    }

    int capabilities = dataCapabilities();
    if ( capabilities == QgsDataProvider::NoDataCapabilities )
    {
      QgsDebugMsg( library->fileName() + " does not have any dataCapabilities" );
      continue;
    }

    dataItem_t *dataItem = ( dataItem_t * ) cast_to_fptr( library->resolve( "dataItem" ) );
    if ( !dataItem )
    {
      QgsDebugMsg( library->fileName() + " does not have dataItem" );
      continue;
    }

    QgsDataItem *item = dataItem( "", NULL );  // empty path -> top level
    if ( item )
    {
      QgsDebugMsg( "Add new top level item : " + item->name() );
      connectItem( item );
      providerMap.insertMulti( capabilities, item );
    }
  }
Пример #10
0
void MapView::getTilesInView()
{
    if (MapSource.id == None) return;

    QRectF viewRect = mapToScene(0,0,width(),height()).boundingRect();
    QList<QPoint> XYTileList = getXYTileInRange(currentZoom,
                                                getLongFromMercatorX(viewRect.x()+viewRect.width()),
                                                getLongFromMercatorX(viewRect.x()),
                                                getLatFromMercatorY(viewRect.y()),
                                                getLatFromMercatorY(viewRect.y()+viewRect.height()) );
    QPoint p1 = XYTileList.first();
    QPoint p2 = XYTileList.last();
    QPointF center = QPointF( (p2.x()+p1.x()) / 2. , (p1.y()+p2.y()) / 2. );

    //sorts list so that points closest to center are loaded first
    QMap<qreal, QPoint> map;
    for(int i=0;i<XYTileList.size();++i) map.insertMulti(lengthSquared((XYTileList.at(i))-center),XYTileList.at(i));

    XYTileList = map.values();

    QPoint p;
    while(XYTileList.size()>0)
    {
        if (currentRequests.count()<requestLimit) p = XYTileList.takeFirst();
        else p = XYTileList.takeLast();

        if (!tilePlaced(p,currentZoom)) getTile(p.x(),p.y(),currentZoom);
    }

    qDebug("Number of items in scene: "+QString::number(scene()->items().count()));
}
Пример #11
0
void PortHandler::arrangeLinearPorts()
{
	for (int linePortId = mPointPorts.size(); linePortId < mPointPorts.size() + mLinePorts.size(); linePortId++) {
		QMap<EdgeArrangeCriteria, EdgeElement*> sortedEdges;
		const QLineF portLine = mLinePorts.at(linePortId)->transformForContents(mNode->contentsRect());
		for (EdgeElement* edge : mNode->edgeList()) {
			QPair<qreal, qreal> edgePortId = edge->portIdOn(mNode);
			qreal currentPortId = -1.0;
			if (portNumber(edgePortId.first) == linePortId) {
				currentPortId = edgePortId.first;
			}
			if (portNumber(edgePortId.second) == linePortId) {
				currentPortId = edgePortId.second;
			}

			if (currentPortId != -1.0) {
				const EdgeArrangeCriteria arrangeCriteria = edge->arrangeCriteria(mNode, portLine);
				sortedEdges.insertMulti(arrangeCriteria, edge);
			}
		}

		const int n = sortedEdges.size();
		int i = 0;
		for (EdgeElement * const edge : sortedEdges) {
			const qreal newId = linePortId + (i + 1.0) / (n + 1);
			edge->moveConnection(mNode, newId);
			i++;
		}
	}
}
Пример #12
0
QMap<QString, int> SCPageEffectFactory::subTypesByName() const
{
    QMap<QString, int> nameToType;
    foreach (const int subType, d->subTypes) {
        nameToType.insertMulti(subTypeName(subType), subType);
    }
    return nameToType;
}
Пример #13
0
QMap<QString, QString> PropertyDialog::getNewMetaMap()
{
	QMap<QString, QString> metaMap;
	
	for (int i=0;i<labelList.size();i++) metaMap.insertMulti(labelList.at(i)->text(),editList.at(i)->text());
	
	return metaMap;
}
void MsgAudioSelectionEngine::HandleQueryCompletedL(CMdEQuery& aQuery,
        TInt aError)
    {
    iNameList.clear();
    iUriList.clear();
    if (aError == KErrCancel)
        {
        emit queryError(aError);
        return;
        }
    else
        {
        QMap<QString,QString> nameUriList;
        CMdEObjectQuery* query = static_cast<CMdEObjectQuery*> (&aQuery);
        TInt count = query->Count();
        for (TInt i = 0; i < count; ++i)
            {
            CMdEObject* object =
                    (CMdEObject*) query->TakeOwnershipOfResult(i);
            CleanupStack::PushL(object);
            CMdEPropertyDef& propDef = MsgAudioSelectionEngine::PropertyDefL(
                    iSession, MsgAudioSelectionEngine::EAttrFileName);

            CMdEProperty* property = 0;
            TInt err = object->Property(propDef, property, 0);
            if (err != KErrNotFound && property)
                {
                QString songName(XQConversions::s60DescToQString(
                        property->TextValueL()));
                QString uriValue(XQConversions::s60DescToQString(
                        object->Uri()));
                
                //insert into the map
                nameUriList.insertMulti(uriValue, songName);
                }
            CleanupStack::PopAndDestroy(object);
            }
        
        //now get all the song names and sort them
        iNameList = nameUriList.values();
        iNameList.sort();
        
        // go through the song list and get the associated uri
        // insert into the uri list
        int nameListTotal = iNameList.count();
        for(int nameListCount = 0; 
                nameListCount<nameListTotal;
                nameListCount++)
            {
            QString key = nameUriList.key(iNameList.at(nameListCount));
            iUriList.append(key);
            nameUriList.remove(key);                        
            }
        
        // emit the list to the model
        emit queryComplete(iNameList, iUriList);
        }
    }
Пример #15
0
void MythUIType::AddFocusableChildrenToList(QMap<int, MythUIType *> &focusList)
{
    if (m_CanHaveFocus)
        focusList.insertMulti(m_focusOrder, this);

    QList<MythUIType *>::Iterator it;
    for (it = m_ChildrenList.end()-1; it != m_ChildrenList.begin()-1; --it)
        (*it)->AddFocusableChildrenToList(focusList);
}
Пример #16
0
QList<QAbstractSeries*> Engine::addSeries(QAbstractSeries::SeriesType type)
{
    const QModelIndexList& list = m_selection->selectedIndexes();

    QMap<int, QModelIndex> columns;

    foreach (const QModelIndex& index, list) {
        columns.insertMulti(index.column(), index);
    }
Пример #17
0
void evaluate(const QByteArray& seq, QMap<char, qreal>& result) {
    QMap<char, int> occurrencesMap;
    foreach(char ch, seq) {
        if (!occurrencesMap.keys().contains(ch)) {
            occurrencesMap.insertMulti(ch, 1);
        } else {
            ++occurrencesMap[ch];
        }
    }

    qreal len = seq.length();
    QMapIterator<char, int> i(occurrencesMap);
    while (i.hasNext()) {
        i.next();
        int count = i.value();
        qreal freq = count / len;
        result.insertMulti(i.key(), freq);
    }
}
Пример #18
0
QMap<QString,QString> SnippetModel::getEntries()
{
    QMap<QString,QString> entries;
    QSqlQuery query;
    query.exec("select language,title from snippets;");
    while(query.next())
        entries.insertMulti(query.value(0).toString(), query.value(1).toString());

    return entries;
}
Пример #19
0
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QMap<QString,int> map;

    // 向map中插入("one",1)
    map["one"] = 1;
    map["three"] = 3;

    // 使用insert()函数进行插入
    map.insert("seven",7);

    // 获取键的值,使用“[ ]”操作符时,如果map中没有该键,那么会自动插入
    int value1 = map["six"];

    qDebug() << "value1:" << value1;
    qDebug() << "contains 'six' ?" << map.contains("six");

    // 使用value()函数获取键的值,这样当键不存在时不会自动插入
    int value2 = map.value("five");

    qDebug() << "value2:" << value2;
    qDebug() << "contains 'five' ?" << map.contains("five");

    // 当键不存在时,value()默认返回0,这里可以设定该值,比如这里设置为9
    int value3 = map.value("nine",9);

    qDebug() << "value3:" << value3;

    // map默认是一个键对应一个值,如果重新给该键设置了值,那么以前的会被擦除
    map.insert("ten",10);
    map.insert("ten",100);
    qDebug() << "ten: " << map.value("ten");

    // 可以使用insertMulti()函数来实现一键多值,然后使用values()函数来获取值的列表
    map.insertMulti("two",2);
    map.insertMulti("two",4);
    QList<int> values = map.values("two");
    qDebug() << "two: " << values;

    // 也可以使用QMultiMap类来实现一键多值
    QMultiMap<QString,int> map1,map2,map3;
    map1.insert("values",1);
    map1.insert("values",2);
    map2.insert("values",3);
    // 可以进行相加,这样map3中的“values”键将包含3,2,1三个值
    map3 = map1 + map2;
    QList<int> myValues = map3.values("values");
    qDebug() << "the values are: ";
    for(int i=0; i<myValues.size(); ++i) {
        qDebug() << myValues.at(i);
    }

    return a.exec();
}
Пример #20
0
void Palapeli::TriggerListView::getAssociations(QMap<QByteArray, Palapeli::Trigger>& associations)
{
	for (int i = 0; i < m_baseModel->rowCount(); ++i)
	{
		QStandardItem* item = m_baseModel->item(i);
		const QByteArray interactor = item->data(Palapeli::InteractorRole).value<QByteArray>();
		const Palapeli::Trigger trigger = item->data(Palapeli::TriggerRole).value<Palapeli::Trigger>();
		if (trigger.isValid())
			associations.insertMulti(interactor, trigger);
	}
}
Пример #21
0
QMap<QString, QgsLocatorFilter *> QgsLocator::prefixedFilters() const
{
  QMap<QString, QgsLocatorFilter *> filters = QMap<QString, QgsLocatorFilter *>();
  for ( QgsLocatorFilter *filter : mFilters )
  {
    if ( !filter->activePrefix().isEmpty() && filter->enabled() )
    {
      filters.insertMulti( filter->activePrefix(), filter );
    }
  }
  return filters;
}
Пример #22
0
QMap<int, QString> ToolsListView::itemsToMap(const QList<QTreeWidgetItem*> items) const
{
    QMap<int, QString> map;

    foreach(QTreeWidgetItem* const itm, items)
    {
        ToolListViewItem* const tlwi = dynamic_cast<ToolListViewItem*>(itm);

        if (tlwi)
        {
            map.insertMulti((int)(tlwi->tool()->toolGroup()), tlwi->tool()->objectName());
        }
    }
Пример #23
0
QList<REntity::Id> RStorage::orderBackToFront(const QSet<REntity::Id>& entityIds) const {
    QMap<int, REntity::Id> res;
    QSet<REntity::Id>::const_iterator it;
    //maxDrawOrder = 0;
    for (it = entityIds.begin(); it != entityIds.end(); ++it) {
        QSharedPointer<REntity> e = queryEntityDirect(*it);
        if (!e.isNull()) {
            res.insertMulti(e->getDrawOrder(), *it);
            //maxDrawOrder = qMax(e->getDrawOrder()+1, maxDrawOrder);
        }
    }
    return res.values();
}
Пример #24
0
void ActivityManager::sortActivities() {
  QGraphicsLinearLayout *layout = static_cast<QGraphicsLinearLayout *>(static_cast<QGraphicsWidget *>(extender()->item("Activities")->widget())->layout());
  // remove all activities from the layout
  while (layout->count())
    layout->removeAt(0);
  // insert all activities to a map
  QMap<QString, ActivityWidget *> activities;
  foreach (ActivityWidget *activity, m_activities.values())
    activities.insertMulti(activity->name(), activity);
  // add activities into the layout at ascending order of their names
  foreach (ActivityWidget *activity, activities.values())
    layout->addItem(activity);
}
Пример #25
0
void QgsServerProjectParser::layerFromLegendLayer( const QDomElement& legendLayerElem, QMap< int, QgsMapLayer*>& layers, bool useCache ) const
{
  QString id = legendLayerElem.firstChild().firstChild().toElement().attribute( "layerid" );
  int drawingOrder = updateLegendDrawingOrder() ? -1 : mCustomLayerOrder.indexOf( id );

  QHash< QString, QDomElement >::const_iterator layerIt = mProjectLayerElementsById.find( id );
  if ( layerIt != mProjectLayerElementsById.constEnd() )
  {
    QgsMapLayer* layer = createLayerFromElement( layerIt.value(), useCache );
    if ( layer )
    {
      layers.insertMulti( drawingOrder, layer );
    }
  }
}
Пример #26
0
QList<HitElement> Sak::createHitsList(const QDateTime& from , const QDateTime& to )
{
    QMap<QDateTime, HitElement> hits;
    foreach(const Task& t, m_editedTasks) {
        QHash<QString, QList< Task::Hit> > ::const_iterator hitr = t.hits.begin(), hend = t.hits.end();
        while(hitr != hend) {
            const QList< Task::Hit > & l(hitr.value());
            for (int i=0; i<l.count(); i++) {
                const QDateTime& d = l[i].timestamp;
                if ( (!from.isValid() || d >= from) && ( !to.isValid() || d <= to) ) {
                    hits.insertMulti(d, HitElement((Task*)&t, hitr.key(), d, l[i].duration));
                }
            }
            hitr++;
        }
    }
Пример #27
0
QMap<QString, QString> PropertyDialog::getOldMetaMap()
{
	QMap<QString, QString> metaMap;
	QStringList metaList = Preferences::p_getMetaList();
	QStringList currentMetaList = QStringList();
	QString currentMeta=QString();
	
	for (int i=0;i<metaList.size();i++)
	{
		currentMeta = domHandler->getExoMeta(currentPath,metaList.at(i));
		currentMetaList = currentMeta.split(" / ");
		
		for (int j=0;j<currentMetaList.size();j++) metaMap.insertMulti(metaList.at(i),currentMetaList.at(j));
	}
	
	return metaMap;
}
Пример #28
0
QMap<int, QString> //static
Tag::list( QNetworkReply* r )
{
    QMap<int, QString> tags;
    try {
        foreach (XmlQuery xq, XmlQuery( r->readAll() ).children("tag"))
            // we toLower always as otherwise it is ugly mixed case, as first
            // ever tag decides case, and Last.fm is case insensitive about it 
            // anyway
            tags.insertMulti( xq["count"].text().toInt(), xq["name"].text().toLower() );
    }
    catch (ws::ParseError& e)
    {
        qWarning() << e.what();
    }
    return tags;
}
Пример #29
0
  Q_FOREACH ( QgsDataItemProvider* pr, QgsDataItemProviderRegistry::instance()->providers() )
  {
    int capabilities = pr->capabilities();
    if ( capabilities == QgsDataProvider::NoDataCapabilities )
    {
      QgsDebugMsg( pr->name() + " does not have any dataCapabilities" );
      continue;
    }

    QgsDataItem *item = pr->createDataItem( "", nullptr );  // empty path -> top level
    if ( item )
    {
      QgsDebugMsg( "Add new top level item : " + item->name() );
      connectItem( item );
      providerMap.insertMulti( capabilities, item );
    }
  }
Пример #30
0
void RecognitionDatabase::addIdentityAttribute(int id, const QString& attribute, const QString& value)
{
    if (!d || !d->dbAvailable)
    {
        return;
    }

    QMutexLocker lock(&d->mutex);
    QHash<int, Identity>::iterator it = d->identityCache.find(id);

    if (it != d->identityCache.end())
    {
        QMap<QString, QString> map = it->attributesMap();
        map.insertMulti(attribute, value);
        it->setAttributesMap(map);
        DatabaseFaceAccess(d->db).db()->updateIdentity(*it);
    }
}