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

C++ QByteArray函数代码示例

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

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



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

示例1:

/**
 * \brief muParser callback for registering user-defined variables
 *
 * When encountering an unknown variable within an expression, this function gets called.
 * Memory for the variable is allocated in m_variables and a pointer to the memory location
 * is returned to muParser. New variables are initialized with NaN.
 */
double *MuParserScript::variableFactory(const char *name, void *self) {
	MuParserScript *me = static_cast<MuParserScript *>(self);
	return me->m_variables.insert(QByteArray(name), NAN).operator->();
}
开发者ID:narunlifescience,项目名称:scidavis,代码行数:11,代码来源:MuParserScript.cpp


示例2: JDEBUG

QByteArray JsonValue::parseCString(const char *&from, const char *to)
{
    QByteArray result;
    JDEBUG("parseCString: " << QByteArray(from, to - from));
    if (*from != '"') {
        qDebug() << "JSON Parse Error, double quote expected";
        ++from; // So we don't hang
        return QByteArray();
    }
    const char *ptr = from;
    ++ptr;
    while (ptr < to) {
        if (*ptr == '"') {
            ++ptr;
            result = QByteArray(from + 1, ptr - from - 2);
            break;
        }
        if (*ptr == '\\') {
            ++ptr;
            if (ptr == to) {
                qDebug() << "JSON Parse Error, unterminated backslash escape";
                from = ptr; // So we don't hang
                return QByteArray();
            }
        }
        ++ptr;
    }
    from = ptr;

    int idx = result.indexOf('\\');
    if (idx >= 0) {
        char *dst = result.data() + idx;
        const char *src = dst + 1, *end = result.data() + result.length();
        do {
            char c = *src++;
            switch (c) {
                case 'a': *dst++ = '\a'; break;
                case 'b': *dst++ = '\b'; break;
                case 'f': *dst++ = '\f'; break;
                case 'n': *dst++ = '\n'; break;
                case 'r': *dst++ = '\r'; break;
                case 't': *dst++ = '\t'; break;
                case 'v': *dst++ = '\v'; break;
                case '"': *dst++ = '"'; break;
                case '\\': *dst++ = '\\'; break;
                default:
                    {
                        int chars = 0;
                        uchar prod = 0;
                        forever {
                            if (c < '0' || c > '7') {
                                --src;
                                break;
                            }
                            prod = prod * 8 + c - '0';
                            if (++chars == 3 || src == end)
                                break;
                            c = *src++;
                        }
                        if (!chars) {
                            qDebug() << "JSON Parse Error, unrecognized backslash escape";
                            return QByteArray();
                        }
                        *dst++ = prod;
                    }
            }
            while (src != end) {
                char c = *src++;
                if (c == '\\')
                    break;
                *dst++ = c;
            }
        } while (src != end);
        *dst = 0;
        result.truncate(dst - result.data());
    }
开发者ID:NoobSaibot,项目名称:qtcreator-minimap,代码行数:76,代码来源:json.cpp


示例3: QByteArray

void SoundEditWidget::deleteSound()
{
    mHasSound = false;
    mSound = QByteArray();
    updateView();
}
开发者ID:quazgar,项目名称:kdepimlibs,代码行数:6,代码来源:soundeditwidget.cpp


示例4: QByteArray

QByteArray Null::encodeData() const
{
    return QByteArray();
}
开发者ID:jomifm,项目名称:coresnmp,代码行数:4,代码来源:snmpnull.cpp


示例5: registerFont

static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
{
    ATSFontContainerRef handle;
    OSStatus e  = noErr;

    if(fnt->data.isEmpty()) {
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
        if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
                extern OSErr qt_mac_create_fsref(const QString &, FSRef *); // qglobal.cpp
                FSRef ref;
                if(qt_mac_create_fsref(fnt->fileName, &ref) != noErr)
                    return;

                ATSFontActivateFromFileReference(&ref, kATSFontContextLocal, kATSFontFormatUnspecified, 0, kATSOptionFlagsDefault, &handle);
        } else 
#endif
        {
#ifndef Q_WS_MAC64
                extern Q_CORE_EXPORT OSErr qt_mac_create_fsspec(const QString &, FSSpec *); // global.cpp
                FSSpec spec;
                if(qt_mac_create_fsspec(fnt->fileName, &spec) != noErr)
                    return;

                e = ATSFontActivateFromFileSpecification(&spec, kATSFontContextLocal, kATSFontFormatUnspecified,
                                                   0, kATSOptionFlagsDefault, &handle);
#endif
        }
    } else {
        e = ATSFontActivateFromMemory((void *)fnt->data.constData(), fnt->data.size(), kATSFontContextLocal,
                                           kATSFontFormatUnspecified, 0, kATSOptionFlagsDefault, &handle);

        fnt->data = QByteArray();
    }

    if(e != noErr)
        return;

    ItemCount fontCount = 0;
    e = ATSFontFindFromContainer(handle, kATSOptionFlagsDefault, 0, 0, &fontCount);
    if(e != noErr)
        return;

    QVarLengthArray<ATSFontRef> containedFonts(fontCount);
    e = ATSFontFindFromContainer(handle, kATSOptionFlagsDefault, fontCount, containedFonts.data(), &fontCount);
    if(e != noErr)
        return;

    fnt->families.clear();
#if defined(QT_MAC_USE_COCOA)
    // Make sure that the family name set on the font matches what
    // kCTFontFamilyNameAttribute returns in initializeDb().
    // So far the best solution seems find the installed font
    // using CoreText and get the family name from it.
    // (ATSFontFamilyGetName appears to be the correct API, but also
    // returns the font display name.)
    for(int i = 0; i < containedFonts.size(); ++i) {
        QCFString fontPostScriptName;
        ATSFontGetPostScriptName(containedFonts[i], kATSOptionFlagsDefault, &fontPostScriptName);
        QCFType<CTFontDescriptorRef> font = CTFontDescriptorCreateWithNameAndSize(fontPostScriptName, 14);
        QCFString familyName = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute);
        fnt->families.append(familyName);
    }
