• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ qCDebug函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: printByteArray

static void printByteArray(const QByteArray &data)
{
    qCDebug(sshLog, "%s", data.toHex().constData());
}
开发者ID:UIKit0,项目名称:qt-creator,代码行数:4,代码来源:sshpacket.cpp


示例2: initializeAESKeys

bool Wallet::readSecurityImage(const QString& inputFilePath, unsigned char** outputBufferPtr, int* outputBufferSize) {
    unsigned char ivec[16];
    unsigned char ckey[32];
    initializeAESKeys(ivec, ckey, _salt);

    // read encrypted file
    QFile inputFile(inputFilePath);
    if (!inputFile.exists()) {
        qCDebug(commerce) << "cannot decrypt file" << inputFilePath << "it doesn't exist";
        return false;
    }
    inputFile.open(QIODevice::ReadOnly | QIODevice::Text);
    bool foundHeader = false;
    bool foundFooter = false;

    QByteArray base64EncryptedBuffer;

    while (!inputFile.atEnd()) {
        QString line(inputFile.readLine());
        if (!foundHeader) {
            foundHeader = (line == IMAGE_HEADER);
        } else {
            foundFooter = (line == IMAGE_FOOTER);
            if (!foundFooter) {
                base64EncryptedBuffer.append(line);
            }
        }
    }
    inputFile.close();
    if (! (foundHeader && foundFooter)) {
        qCDebug(commerce) << "couldn't parse" << inputFilePath << foundHeader << foundFooter;
        return false;
    }

    // convert to bytes
    auto encryptedBuffer = QByteArray::fromBase64(base64EncryptedBuffer);

    // setup decrypted buffer
    unsigned char* outputBuffer = new unsigned char[encryptedBuffer.size()];
    int tempSize;

    // TODO: add error handling
    EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();
    if (!EVP_DecryptInit_ex(ctx, EVP_des_ede3_cbc(), NULL, ckey, ivec)) {
        qCDebug(commerce) << "decrypt init failure";
        delete[] outputBuffer;
        return false;
    }
    if (!EVP_DecryptUpdate(ctx, outputBuffer, &tempSize, (unsigned char*)encryptedBuffer.data(), encryptedBuffer.size())) {
        qCDebug(commerce) << "decrypt update failure";
        delete[] outputBuffer;
        return false;
    }
    *outputBufferSize = tempSize;
    if (!EVP_DecryptFinal_ex(ctx, outputBuffer + tempSize, &tempSize)) {
        qCDebug(commerce) << "decrypt final failure";
        delete[] outputBuffer;
        return false;
    }
    EVP_CIPHER_CTX_free(ctx);
    *outputBufferSize += tempSize;
    *outputBufferPtr = outputBuffer;
    qCDebug(commerce) << "decrypted buffer size" << *outputBufferSize;
    return true;
}
开发者ID:howard-stearns,项目名称:hifi,代码行数:65,代码来源:Wallet.cpp


示例3: qCDebug

void HttpDaemon::actionExecuted(const ActionTypeId &actionTypeId)
{
    qCDebug(dcMockDevice) << "Log actions executed" << actionTypeId.toString();
    m_actionList.append(qMakePair<ActionTypeId, QDateTime>(actionTypeId, QDateTime::currentDateTime()));
}
开发者ID:defc0n1,项目名称:guh,代码行数:5,代码来源:httpdaemon.cpp


示例4: buddyViewScrollableContainer

