当前位置: 首页>>代码示例>>C++>>正文


C++ QSet类代码示例

本文整理汇总了C++中QSet的典型用法代码示例。如果您正苦于以下问题:C++ QSet类的具体用法?C++ QSet怎么用?C++ QSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PatchTri


//.........这里部分代码省略.........
        //cout<<"Patch "<< wtf<<endl;
        wtf++;


        //choose seed triangle, get center point
        //for now, tangent equals vo--->v1  (should be curvature!)
        //assign UVS to PatchTri s.t. centered at .5,.5 and tangent is aligned with texture //HOW???? NEED BITANGENT OR NO?  HOW TO DETERMINE SCALE?
        //enqueue edges of triangle

        //DONT DELETE THESE THINGS!
        //hash table of uvs for this specific patch!
        QHash<PatchVert*,vec2<float> >* UVs = new QHash<PatchVert*, vec2<float> >();
        //list of Tris for this specific patch!
        QList<PatchTri*>* PTris = new QList<PatchTri*>();
        //seed for this specific patch!
        //PatchTri* seed = trisMade[0];//rand()%model->numtriangles];
        PatchTri* seed = trisInNOPatch->at(0);
        //trisInNOPatch->removeFirst();


        vec2<float> seedUV0, seedUV1, seedUV2;
        assignSeedUV(seed, seedUV0, seedUV1, seedUV2);
        UVs->insert(seed->v0,seedUV0);
        UVs->insert(seed->v1,seedUV1);
        UVs->insert(seed->v2,seedUV2);

        QQueue<PatchEdge*>* edgeQ = new QQueue<PatchEdge*>();
        edgeQ->enqueue(seed->e01);
        edgeQ->enqueue(seed->e12);
        edgeQ->enqueue(seed->e20);

        //make visitedSets of edges, verts, tris
        //mark everything from seed as visited
        QSet<PatchVert*>* vertsInPatch = new QSet<PatchVert*>();
        QSet<PatchEdge*>* edgesInPatch = new QSet<PatchEdge*>();
        QSet<PatchTri*>* trisInPatch = new QSet<PatchTri*>();
        vertsInPatch->insert(seed->v0);
        vertsInPatch->insert(seed->v1);
        vertsInPatch->insert(seed->v2);
        edgesInPatch->insert(seed->e01);
        edgesInPatch->insert(seed->e12);
        edgesInPatch->insert(seed->e20);
        trisInPatch->insert(seed);
        trisInNOPatch->removeAll(seed);
        PTris->append(seed);
        //cout<<"PTris size init: "<<PTris->size()<<endl;

        //while Q not empty
        //dequeue edge e
        //find other triangle in edge
        //if tri is not in patch
        //if e isects hull  //see struct polyHull::isectUV
        //if homeomorphic to a disc (new vert not in patch OR only 1 edge not in patch)
        //if new vert already in patch
        //just add triangle to patch!
        //enqueue new edges of triangle
        //and mark them as visited, as well as new tri itself
        //else need to add vert:
        //estimate parametrization of new vert like so:
        //for each triangle containing vert and an already-mapped edge
        //stick a similar triangle onto that edge, and see where the corresponding location of vert is
        //take average of those guys as UV for new vert
        //then add triangle like above: enq new edges, mark any new edges, vert, tri as visited
        //patch is done, delete visitedSets, continue to next patch
        int fucktris = 0;
        while((!edgeQ->isEmpty()))// && fucktris < 3)
开发者ID:hillsalex,项目名称:Darkon,代码行数:67,代码来源:LappedUtils.cpp

示例2: registerTypes

void AsemanQtTools::registerTypes(const char *uri, bool exportMode)
{
    static QSet<QByteArray> register_list;
    if(register_list.contains(uri) && !exportMode)
        return;
    qRegisterMetaType<AsemanMimeData*>("AsemanMimeData*");

    registerType<AsemanMimeData>(uri, 1, 0, "MimeData", exportMode);
    registerType<AsemanDragObject>(uri, 1, 0, "DragObject", exportMode);
    registerType<AsemanHashObject>(uri, 1,0, "HashObject", exportMode);
    registerType<AsemanListObject>(uri, 1,0, "ListObject", exportMode);
    registerType<AsemanDownloader>(uri, 1,0, "Downloader", exportMode);
    registerType<AsemanEncrypter>(uri, 1,0, "Encrypter", exportMode);
#ifndef DISABLE_KEYCHAIN
    registerType<AsemanKeychain>(uri, 1,0, "Keychain", exportMode);
#endif
#ifdef QT_WIDGETS_LIB
    registerType<AsemanSystemTray>(uri, 1,0, "SystemTray", exportMode);
#endif
    registerType<AsemanWindowDetails>(uri, 1,0, "WindowDetails", exportMode);
    registerType<AsemanQuickObject>(uri, 1,0, "AsemanObject", exportMode);
    registerType<AsemanImageColorAnalizor>(uri, 1,0, "ImageColorAnalizor", exportMode);
    registerType<AsemanNotification>(uri, 1,0, "Notification", exportMode);
    registerType<AsemanAutoStartManager>(uri, 1,0, "AutoStartManager", exportMode);
    registerType<AsemanSettings>(uri, 1,0, "Settings", exportMode);
    registerType<AsemanStoreManager>(uri, 1,0, "StoreManager", exportMode);
    registerType<AsemanQuickItemImageGrabber>(uri, 1,0, "ItemImageGrabber", exportMode);
    registerType<AsemanFileDownloaderQueueItem>(uri, 1,0, "FileDownloaderQueueItem", exportMode);
    registerType<AsemanFileDownloaderQueue>(uri, 1,0, "FileDownloaderQueue", exportMode);
    registerType<AsemanFontHandler>(uri, 1,0, "FontHandler", exportMode);
    registerType<AsemanApplicationItem>(uri, 1,0, "AsemanApplication", exportMode);
    registerType<AsemanQmlSmartComponent>(uri, 1,0, "SmartComponentCore", exportMode);
#ifdef DESKTOP_LINUX
    registerType<AsemanMimeApps>(uri, 1,0, "MimeApps", exportMode);
#endif
    registerType<AsemanWebPageGrabber>(uri, 1,0, "WebPageGrabber", exportMode);
    registerType<AsemanHostChecker>(uri, 1,0, "HostChecker", exportMode);
    registerType<AsemanNetworkManager>(uri, 1,0, "NetworkManager", exportMode);
    registerType<AsemanNetworkSleepManager>(uri, 1,0, "NetworkSleepManager", exportMode);
    registerType<AsemanTitleBarColorGrabber>(uri, 1,0, "TitleBarColorGrabber", exportMode);
    registerType<AsemanTaskbarButton>(uri, 1,0, "TaskbarButton", exportMode);
    registerType<AsemanMapDownloader>(uri, 1,0, "MapDownloader", exportMode);
    registerType<AsemanDragArea>(uri, 1,0, "MouseDragArea", exportMode);
    registerType<AsemanCalendarModel>(uri, 1,0, "CalendarModel", exportMode);
#if defined(Q_OS_LINUX) && defined(QT_DBUS_LIB)
    registerType<AsemanKdeWallet>(uri, 1,0, "KdeWallet", exportMode);
#endif

#ifdef ASEMAN_SENSORS
    registerType<AsemanSensors>(uri, 1,0, "AsemanSensors", exportMode);
#endif
#ifdef ASEMAN_MULTIMEDIA
    registerType<AsemanAudioRecorder>(uri, 1,0, "AudioRecorder", exportMode);
    registerType<AsemanAudioEncoderSettings>(uri, 1,0, "AudioEncoderSettings", exportMode);
#endif

    registerModel<AsemanMixedListModel>(uri, 1,0, "MixedListModel", exportMode);
    registerModel<AsemanCountriesModel>(uri, 1,0, "CountriesModel", exportMode);
    registerModel<AsemanFileSystemModel>(uri, 1,0, "FileSystemModel", exportMode);
    registerModel<AsemanStoreManagerModel>(uri, 1,0, "StoreManagerModel", exportMode);
    registerModel<AsemanContributorsModel>(uri, 1,0, "ContributorsModel", exportMode);

    registerSingletonType<AsemanDevices>(uri, 1, 0, "Devices", aseman_devices_singleton, exportMode);
    registerSingletonType<AsemanTextTools>(uri, 1, 0, "TextTools", aseman_text_tools_singleton, exportMode);
    registerSingletonType<AsemanTools>(uri, 1, 0, "Tools", aseman_tools_singleton, exportMode);
    registerSingletonType<AsemanDesktopTools>(uri, 1, 0, "Desktop", aseman_desktoptools_singleton, exportMode);
    registerSingletonType<AsemanCalendarConverter>(uri, 1, 0, "CalendarConv", aseman_calendarconv_singleton, exportMode);
    registerSingletonType<AsemanBackHandler>(uri, 1, 0, "BackHandler", aseman_backhandler_singleton, exportMode);
    registerSingletonType<AsemanApplication>(uri, 1, 0, "AsemanApp", aseman_app_singleton, exportMode);
    registerSingletonType<AsemanQtLogger>(uri, 1, 0, "Logger", aseman_logger_singleton, exportMode);
    registerSingletonType<AsemanQuickViewWrapper>(uri, 1, 0, "View", aseman_qview_singleton, exportMode);
#ifdef Q_OS_ANDROID
    registerSingletonType<AsemanJavaLayer>(uri, 1, 0, "JavaLayer", aseman_javalayer_singleton, exportMode);
#endif

    registerUncreatableType<QScreen>(uri, 1, 0, "Screen", "", exportMode);
    registerUncreatableType<AsemanDesktopTools>(uri, 1,0, "AsemanDesktopTools", "It's a singleton class", exportMode);
    registerUncreatableType<AsemanNetworkManagerItem>(uri, 1,0, "NetworkManagerItem", "It must create using NetworkManager component.", exportMode);

    register_list.insert(uri);
}
开发者ID:ignatenkobrain,项目名称:aseman-qt-tools,代码行数:81,代码来源:asemanqttools.cpp

