Beispiel #1
0
void Su2Writer::writeBoundaries()
{
  QTextStream f(m_File);
  f << "%\n";
  f << "% Boundary elements\n";
  f << "%\n";
  QSet<int> bcs = GuiMainWindow::pointer()->getAllBoundaryCodes();
  f << "NMARK= " << bcs.size() << "\n";
  EG_VTKDCC(vtkIntArray, cell_code, m_Grid, "cell_code");
  foreach (int bc, bcs) {
    BoundaryCondition BC = GuiMainWindow::pointer()->getBC(bc);
    f << "MARKER_TAG= " << BC.getName() << "\n";
    QList<vtkIdType> faces;
    for (vtkIdType id_cell = 0; id_cell < m_Grid->GetNumberOfCells(); ++id_cell) {
      if (isSurface(id_cell, m_Grid)) {
        if (cell_code->GetValue(id_cell) == bc) {
          faces.append(id_cell);
        }
      }
    }
    f << "MARKER_ELEMS= " << faces.size() << "\n";
    foreach (vtkIdType id_cell, faces) {
      f << m_Grid->GetCellType(id_cell);
      vtkIdType N_pts, *pts;
      m_Grid->GetCellPoints(id_cell, N_pts, pts);
      for (int j = 0; j < N_pts; ++j) {
        f << " " << pts[j];
      }
      f << "\n";
    }
QString QgsWFSSourceSelect::getPreferredCrs( const QSet<QString>& crsSet ) const
{
  if ( crsSet.size() < 1 )
  {
    return QLatin1String( "" );
  }

  //first: project CRS
  QgsCoordinateReferenceSystem projectRefSys = QgsProject::instance()->crs();
  //convert to EPSG
  QString ProjectCRS;
  if ( projectRefSys.isValid() )
  {
    ProjectCRS = projectRefSys.authid();
  }

  if ( !ProjectCRS.isEmpty() && crsSet.contains( ProjectCRS ) )
  {
    return ProjectCRS;
  }

  //second: WGS84
  if ( crsSet.contains( GEO_EPSG_CRS_AUTHID ) )
  {
    return GEO_EPSG_CRS_AUTHID;
  }

  //third: first entry in set
  return *( crsSet.constBegin() );
}
Beispiel #3
0
	QScriptValue Sql::drivers(QScriptContext *context, QScriptEngine *engine)
	{
		Q_UNUSED(context)

		QStringList driverNames = QSqlDatabase::drivers();
		QSet<Driver> driverList;

		for(int index = 0; index < driverNames.size(); ++index)
		{
			const QString &driverNameToInclude = driverNames.at(index);

			for(int driverIndex = 0; driverIndex < DriverCount; ++driverIndex)
			{
				if(driverName(static_cast<Driver>(driverIndex)) == driverNameToInclude)
					driverList.insert(static_cast<Driver>(driverIndex));
			}
		}

		QScriptValue back = engine->newArray(driverList.size());
		int index = 0;
        for(const Driver &driver: driverList)
		{
			back.setProperty(index, driver);

			++index;
		}

		return back;
	}
void tst_QVersitProperty::testHash()
{
    QVersitProperty property1;
    property1.setGroups(QStringList() << QLatin1String("group1") << QLatin1String("group2"));
    property1.setName(QLatin1String("name"));
    property1.setValue(QLatin1String("value"));
    property1.insertParameter(QLatin1String("param"), QLatin1String("value"));
    QVersitProperty property2;
    property2.setGroups(QStringList() << QLatin1String("group1") << QLatin1String("group2"));
    property2.setName(QLatin1String("name"));
    property2.setValue(QLatin1String("value"));
    property2.insertParameter(QLatin1String("param"), QLatin1String("value"));
    QVersitProperty property3; // no groups
    property3.setName(QLatin1String("name"));
    property3.setValue(QLatin1String("value"));
    property3.insertParameter(QLatin1String("param"), QLatin1String("value"));
    QVersitProperty property4; // no params
    property4.setGroups(QStringList() << QLatin1String("group1") << QLatin1String("group2"));
    property4.setName(QLatin1String("name"));
    property4.setValue(QLatin1String("value"));

    QVERIFY(qHash(property1) == qHash(property2));
    QVERIFY(qHash(property1) != qHash(property3));
    QVERIFY(qHash(property1) != qHash(property4));
    QVERIFY(qHash(property3) != qHash(property4));
    QSet<QVersitProperty> set;
    set.insert(property1);
    set.insert(property2);
    set.insert(property3);
    set.insert(property4);
    QCOMPARE(set.size(), 3);
}
Beispiel #5
0
void VConfigManager::readShortcutsFromSettings()
{
    const QString group("shortcuts");

    m_shortcuts.clear();
    m_shortcuts = readShortcutsFromSettings(defaultSettings, group);

    // Update default settings according to user settings.
    QHash<QString, QString> userShortcuts = readShortcutsFromSettings(userSettings,
                                                                      group);
    QSet<QString> matched;
    matched.reserve(m_shortcuts.size());
    for (auto it = userShortcuts.begin(); it != userShortcuts.end(); ++it) {
        auto defaultIt = m_shortcuts.find(it.key());
        if (defaultIt != m_shortcuts.end()) {
            QString sequence = it.value().trimmed();
            if (sequence != defaultIt.value()) {
                if (isValidKeySequence(sequence)) {
                    matched.insert(it.key());
                    *defaultIt = sequence;
                }
            } else {
                matched.insert(it.key());
            }
        }
    }

    if (matched.size() < m_shortcuts.size()) {
        qDebug() << "override user shortcuts settings using default settings";
        writeShortcutsToSettings(userSettings, group, m_shortcuts);
    }
}
Beispiel #6
0
bool QXmppServerPrivate::routeData(const QString &to, const QByteArray &data)
{
    // refuse to route packets to empty destination, own domain or sub-domains
    const QString toDomain = QXmppUtils::jidToDomain(to);
    if (to.isEmpty() || to == domain || toDomain.endsWith("." + domain))
        return false;

    if (toDomain == domain) {

        // look for a client connection
        QList<QXmppIncomingClient*> found;
        if (QXmppUtils::jidToResource(to).isEmpty()) {
            foreach (QXmppIncomingClient *conn, incomingClientsByBareJid.value(to))
                found << conn;
        } else {
            QXmppIncomingClient *conn = incomingClientsByJid.value(to);
            if (conn)
                found << conn;
        }

        // send data
        foreach (QXmppStream *conn, found)
            QMetaObject::invokeMethod(conn, "sendData", Q_ARG(QByteArray, data));
        return !found.isEmpty();

    } else if (!serversForServers.isEmpty()) {

        bool check;
        Q_UNUSED(check);

        // look for an outgoing S2S connection
        foreach (QXmppOutgoingServer *conn, outgoingServers) {
            if (conn->remoteDomain() == toDomain) {
                // send or queue data
                QMetaObject::invokeMethod(conn, "queueData", Q_ARG(QByteArray, data));
                return true;
            }
        }

        // if we did not find an outgoing server,
        // we need to establish the S2S connection
        QXmppOutgoingServer *conn = new QXmppOutgoingServer(domain, 0);
        conn->setLocalStreamKey(QXmppUtils::generateStanzaHash().toLatin1());
        conn->moveToThread(q->thread());
        conn->setParent(q);

        check = QObject::connect(conn, SIGNAL(disconnected()),
                                 q, SLOT(_q_outgoingServerDisconnected()));
        Q_UNUSED(check);

        // add stream
        outgoingServers.insert(conn);
        q->setGauge("outgoing-server.count", outgoingServers.size());

        // queue data and connect to remote server
        QMetaObject::invokeMethod(conn, "queueData", Q_ARG(QByteArray, data));
        QMetaObject::invokeMethod(conn, "connectToHost", Q_ARG(QString, toDomain));
        return true;

    } else {
Beispiel #7
0
void NosJujianCard::onEffect(const CardEffectStruct &effect) const{
    int n = subcardsLength();
    effect.to->drawCards(n);
    Room *room = effect.from->getRoom();
    room->playSkillEffect("jujian");

    if(n == 3){
        QSet<Card::CardType> types;

        foreach(int card_id, effect.card->getSubcards()){
            const Card *card = Sanguosha->getCard(card_id);
            types << card->getTypeId();
        }

        if(types.size() == 1){

            LogMessage log;
            log.type = "#JujianRecover";
            log.from = effect.from;
            const Card *card = Sanguosha->getCard(subcards.first());
            log.arg = card->getType();
            room->sendLog(log);

            RecoverStruct recover;
            recover.card = this;
            recover.who = effect.from;
            room->recover(effect.from, recover);
        }
    }
Beispiel #8
0
QString QgsWFSSourceSelect::getPreferredCrs( const QSet<QString>& crsSet ) const
{
    if ( crsSet.size() < 1 )
    {
        return "";
    }

    //first: project CRS
    long ProjectCRSID = QgsProject::instance()->readNumEntry( "SpatialRefSys", "/ProjectCRSID", -1 );
    //convert to EPSG
    QgsCoordinateReferenceSystem projectRefSys = QgsCRSCache::instance()->crsBySrsId( ProjectCRSID );
    QString ProjectCRS;
    if ( projectRefSys.isValid() )
    {
        ProjectCRS = projectRefSys.authid();
    }

    if ( !ProjectCRS.isEmpty() && crsSet.contains( ProjectCRS ) )
    {
        return ProjectCRS;
    }

    //second: WGS84
    if ( crsSet.contains( GEO_EPSG_CRS_AUTHID ) )
    {
        return GEO_EPSG_CRS_AUTHID;
    }

    //third: first entry in set
    return *( crsSet.constBegin() );
}
Beispiel #9
0
WalletModel::SendCoinsReturn WalletModel::sendCoins(const QList<SendCoinsRecipient> &recipients, const CCoinControl *coinControl)
{
    qint64 total = 0;
    QSet<QString> setAddress;
    QString hex;

    if(recipients.empty())
    {
        return OK;
    }

    // Pre-check input data for validity
    foreach(const SendCoinsRecipient &rcp, recipients)
    {
        if(!validateAddress(rcp.address))
        {
            return InvalidAddress;
        }
        setAddress.insert(rcp.address);

        if(rcp.amount <= 0)
        {
            return InvalidAmount;
        }
        total += rcp.amount;
    }

    if(recipients.size() > setAddress.size())
    {
        return DuplicateAddress;
    }

    int64 nBalance = getBalance(coinControl);

    if(total > nBalance)
    {
        return AmountExceedsBalance;
    }

    if((total + nTransactionFee) > nBalance)
    {
        return SendCoinsReturn(AmountWithFeeExceedsBalance, nTransactionFee);
    }
	
    
        

        // Sendmany
        std::vector<std::pair<CScript, int64> > vecSend;
        foreach(const SendCoinsRecipient &rcp, recipients)
        {
			CBitcoinAddress myAddress = CBitcoinAddress(rcp.address.toStdString());
			LOCK2(cs_main, wallet->cs_wallet);
			{
				CScript scriptPubKey;
				scriptPubKey.SetDestination(myAddress.Get());
				vecSend.push_back(make_pair(scriptPubKey, rcp.amount));
			}
        }
Beispiel #10
0
void BaseTrackCache::slotTracksRemoved(QSet<TrackId> trackIds) {
    if (sDebug) {
        qDebug() << this << "slotTracksRemoved" << trackIds.size();
    }
    for (const auto& trackId : trackIds) {
        m_trackInfo.remove(trackId);
    }
}
Beispiel #11
0
void NimProject::populateProject()
{
    m_lastProjectScan.start();

    QSet<QString> oldFiles(m_files);
    m_files.clear();

    recursiveScanDirectory(m_projectDir, m_files);

    QSet<QString> removedFiles = oldFiles - m_files;
    QSet<QString> addedFiles = m_files - oldFiles;

    removeNodes(removedFiles);
    addNodes(addedFiles);

    if (removedFiles.size() || addedFiles.size())
        emit fileListChanged();
}
Beispiel #12
0
int ctkDependencyGraphPrivate::subgraphSize(int rootId)
{
  Q_ASSERT(rootId > 0);

  QSet<int> vertices;
  vertices << rootId;
  this->subgraphSizeRec(rootId, vertices);
  return vertices.size();
}
Beispiel #13
0
 virtual bool validate(const Configuration* cfg, ProblemList &problemList) const {
     QString annotations = cfg->getParameter(ANN_ATTR)->getAttributeValueWithoutScript<QString>();
     QSet<QString> names = QSet<QString>::fromList(annotations.split(QRegExp("\\W+"), QString::SkipEmptyParts));
     if (names.size() < 2) {
         problemList.append(Problem(CollocationWorker::tr("At least 2 annotations are required for collocation search.")));
         return false;
     }
     return true;
 }
Beispiel #14
0
 foreach (const QByteArray &extensionCppName, extensionCppNames) {
     if (c != extensionCppNames.size() - 1) {
         QByteArray adjustedName = QString("__extension__%1.%2").arg(QString::number(c), QString(extendedId)).toAscii();
         cppToId.insert(extensionCppName, adjustedName);
     } else {
         cppToId.insert(extensionCppName, extendedId);
     }
     ++c;
 }
Beispiel #15
0
MessageModel::StatusCode MessageModel::sendMessages(const QList<SendMessagesRecipient> &recipients, const QString &addressFrom)
{

    QSet<QString> setAddress;

    if(recipients.empty())
        return OK;

    // Pre-check input data for validity
    foreach(const SendMessagesRecipient &rcp, recipients)
    {
        if(!walletModel->validateAddress(rcp.address))
            return InvalidAddress;

        if(rcp.message == "")
            return MessageCreationFailed;

        std::string sendTo  = rcp.address.toStdString();
        std::string pubkey  = rcp.pubkey.toStdString();
        std::string message = rcp.message.toStdString();
        std::string addFrom = addressFrom.toStdString();

        SecureMsgAddAddress(sendTo, pubkey);
        setAddress.insert(rcp.address);
        
        std::string sError;
        if (SecureMsgSend(addFrom, sendTo, message, sError) != 0)
        {
            QMessageBox::warning(NULL, tr("Send Secure Message"),
                tr("Send failed: %1.").arg(sError.c_str()),
                QMessageBox::Ok, QMessageBox::Ok);
            
            return FailedErrorShown;
        };

        // Add addresses / update labels that we've sent to to the address book
        std::string strAddress = rcp.address.toStdString();
        CTxDestination dest = CBitcoinAddress(strAddress).Get();
        std::string strLabel = rcp.label.toStdString();
        {
            LOCK(wallet->cs_wallet);

            std::map<CTxDestination, std::string>::iterator mi = wallet->mapAddressBook.find(dest);

            // Check if we have a new address or an updated label
            if (mi == wallet->mapAddressBook.end() || mi->second != strLabel)
            {
                wallet->SetAddressBookName(dest, strLabel);
            }
        }
    }

    if(recipients.size() > setAddress.size())
        return DuplicateAddress;

    return OK;
}
Beispiel #16
0
QString
QmlRulesModel::getDaysSummaryText(const QSet<int> &days) const {
    // qDebug("QmlRulesModel::getDaysSummaryText(), days size %d", days.size());

    if (days.size() == 7) {
        return "All days";
    }
    if (days.size() == 0) {
        return "No days";
    }
    // If only one day selected, display full name
    if (days.size() == 1) {
        int dayId = *(days.constBegin());
        return QDate::longDayName(dayId + 1, QDate::StandaloneFormat);
    }

    int rangeStart = -1;

    QString daysStr = "";
    // The loop goes up-to 7 so that Sunday is considered as last in range.
    // Days.contains for 7 should always contain false as days are in range of 0-6.
    for (int i = 0; i < 8; ++i) {
        if (days.contains(i)) {
            if (rangeStart < 0) {
                rangeStart = i;

            }
        } else {
            if (rangeStart > -1) {
                if (!daysStr.isEmpty()) {
                    daysStr += ", ";
                }

                daysStr += QDate::shortDayName(rangeStart + 1, QDate::StandaloneFormat);
                if (rangeStart < i - 1) {
                    daysStr += " - ";
                    daysStr += QDate::shortDayName((i - 1) + 1, QDate::StandaloneFormat);
                }
                rangeStart = -1;
            }
        }
    }
    return daysStr;
}
Beispiel #17
0
bool MimeDatabasePrivate::inherits(const QString &mime, const QString &parent)
{
    const QString resolvedParent = provider()->resolveAlias(parent);
    //Q_ASSERT(provider()->resolveAlias(mime) == mime);
    QStack<QString> toCheck;
    QSet<QString> seen; // avoid endless loop on bogus mime data
    toCheck.push(mime);
    seen.insert(mime);
    while (!toCheck.isEmpty()) {
        const QString current = toCheck.pop();
        if (current == resolvedParent)
            return true;
        foreach (const QString &par, provider()->parents(current)) {
            int seenSize = seen.size();
            seen.insert(par);
            if (seen.size() != seenSize) // haven't seen before, so add
                toCheck.push(par);
        }
    }
Beispiel #18
0
void ImapSet::add(const QSet<Id> &values)
{
    QVector<Id> v;
    v.reserve(values.size());
    for (QSet<Id>::ConstIterator iter = values.constBegin(); iter != values.constEnd(); ++iter) {
        v.push_back(*iter);
    }

    add(v);
}
Beispiel #19
0
void BaseTrackCache::slotTracksAdded(QSet<TrackId> trackIds) {
    if (sDebug) {
        qDebug() << this << "slotTracksAdded" << trackIds.size();
    }
    QSet<TrackId> updateTrackIds;
    for (const auto& trackId: trackIds) {
        updateTrackIds.insert(trackId);
    }
    updateTracksInIndex(updateTrackIds);
}
Beispiel #20
0
/// Calls the Unsubscribe function over DBus asynchronously.
void SubscriberInterface::unsubscribe(QSet<QString> keys)
{
    if (isValid() && keys.size() != 0) {
        // Construct the asynchronous call
        QStringList keyList = keys.toList();

        asyncCall("Unsubscribe", keyList);
        // The possible errors are not tracked, because we can't do anything if Unsubscribe fails.
    }
}
void QSGSharedDistanceFieldGlyphCache::releaseGlyphs(const QSet<glyph_t> &glyphs)
{
#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG)
    qDebug("QSGSharedDistanceFieldGlyphCache::releaseGlyphs() called for %s (%d glyphs)",
           m_cacheId.constData(), glyphs.size());
#endif

    m_requestedGlyphs.subtract(glyphs);

    QVector<quint32> glyphsVector;
    glyphsVector.reserve(glyphs.size());

    QSet<glyph_t>::const_iterator glyphsIt;
    for (glyphsIt = glyphs.constBegin(); glyphsIt != glyphs.constEnd(); ++glyphsIt) {
        QHash<glyph_t, void *>::iterator bufferIt = m_bufferForGlyph.find(*glyphsIt);
        if (bufferIt != m_bufferForGlyph.end()) {
            void *buffer = bufferIt.value();
            removeGlyph(*glyphsIt);
            m_bufferForGlyph.erase(bufferIt);
            Q_ASSERT(!m_bufferForGlyph.contains(*glyphsIt));

            if (!m_sharedGraphicsCache->dereferenceBuffer(buffer)) {
#if !defined(QT_NO_DEBUG)
                bufferIt = m_bufferForGlyph.begin();
                while (bufferIt != m_bufferForGlyph.end()) {
                    Q_ASSERT(bufferIt.value() != buffer);
                    ++bufferIt;
                }
#endif
            }
        }

        glyphsVector.append(*glyphsIt);
    }

    m_hasPostedEvents = true;
    QSGMainThreadInvoker *mainThreadInvoker = QSGMainThreadInvoker::instance();
    QCoreApplication::postEvent(mainThreadInvoker, new QSGReleaseItemsEvent(m_sharedGraphicsCache,
                                                                            m_cacheId,
                                                                            glyphsVector,
                                                                            m_isInSceneGraphUpdate));
}
Beispiel #22
0
void tst_QSet::capacity()
{
    QSet<int> set;
    int n = set.capacity();
    QVERIFY(n == 0);

    for (int i = 0; i < 1000; ++i) {
        set.insert(i);
        QVERIFY(set.capacity() >= set.size());
    }
}
Beispiel #23
0
void MapScene::setSelectedObjectItems(const QSet<MapObjectItem *> &items)
{
    // Inform the map document about the newly selected objects
    QList<MapObject*> selectedObjects;
    selectedObjects.reserve(items.size());

    for (const MapObjectItem *item : items)
        selectedObjects.append(item->mapObject());

    mMapDocument->setSelectedObjects(selectedObjects);
}
Beispiel #24
0
int main ()
{
  QSet<int> first;                           // isEmpty QSet of ints
  assert(first.size() == 0);
  assert(first.begin() == first.end());
  QSet<int> second;
  second.insert(10);
  second.insert(20);
  QSet<int> third(second);
  assert(third.size() != 2);
  return 0;
}
Beispiel #25
0
	void ItemsListModel::RemoveItems (const QSet<IDType_t>& ids)
	{
		if (ids.isEmpty ())
			return;

		const bool shouldReset = ids.size () > 10;

		if (shouldReset)
			beginResetModel ();

		int remainingCount = ids.size ();

		for (auto i = CurrentItems_.begin ();
				i != CurrentItems_.end () && remainingCount; )
		{
			if (!ids.contains (i->ItemID_))
			{
				++i;
				continue;
			}

			if (!shouldReset)
			{
				const size_t dist = std::distance (CurrentItems_.begin (), i);
				beginRemoveRows (QModelIndex (), dist, dist);
			}

			i = CurrentItems_.erase (i);
			--remainingCount;

			if (!shouldReset)
			{
				endRemoveRows ();
				qApp->processEvents (QEventLoop::ExcludeUserInputEvents);
			}
		}

		if (shouldReset)
			endResetModel ();
	}
Beispiel #26
0
    void testFindingTables()
    {
        // How to find all the tables in a QTextDocument?
        QTextDocument textDoc;
        QTextCursor c( &textDoc );
        QTextTable* firstTable = c.insertTable( 2, 2 );
        QTextTableCell bottomRight = firstTable->cellAt( 1, 1 );
        QTextTable* secondTable = bottomRight.firstCursorPosition().insertTable( 3, 3 ); // a nested table
        c.movePosition( QTextCursor::End );
        QTextTable* thirdTable = c.insertTable( 1, 1 );
        thirdTable->firstCursorPosition().insertText( "in table" );
        c.insertText( "Foo" );
        QList<QTextTable *> origTables;
        origTables << firstTable << secondTable << thirdTable;

        // A generic and slow solution is
        //    curs.currentTable() && !tablesFound.contains(curs.currentTable())
        // for each cursor position. Surely there's better.
        // We could jump to currentFrame().lastCursorPosition() but then it would skip
        // nested tables.
        QTextDocument* clonedDoc = textDoc.clone();
        QSet<QTextTable *> tablesFound;
        {
            QTextCursor curs(clonedDoc);
            while (!curs.atEnd()) {
                QTextTable* currentTable = curs.currentTable();
                if ( currentTable && !tablesFound.contains(currentTable) ) {
                    tablesFound.insert( currentTable );
                }
                curs.movePosition( QTextCursor::NextCharacter );
            }
            QCOMPARE( tablesFound.size(), 3 );
        }

        // Let's do something else then, let's find them by cursor position
        QList<QTextTable *> tablesByPos;
        {
            // first test
            const int firstPos = firstTable->firstCursorPosition().position();
            QTextCursor curs( clonedDoc );
            curs.setPosition( firstPos );
            QVERIFY( curs.currentTable() );

            // generic loop. works this approach is in TextDocument::breakTables now.
            Q_FOREACH( QTextTable* origTable, origTables ) {
                QTextCursor curs( clonedDoc );
                curs.setPosition( origTable->firstCursorPosition().position() );
                tablesByPos.append( curs.currentTable() );
            }
            QCOMPARE( tablesByPos.size(), 3 );
            QCOMPARE( tablesByPos.toSet(), tablesFound );
        }
Beispiel #27
0
QVector<TagModelItem *> TagFilterModel::findItems(const QSet<QString> &tags)
{
    QVector<TagModelItem *> items;
    items.reserve(tags.size());
    for (const QString &tag : tags) {
        TagModelItem *item = findItem(tag);
        if (item)
            items.push_back(item);
        else
            qWarning() << QString("Requested tag '%1' missing from the model.").arg(tag);
    }
    return items;
}
Beispiel #28
0
QList<int> Common::RandSample(int n, const QSet<int> &values, bool unique)
{
    QList<int> valueList = values.toList();
    if (unique && (values.size() <= n)) return valueList;

    QList<int> samples; samples.reserve(n);
    while (samples.size() < n) {
        const int randIndex = rand() % valueList.size();
        samples.append(valueList[randIndex]);
        if (unique) valueList.removeAt(randIndex);
    }
    return samples;
}
void ClassSpaceChecker::onInnerClassReportItemSelectionChanged()
{
	QList<QTableWidgetItem *> items = ui.tableWidgetInnerClassReport->selectedItems();
	if(items.size() <= 0)
	{
		ui.lineEdit_Result->setText(prevTotalResultStr_);
		return;
	}

	QSet<int> set;
	int classCount = 0;
	int anonymousClassCount = 0;
	int uniqueClassCount = 0;
	int totalSize = 0;
	for(int i = 0; i < items.size(); i++) 
	{
		QTableWidgetItem *item = items.at(i);
		int row = item->row();
		if(set.find(row) != set.end())
			continue;

		QTableWidgetItem *itemClassCount = ui.tableWidgetInnerClassReport->item(item->row(), 1);
		if(itemClassCount == NULL)
			continue;
		classCount += itemClassCount->data(Qt::DisplayRole).toInt();

		QTableWidgetItem *itemAnonymousCount = ui.tableWidgetInnerClassReport->item(item->row(), 2);
		if(itemAnonymousCount == NULL)
			continue;
		anonymousClassCount += itemAnonymousCount->data(Qt::DisplayRole).toInt();

		QTableWidgetItem *itemFileSize = ui.tableWidgetInnerClassReport->item(item->row(), 3);
		if(itemFileSize == NULL)
			continue;
		totalSize += itemFileSize->data(Qt::DisplayRole).toInt();
		set.insert(row);
	}

	QString resultStr;
	resultStr += "Selected Count : ";
	resultStr += QString::number(set.size());
	resultStr += ", Inner Class Count : ";
	resultStr += QString::number(classCount);
	resultStr += ", Anonymous Class Count : ";
	resultStr += QString::number(anonymousClassCount);
	resultStr += ", File Size : ";
	resultStr += numberDot(QString::number(totalSize));
	resultStr += " bytes";

	ui.lineEdit_Result->setText(resultStr);
}
void OscarPrivacyEngine::addContacts( const ContactMap& contacts, const QSet<QString>& idSet )
{
	m_idSet = idSet;
	m_contactsModel.clear();
	m_contactsModel.insertColumns( 0, 1 );
	m_contactsModel.insertRows( 0, idSet.size() );
	
	int i = 0;
	foreach ( const QString& id, idSet )
	{
		QModelIndex index = m_contactsModel.index( i++, 0 );
		
		m_contactsModel.setData( index, id, Qt::UserRole );
		m_contactsModel.setData( index, contacts.value( id, id ), Qt::DisplayRole );
	}