// public slot virtual [base kpView]
void kpUnzoomedThumbnailView::adjustToEnvironment ()
{
    if (!buddyView () || !buddyViewScrollableContainer () || !document ())
        return;

    const int scrollViewContentsX =
        buddyViewScrollableContainer()->horizontalScrollBar()->value();
    const int scrollViewContentsY =
        buddyViewScrollableContainer ()->verticalScrollBar()->value();

#if DEBUG_KP_UNZOOMED_THUMBNAIL_VIEW
    qCDebug(kpLogViews) << "kpUnzoomedThumbnailView(" << name ()
               << ")::adjustToEnvironment("
               << scrollViewContentsX
               << ","
               << scrollViewContentsY
               << ") width=" << width ()
               << " height=" << height ()
               << endl;
#endif


#if 1
    int x;
    if (document ()->width () > width ())
    {
        x = (int) buddyView ()->transformViewToDocX (scrollViewContentsX);
        const int rightMostAllowedX = qMax (0, document ()->width () - width ());
    #if DEBUG_KP_UNZOOMED_THUMBNAIL_VIEW
        qCDebug(kpLogViews) << "\tdocX=" << x
                << " docWidth=" << document ()->width ()
                << " rightMostAllowedX=" << rightMostAllowedX
                << endl;
    #endif
        if (x > rightMostAllowedX)
            x = rightMostAllowedX;
    }
    // Thumbnail width <= doc width
    else
    {
        // Center X (rather than flush left to be consistent with
        //           kpZoomedThumbnailView)
        x = -(width () - document ()->width ()) / 2;
    }


    int y;
    if (document ()->height () > height ())
    {
        y = (int) buddyView ()->transformViewToDocY (scrollViewContentsY);
        const int bottomMostAllowedY = qMax (0, document ()->height () - height ());
    #if DEBUG_KP_UNZOOMED_THUMBNAIL_VIEW
        qCDebug(kpLogViews) << "\tdocY=" << y
                    << " docHeight=" << document ()->height ()
                    << " bottomMostAllowedY=" << bottomMostAllowedY
                    << endl;
    #endif
        if (y > bottomMostAllowedY)
            y = bottomMostAllowedY;
    }
    // Thumbnail height <= doc height
    else
    {
        // Center Y (rather than flush top to be consistent with
        //           kpZoomedThumbnailView)
        y = -(height () - document ()->height ()) / 2;
    }
// Prefer to keep visible area centred in thumbnail instead of flushed left.
// Gives more editing context to the left and top.
// But feels awkward for left-to-right users.  So disabled for now.
// Not totally tested.
#else
    if (!buddyViewScrollableContainer ())
        return;

    QRect docRect = buddyView ()->transformViewToDoc (
        QRect (buddyViewScrollableContainer ()->horizontalScrollBar()->value(),
               buddyViewScrollableContainer ()->verticalScrollBar()->value(),
               qMin (buddyView ()->width (), buddyViewScrollableContainer ()->viewport()->width ()),
               qMin (buddyView ()->height (), buddyViewScrollableContainer ()->viewport()->height ())));

    x = docRect.x () - (width () - docRect.width ()) / 2;
    qCDebug(kpLogViews) << "\tnew suggest x=" << x;
    const int rightMostAllowedX = qMax (0, document ()->width () - width ());
    if (x < 0)
        x = 0;
    if (x > rightMostAllowedX)
        x = rightMostAllowedX;

    y = docRect.y () - (height () - docRect.height ()) / 2;
    qCDebug(kpLogViews) << "\tnew suggest y=" << y;
    const int bottomMostAllowedY = qMax (0, document ()->height () - height ());
    if (y < 0)
        y = 0;
    if (y > bottomMostAllowedY)
        y = bottomMostAllowedY;
#endif


//.........这里部分代码省略.........
开发者ID:KDE,项目名称:kolourpaint,代码行数:101,代码来源:kpUnzoomedThumbnailView.cpp


示例5: qMax

void FilterActionFilter::filterImage()
{
    d->appliedActions.clear();
    d->errorMessage.clear();
    const float progressIncrement = 1.0 / qMax(1, d->actions.size());
    float progress                = 0;

    postProgress(0);

    DImg img = m_orgImage;

    foreach(const FilterAction& action, d->actions)
    {
        qCDebug(DIGIKAM_DIMG_LOG) << "Replaying action" << action.identifier();

        if (action.isNull())
        {
            continue;
        }

        if (DImgBuiltinFilter::isSupported(action.identifier()))
        {
            DImgBuiltinFilter filter(action);

            if (!filter.isValid())
            {
                d->errorMessage = i18n("Built-in transformation not supported");

                if (d->continueOnError)
                {
                    continue;
                }
                else
                {
                    break;
                }
            }

            filter.apply(img);
            d->appliedActions << filter.filterAction();
        }
        else
        {
            QScopedPointer<DImgThreadedFilter> filter
            (DImgFilterManager::instance()->createFilter(action.identifier(), action.version()));

            if (!filter)
            {
                d->errorMessage = i18n("Filter identifier or version is not supported");

                if (d->continueOnError)
                {
                    continue;
                }
                else
                {
                    break;
                }
            }

            filter->readParameters(action);

            if (!filter->parametersSuccessfullyRead())
            {
                d->errorMessage = filter->readParametersError(action);

                if (d->continueOnError)
                {
                    continue;
                }
                else
                {
                    break;
                }
            }

            // compute
            filter->setupAndStartDirectly(img, this, (int)progress, (int)(progress + progressIncrement));
            img = filter->getTargetImage();
            d->appliedActions << filter->filterAction();
        }

        progress += progressIncrement;
        postProgress((int)progress);
    }

    m_destImage = img;
}
开发者ID:Match-Yang,项目名称:digikam,代码行数:88,代码来源:filteractionfilter.cpp


示例6: qCDebug

void ScriptEngine::errorInLoadingScript(const QUrl& url) {
    qCDebug(scriptengine) << "ERROR Loading file:" << url.toString() << "line:" << __LINE__;
    emit errorLoadingScript(_fileNameString); // ??
}
开发者ID:linkedinyou,项目名称:hifi,代码行数:4,代码来源:ScriptEngine.cpp


示例7: qCDebug

QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint16 keycode, bool pressed, bool autorepeat)
{
    KeycodeAction result = None;
    bool first_press = pressed && !autorepeat;

    const QEvdevKeyboardMap::Mapping *map_plain = 0;
    const QEvdevKeyboardMap::Mapping *map_withmod = 0;

    quint8 modifiers = m_modifiers;

    // get a specific and plain mapping for the keycode and the current modifiers
    for (int i = 0; i < m_keymap_size && !(map_plain && map_withmod); ++i) {
        const QEvdevKeyboardMap::Mapping *m = m_keymap + i;
        if (m->keycode == keycode) {
            if (m->modifiers == 0)
                map_plain = m;

            quint8 testmods = m_modifiers;
            if (m_locks[0] /*CapsLock*/ && (m->flags & QEvdevKeyboardMap::IsLetter))
                testmods ^= QEvdevKeyboardMap::ModShift;
            if (m->modifiers == testmods)
                map_withmod = m;
        }
    }

    if (m_locks[0] /*CapsLock*/ && map_withmod && (map_withmod->flags & QEvdevKeyboardMap::IsLetter))
        modifiers ^= QEvdevKeyboardMap::ModShift;

    qCDebug(qLcEvdevKeyMap, "Processing key event: keycode=%3d, modifiers=%02x pressed=%d, autorepeat=%d  |  plain=%d, withmod=%d, size=%d",
            keycode, modifiers, pressed ? 1 : 0, autorepeat ? 1 : 0,
            int(map_plain ? map_plain - m_keymap : -1),
            int(map_withmod ? map_withmod - m_keymap : -1),
            m_keymap_size);

    const QEvdevKeyboardMap::Mapping *it = map_withmod ? map_withmod : map_plain;

    if (!it) {
        // we couldn't even find a plain mapping
        qCDebug(qLcEvdevKeyMap, "Could not find a suitable mapping for keycode: %3d, modifiers: %02x", keycode, modifiers);
        return result;
    }

    bool skip = false;
    quint16 unicode = it->unicode;
    quint32 qtcode = it->qtcode;

    if ((it->flags & QEvdevKeyboardMap::IsModifier) && it->special) {
        // this is a modifier, i.e. Shift, Alt, ...
        if (pressed)
            m_modifiers |= quint8(it->special);
        else
            m_modifiers &= ~quint8(it->special);
    } else if (qtcode >= Qt::Key_CapsLock && qtcode <= Qt::Key_ScrollLock) {
        // (Caps|Num|Scroll)Lock
        if (first_press) {
            quint8 &lock = m_locks[qtcode - Qt::Key_CapsLock];
            lock ^= 1;

            switch (qtcode) {
            case Qt::Key_CapsLock  : result = lock ? CapsLockOn : CapsLockOff; break;
            case Qt::Key_NumLock   : result = lock ? NumLockOn : NumLockOff; break;
            case Qt::Key_ScrollLock: result = lock ? ScrollLockOn : ScrollLockOff; break;
            default                : break;
            }
        }
    } else if ((it->flags & QEvdevKeyboardMap::IsSystem) && it->special && first_press) {
        switch (it->special) {
        case QEvdevKeyboardMap::SystemReboot:
            result = Reboot;
            break;

        case QEvdevKeyboardMap::SystemZap:
            if (!m_no_zap)
                qApp->quit();
            break;

        case QEvdevKeyboardMap::SystemConsolePrevious:
            result = PreviousConsole;
            break;

        case QEvdevKeyboardMap::SystemConsoleNext:
            result = NextConsole;
            break;

        default:
            if (it->special >= QEvdevKeyboardMap::SystemConsoleFirst &&
                it->special <= QEvdevKeyboardMap::SystemConsoleLast) {
                result = KeycodeAction(SwitchConsoleFirst + ((it->special & QEvdevKeyboardMap::SystemConsoleMask) & SwitchConsoleMask));
            }
            break;
        }

        skip = true; // no need to tell Qt about it
    } else if ((qtcode == Qt::Key_Multi_key) && m_do_compose) {
        // the Compose key was pressed
        if (first_press)
            m_composing = 2;
        skip = true;
    } else if ((it->flags & QEvdevKeyboardMap::IsDead) && m_do_compose) {
        // a Dead key was pressed
//.........这里部分代码省略.........
开发者ID:2gis,项目名称:2gisqt5android,代码行数:101,代码来源:qevdevkeyboardhandler.cpp


示例8: qCDebug

QString AbstractExtItem::tag(const QString &_type) const
{
    qCDebug(LOG_LIB) << "Tag type" << _type;

    return QString("%1%2").arg(_type).arg(number());
}
开发者ID:arcan1s,项目名称:awesome-widgets,代码行数:6,代码来源:abstractextitem.cpp


示例9: qDebug

void AudioMixerClientData::processStreamPacket(ReceivedMessage& message, ConcurrentAddedStreams &addedStreams) {

    if (!containsValidPosition(message)) {
        qDebug() << "Refusing to process audio stream from" << message.getSourceID() << "with invalid position";
        return;
    }

    SharedStreamPointer matchingStream;

    auto packetType = message.getType();
    bool newStream = false;

    if (packetType == PacketType::MicrophoneAudioWithEcho
        || packetType == PacketType::MicrophoneAudioNoEcho
        || packetType == PacketType::SilentAudioFrame) {

        auto micStreamIt = std::find_if(_audioStreams.begin(), _audioStreams.end(), [](const SharedStreamPointer& stream){
            return stream->getStreamIdentifier().isNull();
        });

        if (micStreamIt == _audioStreams.end()) {
            // we don't have a mic stream yet, so add it

            // hop past the sequence number that leads the packet
            message.seek(sizeof(StreamSequenceNumber));

            // pull the codec string from the packet
            auto codecString = message.readString();

            // determine if the stream is stereo or not
            bool isStereo;
            if (packetType == PacketType::SilentAudioFrame || packetType == PacketType::ReplicatedSilentAudioFrame) {
                SilentSamplesBytes numSilentSamples;
                message.readPrimitive(&numSilentSamples);
                isStereo = numSilentSamples == AudioConstants::NETWORK_FRAME_SAMPLES_STEREO;
            } else {
                ChannelFlag channelFlag;
                message.readPrimitive(&channelFlag);
                isStereo = channelFlag == 1;
            }

            auto avatarAudioStream = new AvatarAudioStream(isStereo, AudioMixer::getStaticJitterFrames());
            avatarAudioStream->setupCodec(_codec, _selectedCodecName, isStereo ? AudioConstants::STEREO : AudioConstants::MONO);

            if (_isIgnoreRadiusEnabled) {
                avatarAudioStream->enableIgnoreBox();
            } else {
                avatarAudioStream->disableIgnoreBox();
            }

            qCDebug(audio) << "creating new AvatarAudioStream... codec:" << _selectedCodecName << "isStereo:" << isStereo;

            connect(avatarAudioStream, &InboundAudioStream::mismatchedAudioCodec,
                    this, &AudioMixerClientData::handleMismatchAudioFormat);

            matchingStream = SharedStreamPointer(avatarAudioStream);
            _audioStreams.push_back(matchingStream);

            newStream = true;
        } else {
            matchingStream = *micStreamIt;
        }
    } else if (packetType == PacketType::InjectAudio) {

        // this is injected audio
        // skip the sequence number and codec string and grab the stream identifier for this injected audio
        message.seek(sizeof(StreamSequenceNumber));
        message.readString();

        QUuid streamIdentifier = QUuid::fromRfc4122(message.readWithoutCopy(NUM_BYTES_RFC4122_UUID));

        auto streamIt = std::find_if(_audioStreams.begin(), _audioStreams.end(), [&streamIdentifier](const SharedStreamPointer& stream) {
            return stream->getStreamIdentifier() == streamIdentifier;
        });

        if (streamIt == _audioStreams.end()) {
            bool isStereo;
            message.readPrimitive(&isStereo);

            // we don't have this injected stream yet, so add it
            auto injectorStream = new InjectedAudioStream(streamIdentifier, isStereo, AudioMixer::getStaticJitterFrames());

#if INJECTORS_SUPPORT_CODECS
            injectorStream->setupCodec(_codec, _selectedCodecName, isStereo ? AudioConstants::STEREO : AudioConstants::MONO);
            qCDebug(audio) << "creating new injectorStream... codec:" << _selectedCodecName << "isStereo:" << isStereo;
#endif

            matchingStream = SharedStreamPointer(injectorStream);
            _audioStreams.push_back(matchingStream);

            newStream = true;
        } else {
            matchingStream = *streamIt;
        }
    }

    // seek to the beginning of the packet so that the next reader is in the right spot
    message.seek(0);

    // check the overflow count before we parse data
//.........这里部分代码省略.........
开发者ID:Menithal,项目名称:hifi,代码行数:101,代码来源:AudioMixerClientData.cpp


示例10: d

// ----------------------- Generic IO -------------------------
KGameIO::KGameIO()
  : d(new KGameIOPrivate)
{
  QLoggingCategory::setFilterRules(QLatin1Literal("games.private.kgame.debug = true"));
  qCDebug(GAMES_PRIVATE_KGAME) << ": this=" << this << ", sizeof(this)" << sizeof(KGameIO);
}
开发者ID:alasin,项目名称:libkdegames,代码行数:7,代码来源:kgameio.cpp


示例11: qCDebug

void StructViewDisplaySettingsWidget::setUnsignedDisplay(int index)
{
    qCDebug(LOG_KASTEN_OKTETA_CONTROLLERS_STRUCTURES) << "byteOrder changed to " << index;
    handleMapping(index, ui.combo_UnsignedDisplayBase, ui.kcfg_UnsignedDisplayBase);
}
开发者ID:KDE,项目名称:okteta,代码行数:5,代码来源:structviewdisplaysettingswidget.cpp


示例12: Q_ASSERT

void CanvasRenderer::paintVectorFrame( QPainter& painter,
                                       int layerId,
                                       int nFrame,
                                       bool colorize,
                                       bool useLastKeyFrame )
{
    Layer* layer = mObject->getLayer( layerId );

    if ( !layer->visible() )
    {
        return;
    }

    LayerVector* vectorLayer = dynamic_cast< LayerVector* >( layer );
    if ( vectorLayer == nullptr )
    {
        Q_ASSERT( vectorLayer );
        return;
    }

    qCDebug( mLog ) << "Paint Onion skin vector, Frame = " << nFrame;
    VectorImage* vectorImage;
    if (useLastKeyFrame)
    {
        vectorImage = vectorLayer->getLastVectorImageAtFrame( nFrame, 0 );
    }
    else
    {
        vectorImage = vectorLayer->getVectorImageAtFrame( nFrame );
    }
    if ( vectorImage == nullptr )
    {
        return;
    }

    QImage* pImage = new QImage( mCanvas->size(), QImage::Format_ARGB32_Premultiplied );
    vectorImage->outputImage( pImage, mViewTransform, mOptions.bOutlines, mOptions.bThinLines, mOptions.bAntiAlias );


    //painter.drawImage( QPoint( 0, 0 ), *pImage );

    // Go through a Bitmap image to paint the onion skin colour
    //
    BitmapImage* tempBitmapImage = new BitmapImage();
    tempBitmapImage->setImage(pImage);

    if ( colorize )
    {
        QBrush colorBrush = QBrush(Qt::transparent); //no color for the current frame

        if (nFrame < mFrameNumber)
        {
            colorBrush = QBrush(Qt::red);
        }
        else if (nFrame > mFrameNumber)
        {
            colorBrush = QBrush(Qt::blue);
        }

        tempBitmapImage->drawRect(  pImage->rect(),
                                    Qt::NoPen,
                                    colorBrush,
                                    QPainter::CompositionMode_SourceIn,
                                    false);
    }

    painter.setWorldMatrixEnabled( false ); //Don't tranform the image here as we used the viewTransform in the image output
    tempBitmapImage->paintImage( painter );

    delete tempBitmapImage;
}
开发者ID:GregorysonofCarl,项目名称:pencil,代码行数:71,代码来源:canvasrenderer.cpp


示例13: init


//.........这里部分代码省略.........
                QByteArray audioPacket = byteArrayWithPopulatedHeader(silentFrame
                                                                      ? PacketTypeSilentAudioFrame
                                                                      : PacketTypeMicrophoneAudioNoEcho);

                QDataStream packetStream(&audioPacket, QIODevice::Append);

                // pack a placeholder value for sequence number for now, will be packed when destination node is known
                int numPreSequenceNumberBytes = audioPacket.size();
                packetStream << (quint16) 0;

                if (silentFrame) {
                    if (!_isListeningToAudioStream) {
                        // if we have a silent frame and we're not listening then just send nothing and break out of here
                        break;
                    }

                    // write the number of silent samples so the audio-mixer can uphold timing
                    packetStream.writeRawData(reinterpret_cast<const char*>(&SCRIPT_AUDIO_BUFFER_SAMPLES), sizeof(int16_t));

                    // use the orientation and position of this avatar for the source of this audio
                    packetStream.writeRawData(reinterpret_cast<const char*>(&_avatarData->getPosition()), sizeof(glm::vec3));
                    glm::quat headOrientation = _avatarData->getHeadOrientation();
                    packetStream.writeRawData(reinterpret_cast<const char*>(&headOrientation), sizeof(glm::quat));

                } else if (nextSoundOutput) {
                    // assume scripted avatar audio is mono and set channel flag to zero
                    packetStream << (quint8)0;

                    // use the orientation and position of this avatar for the source of this audio
                    packetStream.writeRawData(reinterpret_cast<const char*>(&_avatarData->getPosition()), sizeof(glm::vec3));
                    glm::quat headOrientation = _avatarData->getHeadOrientation();
                    packetStream.writeRawData(reinterpret_cast<const char*>(&headOrientation), sizeof(glm::quat));

                    // write the raw audio data
                    packetStream.writeRawData(reinterpret_cast<const char*>(nextSoundOutput), numAvailableSamples * sizeof(int16_t));
                }
                
                // write audio packet to AudioMixer nodes
                auto nodeList = DependencyManager::get<NodeList>();
                nodeList->eachNode([this, &nodeList, &audioPacket, &numPreSequenceNumberBytes](const SharedNodePointer& node){
                    // only send to nodes of type AudioMixer
                    if (node->getType() == NodeType::AudioMixer) {
                        // pack sequence number
                        quint16 sequence = _outgoingScriptAudioSequenceNumbers[node->getUUID()]++;
                        memcpy(audioPacket.data() + numPreSequenceNumberBytes, &sequence, sizeof(quint16));
                        
                        // send audio packet
                        nodeList->writeDatagram(audioPacket, node);
                    }
                });
            }
        }

        qint64 now = usecTimestampNow();
        float deltaTime = (float) (now - lastUpdate) / (float) USECS_PER_SECOND;

        if (hasUncaughtException()) {
            int line = uncaughtExceptionLineNumber();
            qCDebug(scriptengine) << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << uncaughtException().toString();
            emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + uncaughtException().toString());
            clearExceptions();
        }

        if (!_isFinished) {
            emit update(deltaTime);
        }
        lastUpdate = now;
        
    }

    stopAllTimers(); // make sure all our timers are stopped if the script is ending
    emit scriptEnding();

    // kill the avatar identity timer
    delete _avatarIdentityTimer;

    if (entityScriptingInterface->getEntityPacketSender()->serversExist()) {
        // release the queue of edit entity messages.
        entityScriptingInterface->getEntityPacketSender()->releaseQueuedMessages();

        // since we're in non-threaded mode, call process so that the packets are sent
        if (!entityScriptingInterface->getEntityPacketSender()->isThreaded()) {
            entityScriptingInterface->getEntityPacketSender()->process();
        }
    }

    // If we were on a thread, then wait till it's done
    if (thread()) {
        thread()->quit();
    }

    emit finished(_fileNameString);

    _isRunning = false;
    emit runningStateChanged();

    emit doneRunning();

    _doneRunningThisScript = true;
}
开发者ID:linkedinyou,项目名称:hifi,代码行数:101,代码来源:ScriptEngine.cpp