示例3: oneHLine

bool PorkSendPage::threeLine(int x0, int x1, int y0, int y1)
{
    int i;
    bool ret;

    //横向扫描
    for(i = 0; i < map_col; i++)
    {
         lines.clear();
        if(i == y0 || arr_map[x0][i] != EMPTY)
         continue;
        ret = oneHLine(x0,y0,i);
        if(ret)
        {
            ret = twoLine(x0,x1,i,y1,ret);
            if(ret)
            {
                QSet<QPoint> s;
                for(int i=0;i<lines.size();i++)
                {
                    QLine line=lines[i];
                  //  line.p1();
                    s.insert(line.p1());
                    s.insert(line.p2());
                }

                if(s.size()==5)
                {
                    printf("%d",s.size());
                    lines.removeAt(1);

                }

                return true;
            }
        }
    }
 lines.clear();
    //纵向扫描
    for(i = 0; i < map_row; i++)
    { lines.clear();
        if(i == x0 || arr_map[i][y0] != EMPTY)
         continue;
        ret = oneVLine(y0,x0,i);
        if(ret)
        {
            ret = twoLine(i,x1,y0,y1,ret);
            if(ret)
            {

                //  drawLine(i,y0,i,y1);
               //  drawLine(x0,y0,x1,y0);
                // drawLine(i,y1,x1,y1);

                return true;
            }
        }
    }

    return false;
}
开发者ID:duicoin,项目名称:DuiCoin,代码行数:61,代码来源:porksend.cpp

示例4: load

/**
 * FASTQ format specification: http://maq.sourceforge.net/fastq.shtml
 */
static void load(IOAdapter* io, const U2DbiRef& dbiRef, const QVariantMap& hints, QList<GObject*>& objects, U2OpStatus& os,
                 int gapSize, int predictedSize, QString& writeLockReason, QMap<QString, QString>& skippedLines) {
    DbiOperationsBlock opBlock(dbiRef, os);
    CHECK_OP(os, );
    Q_UNUSED(opBlock);
    writeLockReason.clear();

    bool merge = gapSize!=-1;
    QByteArray sequence;
    QByteArray qualityScores;
    QStringList headers;
    QSet<QString> uniqueNames;

    QVector<U2Region> mergedMapping;
    QByteArray gapSequence((merge ? gapSize : 0), 0);
    sequence.reserve(predictedSize);
    qualityScores.reserve(predictedSize);

    // for lower case annotations
    GObjectReference sequenceRef;
    qint64 sequenceStart = 0;

    U2SequenceImporter seqImporter(hints, true);
    const QString folder = hints.value(DocumentFormat::DBI_FOLDER_HINT, U2ObjectDbi::ROOT_FOLDER).toString();
    int seqNumber = 0;
    int progressUpNum = 0;


    const int objectsCountLimit = hints.contains(DocumentReadingMode_MaxObjectsInDoc) ? hints[DocumentReadingMode_MaxObjectsInDoc].toInt() : -1;
    const bool settingsMakeUniqueName = !hints.value(DocumentReadingMode_DontMakeUniqueNames, false).toBool();
    while (!os.isCoR()) {
        U2OpStatus2Log warningOs;

        //read header
        QString sequenceName = readSequenceName(warningOs, io, '@');
        // check for eof while trying to read another FASTQ block
        if (io->isEof()) {
            if (io->hasError()) {
                os.setError(io->errorString());
            }
            break;
        }

        if(errorLoggingBreak(warningOs, skippedLines, sequenceName)){
            continue;
        }

        if(sequenceName.isEmpty()){
            sequenceName = "Sequence";
        }

        if ((merge == false) || (seqNumber == 0)) {
            QString objName = sequenceName;
            if (settingsMakeUniqueName) {
                objName = (merge) ? "Sequence" : TextUtils::variate(sequenceName, "_", uniqueNames);
                objName.squeeze();
                uniqueNames.insert(objName);
            }
            seqImporter.startSequence(warningOs, dbiRef, folder, objName, false);
            if(errorLoggingBreak(warningOs, skippedLines, sequenceName)){
                U2OpStatusImpl seqOs;
                seqImporter.finalizeSequenceAndValidate(seqOs);
                continue;
            }
        }

        //read sequence
        if (merge && sequence.length() > 0) {
            seqImporter.addDefaultSymbolsBlock(gapSize, warningOs);
            sequenceStart += sequence.length();
            sequenceStart+=gapSize;
            if(errorLoggingBreak(warningOs, skippedLines, sequenceName)){
                U2OpStatusImpl seqOs;
                seqImporter.finalizeSequenceAndValidate(seqOs);
                continue;
            }
        }

        sequence.clear();
        readSequence(warningOs, io, sequence);
        if(errorLoggingBreak(warningOs, skippedLines, sequenceName)){
            U2OpStatusImpl seqOs;
            seqImporter.finalizeSequenceAndValidate(seqOs);
            continue;
        }
        MemoryLocker lSequence(os, qCeil(sequence.size()/(1000*1000)));
        CHECK_OP_BREAK(os);
        Q_UNUSED(lSequence);

        seqImporter.addBlock(sequence.data(),sequence.length(), warningOs);
        if(errorLoggingBreak(warningOs, skippedLines, sequenceName)){
            U2OpStatusImpl seqOs;
            seqImporter.finalizeSequenceAndValidate(seqOs);
            continue;
        }

        QString qualSequenceName = readSequenceName(warningOs, io, '+');
//.........这里部分代码省略.........
开发者ID:ugeneunipro,项目名称:ugene,代码行数:101,代码来源:FastqFormat.cpp

示例5: previousBlockState

void QScriptHighlighter::highlightBlock(const QString &text)
{
    // states
    enum {
        StateStandard,
        StateCommentStart1,
        StateCCommentStart2,
        StateCppCommentStart2,
        StateCComment,
        StateCppComment,
        StateCCommentEnd1,
        StateCCommentEnd2,
        StateStringStart,
        StateString,
        StateStringEnd,
        StateString2Start,
        StateString2,
        StateString2End,
        StateNumber,
        StatePreProcessor,
        NumStates
    };
    // tokens
    enum {
        InputAlpha,
        InputNumber,
        InputAsterix,
        InputSlash,
        InputParen,
        InputSpace,
        InputHash,
        InputQuotation,
        InputApostrophe,
        InputSep,
        NumInputs
    };

    static const uchar table[NumStates][NumInputs] = {
        { StateStandard,      StateNumber,     StateStandard,       StateCommentStart1,    StateStandard,   StateStandard,   StatePreProcessor, StateStringStart, StateString2Start, StateStandard }, // StateStandard
        { StateStandard,      StateNumber,   StateCCommentStart2, StateCppCommentStart2, StateStandard,   StateStandard,   StatePreProcessor, StateStringStart, StateString2Start, StateStandard }, // StateCommentStart1
        { StateCComment,      StateCComment,   StateCCommentEnd1,   StateCComment,         StateCComment,   StateCComment,   StateCComment,     StateCComment,    StateCComment,     StateCComment }, // StateCCommentStart2
        { StateCppComment,    StateCppComment, StateCppComment,     StateCppComment,       StateCppComment, StateCppComment, StateCppComment,   StateCppComment,  StateCppComment,   StateCppComment }, // CppCommentStart2
        { StateCComment,      StateCComment,   StateCCommentEnd1,   StateCComment,         StateCComment,   StateCComment,   StateCComment,     StateCComment,    StateCComment,     StateCComment }, // StateCComment
        { StateCppComment,    StateCppComment, StateCppComment,     StateCppComment,       StateCppComment, StateCppComment, StateCppComment,   StateCppComment,  StateCppComment,   StateCppComment }, // StateCppComment
        { StateCComment,      StateCComment,   StateCCommentEnd1,   StateCCommentEnd2,     StateCComment,   StateCComment,   StateCComment,     StateCComment,    StateCComment,     StateCComment }, // StateCCommentEnd1
        { StateStandard,      StateNumber,     StateStandard,       StateCommentStart1,    StateStandard,   StateStandard,   StatePreProcessor, StateStringStart, StateString2Start, StateStandard }, // StateCCommentEnd2
        { StateString,        StateString,     StateString,         StateString,           StateString,     StateString,     StateString,       StateStringEnd,   StateString,       StateString }, // StateStringStart
        { StateString,        StateString,     StateString,         StateString,           StateString,     StateString,     StateString,       StateStringEnd,   StateString,       StateString }, // StateString
        { StateStandard,      StateStandard,   StateStandard,       StateCommentStart1,    StateStandard,   StateStandard,   StatePreProcessor, StateStringStart, StateString2Start, StateStandard }, // StateStringEnd
        { StateString2,       StateString2,    StateString2,        StateString2,          StateString2,    StateString2,    StateString2,      StateString2,     StateString2End,   StateString2 }, // StateString2Start
        { StateString2,       StateString2,    StateString2,        StateString2,          StateString2,    StateString2,    StateString2,      StateString2,     StateString2End,   StateString2 }, // StateString2
        { StateStandard,      StateStandard,   StateStandard,       StateCommentStart1,    StateStandard,   StateStandard,   StatePreProcessor, StateStringStart, StateString2Start, StateStandard }, // StateString2End
        { StateNumber,        StateNumber,     StateStandard,       StateCommentStart1,    StateStandard,   StateStandard,   StatePreProcessor, StateStringStart, StateString2Start, StateStandard }, // StateNumber
        { StatePreProcessor,  StateStandard,   StateStandard,       StateCommentStart1,    StateStandard,   StateStandard,   StatePreProcessor, StateStringStart, StateString2Start, StateStandard } // StatePreProcessor
    };

    QString buffer;
    buffer.reserve(text.length());
    QTextCharFormat emptyFormat;

    int state = StateStandard;
    const int previousState = previousBlockState();
    if (previousState != -1)
        state = previousState;

    if (text.isEmpty()) {
        setCurrentBlockState(previousState);
        return;
    }

    int input = -1;
    int i = 0;
    bool lastWasBackSlash = false;
    bool makeLastStandard = false;

    static const QSet<QChar> alphabeth = alphaChars();
    static const QString mathChars = QString::fromLatin1("xXeE");
    static const QString numbers = QString::fromLatin1("0123456789");
    bool questionMark = false;
    QChar lastChar;
    QString firstWord;
    forever {
        const QChar c = text.at(i);

        if (lastWasBackSlash) {
            input = InputSep;
        } else {
            switch (c.toLatin1()) {
                case '*':
                    input = InputAsterix;
                    break;
                case '/':
                    input = InputSlash;
                    break;
                case '(': case '[': case '{':
                    input = InputParen;
                    if (state == StateStandard
                        || state == StateNumber
                        || state == StatePreProcessor
                        || state == StateCCommentEnd2
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例6: sendCoins

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_t nBalance = 0;
    std::vector<COutput> vCoins;
    wallet->AvailableCoins(vCoins, true, coinControl,false);

    for (auto const& out : vCoins)
        nBalance += out.tx->vout[out.i].nValue;

    if(total > nBalance)
    {
        return AmountExceedsBalance;
    }

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

	std::string txid = "";
	std::string messages = "";
	std::string hashBoinc = "";

    {
        LOCK2(cs_main, wallet->cs_wallet);

        // Sendmany
        std::vector<std::pair<CScript, int64_t> > vecSend;
		foreach(const SendCoinsRecipient &rcp, recipients)
        {
            CScript scriptPubKey;
            scriptPubKey.SetDestination(CBitcoinAddress(rcp.address.toStdString()).Get());
            vecSend.push_back(make_pair(scriptPubKey, rcp.amount));
            std::string smessage = MakeSafeMessage(FromQStringW(rcp.Message));
            messages += "<MESSAGE>" + smessage + "</MESSAGE>";

        }

        CWalletTx wtx;
        CReserveKey keyChange(wallet);
        int64_t nFeeRequired = 0;
		if (!msAttachmentGuid.empty())
		{
				LogPrintf("Adding attachment to tx %s",wtx.hashBoinc);
				wtx.hashBoinc += "<ATTACHMENT><TXID>" + wtx.GetHash().ToString() + "</TXID><ATTACHMENTGUID>" + msAttachmentGuid + "</ATTACHMENTGUID></ATTACHMENT>";
		}
		wtx.hashBoinc += messages;
		bool fCreated = wallet->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, coinControl);

        if(!fCreated)
        {
            if((total + nFeeRequired) > nBalance) // FIXME: could cause collisions in the future
            {
                return SendCoinsReturn(AmountWithFeeExceedsBalance, nFeeRequired);
            }
            return TransactionCreationFailed;
        }

		std::string samt = FormatMoney(wtx.vout[0].nValue);
        if(!uiInterface.ThreadSafeAskFee(nFeeRequired, tr("Sending...").toStdString()))
        {
            return Aborted;
        }
        if(!wallet->CommitTransaction(wtx, keyChange))
        {
            return TransactionCommitFailed;
        }
        hex = QString::fromStdString(wtx.GetHash().GetHex());
		txid = wtx.GetHash().GetHex();
		hashBoinc = wtx.hashBoinc;
//.........这里部分代码省略.........
开发者ID:TheCharlatan,项目名称:Gridcoin-Research,代码行数:101,代码来源:walletmodel.cpp

示例7: updatePeers

void PeerListModel::updatePeers(const google::protobuf::RepeatedPtrField<Protos::GUI::State::Peer>& peers, const QSet<Common::Hash>& peersDownloadingOurData)
{
   Common::SortedArray<Peer*> peersToRemove = this->orderedPeers;
   QList<Peer*> peersToAdd;

   for (int i = 0; i < peers.size(); i++)
   {
      const Common::Hash peerID(peers.Get(i).peer_id().hash());
      const QString& nick = Common::ProtoHelper::getStr(peers.Get(i), &Protos::GUI::State::Peer::nick);
      const QString& coreVersion = Common::ProtoHelper::getStr(peers.Get(i), &Protos::GUI::State::Peer::core_version);
      const quint64 sharingAmount(peers.Get(i).sharing_amount());
      const TransferInformation transferInformation { peers.Get(i).download_rate(), peers.Get(i).upload_rate(),  peersDownloadingOurData.contains(peerID) };
      const QHostAddress ip =
         peers.Get(i).has_ip() ?
            Common::ProtoHelper::getIP(peers.Get(i).ip()) :
            QHostAddress();

      Peer* peer = this->indexedPeers[peerID];
      int j = this->orderedPeers.indexOf(peer);
      if (j != -1)
      {
         peersToRemove.remove(peer);
         if (peer->nick != nick)
         {
            if (this->currentSortType == Protos::GUI::Settings::BY_NICK)
            {
               this->beginRemoveRows(QModelIndex(), j, j);
               this->orderedPeers.remove(peer);
               this->endRemoveRows();
               peer->nick = nick;
               peersToAdd << peer;
            }
            else
            {
               peer->nick = nick;
               emit dataChanged(this->createIndex(j, 1), this->createIndex(j, 1));
            }
         }
         if (peer->sharingAmount != sharingAmount)
         {
            if (this->currentSortType == Protos::GUI::Settings::BY_SHARING_AMOUNT)
            {
               this->beginRemoveRows(QModelIndex(), j, j);
               this->orderedPeers.remove(peer);
               this->endRemoveRows();
               peer->sharingAmount = sharingAmount;
               peersToAdd << peer;
            }
            else
            {
               peer->sharingAmount = sharingAmount;
               emit dataChanged(this->createIndex(j, 1), this->createIndex(j, 1));
            }
         }
         if (peer->transferInformation != transferInformation)
         {
            peer->transferInformation = transferInformation;
            emit dataChanged(this->createIndex(j, 0), this->createIndex(j, 0));
         }

         peer->ip = ip;
         peer->coreVersion = coreVersion;
      }
      else
      {
         peersToAdd << new Peer(peerID, nick, coreVersion, sharingAmount, ip, transferInformation);
      }
   }

   QList<Common::Hash> peerIDsRemoved;
   for (Common::SortedArray<Peer*>::Iterator i(peersToRemove); i.hasNext();)
   {
      Peer* const peer = i.next();
      peerIDsRemoved << peer->peerID;
      int j = this->orderedPeers.indexOf(peer);
      if (j != -1)
      {
         this->beginRemoveRows(QModelIndex(), j, j);
         this->indexedPeers.remove(peer->peerID);
         this->orderedPeers.remove(peer);
         delete peer;
         this->endRemoveRows();
      }
   }

   if (!peerIDsRemoved.isEmpty())
      emit peersRemoved(peerIDsRemoved);

   for (QListIterator<Peer*> i(peersToAdd); i.hasNext();)
   {
      Peer* const peer = i.next();
      int pos = this->orderedPeers.insert(peer);
      this->beginInsertRows(QModelIndex(), pos, pos);
      this->indexedPeers.insert(peer->peerID, peer);
      this->endInsertRows();
   }
}
开发者ID:hmartinet,项目名称:D-LAN,代码行数:97,代码来源:PeerListModel.cpp

示例8: beginResetModel

void SourcesModel::slotMatchesChanged(const QList<Plasma::QueryMatch>& l)
{
    beginResetModel();
    m_matches.clear();
    m_size = 0;
    m_types.clear();
    m_duplicates.clear();

    QList<Plasma::QueryMatch> list(l);
    qSort(list);

    for (auto it = list.crbegin(), end = list.crend(); it != end; ++it) {
        slotMatchAdded(*it);
    }

    // Sort the result types. We give the results which contain the query
    // text in the user visible string a higher preference than the ones
    // that do not
    // The rest are given the same preference as given by the runners.
    const QString simplifiedQuery = m_queryString.simplified();
    const auto words = simplifiedQuery.splitRef(QLatin1Char(' '), QString::SkipEmptyParts);

    QSet<QString> higherTypes;
    foreach (const QString &type, m_types) {
        const TypeData td = m_matches.value(type);

        for (const Plasma::QueryMatch &match : td.shown) {
            const QString text = match.text().simplified();
            bool containsAll = true;

            for (const auto &word : words) {
                if (!text.contains(word, Qt::CaseInsensitive)) {
                    containsAll = false;
                    break;
                }
            }

            // Maybe we should be giving it a higher type based on the number of matched
            // words in the text?
            if (containsAll) {
                higherTypes << match.matchCategory();
            }
        }
    }

    auto sortFunc = [&](const QString& l, const QString& r) {
        bool lHigher = higherTypes.contains(l);
        bool rHigher = higherTypes.contains(r);

        if (lHigher == rHigher) {
            return false;
        }
        else {
            return lHigher;
        }
    };
    qStableSort(m_types.begin(), m_types.end(), sortFunc);

    m_modelPopulated = true;
    endResetModel();
}
开发者ID:KDE,项目名称:milou,代码行数:61,代码来源:sourcesmodel.cpp

示例9: Q_ASSERT

void MaintainingReader<TokenLookupClass, LookupKey>::validateElement(const LookupKey elementName) const
{
    Q_ASSERT(tokenType() == QXmlStreamReader::StartElement);

    if(m_elementDescriptions.contains(elementName))
    {
        // QHash::value breaks in Metrowerks Compiler
        const ElementDescription<TokenLookupClass, LookupKey> &desc = *m_elementDescriptions.find(elementName);
        const int attCount = m_currentAttributes.count();

        QSet<typename TokenLookupClass::NodeName> encounteredXSLTAtts;

        for(int i = 0; i < attCount; ++i)
        {
            const QXmlStreamAttribute &attr = m_currentAttributes.at(i);
            if(attr.namespaceUri().isEmpty())
            {
                const typename TokenLookupClass::NodeName attrName(TokenLookupClass::toToken(attr.name()));
                encounteredXSLTAtts.insert(attrName);

                if(!desc.requiredAttributes.contains(attrName) &&
                   !desc.optionalAttributes.contains(attrName) &&
                   !m_standardAttributes.contains(attrName) &&
                   !isAnyAttributeAllowed())
                {
                    QString translationString;

                    QList<typename TokenLookupClass::NodeName> all(desc.requiredAttributes.toList() + desc.optionalAttributes.toList());
                    const int totalCount = all.count();
                    QStringList allowed;

                    for(int i = 0; i < totalCount; ++i)
                        allowed.append(QPatternist::formatKeyword(TokenLookupClass::toString(all.at(i))));

                    /* Note, we can't run toString() on attrName, because we're in this branch,
                     * the token lookup doesn't have the string(!).*/
                    const QString stringedName(attr.name().toString());

                    if(totalCount == 0)
                    {
                        translationString = QtXmlPatterns::tr("Attribute %1 cannot appear on the element %2. Only the standard attributes can appear.")
                                            .arg(formatKeyword(stringedName),
                                                 formatKeyword(name()));
                    }
                    else if(totalCount == 1)
                    {
                        translationString = QtXmlPatterns::tr("Attribute %1 cannot appear on the element %2. Only %3 is allowed, and the standard attributes.")
                                            .arg(formatKeyword(stringedName),
                                                 formatKeyword(name()),
                                                 allowed.first());
                    }
                    else if(totalCount == 1)
                    {
                        /* Note, allowed has already had formatKeyword() applied. */
                        translationString = QtXmlPatterns::tr("Attribute %1 cannot appear on the element %2. Allowed is %3, %4, and the standard attributes.")
                                            .arg(formatKeyword(stringedName),
                                                 formatKeyword(name()),
                                                 allowed.first(),
                                                 allowed.last());
                    }
                    else
                    {
                        /* Note, allowed has already had formatKeyword() applied. */
                        translationString = QtXmlPatterns::tr("Attribute %1 cannot appear on the element %2. Allowed is %3, and the standard attributes.")
                                            .arg(formatKeyword(stringedName),
                                                 formatKeyword(name()),
                                                 allowed.join(QLatin1String(", ")));
                    }

                    m_context->error(translationString,
                                     ReportContext::XTSE0090,
                                     currentLocation());
                }
            }
            else if(attr.namespaceUri() == namespaceUri())
            {
                m_context->error(QtXmlPatterns::tr("XSL-T attributes on XSL-T elements must be in the null namespace, not in the XSL-T namespace which %1 is.")
                                                  .arg(formatKeyword(attr.name())),
                                 ReportContext::XTSE0090,
                                 currentLocation());
            }
            /* Else, attributes in other namespaces are allowed, continue. */
        }

        const QSet<typename TokenLookupClass::NodeName> requiredButMissing(QSet<typename TokenLookupClass::NodeName>(desc.requiredAttributes).subtract(encounteredXSLTAtts));

        if(!requiredButMissing.isEmpty())
        {
            error(QtXmlPatterns::tr("The attribute %1 must appear on element %2.")
                             .arg(QPatternist::formatKeyword(TokenLookupClass::toString(*requiredButMissing.constBegin())),
                                  formatKeyword(name())),
                  ReportContext::XTSE0010);
        }
    }
    else
    {
        error(QtXmlPatterns::tr("The element with local name %1 does not exist in XSL-T.").arg(formatKeyword(name())),
              ReportContext::XTSE0010);
    }
}
开发者ID:wpbest,项目名称:copperspice,代码行数:100,代码来源:qmaintainingreader.cpp

示例10: partition

bool Nfa::runNfaP(QString string)
{
  /* Create the partition of states */
  QList<QSet<Node*>*>* part = partition();

  /* Allocate threads depending on size partitioning */
  pthread_t* threads = (pthread_t*)malloc(part->size()*sizeof(pthread_t));
  /* Allocate params for each thread */
  NfaParams* params = (NfaParams*)malloc(part->size()*sizeof(NfaParams));
  /* Initial state set will be stored here later in the code */
  QSet<Node*>* initialStateSet = NULL;
  /* Loop counter */
  int i;

  /*
   *  IMPORTANT: An assumption is being made here that the very last set 
   *  in the list contains ONLY the inital state
   *
   */
  for(i = 0; i < part->size(); i++)
  {
    params[i].nfa = this;
    params[i].str = &string;
    /* If the set is the initial state, mark it as such */
    if (i == part->size() - 1) 
    {
      initialStateSet = part->at(i);
      params[i].isInitial = true;
    }
    else
    {
      params[i].isInitial = false;
    }
    /* Assign the params being sent to the thread the list it will be working on */
    params[i].nodes = part->at(i);
    /* Send off the thread! */
    pthread_create(&threads[i], NULL, &traverseP, &params[i]);
  }

  /* Reap the threads */
  for (i = 0; i < part->size(); i++) 
  {
    int* ptr;
    pthread_join(threads[i], (void**)&ptr);
  }

  bool intersects = false;

  /* Again, we're assuming the last list is the inital state so we aren't checking it */
  /* If there's any intersection between the initial set and the final sets then it was a valid string */
  for(i = 0; i < part->size() - 1; i++)
  {
    if(initialStateSet->intersect(*part->at(i)).size() > 0)
      intersects = true;
  }

  free(threads);
  free(params);

  return intersects;
}
开发者ID:narayana1208,项目名称:nfa_evaluator,代码行数:61,代码来源:nfa.cpp

示例11:

bool Utils::Misc::isPreviewable(const QString &extension)
{
    static QSet<QString> multimedia_extensions;
    if (multimedia_extensions.empty()) {
        multimedia_extensions.insert("3GP");
        multimedia_extensions.insert("AAC");
        multimedia_extensions.insert("AC3");
        multimedia_extensions.insert("AIF");
        multimedia_extensions.insert("AIFC");
        multimedia_extensions.insert("AIFF");
        multimedia_extensions.insert("ASF");
        multimedia_extensions.insert("AU");
        multimedia_extensions.insert("AVI");
        multimedia_extensions.insert("FLAC");
        multimedia_extensions.insert("FLV");
        multimedia_extensions.insert("M3U");
        multimedia_extensions.insert("M4A");
        multimedia_extensions.insert("M4P");
        multimedia_extensions.insert("M4V");
        multimedia_extensions.insert("MID");
        multimedia_extensions.insert("MKV");
        multimedia_extensions.insert("MOV");
        multimedia_extensions.insert("MP2");
        multimedia_extensions.insert("MP3");
        multimedia_extensions.insert("MP4");
        multimedia_extensions.insert("MPC");
        multimedia_extensions.insert("MPE");
        multimedia_extensions.insert("MPEG");
        multimedia_extensions.insert("MPG");
        multimedia_extensions.insert("MPP");
        multimedia_extensions.insert("OGG");
        multimedia_extensions.insert("OGM");
        multimedia_extensions.insert("OGV");
        multimedia_extensions.insert("QT");
        multimedia_extensions.insert("RA");
        multimedia_extensions.insert("RAM");
        multimedia_extensions.insert("RM");
        multimedia_extensions.insert("RMV");
        multimedia_extensions.insert("RMVB");
        multimedia_extensions.insert("SWA");
        multimedia_extensions.insert("SWF");
        multimedia_extensions.insert("VOB");
        multimedia_extensions.insert("WAV");
        multimedia_extensions.insert("WMA");
        multimedia_extensions.insert("WMV");
    }

    if (extension.isEmpty())
        return false;

    return multimedia_extensions.contains(extension.toUpper());
}
开发者ID:ATGardner,项目名称:qBittorrent,代码行数:52,代码来源:misc.cpp

示例12: k

QSet<Node*>* Nfa::traverse(QSet<Node*>* node, QString* str, int direction)
{
    QSet<Node*>* q = node; //node->rawStates(direction);

    /* 
     * We want the rest of the functions to perform only considering the
     * Possibility of FORWARDS/BACKWARDS, not -1
     */
    int trav_direction = (direction == -1 || direction == FORWARDS ? FORWARDS : BACKWARDS);

    // Epsilon closure
    QSetIterator<Node*> k(*q);
    while (k.hasNext())
    {
        Node* node = k.next();
        q->unite(*node->rawStates(trav_direction));
    }

    /*
     * Setup variables that loop will use
     */
    int incr = 1;
    int limit = str->size();
    int i = 0;
    if(direction != -1)
    {
      if(direction == FORWARDS)
      {
        limit = (str->size() % 2 == 0 ? str->size() / 2 + 1 : str->size() / 2 );
        if(VERBOSE)
          printf("FORWARDS: i: %d, limit: %d\n", i, limit);//(direction == FORWARDS ? "Forwards" : "Backwards"));
      }
      /* Backwards */
      else
      {
        limit = str->size() / 2 + 1;
        incr = -1;
        i = str->size() - 1;
        if(VERBOSE)
          printf("BACKWARDS: i: %d, limit: %d, string length: %d\n", i, limit, str->size());//(direction == FORWARDS ? "Forwards" : "Backwards"));
      }
    }

    //printf("Outside: i: %d, limit: %d\n", i, limit);//(direction == FORWARDS ? "Forwards" : "Backwards"));

    QSet<Node*>* newSet = new QSet<Node*>();
    /* You want to loop backwards sometimes, so the comparison you do depends on that */
    for (; ( trav_direction == FORWARDS ? i < limit : i >= limit ); i += incr)
    {
    //printf("i: %d, limit: %d\n", i, limit);//(direction == FORWARDS ? "Forwards" : "Backwards"));
        newSet->clear();
        QSetIterator<Node*> j(*q);
        while (j.hasNext())
        {
            Node* node = j.next();
            QString subStr(str->at(i));
            newSet->unite(*node->traverseOn(subStr, trav_direction));
        }

        // Make q eqaul newSet.
        q->clear();
        q->unite(*newSet); // Done this way for mem. management.

        // Epsilon closure.
        QSetIterator<Node*> k(*q);
        while (k.hasNext())
        {
            Node* node = k.next();
            q->unite(*node->rawStates(trav_direction));
        }

        // Break out early if the q set ends up empty.
        if (q->count() == 0)
        {
            return q;
        }
    }
    return q;
}
开发者ID:narayana1208,项目名称:nfa_evaluator,代码行数:79,代码来源:nfa.cpp

示例13: filterGePoints

void LogsDialog::exportToGoogleEarth()
{
  // filter data points
  QList<QStringList> dataPoints = filterGePoints(csvlog);
  int n = dataPoints.count(); // number of points to export
  if (n==0) return;

  int latcol=0, longcol=0, altcol=0, speedcol=0;
  QSet<int> nondataCols;
  for (int i=1; i<dataPoints.at(0).count(); i++) {
    // Long,Lat,Course,GPS Speed,GPS Alt
    if (dataPoints.at(0).at(i).contains("Long")) {
      longcol = i;
      nondataCols << i;
    }
    if (dataPoints.at(0).at(i).contains("Lat")) {
      latcol = i;
      nondataCols << i;
    }
    if (dataPoints.at(0).at(i).contains("GPS Alt") || dataPoints.at(0).at(i).contains("GAlt")) {
      altcol = i;
      nondataCols << i;
    }
    if (dataPoints.at(0).at(i).contains("GPS Speed")) {
      speedcol = i;
      nondataCols << i;
    }
  }

  if (longcol==0 || latcol==0) {
    return;
  }

  QString geIconFilename = generateProcessUniqueTempFileName("track0.png");
  if (QFile::exists(geIconFilename)) {
    QFile::remove(geIconFilename);
  }
  QFile::copy(":/images/track0.png", geIconFilename);

  QString geFilename = generateProcessUniqueTempFileName("flight.kml");
  if (QFile::exists(geFilename)) {
    QFile::remove(geFilename);
  }
  QFile geFile(geFilename);
  if (!geFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
    QMessageBox::warning(this, tr("Error"),
        tr("Cannot write file %1:\n%2.")
        .arg(geFilename)
        .arg(geFile.errorString()));
    return;
  }

  QTextStream outputStream(&geFile);

  // file header
  outputStream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\" xmlns:gx=\"http://www.google.com/kml/ext/2.2\">\n";
  outputStream << "\t<Document>\n\t\t<name>" << logFilename << "</name>\n";
  outputStream << "\t\t<Style id=\"multiTrack_n\">\n\t\t\t<IconStyle>\n\t\t\t\t<Icon>\n\t\t\t\t\t<href>file://" << geIconFilename << "</href>\n\t\t\t\t</Icon>\n\t\t\t</IconStyle>\n\t\t\t<LineStyle>\n\t\t\t\t<color>991081f4</color>\n\t\t\t\t<width>6</width>\n\t\t\t</LineStyle>\n\t\t</Style>\n";
  outputStream << "\t\t<Style id=\"multiTrack_h\">\n\t\t\t<IconStyle>\n\t\t\t\t<scale>0</scale>\n\t\t\t\t<Icon>\n\t\t\t\t\t<href>file://" << geIconFilename << "</href>\n\t\t\t\t</Icon>\n\t\t\t</IconStyle>\n\t\t\t<LineStyle>\n\t\t\t\t<color>991081f4</color>\n\t\t\t\t<width>8</width>\n\t\t\t</LineStyle>\n\t\t</Style>\n";
  outputStream << "\t\t<StyleMap id=\"multiTrack\">\n\t\t\t<Pair>\n\t\t\t\t<key>normal</key>\n\t\t\t\t<styleUrl>#multiTrack_n</styleUrl>\n\t\t\t</Pair>\n\t\t\t<Pair>\n\t\t\t\t<key>highlight</key>\n\t\t\t\t<styleUrl>#multiTrack_h</styleUrl>\n\t\t\t</Pair>\n\t\t</StyleMap>\n";
  outputStream << "\t\t<Style id=\"lineStyle\">\n\t\t\t<LineStyle>\n\t\t\t\t<color>991081f4</color>\n\t\t\t\t<width>6</width>\n\t\t\t</LineStyle>\n\t\t</Style>\n";
  outputStream << "\t\t<Schema id=\"schema\">\n";
  outputStream << "\t\t\t<gx:SimpleArrayField name=\"GPSSpeed\" type=\"float\">\n\t\t\t\t<displayName>GPS Speed</displayName>\n\t\t\t</gx:SimpleArrayField>\n";
  
  // declare additional fields
  for (int i=0; i<dataPoints.at(0).count()-2; i++) {
    if (ui->FieldsTW->item(0,i)->isSelected() && !nondataCols.contains(i+2)) {
      QString origName = dataPoints.at(0).at(i+2);
      QString safeName = origName;
      safeName.replace(" ","_");
      outputStream << "\t\t\t<gx:SimpleArrayField name=\""<< safeName <<"\" ";
      outputStream << "type=\"string\"";   // additional fields have fixed type: string
      outputStream << ">\n\t\t\t\t<displayName>" << origName << "</displayName>\n\t\t\t</gx:SimpleArrayField>\n";
    }
  }

  QString planeName;
  if (logFilename.indexOf("-")>0) {
    planeName=logFilename.left(logFilename.indexOf("-"));
  } else {
    planeName=logFilename;
  }

  outputStream << "\t\t</Schema>\n";
  outputStream << "\t\t<Folder>\n\t\t\t<name>Log Data</name>\n\t\t\t<Placemark>\n\t\t\t\t<name>" << planeName << "</name>";
  outputStream << "\n\t\t\t\t<styleUrl>#multiTrack</styleUrl>";
  outputStream << "\n\t\t\t\t<gx:Track>\n";
  outputStream << "\n\t\t\t\t\t<altitudeMode>absolute</altitudeMode>\n";

  // time data points
  for (int i=1; i<n; i++) {
    QString tstamp=dataPoints.at(i).at(0)+QString("T")+dataPoints.at(i).at(1)+QString("Z");
    outputStream << "\t\t\t\t\t<when>"<< tstamp <<"</when>\n";
  }

  // coordinate data points
  for (int i=1; i<n; i++) {
    QString latitude = dataPoints.at(i).at(latcol).trimmed();
    QString longitude = dataPoints.at(i).at(longcol).trimmed();
    int altitude = altcol ? dataPoints.at(i).at(altcol).toFloat() : 0;
//.........这里部分代码省略.........
开发者ID:kamnxt,项目名称:opentx,代码行数:101,代码来源:logsdialog.cpp

示例14: prepareTransaction

WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransaction &transaction, const CCoinControl *coinControl)
{
    qint64 total = 0;
    QList<SendCoinsRecipient> recipients = transaction.getRecipients();
    std::vector<std::pair<CScript, int64_t> > vecSend;

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

    if(isAnonymizeOnlyUnlocked())
    {
        return AnonymizeOnlyUnlocked;
    }

    QSet<QString> setAddress; // Used to detect duplicates
    int nAddresses = 0;

    // Pre-check input data for validity
    foreach(const SendCoinsRecipient &rcp, recipients)
    {
        if (rcp.paymentRequest.IsInitialized())
        {   // PaymentRequest...
            int64_t subtotal = 0;
            const payments::PaymentDetails& details = rcp.paymentRequest.getDetails();
            for (int i = 0; i < details.outputs_size(); i++)
            {
                const payments::Output& out = details.outputs(i);
                if (out.amount() <= 0) continue;
                subtotal += out.amount();
                const unsigned char* scriptStr = (const unsigned char*)out.script().data();
                CScript scriptPubKey(scriptStr, scriptStr+out.script().size());
                vecSend.push_back(std::pair<CScript, int64_t>(scriptPubKey, out.amount()));
            }
            if (subtotal <= 0)
            {
                return InvalidAmount;
            }
            total += subtotal;
        }
        else
        {   // User-entered unpay address / amount:
            if(!validateAddress(rcp.address))
            {
                return InvalidAddress;
            }
            if(rcp.amount <= 0)
            {
                return InvalidAmount;
            }
            setAddress.insert(rcp.address);
            ++nAddresses;

            CScript scriptPubKey;
            scriptPubKey.SetDestination(CBitcoinAddress(rcp.address.toStdString()).Get());
            vecSend.push_back(std::pair<CScript, int64_t>(scriptPubKey, rcp.amount));

            total += rcp.amount;
        }
    }
    if(setAddress.size() != nAddresses)
    {
        return DuplicateAddress;
    }

    qint64 nBalance = getBalance(coinControl);

    if(total > nBalance)
    {
        return AmountExceedsBalance;
    }

    if((total + nTransactionFee) > nBalance)
    {
        transaction.setTransactionFee(nTransactionFee);
        return SendCoinsReturn(AmountWithFeeExceedsBalance);
    }

    {
        LOCK2(cs_main, wallet->cs_wallet);

        transaction.newPossibleKeyChange(wallet);
        int64_t nFeeRequired = 0;
        std::string strFailReason;

        CWalletTx *newTx = transaction.getTransaction();
        CReserveKey *keyChange = transaction.getPossibleKeyChange();


        if(recipients[0].useInstantX && total > GetSporkValue(SPORK_5_MAX_VALUE)*COIN){
            emit message(tr("Send Coins"), tr("InstantX doesn't support sending values that high yet. Transactions are currently limited to %n UNP.", "", GetSporkValue(SPORK_5_MAX_VALUE)),
                         CClientUIInterface::MSG_ERROR);
            return TransactionCreationFailed;
        }

        bool fCreated = wallet->CreateTransaction(vecSend, *newTx, *keyChange, nFeeRequired, strFailReason, coinControl, recipients[0].inputType, recipients[0].useInstantX);
        transaction.setTransactionFee(nFeeRequired);

        if(!fCreated)
//.........这里部分代码省略.........
开发者ID:unpaybank,项目名称:unpaycore,代码行数:101,代码来源:walletmodel.cpp

示例15: QgsDebugMsg

QDomDocument QgsWFSServer::describeFeatureType()
{
  QgsDebugMsg( "Entering." );
  QDomDocument doc;
  //xsd:schema
  QDomElement schemaElement = doc.createElement( "schema"/*xsd:schema*/ );
  schemaElement.setAttribute( "xmlns", "http://www.w3.org/2001/XMLSchema" );
  schemaElement.setAttribute( "xmlns:xsd", "http://www.w3.org/2001/XMLSchema" );
  schemaElement.setAttribute( "xmlns:ogc", "http://www.opengis.net/ogc" );
  schemaElement.setAttribute( "xmlns:gml", "http://www.opengis.net/gml" );
  schemaElement.setAttribute( "xmlns:qgs", "http://www.qgis.org/gml" );
  schemaElement.setAttribute( "targetNamespace", "http://www.qgis.org/gml" );
  doc.appendChild( schemaElement );

  //xsd:import
  QDomElement importElement = doc.createElement( "import"/*xsd:import*/ );
  importElement.setAttribute( "namespace", "http://www.opengis.net/gml" );
  importElement.setAttribute( "schemaLocation", "http://schemas.opengis.net/gml/2.1.2/feature.xsd" );
  schemaElement.appendChild( importElement );

  //read TYPENAME
  QString typeName;
  QMap<QString, QString>::const_iterator type_name_it = mParameterMap.find( "TYPENAME" );
  if ( type_name_it != mParameterMap.end() )
  {
    typeName = type_name_it.value();
  }
  else
  {
    return doc;
  }

  QStringList wfsLayersId = mConfigParser->wfsLayers();
  QMap< QString, QMap< int, QString > > aliasInfo = mConfigParser->layerAliasInfo();
  QMap< QString, QSet<QString> > hiddenAttributes = mConfigParser->hiddenAttributes();

  QList<QgsMapLayer*> layerList;
  QgsMapLayer* currentLayer = 0;

  layerList = mConfigParser->mapLayerFromStyle( typeName, "" );
  currentLayer = layerList.at( 0 );

  QgsVectorLayer* layer = dynamic_cast<QgsVectorLayer*>( currentLayer );
  if ( layer && wfsLayersId.contains( layer->id() ) )
  {
    //is there alias info for this vector layer?
    QMap< int, QString > layerAliasInfo;
    QMap< QString, QMap< int, QString > >::const_iterator aliasIt = aliasInfo.find( currentLayer->id() );
    if ( aliasIt != aliasInfo.constEnd() )
    {
      layerAliasInfo = aliasIt.value();
    }

    //hidden attributes for this layer
    QSet<QString> layerHiddenAttributes;
    QMap< QString, QSet<QString> >::const_iterator hiddenIt = hiddenAttributes.find( currentLayer->id() );
    if ( hiddenIt != hiddenAttributes.constEnd() )
    {
      layerHiddenAttributes = hiddenIt.value();
    }

    //do a select with searchRect and go through all the features
    QgsVectorDataProvider* provider = layer->dataProvider();
    if ( !provider )
    {
      return doc;
    }

    typeName = typeName.replace( QString( " " ), QString( "_" ) );

    //xsd:element
    QDomElement elementElem = doc.createElement( "element"/*xsd:element*/ );
    elementElem.setAttribute( "name", typeName );
    elementElem.setAttribute( "type", "qgs:" + typeName + "Type" );
    elementElem.setAttribute( "substitutionGroup", "gml:_Feature" );
    schemaElement.appendChild( elementElem );

    //xsd:complexType
    QDomElement complexTypeElem = doc.createElement( "complexType"/*xsd:complexType*/ );
    complexTypeElem.setAttribute( "name", typeName + "Type" );
    schemaElement.appendChild( complexTypeElem );

    //xsd:complexType
    QDomElement complexContentElem = doc.createElement( "complexContent"/*xsd:complexContent*/ );
    complexTypeElem.appendChild( complexContentElem );

    //xsd:extension
    QDomElement extensionElem = doc.createElement( "extension"/*xsd:extension*/ );
    extensionElem.setAttribute( "base", "gml:AbstractFeatureType" );
    complexContentElem.appendChild( extensionElem );

    //xsd:sequence
    QDomElement sequenceElem = doc.createElement( "sequence"/*xsd:sequence*/ );
    extensionElem.appendChild( sequenceElem );

    //xsd:element
    QDomElement geomElem = doc.createElement( "element"/*xsd:element*/ );
    geomElem.setAttribute( "name", "geometry" );
    geomElem.setAttribute( "type", "gml:GeometryPropertyType" );
    geomElem.setAttribute( "minOccurs", "0" );
//.........这里部分代码省略.........
开发者ID:coyotte508,项目名称:Quantum-GIS,代码行数:101,代码来源:qgswfsserver.cpp


注:本文中的QSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。