#else
    for(int i = 0; i < containedFonts.size(); ++i) {
        QCFString family;
        ATSFontGetName(containedFonts[i], kATSOptionFlagsDefault, &family);
        fnt->families.append(family);
    }
#endif

    fnt->handle = handle;
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:72,代码来源:qfontdatabase_mac.cpp


示例6: getConf

void Server::initializeCert() {
	QByteArray crt, key, pass, dhparams;

	crt = getConf("certificate", QString()).toByteArray();
	key = getConf("key", QString()).toByteArray();
	pass = getConf("passphrase", QByteArray()).toByteArray();
	dhparams = getConf("sslDHParams", Meta::mp.qbaDHParams).toByteArray();

	QList<QSslCertificate> ql;

	// Attempt to load key as an RSA key or a DSA key
	if (! key.isEmpty()) {
		qskKey = QSslKey(key, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, pass);
		if (qskKey.isNull())
			qskKey = QSslKey(key, QSsl::Dsa, QSsl::Pem, QSsl::PrivateKey, pass);
	}

	// If we still can't load the key, try loading any keys from the certificate
	if (qskKey.isNull() && ! crt.isEmpty()) {
		qskKey = QSslKey(crt, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, pass);
		if (qskKey.isNull())
			qskKey = QSslKey(crt, QSsl::Dsa, QSsl::Pem, QSsl::PrivateKey, pass);
	}

	// If have a key, walk the list of certs, find the one for our key,
	// remove any certs for our key from the list, what's left is part of
	// the CA certificate chain.
	if (! qskKey.isNull()) {
		ql << QSslCertificate::fromData(crt);
		ql << QSslCertificate::fromData(key);
		for (int i=0;i<ql.size();++i) {
			const QSslCertificate &c = ql.at(i);
			if (isKeyForCert(qskKey, c)) {
				qscCert = c;
				ql.removeAt(i);
			}
		}
		qlCA = ql;
	}

#if defined(USE_QSSLDIFFIEHELLMANPARAMETERS)
	if (! dhparams.isEmpty()) {
		QSslDiffieHellmanParameters qdhp = QSslDiffieHellmanParameters(dhparams);
		if (qdhp.isValid()) {
			qsdhpDHParams = qdhp;
		} else {
			log(QString::fromLatin1("Unable to use specified Diffie-Hellman parameters (sslDHParams): %1").arg(qdhp.errorString()));
		}
	}
#else
	if (! dhparams.isEmpty()) {
		log("Diffie-Hellman parameters (sslDHParams) were specified, but will not be used. This version of Murmur does not support Diffie-Hellman parameters.");
	}
#endif

	QString issuer;
#if QT_VERSION >= 0x050000
	QStringList issuerNames = qscCert.issuerInfo(QSslCertificate::CommonName);
	if (! issuerNames.isEmpty()) {
		issuer = issuerNames.first();
	}
#else
	issuer = qscCert.issuerInfo(QSslCertificate::CommonName);
#endif

	// Really old certs/keys are no good, throw them away so we can
	// generate a new one below.
	if (issuer == QString::fromUtf8("Murmur Autogenerated Certificate")) {
		log("Old autogenerated certificate is unusable for registration, invalidating it");
		qscCert = QSslCertificate();
		qskKey = QSslKey();
	}

	// If we have a cert, and it's a self-signed one, but we're binding to
	// all the same addresses as the Meta server is, use it's cert instead.
	// This allows a self-signed certificate generated by Murmur to be
	// replaced by a CA-signed certificate in the .ini file.
	if (!qscCert.isNull() && issuer == QString::fromUtf8("Murmur Autogenerated Certificate v2") && ! Meta::mp.qscCert.isNull() && ! Meta::mp.qskKey.isNull() && (Meta::mp.qlBind == qlBind)) {
		qscCert = Meta::mp.qscCert;
		qskKey = Meta::mp.qskKey;
	}

	// If we still don't have a certificate by now, try to load the one from Meta
	if (qscCert.isNull() || qskKey.isNull()) {
		if (! key.isEmpty() || ! crt.isEmpty()) {
			log("Certificate specified, but failed to load.");
		}
		qskKey = Meta::mp.qskKey;
		qscCert = Meta::mp.qscCert;

		// If loading from Meta doesn't work, build+sign a new one
		if (qscCert.isNull() || qskKey.isNull()) {
			log("Generating new server certificate.");

			CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);

			X509 *x509 = X509_new();
			EVP_PKEY *pkey = EVP_PKEY_new();
			RSA *rsa = RSA_generate_key(2048,RSA_F4,NULL,NULL);
			EVP_PKEY_assign_RSA(pkey, rsa);
//.........这里部分代码省略.........
开发者ID:CimpianAlin,项目名称:mumble,代码行数:101,代码来源:Cert.cpp


示例7: _header

Frame::Frame(quint8 header)
    : _header(header)
    , _data(QByteArray())
{
}
开发者ID:Kampfgnom,项目名称:qmqtt,代码行数:5,代码来源:qmqtt_frame.cpp


示例8: QString


//.........这里部分代码省略.........
    SYSTEM_INFO sysinfo;
    GetSystemInfo(&sysinfo);
    number_of_cores += QString::number(sysinfo.dwNumberOfProcessors) + "\n";
    MEMORYSTATUSEX status;
    status.dwLength = sizeof(status);
    GlobalMemoryStatusEx(&status);
    total_ram += QString::number(status.ullTotalPhys/1024/1024) + " MB\n";

    switch(QSysInfo::windowsVersion())
    {
        case QSysInfo::WV_NT: os_version += "Windows NT\n"; break;
        case QSysInfo::WV_2000: os_version += "Windows 2000\n"; break;
        case QSysInfo::WV_XP: os_version += "Windows XP\n"; break;
        case QSysInfo::WV_2003: os_version += "Windows Server 2003\n"; break;
        case QSysInfo::WV_VISTA: os_version += "Windows Vista\n"; break;
        case QSysInfo::WV_WINDOWS7: os_version += "Windows 7\n"; break;
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
        case QSysInfo::WV_WINDOWS8: os_version += "Windows 8\n"; break;
#endif
        default: os_version += "Windows (Unknown version)\n"; break;
    }
    kernel_line += "Windows kernel\n";
#endif
#ifdef Q_OS_LINUX
    number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
    quint32 pages = sysconf(_SC_PHYS_PAGES);
    quint32 page_size = sysconf(_SC_PAGE_SIZE);
    quint64 total = (quint64)pages * page_size / 1024 / 1024;
    total_ram += QString::number(total) + " MB\n";
    os_version += "GNU/Linux or BSD\n";
#endif

    // uname -a
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
    QProcess *process = new QProcess();
    QStringList arguments = QStringList("-a");
    process->start("uname", arguments);
    if (process->waitForFinished())
        kernel_line += QString(process->readAll());
    delete process;
#endif

#if (defined(Q_OS_WIN) && defined(__i386__)) || defined(__x86_64__)
    // cpu info
    quint32 registers[4];
    quint32 i;

    i = 0x80000002;
    asm volatile
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
       : "a" (i), "c" (0));
    processor_name += QByteArray(reinterpret_cast<char*>(&registers[0]), 4);
    processor_name += QByteArray(reinterpret_cast<char*>(&registers[1]), 4);
    processor_name += QByteArray(reinterpret_cast<char*>(&registers[2]), 4);
    processor_name += QByteArray(reinterpret_cast<char*>(&registers[3]), 4);
    i = 0x80000003;
    asm volatile
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
       : "a" (i), "c" (0));
    processor_name += QByteArray(reinterpret_cast<char*>(&registers[0]), 4);
    processor_name += QByteArray(reinterpret_cast<char*>(&registers[1]), 4);
    processor_name += QByteArray(reinterpret_cast<char*>(&registers[2]), 4);
    processor_name += QByteArray(reinterpret_cast<char*>(&registers[3]), 4);
    i = 0x80000004;
    asm volatile
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
       : "a" (i), "c" (0));
    processor_name += QByteArray(reinterpret_cast<char*>(&registers[0]), 4);
    processor_name += QByteArray(reinterpret_cast<char*>(&registers[1]), 4);
    processor_name += QByteArray(reinterpret_cast<char*>(&registers[2]), 4);
    processor_name += QByteArray(reinterpret_cast<char*>(&registers[3]), 4);
    processor_name += "\n";
#else
    processor_name += "Unknown";
#endif

    // compiler
#ifdef __GNUC__
    compiler_version += "GCC " + QString(__VERSION__) + "\n";
#else
    compiler_version += "Unknown\n";
#endif

    if(sizeof(void*) == 4)
        compiler_bits += "i386\n";
    else if(sizeof(void*) == 8)
        compiler_bits += "x86_64\n";

    // concat system info
    specs = qt_version
        + os_version
        + total_ram
        + screen_size
        + number_of_screens
        + processor_name
        + number_of_cores
        + compiler_version
        + compiler_bits
        + kernel_line;
}
开发者ID:EchoLiao,项目名称:hedgewars,代码行数:101,代码来源:feedbackdialog.cpp


示例9: data

    ParametersRecord::ParametersRecord(const RecordHeader& header, const QByteArray& _data)
    {
        const UnsignedByteArray data(_data);
        Q_ASSERT(header.type() == RecordHeader::ParametersRecord);
        Q_ASSERT(data.length() >= header.contentLength());

        int i = 0;
        quint16 bytesToRead = header.contentLength();

        const quint8 highBitMask = 1 << 7;

        QByteArray name, value;

        while(i < bytesToRead)
        {
            quint32 nameLength;
            quint32 valueLength;

            // See "Name-Value pairs" in the spec

            // work out name length
            if(data[i] & highBitMask)
            {
                // Four bytes of name length
                nameLength =
                    ((data[i] & ~highBitMask) << 24)
                    + (data[i+1] << 16)
                    + (data[i+2] << 8)
                    + data[i+3]
                ;
                i+= 4;
            }
            else
            {
                // 1 byte of name length
                nameLength = data[i++];
            }

            // ditto for value
            if(data[i] & highBitMask)
            {
                // Four bytes of value length
                valueLength =
                    ((data[i] & ~highBitMask) << 24)
                    + (data[i+1] << 16)
                    + (data[i+2] << 8)
                    + data[i+3]
                ;
                i+= 4;
            }
            else
            {
                // 1 byte of name length
                valueLength = data[i++];
            }

            name = QByteArray(&data.constData()[i], nameLength);
            i += nameLength;
            value = QByteArray(&data.constData()[i], valueLength);
            i += valueLength;
            m_parameters.insert(name, value);
            name.clear();
            value.clear();
        }
    }
开发者ID:alexey-zayats,项目名称:athletic,代码行数:65,代码来源:parametersrecord.cpp


示例10: QByteArray

// XXX: documentation!!!
QByteArray QWSWindowSurface::transientState() const
{
    return QByteArray();
}
开发者ID:13W,项目名称:phantomjs,代码行数:5,代码来源:qwindowsurface_qws.cpp


示例11: Perf


//.........这里部分代码省略.........
	// Prepare the source frames

	QVector<void *>		SrcPtr;

	for( int i = 0 ; i < mInputs.size() ; i++ )
	{
		fugio::Image	SrcImg = variant<fugio::Image>( mInputs.at( i ) );

		if( !SrcImg.isValid() )
		{
			continue;
		}

		if( SrcImg.size() != SrcSze || SrcImg.lineSize( 0 ) != DstImg.lineSize( 0 ) )
		{
			continue;
		}

		SrcPtr << SrcImg.buffer( 0 );
	}

	//-------------------------------------------------------------------------
	// Update the parameters

	SetParameterStructTag	PrmSet;

	for( int i = 0 ; i < mParams.size() ; i++ )
	{
		QSharedPointer<fugio::PinInterface>		PrmPin = mParams.at( i );
		FreeframeLibrary::ParamEntry			PrmEnt = mLibrary->params().at( i );

		QVariant		PrmVal = variant( PrmPin );

		PrmSet.ParameterNumber = i;

		if( PrmEnt.mType == FF_TYPE_STANDARD )
		{
			PrmSet.NewParameterValue.FloatValue = qBound( 0.0f, PrmVal.value<float>(), 1.0f );

			PMU.PointerValue = &PrmSet;

			MainFunc( FF_SETPARAMETER, PMU, mInstanceId );
		}
		else if( PrmEnt.mType == FF_TYPE_BOOLEAN )
		{
			PrmSet.NewParameterValue.UIntValue = PrmVal.value<bool>() ? FF_TRUE : FF_FALSE;

			PMU.PointerValue = &PrmSet;

			MainFunc( FF_SETPARAMETER, PMU, mInstanceId );
		}

		PMU.UIntValue = i;

		PMU = MainFunc( FF_GETPARAMETERDISPLAY, PMU, mInstanceId );

		if( PMU.UIntValue != FF_FAIL )
		{
			PrmPin->setDisplayLabel( QString::fromLatin1( QByteArray( (const char *)PMU.PointerValue, 16 ) ) );
		}
	}

	//-------------------------------------------------------------------------
	// Call the plugin

	if( SrcPtr.size() >= mLibrary->minInputFrames() )
	{
		if( mLibrary->hasProcessFrameCopy() )
		{
			ProcessFrameCopyStruct	PFC;

			PFC.numInputFrames = SrcPtr.size();
			PFC.pOutputFrame   = DstImg.buffer( 0 );
			PFC.ppInputFrames  = SrcPtr.data();

			PMU.PointerValue = &PFC;

			PMU = MainFunc( FF_PROCESSFRAMECOPY, PMU, mInstanceId );
		}
		else
		{
			if( !SrcPtr.isEmpty() )
			{
				memcpy( DstImg.buffer( 0 ), SrcPtr.first(), DstImg.bufferSize( 0 ) );
			}

			PMU.PointerValue = DstImg.buffer( 0 );

			PMU = MainFunc( FF_PROCESSFRAME, PMU, mInstanceId );
		}
	}

	//-------------------------------------------------------------------------
	// Update the pin if we succeed

	if( PMU.UIntValue == FF_SUCCESS )
	{
		pinUpdated( mPinOutput );
	}
}
开发者ID:bigfug,项目名称:Fugio,代码行数:101,代码来源:ff10node.cpp


示例12: QByteArray

/**
 * @brief Clears contents of the movie based on a list
 * @param infos List of infos which should be cleared
 */
void Movie::clear(QList<int> infos)
{
    if (infos.contains(MovieScraperInfos::Actors))
        m_actors.clear();
    if (infos.contains(MovieScraperInfos::Backdrop)) {
        m_backdrops.clear();
        m_images.insert(ImageType::MovieBackdrop, QByteArray());
        m_hasImageChanged.insert(ImageType::MovieBackdrop, false);
        m_imagesToRemove.removeOne(ImageType::MovieBackdrop);
    }
    if (infos.contains(MovieScraperInfos::CdArt)) {
        m_discArts.clear();
        m_images.insert(ImageType::MovieCdArt, QByteArray());
        m_hasImageChanged.insert(ImageType::MovieCdArt, false);
        m_imagesToRemove.removeOne(ImageType::MovieCdArt);
    }
    if (infos.contains(MovieScraperInfos::ClearArt)) {
        m_clearArts.clear();
        m_images.insert(ImageType::MovieClearArt, QByteArray());
        m_hasImageChanged.insert(ImageType::MovieClearArt, false);
        m_imagesToRemove.removeOne(ImageType::MovieClearArt);
    }
    if (infos.contains(MovieScraperInfos::Logo)) {
        m_logos.clear();
        m_images.insert(ImageType::MovieLogo, QByteArray());
        m_hasImageChanged.insert(ImageType::MovieLogo, false);
        m_imagesToRemove.removeOne(ImageType::MovieLogo);
    }
    if (infos.contains(MovieScraperInfos::Countries))
        m_countries.clear();
    if (infos.contains(MovieScraperInfos::Genres))
        m_genres.clear();
    if (infos.contains(MovieScraperInfos::Poster)){
        m_posters.clear();
        m_images.insert(ImageType::MoviePoster, QByteArray());
        m_hasImageChanged.insert(ImageType::MoviePoster, false);
        m_numPrimaryLangPosters = 0;
        m_imagesToRemove.removeOne(ImageType::MoviePoster);
    }
    if (infos.contains(MovieScraperInfos::Studios))
        m_studios.clear();
    if (infos.contains(MovieScraperInfos::Title))
        m_originalName = "";
    if (infos.contains(MovieScraperInfos::Set))
        m_set = "";
    if (infos.contains(MovieScraperInfos::Overview)) {
        m_overview = "";
        m_outline = "";
    }
    if (infos.contains(MovieScraperInfos::Rating)) {
        m_rating = 0;
        m_votes = 0;
    }
    if (infos.contains(MovieScraperInfos::Released))
        m_released = QDate(2000, 02, 30); // invalid date
    if (infos.contains(MovieScraperInfos::Tagline))
        m_tagline = "";
    if (infos.contains(MovieScraperInfos::Runtime))
        m_runtime = 0;
    if (infos.contains(MovieScraperInfos::Trailer))
        m_trailer = "";
    if (infos.contains(MovieScraperInfos::Certification))
        m_certification = "";
    if (infos.contains(MovieScraperInfos::Writer))
        m_writer = "";
    if (infos.contains(MovieScraperInfos::Director))
        m_director = "";
    if (infos.contains(MovieScraperInfos::Tags))
        m_tags.clear();

    if (infos.contains(MovieScraperInfos::Banner)) {
        m_images.insert(ImageType::MovieBanner, QByteArray());
        m_hasImageChanged.insert(ImageType::MovieBanner, false);
        m_imagesToRemove.removeOne(ImageType::MovieBanner);
    }
    if (infos.contains(MovieScraperInfos::Thumb)) {
        m_images.insert(ImageType::MovieThumb, QByteArray());
        m_hasImageChanged.insert(ImageType::MovieThumb, false);
        m_imagesToRemove.removeOne(ImageType::MovieThumb);
    }
    if (infos.contains(MovieScraperInfos::ExtraFanarts)) {
        m_extraFanartsToRemove.clear();
        m_extraFanartImagesToAdd.clear();
        m_extraFanarts.clear();
    }
}
开发者ID:BlitzGLEP1326,项目名称:MediaElch,代码行数:90,代码来源:Movie.cpp


示例13: QByteArray

void ImageScalingTest::shouldHaveChangeMimetype_data()
{
    QTest::addColumn<QByteArray>("initialmimetype");
    QTest::addColumn<QByteArray>("newmimetype");
    QTest::addColumn<QString>("format");

    QTest::newRow("no change mimetype when empty") <<  QByteArray() << QByteArray() << QStringLiteral("PNG");
    QTest::newRow("no change mimetype when empty jpeg") <<  QByteArray() << QByteArray() << QStringLiteral("JPG");
    QTest::newRow("no change mimetype when jpeg (same)") <<  QByteArray("image/jpeg") << QByteArray("image/jpeg") << QStringLiteral("JPG");
    QTest::newRow("no change mimetype when jpeg") <<  QByteArray("image/jpeg") << QByteArray("image/jpeg") << QStringLiteral("PNG");

    QTest::newRow("no change mimetype when png (same)") <<  QByteArray("image/png") << QByteArray("image/png") << QStringLiteral("JPG");
    QTest::newRow("no change mimetype when png") <<  QByteArray("image/png") << QByteArray("image/png") << QStringLiteral("PNG");

    QTest::newRow("change mimetype when png") <<  QByteArray("image/mng") << QByteArray("image/png") << QStringLiteral("PNG");
    QTest::newRow("change mimetype when jpeg") <<  QByteArray("image/mng") << QByteArray("image/jpeg") << QStringLiteral("JPG");

    QTest::newRow("When format is not defined but png") <<  QByteArray("image/png") << QByteArray("image/png") << QString();
    QTest::newRow("When format is not defined but jpeg") <<  QByteArray("image/jpeg") << QByteArray("image/jpeg") << QString();

    QTest::newRow("When format is not defined but other mimetype (return png)") <<  QByteArray("image/mng") << QByteArray("image/png") << QString();
}
开发者ID:VolkerChristian,项目名称:messagelib,代码行数:22,代码来源:imagescalingtest.cpp


示例14: switch

QVariant SettingsHandlerBase::handleReadItemValue(const XQSettingsKey& key, XQSettingsManager::Type type, TInt& error)
{
    const TInt KRBufDefaultLength = 32;
    switch(type)
    {
        case XQSettingsManager::TypeVariant:
        {
            //Try to read TInt
            TInt intValue;
            error = getValue(key.key(), intValue);
            if (error == KErrNone)
            {
                return QVariant(intValue);
            }

            //Try to read TReal
            TReal realValue;
            error = getValue(key.key(), realValue);
            if (error == KErrNone)
            {
                return QVariant(realValue);
            }

            //Try to read RBuf8
            QVariant byteArrayVariant;
            TRAP(error,
                RBuf8 tdes8Value;
                tdes8Value.CreateL(KRBufDefaultLength);
                CleanupClosePushL(tdes8Value);
                getValueL(key.key(), tdes8Value);
                byteArrayVariant.setValue(QByteArray((const char*)tdes8Value.Ptr(), tdes8Value.Length()));
                CleanupStack::PopAndDestroy(&tdes8Value);
            )
            if (error == KErrNone)
            {
                return byteArrayVariant;
            }
            break;
        }
        case XQSettingsManager::TypeInt:
        {
            //Try to read TInt
            TInt intValue;
            error = getValue(key.key(), intValue);
            if (error == KErrNone)
            {
                return QVariant(intValue);
            }
            break;
        }
        case XQSettingsManager::TypeDouble:
        {
            //Try to read TReal
            TReal realValue;
            error = getValue(key.key(), realValue);
            if (error == KErrNone)
            {
                return QVariant(realValue);
            }
            break;
        }
        case XQSettingsManager::TypeString:
        {
            //Try to read RBuf8
            QVariant stringVariant;
            TRAP(error,
                RBuf16 tdes16Value;
                tdes16Value.CreateL(KRBufDefaultLength);
                CleanupClosePushL(tdes16Value);
                getValueL(key.key(), tdes16Value);
                stringVariant.setValue(QString::fromUtf16(tdes16Value.Ptr(), tdes16Value.Length()));
                CleanupStack::PopAndDestroy(&tdes16Value);
            )
            if (error == KErrNone)
            {
                return stringVariant;
            }
            break;
        }
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:79,代码来源:settingshandlerbase.cpp


示例15: init

void SshOutgoingPacket::generateChannelOpenFailurePacket(quint32 remoteChannel, quint32 reason,
                                                         const QByteArray &reasonString)
{
    init(SSH_MSG_CHANNEL_OPEN_FAILURE).appendInt(remoteChannel).appendInt(reason)
            .appendString(reasonString).appendString(QByteArray()).finalize();
}
开发者ID:choenig,项目名称:qt-creator,代码行数:6,代码来源:sshoutgoingpacket.cpp


示例16: DEBUGP

void FGFSIoTelnetChannel::collectIncomingData (const char* s, int n) {
  DEBUGP(LOGBULK, "collect bs" << n);
  emit sigRcvd(QByteArray(s));
};
开发者ID:Rodeo314,项目名称:vasFMC-Krolock85,代码行数:4,代码来源:fsaccess_fgfs_io.cpp


示例17: QByteArray

/**
  * \brief Parse \a argv into a name,value map.
  * \param terminalArgs stop parsing when one of these options is found (it will be included in result)
  * \param safeArgs if not NULL, will be used to pass number of arguments before terminal argument (or argc if there was no terminal argument)
  *
  * Supported options syntax: --switch; --param=value; --param value; -switch; -param=value; -param value.
  * Additionally on Windows: /switch; /param:value; /param value.
  *
  * When creating the map, alias names are converted to original option names.
  *
  * Use \a terminalArgs if you want need to stop parsing after certain options for security reasons, etc.
  */
QHash<QByteArray, QByteArray> SimpleCli::parse(int argc, char* argv[], const QList<QByteArray>& terminalArgs, int* safeArgc)
{
#ifdef Q_OS_WIN
	const bool winmode = true;
#else
	const bool winmode = false;
#endif

	QHash<QByteArray, QByteArray> map;
	int safe = 1;
	int n = 1;
	for (; n < argc; ++n) {
		QByteArray str = QByteArray(argv[n]);
		QByteArray left, right;
		int sep = str.indexOf('=');
		if (sep == -1) {
			left = str;
		} else {
			left = str.mid(0, sep);
			right = str.mid(sep + 1);
		}

		bool unnamedArgument = true;
		if (left.startsWith("--")) {
			left = left.mid(2);
			unnamedArgument = false;
		} else if (left.startsWith('-')  ||  (left.startsWith('/') && winmode)) {
			left = left.mid(1);
			unnamedArgument = false;
		} else if (n == 1 && left.startsWith("xmpp:")) {
			unnamedArgument = false;
			left = "uri";
			right = str;
		}

		QByteArray name, value;
		if (unnamedArgument) {
			value = left;
		} else {
			name = left;
			value = right;
			if (aliases.contains(name)) {
				name = argdefs[aliases[name]].name;
				if (argdefs[name].needsValue && value.isNull() && n + 1 < argc) {
					value = QByteArray(argv[++n]);
				}
			}

		}

		if (map.contains(name)) {
			qDebug("CLI: Ignoring next value ('%s') for '%s' arg.",
				   value.constData(), name.constData());
		} else {
			map[name] = value;
		}

		if (terminalArgs.contains(name)) {
			break;
		} else {
			safe = n + 1;
		}
	}

	if (safeArgc) {
		*safeArgc = safe;
	}
	return map;
}
开发者ID:Murfen,项目名称:libpsi,代码行数:81,代码来源:simplecli.cpp


示例18: QByteArray

// ### autotest failure for non-empty passPhrase and private key
QByteArray QSslKey::toDer(const QByteArray &passPhrase) const
{
    if (d->isNull)
        return QByteArray();
    return d->derFromPem(toPem(passPhrase));
}
开发者ID:Nacto1,项目名称:qt-everywhere-opensource-src-4.6.2,代码行数:7,代码来源:qsslkey.cpp


示例19: if

QStringList QGenericUnixTheme::themeNames()
{
    QStringList result;
    if (QGuiApplication::desktopSettingsAware()) {
        if (QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment() == QByteArray("KDE")) {
#ifndef QT_NO_SETTINGS
            result.push_back(QLatin1String(QKdeTheme::name));
#endif
        } else if (QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment() == QByteArray("GNOME")) {
            result.push_back(QLatin1String(QGnomeTheme::name));
        }
        const QByteArray session = qgetenv("DESKTOP_SESSION");
        if (!session.isEmpty() && session != "default")
            result.push_back(QString::fromLocal8Bit(session));
    } // desktopSettingsAware
    if (result.isEmpty())
        result.push_back(QLatin1String(QGenericUnixTheme::name));
    return result;
}
开发者ID:KDE,项目名称:android-qt5-qtbase,代码行数:19,代码来源:qgenericunixthemes.cpp


示例20: originsRoot

QByteArray Html5App::appViewerCppFileCode(QString *errorMessage) const
{
    static const char* touchNavigavigationFiles[] = {
        "webtouchphysicsinterface.h",
        "webtouchphysics.h",
        "webtouchevent.h",
        "webtouchscroller.h",
        "webtouchnavigation.h",
        "webnavigation.h",
        "navigationcontroller.h",
        "webtouchphysicsinterface.cpp",
        "webtouchphysics.cpp",
        "webtouchevent.cpp",
        "webtouchscroller.cpp",
        "webtouchnavigation.cpp",
        "webnavigation.cpp",
        "navigationcontroller.cpp",
    };
    static const QString touchNavigavigationDir =
            originsRoot() + appViewerOriginsSubDir + QLatin1String("touchnavigation/");
    QByteArray touchNavigavigationCode;
    for (size_t i = 0; i < sizeof(touchNavigavigationFiles) / sizeof(touchNavigavigationFiles[0]); ++i) {
        QFile touchNavigavigationFile(touchNavigavigationDir + QLatin1String(touchNavigavigationFiles[i]));
        if (!touchNavigavigationFile.open(QIODevice::ReadOnly)) {
            if (errorMessage)
                *errorMessage = QCoreApplication::translate("Qt4ProjectManager::AbstractMobileApp",
                    "Could not open template file '%1'.").arg(touchNavigavigationFiles[i]);
            return QByteArray();
        }
        QTextStream touchNavigavigationFileIn(&touchNavigavigationFile);
        QString line;
        while (!(line = touchNavigavigationFileIn.readLine()).isNull()) {
            if (line.startsWith(QLatin1String("#include")) ||
                    ((line.startsWith(QLatin1String("#ifndef"))
                      || line.startsWith(QLatin1String("#define"))
                      || line.startsWith(QLatin1String("#endif")))
                    && line.endsWith(QLatin1String("_H"))))
                continue;
            touchNavigavigationCode.append(line.toLatin1());
            touchNavigavigationCode.append('\n');
        }
    }

    QFile appViewerCppFile(path(AppViewerCppOrigin));
    if (!appViewerCppFile.open(QIODevice::ReadOnly)) {
        if (errorMessage)
            *errorMessage = QCoreApplication::translate("Qt4ProjectManager::AbstractMobileApp",
                "Could not open template file '%1'.").arg(path(AppViewerCppOrigin));
        return QByteArray();
    }
    QTextStream in(&appViewerCppFile);
    QByteArray appViewerCppCode;
    bool touchNavigavigationCodeInserted = false;
    QString line;
    while (!(line = in.readLine()).isNull()) {
        if (!touchNavigavigationCodeInserted && line == QLatin1String("#ifdef TOUCH_OPTIMIZED_NAVIGATION")) {
            appViewerCppCode.append(line.toLatin1());
            appViewerCppCode.append('\n');
            while (!(line = in.readLine()).isNull()
                && !line.contains(QLatin1String("#endif // TOUCH_OPTIMIZED_NAVIGATION")))
            {
                if (!line.startsWith(QLatin1String("#include \""))) {
                    appViewerCppCode.append(line.toLatin1());
                    appViewerCppCode.append('\n');
                }
            }
            appViewerCppCode.append(touchNavigavigationCode);
            touchNavigavigationCodeInserted = true;
        }
        appViewerCppCode.append(line.toLatin1());
        appViewerCppCode.append('\n');
    }
    return appViewerCppCode;
}
开发者ID:anchowee,项目名称:QtCreator,代码行数:74,代码来源:html5app.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ QByteArrayLiteral函数代码示例发布时间:2022-05-30
下一篇:
C++ QBluetoothAddress函数代码示例发布时间: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