示例14: connect

QTreeView* OutputWidget::createListView(int id)
{
    auto createHelper = [&]() -> QTreeView* {
        KDevelop::FocusedTreeView* listview = new KDevelop::FocusedTreeView(this);
        listview->setEditTriggers( QAbstractItemView::NoEditTriggers );
        listview->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); //Always enable the scrollbar, so it doesn't flash around
        listview->setHeaderHidden(true);
        listview->setUniformRowHeights(true);
        listview->setRootIsDecorated(false);
        listview->setSelectionMode( QAbstractItemView::ContiguousSelection );

        if (data->outputdata.value(id)->behaviour & KDevelop::IOutputView::AutoScroll) {
            listview->setAutoScrollAtEnd(true);
        }

        connect(listview, &QTreeView::activated, this, &OutputWidget::activate);
        connect(listview, &QTreeView::clicked, this, &OutputWidget::activate);

        return listview;
    };

    QTreeView* listview = 0;
    if( !views.contains(id) )
    {
        bool newView = true;

        if( data->type & KDevelop::IOutputView::MultipleView || data->type & KDevelop::IOutputView::HistoryView )
        {
            qCDebug(PLUGIN_STANDARDOUTPUTVIEW) << "creating listview";
            listview = createHelper();

            if( data->type & KDevelop::IOutputView::MultipleView )
            {
                tabwidget->addTab( listview, data->outputdata.value(id)->title );
            } else
            {
                stackwidget->addWidget( listview );
                stackwidget->setCurrentWidget( listview );
            }
        } else
        {
            if( views.isEmpty() )
            {
                listview = createHelper();

                layout()->addWidget( listview );
            } else
            {
                listview = views.begin().value();
                newView = false;
            }
        }
        views[id] = listview;

        changeModel( id );
        changeDelegate( id );

        if (newView)
            listview->scrollToBottom();
    } else
    {
        listview = views.value(id);
    }
    enableActions();
    return listview;
}
开发者ID:mali,项目名称:kdevplatform,代码行数:66,代码来源:outputwidget.cpp


示例15: LensFunContainer

LensFunIface::MetadataMatch LensFunIface::findFromMetadata(const DMetadata& meta)
{
    MetadataMatch ret  = MetadataNoMatch;
    d->settings        = LensFunContainer();
    d->usedCamera      = 0;
    d->usedLens        = 0;
    d->lensDescription.clear();

    if (meta.isEmpty())
    {
        qCDebug(DIGIKAM_DIMG_LOG) << "No metadata available";
        return LensFunIface::MetadataUnavailable;
    }

    PhotoInfoContainer photoInfo = meta.getPhotographInformation();
    d->makeDescription           = photoInfo.make.trimmed();
    d->modelDescription          = photoInfo.model.trimmed();
    bool exactMatch              = true;

    if (d->makeDescription.isEmpty())
    {
        qCDebug(DIGIKAM_DIMG_LOG) << "No camera maker info available";
        exactMatch = false;
    }
    else
    {
        // NOTE: see bug #184156:
        // Some rules to wrap unknown camera device from Lensfun database, which have equivalent in fact.
        if (d->makeDescription == QLatin1String("Canon"))
        {
            if (d->modelDescription == QLatin1String("Canon EOS Kiss Digital X"))
            {
                d->modelDescription = QLatin1String("Canon EOS 400D DIGITAL");
            }

            if (d->modelDescription == QLatin1String("G1 X"))
            {
                d->modelDescription = QLatin1String("G1X");
            }
        }

        d->lensDescription = photoInfo.lens.trimmed();

        // ------------------------------------------------------------------------------------------------

        DevicePtr lfCamera = findCamera(d->makeDescription, d->modelDescription);

        if (lfCamera)
        {
            setUsedCamera(lfCamera);

            qCDebug(DIGIKAM_DIMG_LOG) << "Camera maker   : " << d->settings.cameraMake;
            qCDebug(DIGIKAM_DIMG_LOG) << "Camera model   : " << d->settings.cameraModel;

            // ------------------------------------------------------------------------------------------------
            // -- Performing lens description searches.

            if (!d->lensDescription.isEmpty())
            {
                LensList lensMatches;
                QString  lensCutted;
                LensList lensList;

                // STAGE 1, search in LensFun database as well.
                lensList = findLenses(d->usedCamera, d->lensDescription);
                qCDebug(DIGIKAM_DIMG_LOG) << "* Check for lens by direct query (" << d->lensDescription << " : " << lensList.count() << ")";
                lensMatches.append(lensList);

                // STAGE 2, Adapt exiv2 strings to lensfun strings for Nikon.
                lensCutted = d->lensDescription;

                if (lensCutted.contains(QLatin1String("Nikon")))
                {
                    lensCutted.remove(QLatin1String("Nikon "));
                    lensCutted.remove(QLatin1String("Zoom-"));
                    lensCutted.replace(QLatin1String("IF-ID"), QLatin1String("ED-IF"));
                    lensList = findLenses(d->usedCamera, lensCutted);
                    qCDebug(DIGIKAM_DIMG_LOG) << "* Check for Nikon lens (" << lensCutted << " : " << lensList.count() << ")";
                    lensMatches.append(lensList);
                }

                // TODO : Add here more specific lens maker rules.

                // LAST STAGE, Adapt exiv2 strings to lensfun strings. Some lens description use something like that :
                // "10.0 - 20.0 mm". This must be adapted like this : "10-20mm"
                lensCutted = d->lensDescription;
                lensCutted.replace(QRegExp(QLatin1String("\\.[0-9]")), QLatin1String("")); //krazy:exclude=doublequote_chars
                lensCutted.replace(QLatin1String(" - "), QLatin1String("-"));
                lensCutted.replace(QLatin1String(" mm"), QLatin1String("mn"));
                lensList   = findLenses(d->usedCamera, lensCutted);
                qCDebug(DIGIKAM_DIMG_LOG) << "* Check for no maker lens (" << lensCutted << " : " << lensList.count() << ")";
                lensMatches.append(lensList);

                // Remove all duplicate lenses in the list by using QSet.
                lensMatches = lensMatches.toSet().toList();

                // Display the results.

                if (lensMatches.isEmpty())
                {
//.........这里部分代码省略.........
开发者ID:KDE,项目名称:digikam,代码行数:101,代码来源:lensfuniface.cpp


示例16: qCDebug

ObjectConstraintBallSocket::~ObjectConstraintBallSocket() {
    #if WANT_DEBUG
    qCDebug(physics) << "ObjectConstraintBallSocket::~ObjectConstraintBallSocket";
    #endif
}
开发者ID:ZappoMan,项目名称:hifi,代码行数:5,代码来源:ObjectConstraintBallSocket.cpp


示例17: qCDebug

bool QmlCommerce::installApp(const QString& itemHref, const bool& alsoOpenImmediately) {
    if (!QDir(_appsPath).exists()) {
        if (!QDir().mkdir(_appsPath)) {
            qCDebug(commerce) << "Couldn't make _appsPath directory.";
            return false;
        }
    }

    QUrl appHref(itemHref);

    auto request =
        DependencyManager::get<ResourceManager>()->createResourceRequest(this, appHref, true, -1, "QmlCommerce::installApp");

    if (!request) {
        qCDebug(commerce) << "Couldn't create resource request for app.";
        return false;
    }

    connect(request, &ResourceRequest::finished, this, [=]() {
        if (request->getResult() != ResourceRequest::Success) {
            qCDebug(commerce) << "Failed to get .app.json file from remote.";
            return false;
        }

        // Copy the .app.json to the apps directory inside %AppData%/High Fidelity/Interface
        auto requestData = request->getData();
        QFile appFile(_appsPath + "/" + appHref.fileName());
        if (!appFile.open(QIODevice::WriteOnly)) {
            qCDebug(commerce) << "Couldn't open local .app.json file for creation.";
            return false;
        }
        if (appFile.write(requestData) == -1) {
            qCDebug(commerce) << "Couldn't write to local .app.json file.";
            return false;
        }
        // Close the file
        appFile.close();

        // Read from the returned datastream to know what .js to add to Running Scripts
        QJsonDocument appFileJsonDocument = QJsonDocument::fromJson(requestData);
        QJsonObject appFileJsonObject = appFileJsonDocument.object();
        QString scriptUrl = appFileJsonObject["scriptURL"].toString();

        // Don't try to re-load (install) a script if it's already running
        QStringList runningScripts = DependencyManager::get<ScriptEngines>()->getRunningScripts();
        if (!runningScripts.contains(scriptUrl)) {
            if ((DependencyManager::get<ScriptEngines>()->loadScript(scriptUrl.trimmed())).isNull()) {
                qCDebug(commerce) << "Couldn't load script.";
                return false;
            }

            QFileInfo appFileInfo(appFile);
            emit appInstalled(appFileInfo.baseName());
        }

        if (alsoOpenImmediately) {
            QmlCommerce::openApp(itemHref);
        }

        return true;
    });
    request->send();
    return true;
}
开发者ID:Nex-Pro,项目名称:hifi,代码行数:64,代码来源:QmlCommerce.cpp


示例18: lock

QVariant NormalDeclarationCompletionItem::data(const QModelIndex& index, int role, const KDevelop::CodeCompletionModel* model) const
{
    DUChainReadLocker lock(DUChain::lock(), 500);
    if(!lock.locked()) {
        qCDebug(LANGUAGE) << "Failed to lock the du-chain in time";
        return QVariant();
    }

    if(!m_declaration)
        return QVariant();

    switch (role) {
    case Qt::DisplayRole:
        if (index.column() == CodeCompletionModel::Name) {
            return declarationName();
        } else if(index.column() == CodeCompletionModel::Postfix) {
            if (FunctionType::Ptr functionType = m_declaration->type<FunctionType>()) {
                // Retrieve const/volatile string
                return functionType->AbstractType::toString();
            }
        } else if(index.column() == CodeCompletionModel::Prefix) {
            if(m_declaration->kind() == Declaration::Namespace)
                return QStringLiteral("namespace");
            if (m_declaration->abstractType()) {
                if(EnumeratorType::Ptr enumerator = m_declaration->type<EnumeratorType>()) {
                    if(m_declaration->context()->owner() && m_declaration->context()->owner()->abstractType()) {
                        if(!m_declaration->context()->owner()->identifier().isEmpty())
                            return shortenedTypeString(DeclarationPointer(m_declaration->context()->owner()), desiredTypeLength);
                        else
                            return "enum";
                    }
                }
                if (FunctionType::Ptr functionType = m_declaration->type<FunctionType>()) {
                    ClassFunctionDeclaration* funDecl = dynamic_cast<ClassFunctionDeclaration*>(m_declaration.data());

                    if (functionType->returnType()) {
                        QString ret = shortenedTypeString(m_declaration, desiredTypeLength);
                        if(shortenArgumentHintReturnValues && argumentHintDepth() && ret.length() > maximumArgumentHintReturnValueLength)
                            return QStringLiteral("...");
                        else
                            return ret;
                    } else if(argumentHintDepth()) {
                        return QString();//Don't show useless prefixes in the argument-hints
                    } else if(funDecl && funDecl->isConstructor() )
                        return "<constructor>";
                    else if(funDecl && funDecl->isDestructor() )
                        return "<destructor>";
                    else
                        return "<incomplete type>";

                } else {
                    return shortenedTypeString(m_declaration, desiredTypeLength);
                }
            } else {
                return "<incomplete type>";
            }
        } else if (index.column() == CodeCompletionModel::Arguments) {
            if (m_declaration->isFunctionDeclaration()) {
                auto functionType = declaration()->type<FunctionType>();
                return functionType ? functionType->partToString(FunctionType::SignatureArguments) : QVariant();
            }
        }
        break;
    case C 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ qCInfo函数代码示例发布时间:2022-05-30
下一篇:
C++ qBound函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap