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

C++ qint64函数代码示例

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

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



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

示例1: ASSUME_LOCK

void CDatagrams::__FlushSendCache()
{
	if(!m_bActive)
	{
		return;
	}

	//QMutexLocker l(&m_pSection);
	ASSUME_LOCK(Datagrams.m_pSection);

	quint32 tNow = time(0);

	qint64 nToWrite = qint64(m_nUploadLimit) - qint64(m_mOutput.Usage());

	static TCPBandwidthMeter meter;

	// TODO: Maybe make it dynamic? So bad routers are automatically detected and settings adjusted?
	qint64 nMaxPPS = quazaaSettings.Connection.UDPOutLimitPPS - meter.Usage();

	if( nMaxPPS <= 0 )
	{
		systemLog.postLog( LogSeverity::Debug, Components::Network,
						   "UDP: PPS limit reached, ACKS: %d, Packets: %d, Average PPS: %u / %u",
						   m_AckCache.size(), m_SendCache.size(), meter.AvgUsage(), meter.Usage() );
		return;
	}

	while( nToWrite > 0 && !m_AckCache.isEmpty() && nMaxPPS > 0)
	{
		QPair< CEndPoint, char* > oAck = m_AckCache.takeFirst();
		m_pSocket->writeDatagram(oAck.second, sizeof(GND_HEADER), oAck.first, oAck.first.port());
		m_mOutput.Add(sizeof(GND_HEADER));
		nToWrite -= sizeof(GND_HEADER);
		delete (GND_HEADER*)oAck.second;
		nMaxPPS--;
		meter.Add(1);
	}

	QHostAddress nLastHost;

	// it can write slightly more than limit allows... that's ok
	while(nToWrite > 0 && !m_SendCache.isEmpty() && nMaxPPS > 0)
	{
		bool bSent = false;

		char* pPacket;
		quint32 nPacket;

		for(QLinkedList<DatagramOut*>::iterator itPacket = m_SendCache.begin(); itPacket != m_SendCache.end(); ++itPacket)
		{
			DatagramOut* pDatagramOut = *itPacket;

			if(pDatagramOut->m_oAddress == nLastHost)
			{
				continue;
			}

			// TODO: Check the firewall's UDP state. Could do 3 UDP states.
			if(pDatagramOut->getPacket(tNow, &pPacket, &nPacket, pDatagramOut->m_bAck && m_nInFrags > 0))
			{
#ifdef DEBUG_UDP
				systemLog.postLog(LogSeverity::Debug, "UDP sending to %s seq %u part %u count %u", pDatagramOut->m_oAddress.toString().toLocal8Bit().constData(), pDatagramOut->m_nSequence, ((GND_HEADER*)pPacket)->nPart, pDatagramOut->m_nCount);
#endif

				m_pSocket->writeDatagram(pPacket, nPacket, pDatagramOut->m_oAddress, pDatagramOut->m_oAddress.port());
				m_nOutFrags++;

				nLastHost = pDatagramOut->m_oAddress;

				if(nToWrite >= nPacket)
				{
					nToWrite -= nPacket;
				}
				else
				{
					nToWrite = 0;
				}

				m_mOutput.Add(nPacket);

				if(!pDatagramOut->m_bAck)
				{
					remove(pDatagramOut);
				}

				nMaxPPS--;
				meter.Add(1);

				bSent = true;

				break;
			}
		}

		if(m_SendCache.isEmpty() || !bSent)
		{
			break;
		}
	}

//.........这里部分代码省略.........
开发者ID:quazaa-development-team,项目名称:quazaa,代码行数:101,代码来源:datagrams.cpp


示例2: Q_D

/*!
    \reimp
*/
qint64 QBuffer::size() const
{
    Q_D(const QBuffer);
    return qint64(d->buf->size());
}
开发者ID:psi-im,项目名称:neatstuff,代码行数:8,代码来源:qbuffer.cpp


示例3: setPosition

 void MainWindow::setPosition(int position)
 {
    player->setPosition(qint64(position));
 }
开发者ID:HeliosV,项目名称:MyProjects,代码行数:4,代码来源:MainWnd.cpp


示例4: chunkSize

void PropagateUploadFileQNAM::startNextChunk()
{
    if (_propagator->_abortRequested.fetchAndAddRelaxed(0))
        return;

    if (! _jobs.isEmpty() &&  _currentChunk + _startChunk >= _chunkCount - 1) {
        // Don't do parallel upload of chunk if this might be the last chunk because the server cannot handle that
        // https://github.com/owncloud/core/issues/11106
        // We return now and when the _jobs will be finished we will proceed the last chunk
        return;
    }
    quint64 fileSize = _item._size;
    QMap<QByteArray, QByteArray> headers;
    headers["OC-Total-Length"] = QByteArray::number(fileSize);
    headers["OC-Async"] = "1";
    headers["Content-Type"] = "application/octet-stream";
    headers["X-OC-Mtime"] = QByteArray::number(qint64(_item._modtime));
    if (!_item._etag.isEmpty() && _item._etag != "empty_etag" &&
            _item._instruction != CSYNC_INSTRUCTION_NEW  // On new files never send a If-Match
            ) {
        // We add quotes because the owncloud server always add quotes around the etag, and
        //  csync_owncloud.c's owncloud_file_id always strip the quotes.
        headers["If-Match"] = '"' + _item._etag + '"';
    }

    QString path = _item._file;
    UploadDevice *device = 0;
    if (_chunkCount > 1) {
        int sendingChunk = (_currentChunk + _startChunk) % _chunkCount;
        // XOR with chunk size to make sure everything goes well if chunk size change between runs
        uint transid = _transferId ^ chunkSize();
        path +=  QString("-chunking-%1-%2-%3").arg(transid).arg(_chunkCount).arg(sendingChunk);
        headers["OC-Chunked"] = "1";
        int currentChunkSize = chunkSize();
        if (sendingChunk == _chunkCount - 1) { // last chunk
            currentChunkSize = (fileSize % chunkSize());
            if( currentChunkSize == 0 ) { // if the last chunk pretents to be 0, its actually the full chunk size.
                currentChunkSize = chunkSize();
            }
        }
        device = new UploadDevice(_file, chunkSize() * quint64(sendingChunk), currentChunkSize, &_propagator->_bandwidthManager);
    } else {
        device = new UploadDevice(_file, 0, fileSize, &_propagator->_bandwidthManager);
    }

    bool isOpen = true;
    if (!device->isOpen()) {
        isOpen = device->open(QIODevice::ReadOnly);
    }

    if( isOpen ) {
        PUTFileJob* job = new PUTFileJob(AccountManager::instance()->account(), _propagator->_remoteFolder + path, device, headers, _currentChunk);
        _jobs.append(job);
        job->setTimeout(_propagator->httpTimeout() * 1000);
        connect(job, SIGNAL(finishedSignal()), this, SLOT(slotPutFinished()));
        connect(job, SIGNAL(uploadProgress(qint64,qint64)), this, SLOT(slotUploadProgress(qint64,qint64)));
        connect(job, SIGNAL(uploadProgress(qint64,qint64)), device, SLOT(slotJobUploadProgress(qint64,qint64)));
        connect(job, SIGNAL(destroyed(QObject*)), this, SLOT(slotJobDestroyed(QObject*)));
        job->start();
        _propagator->_activeJobs++;
        _currentChunk++;

        QByteArray env = qgetenv("OWNCLOUD_PARALLEL_CHUNK");
        bool parallelChunkUpload = env=="true" || env =="1";;
        if (_currentChunk + _startChunk >= _chunkCount - 1) {
            // Don't do parallel upload of chunk if this might be the last chunk because the server cannot handle that
            // https://github.com/owncloud/core/issues/11106
            parallelChunkUpload = false;
        }

        if (parallelChunkUpload && (_propagator->_activeJobs < _propagator->maximumActiveJob())
                && _currentChunk < _chunkCount ) {
            startNextChunk();
        }
        if (!parallelChunkUpload || _chunkCount - _currentChunk <= 0) {
            emitReady();
        }
    } else {
开发者ID:nocteau,项目名称:mirall,代码行数:78,代码来源:propagateupload.cpp


示例5: quint64

//-----------------------------------------------------------------------------
//! Slot called from timer and whenever the list needs to be refreshed
//-----------------------------------------------------------------------------
void tAutopilotSelectedDeviceMenu::UpdateListOfDevices()
{
    //DbgPrintf( QString("UpdateListOfDevices: START for %1").arg( Title() ) );

    quint64 llSelectedDeviceName = quint64(-1);
    bool anyAdded = false;
    QList<tDataId> sourceList = tNDP2kSimnetSelectedData::SimnetDataTypeSources( m_SourceSelectionType );

    // Make sure the simrad group selection is displayed - even if currently invalid
    llSelectedDeviceName = GetSelectedDevice();

    if( llSelectedDeviceName != 0 && llSelectedDeviceName != quint64(-1) )
    {
        //DbgPrintf( "Adding in simrad group section" );

        // Only add the device if it's not the no selection device
        tN2kName name( llSelectedDeviceName );
        if(name.NoInstance() != m_cNoSelectionDeviceName.NoInstance())
        {
            llSelectedDeviceName = name.NoInstance();
            AddDevice( llSelectedDeviceName, true );
            anyAdded = true;
        }
    }

    for( int i = 0, count = sourceList.count(); i < count; ++i )
    {
        const tDataId& dataId = sourceList.value( i );
        tN2kName name;
        if( tNDP2kDataEngine::DataIdToN2kName( dataId, name ) )
        {
            // Only add the device if it's not the no selection device
            if(name.NoInstance() != m_cNoSelectionDeviceName.NoInstance())
            {
                name = tN2kName( name.NoInstance() );
                AddDevice( name, name.NoInstance() == qint64(llSelectedDeviceName) );
                anyAdded = true;
            }
        }
    }

    // Grey out any invalid sources
    QList<tAction*> actionList = m_SelectDeviceActGroup;
    for( int a = 0; a < actionList.size(); ++a )
    {
        bool isValid = false;
        long long nameNoInstance = actionList[a]->data().toLongLong();
        for( int i = 0, count = sourceList.count(); i < count; ++i )
        {
            const tDataId& dataId = sourceList.value(i);
            tN2kName name;
            if( tNDP2kDataEngine::DataIdToN2kName( dataId, name ) &&
                name.NoInstance() == nameNoInstance )
            {
                isValid = true;
                break;
            }
        }

        // If user changes selection - uncheck the previous selection if it was invalid.
        tAction* pAction = actionList[a];
        if( !isValid && pAction->data().toLongLong() != qint64(llSelectedDeviceName) )
        {
            if ( pAction->isCheckable() )
            {
                pAction->setChecked( false );
            }
        }
        pAction->setEnabled( true );
        if( isValid == false )
        {
            if( pAction->isChecked() == false )
            {
                pAction->setEnabled( false );
            }
            if( pAction->text().contains( tr( "[OFF] ", "device is offline" ) ) == false )
            {
                pAction->setText( tr( "[OFF] ", "device is offline" ) + pAction->text() );
            }
        }
    }

    m_pNoDevicesAct->setVisible( !anyAdded );
}
开发者ID:dulton,项目名称:53_hero,代码行数:87,代码来源:tAutopilotSelectedDeviceMenu.cpp


示例6: QTreeWidgetItem

void BwCtrlWindow::updateBandwidth()
{
	QTreeWidget *peerTreeWidget = bwTreeWidget;

	peerTreeWidget->clear();

	RsConfigDataRates totalRates;
	std::map<RsPeerId, RsConfigDataRates> rateMap;
	std::map<RsPeerId, RsConfigDataRates>::iterator it;

    rsConfig->getTotalBandwidthRates(totalRates);
	rsConfig->getAllBandwidthRates(rateMap);

			/* insert */
	QTreeWidgetItem *item = new QTreeWidgetItem();
	peerTreeWidget->addTopLevelItem(item);
	peerTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
	
	/* do Totals */
	item -> setData(COLUMN_PEERID, Qt::DisplayRole, tr("TOTALS"));
	item -> setData(COLUMN_RSNAME, Qt::DisplayRole, tr("Totals"));

	item -> setData(COLUMN_IN_RATE, Qt::DisplayRole, totalRates.mRateIn);
	item -> setData(COLUMN_IN_MAX, Qt::DisplayRole,totalRates.mRateMaxIn);
	item -> setData(COLUMN_IN_QUEUE, Qt::DisplayRole, totalRates.mQueueIn);
	item -> setData(COLUMN_IN_ALLOC, Qt::DisplayRole, std::numeric_limits<float>::max());
	item -> setData(COLUMN_IN_ALLOC_SENT, Qt::DisplayRole, std::numeric_limits<qint64>::max());

	item -> setData(COLUMN_OUT_RATE, Qt::DisplayRole, totalRates.mRateOut);
	item -> setData(COLUMN_OUT_MAX, Qt::DisplayRole, totalRates.mRateMaxOut);
	item -> setData(COLUMN_OUT_QUEUE, Qt::DisplayRole, totalRates.mQueueOut);
	item -> setData(COLUMN_OUT_ALLOC, Qt::DisplayRole, std::numeric_limits<float>::max());
	item -> setData(COLUMN_OUT_ALLOC_SENT, Qt::DisplayRole, std::numeric_limits<qint64>::max());

	time_t now = time(NULL);
	for(it = rateMap.begin(); it != rateMap.end(); ++it)
	{
		/* find the entry */
		QTreeWidgetItem *peer_item = NULL;
#if 0
		QString qpeerid = QString::fromStdString(*it);
		int itemCount = peerTreeWidget->topLevelItemCount();
		for (int nIndex = 0; nIndex < itemCount; ++nIndex)
		{
			QTreeWidgetItem *tmp_item = peerTreeWidget->topLevelItem(nIndex);
			if (tmp_item->data(COLUMN_PEERID, Qt::DisplayRole).toString() == qpeerid)
			{
				peer_item = tmp_item;
				break;
			}
		}
#endif

		if (!peer_item)
		{
			/* insert */
			peer_item = new QTreeWidgetItem();
			peerTreeWidget->addTopLevelItem(peer_item);
		}

		std::string name = rsPeers->getPeerName(it->first);

		peer_item -> setData(COLUMN_PEERID, Qt::DisplayRole, QString::fromStdString(it->first.toStdString()));
		peer_item -> setData(COLUMN_RSNAME, Qt::DisplayRole, QString::fromStdString(name));

		peer_item -> setData(COLUMN_IN_RATE, Qt::DisplayRole, it->second.mRateIn);
		peer_item -> setData(COLUMN_IN_MAX, Qt::DisplayRole, it->second.mRateMaxIn);
		peer_item -> setData(COLUMN_IN_QUEUE, Qt::DisplayRole, it->second.mQueueIn);
		peer_item -> setData(COLUMN_IN_ALLOC, Qt::DisplayRole, it->second.mAllocIn);
		peer_item -> setData(COLUMN_IN_ALLOC_SENT, Qt::DisplayRole, qint64(now - it->second.mAllocTs));

		peer_item -> setData(COLUMN_OUT_RATE, Qt::DisplayRole, it->second.mRateOut);
		peer_item -> setData(COLUMN_OUT_MAX, Qt::DisplayRole, it->second.mRateMaxOut);
		peer_item -> setData(COLUMN_OUT_QUEUE, Qt::DisplayRole, it->second.mQueueOut);
		if (it->second.mAllowedTs != 0)
		{
			peer_item -> setData(COLUMN_OUT_ALLOC, Qt::DisplayRole, it->second.mAllowedOut);
			peer_item -> setData(COLUMN_OUT_ALLOC_SENT, Qt::DisplayRole,qint64(now - it->second.mAllowedTs));
		}
		else
		{
			peer_item -> setData(COLUMN_OUT_ALLOC, Qt::DisplayRole, std::numeric_limits<float>::max());
			peer_item -> setData(COLUMN_OUT_ALLOC_SENT, Qt::DisplayRole, std::numeric_limits<qint64>::max());
		}


		/* colour the columns */
		if (it->second.mAllowedTs != 0)
		{
			if (it->second.mAllowedOut < it->second.mRateOut)
			{	
				/* RED */
				QColor bc("#ff4444"); // red
				peer_item -> setBackground(COLUMN_OUT_RATE,QBrush(bc));
	
			}
			else if (it->second.mAllowedOut < it->second.mRateMaxOut)
			{
				/* YELLOW */
				QColor bc("#ffff66"); // yellow
//.........这里部分代码省略.........
开发者ID:N00D13,项目名称:RetroShare,代码行数:101,代码来源:BwCtrlWindow.cpp


示例7: getValue

static QVariant getValue(IWMHeaderInfo *header, const wchar_t *key)
{
    WORD streamNumber = 0;
    WMT_ATTR_DATATYPE type = WMT_TYPE_DWORD;
    WORD size = 0;

    if (header->GetAttributeByName(&streamNumber, key, &type, 0, &size) == S_OK) {
        switch (type) {
        case WMT_TYPE_DWORD:
            if (size == sizeof(DWORD)) {
                DWORD word;
                if (header->GetAttributeByName(
                        &streamNumber,
                        key,
                        &type,
                        reinterpret_cast<BYTE *>(&word),
                        &size) == S_OK) {
                    return int(word);
                }
            }
            break;
        case WMT_TYPE_STRING:
            {
                QString string;
                string.resize(size / 2 - 1);

                if (header->GetAttributeByName(
                        &streamNumber,
                        key,
                        &type,
                        reinterpret_cast<BYTE *>(const_cast<ushort *>(string.utf16())),
                        &size) == S_OK) {
                    return string;
                }
            }
            break;
        case WMT_TYPE_BINARY:
            {
                QByteArray bytes;
                bytes.resize(size);
                if (header->GetAttributeByName(
                        &streamNumber,
                        key,
                        &type,
                        reinterpret_cast<BYTE *>(bytes.data()),
                        &size) == S_OK) {
                    return bytes;
                }
            }
            break;
        case WMT_TYPE_BOOL:
            if (size == sizeof(DWORD)) {
                DWORD word;
                if (header->GetAttributeByName(
                        &streamNumber,
                        key,
                        &type,
                        reinterpret_cast<BYTE *>(&word),
                        &size) == S_OK) {
                    return bool(word);
                }
            }
            break;
        case WMT_TYPE_QWORD:
            if (size == sizeof(QWORD)) {
                QWORD word;
                if (header->GetAttributeByName(
                        &streamNumber,
                        key,
                        &type,
                        reinterpret_cast<BYTE *>(&word),
                        &size) == S_OK) {
                    return qint64(word);
                }
            }
            break;
        case WMT_TYPE_WORD:
            if (size == sizeof(WORD)){
                WORD word;
                if (header->GetAttributeByName(
                        &streamNumber,
                        key, 
                        &type,
                        reinterpret_cast<BYTE *>(&word),
                        &size) == S_OK) {
                    return short(word);
                }
            }
            break;
        case WMT_TYPE_GUID:
            if (size == 16) {
            }
            break;
        default:
            break;
        }
    }
    return QVariant();
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:99,代码来源:directshowmetadatacontrol.cpp


示例8: QFETCH

void tst_QVideoFrame::assign()
{
    QFETCH(QAbstractVideoBuffer::HandleType, handleType);
    QFETCH(QSize, size);
    QFETCH(QVideoFrame::PixelFormat, pixelFormat);
    QFETCH(QVideoFrame::FieldType, fieldType);
    QFETCH(qint64, startTime);
    QFETCH(qint64, endTime);

    QPointer<QtTestVideoBuffer> buffer = new QtTestVideoBuffer(handleType);

    QVideoFrame frame;
    {
        QVideoFrame otherFrame(buffer, size, pixelFormat);
        otherFrame.setFieldType(fieldType);
        otherFrame.setStartTime(startTime);
        otherFrame.setEndTime(endTime);

        frame = otherFrame;

        QVERIFY(!buffer.isNull());

        QVERIFY(otherFrame.isValid());
        QCOMPARE(otherFrame.handleType(), handleType);
        QCOMPARE(otherFrame.pixelFormat(), pixelFormat);
        QCOMPARE(otherFrame.size(), size);
        QCOMPARE(otherFrame.width(), size.width());
        QCOMPARE(otherFrame.height(), size.height());
        QCOMPARE(otherFrame.fieldType(), fieldType);
        QCOMPARE(otherFrame.startTime(), startTime);
        QCOMPARE(otherFrame.endTime(), endTime);

        otherFrame.setStartTime(-1);

        QVERIFY(!buffer.isNull());

        QVERIFY(otherFrame.isValid());
        QCOMPARE(otherFrame.handleType(), handleType);
        QCOMPARE(otherFrame.pixelFormat(), pixelFormat);
        QCOMPARE(otherFrame.size(), size);
        QCOMPARE(otherFrame.width(), size.width());
        QCOMPARE(otherFrame.height(), size.height());
        QCOMPARE(otherFrame.fieldType(), fieldType);
        QCOMPARE(otherFrame.startTime(), qint64(-1));
        QCOMPARE(otherFrame.endTime(), endTime);
    }

    QVERIFY(!buffer.isNull());

    QVERIFY(frame.isValid());
    QCOMPARE(frame.handleType(), handleType);
    QCOMPARE(frame.pixelFormat(), pixelFormat);
    QCOMPARE(frame.size(), size);
    QCOMPARE(frame.width(), size.width());
    QCOMPARE(frame.height(), size.height());
    QCOMPARE(frame.fieldType(), fieldType);
    QCOMPARE(frame.startTime(), qint64(-1));
    QCOMPARE(frame.endTime(), endTime);

    frame = QVideoFrame();

    QVERIFY(buffer.isNull());

    QVERIFY(!frame.isValid());
    QCOMPARE(frame.handleType(), QAbstractVideoBuffer::NoHandle);
    QCOMPARE(frame.pixelFormat(), QVideoFrame::Format_Invalid);
    QCOMPARE(frame.size(), QSize());
    QCOMPARE(frame.width(), -1);
    QCOMPARE(frame.height(), -1);
    QCOMPARE(frame.fieldType(), QVideoFrame::ProgressiveFrame);
    QCOMPARE(frame.startTime(), qint64(-1));
    QCOMPARE(frame.endTime(), qint64(-1));
}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:73,代码来源:tst_qvideoframe.cpp


示例9: RegOpenKeyEx

void tst_QValueSpaceSubscriber::initTestCase()
{
    qRegisterMetaType<QVariant>("QVariant");
    qRegisterMetaType<QValueSpace::LayerOptions>("QValueSpace::LayerOptions");

#ifdef Q_OS_WIN
    HKEY key;
    long result = RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Nokia",
                               0, KEY_ALL_ACCESS, &key);
    if (result == ERROR_SUCCESS) {
        result = RegDeleteKey(key, L"QtMobility\\volatileContext");
        result = RegDeleteKey(key, L"QtMobility\\nonVolatileContext");
        result = RegDeleteKey(key, L"QtMobility");

        RegCloseKey(key);
    }
#endif

#if defined(Q_OS_UNIX) && defined(QT_START_VALUESPACE)
    QFile::remove("/tmp/qt-0/valuespace_shmlayer");
#endif

#if defined(QT_START_VALUESPACE)
    QValueSpace::initValueSpaceServer();
#endif

    QList<QAbstractValueSpaceLayer *> layers = QValueSpaceManager::instance()->getLayers();
    for (int i = 0; i < layers.count(); ++i) {
        QValueSpacePublisher *root = new QValueSpacePublisher(layers.at(i)->id(), "/");
        root->setValue("/home/user/bool", true);
        root->setValue("/home/user/int", 3);
        root->setValue("/home/user/QString", QString("testString"));
        QStringList stringList;
        stringList << QString("String 1") << QString("String 2");
        root->setValue("/home/user/QStringList", stringList);
        root->setValue("/home/user/qint64", qint64(64));
        root->setValue("/home/user/QByteArray", QByteArray("testByteArray"));
        root->setValue("/home/user/double", 4.56);
        root->setValue("/home/user/float", (float)4.56f);
        root->setValue("/home/user/QChar", QChar('c'));
        //so far not a lot of data types are supported
        //root->setValue("/home/user/QRect", QRect(0,0,5,6));

        root->setValue("/home/usercount", 1);

        root->setValue("/layer/name", layers.at(i)->name());
        root->setValue("/layer/id", layers.at(i)->id().toString());
        root->setValue("/layer/options", uint(layers.at(i)->layerOptions()));

        root->sync();

        roots.insert(layers.at(i), root);

        QValueSpacePublisher *busy = new QValueSpacePublisher(layers.at(i)->id(), "/usr");
        busy->setValue("alex/busy", true);
        busy->setValue("lorn/busy", false);
        busy->sync();

        busys.insert(layers.at(i), busy);
    }
}
开发者ID:bavanisp,项目名称:qtmobility-1.1.0,代码行数:61,代码来源:tst_qvaluespacesubscribershared.cpp


示例10: fileInfo

void ZHttpServer::readFile(QUrl url, QTcpSocket *socket) const
{
    QFileInfo fileInfo(sysroot + url.path());

    do{
        if(!fileInfo.absoluteFilePath().contains(sysroot)){
            socket->write(messagePackage("", "text/html",  HttpInfo::UnauthorizedAccessError, "Unauthorized Access"));
            break;
        }

        QFile file;

        if(fileInfo.isFile()){
            file.setFileName(fileInfo.absoluteFilePath());
        }else if(fileInfo.isDir()){
            QSettings setting(fileInfo.absoluteFilePath().append("/.ini"), QSettings::IniFormat);
            QString jump = setting.value("jump").toString();

            if(jump.isEmpty()){
                file.setFileName(fileInfo.absoluteFilePath().append(setting.value("default", "default.html").toString()));
            }else{
                QDir dir(fileInfo.absoluteFilePath());

                if(dir.cd(jump)){
                    url.setPath(dir.absolutePath().replace(sysroot, ""));
                    socket->write(getJumpPackage(url.toString().toUtf8()));
                    break;
                }else{
                    socket->write(messagePackage("", "text/Html", HttpInfo::UnknowError, QString("Jump to %1 failed").arg(jump)));
                    break;
                }
            }
        }

        qWarning() << "Open file:" << file.fileName();

        if(!file.exists()){
            socket->write(messagePackage("", "text/html",  HttpInfo::FileNotFoundError, "File Not Found"));
            break;
        }

        if(file.open(QIODevice::ReadOnly)){
            fileInfo.setFile(file.fileName());

            if(fileInfo.suffix() == "html" || fileInfo.suffix() == "xml") {
                socket->write(messagePackage(file.readAll(), "text/Html"));
            } else {
                socket->write(messagePackage(file.read(64), "text/plain;charset=utf-8", HttpInfo::NoError, QString(), file.size()));

                QPointer<QTcpSocket> socket_pointer = socket;
                qint64 send_buffer_size = socket->socketOption(QTcpSocket::SendBufferSizeSocketOption).toLongLong();

                send_buffer_size = qMin(send_buffer_size, qint64(16384));

                while (!file.atEnd() && socket_pointer && socket->state() == QTcpSocket::ConnectedState) {
                    socket->write(file.read(send_buffer_size));
                    socket->waitForBytesWritten(500);

                    qApp->processEvents();
                }
            }
        }else{
            qWarning() << "Open file failed:" << file.fileName() << "error:" << file.errorString();
            socket->write(messagePackage("", "text/html", HttpInfo::OtherError, file.errorString()));
        }
    }while(false);
}
开发者ID:zccrs,项目名称:z-http-service,代码行数:67,代码来源:zhttpserver.cpp


示例11: Q_UNUSED


//.........这里部分代码省略.........
            if ((controlblock[3] | (controlblock[4] << 8))!=t16) {
                qDebug() << "Non matching control block tail value" << path;
            }
        }
        controlblock+=6;
    }

    unsigned char *cb=controlblock;
    quint16 u1,u2,u3,u4,d1;
    quint32 ts,st,lt;
    QDateTime dt;
    QDate date;
    QTime time;

    for (int chk=0;chk<7;chk++) {
        ts=cb[0] << 24 | cb[1] << 16 | cb[2] << 8 | cb[3];
        //ts-=epoch;
        dt=QDateTime::fromTime_t(ts);
        date=dt.date();
        time=dt.time();
        qDebug() << "New Sparse Chunk" << chk << dt << hex << ts;

        cb+=4;
        quint8 sum=0;
        for (int i=0;i<0x268;i++) sum+=cb[i];
        if (cb[0x268]==sum) {
            qDebug() << "Checksum bad for block" << chk << path;
        }
        cb+=0x26a;
    }

    unsigned char * endcard=(unsigned char *)block.data()+dataends;
    bool done=false;
    qint64 ti;
    int cnt=0;
    do {
        ts=cb[0] << 24 | cb[1] << 16 | cb[2] << 8 | cb[3];
        lt=st=ts;
        ti=qint64(ts)*1000L;
        dt=QDateTime::fromTime_t(ts);
        date=dt.date();
        time=dt.time();
        qDebug() << "Details New Data Chunk" << cnt << dt << hex << ts;

        cb+=4;
        do {
            if (cb[0]==0xfe) { // not sure what this means
                cb++;
            }
            u1=cb[0] << 8 | cb[1]; // expecting 0xCXXX

            if (u1==0xffff) { // adjust timestamp code
                cb+=2;
                u1=cb[0];
                cb++;

                if (cb[0]==0xfe) {
                    u1=cb[0] << 8 | cb[1]; // fe 0a, followed by timestamp
                    cb+=2;
                    break; // start on the next timestamp
                }
            } else {
                if ((cb[0] & 0xc0) == 0xc0) {
                    cb+=2;
                    u1 &= 0x0fff; // time delta??
                    lt=ts;
开发者ID:greg100,项目名称:greg100-sleepyhead,代码行数:67,代码来源:mseries_loader.cpp


示例12: minPos

bool GPSGridClient::checkCell( Result* result, QVector< UnsignedCoordinate >* path, NodeID gridX, NodeID gridY, const UnsignedCoordinate& coordinate, double gridRadius2, double gridHeadingPenalty2, double heading ) {
	static const int width = 32 * 32 * 32;
	ProjectedCoordinate minPos( ( double ) gridX / width, ( double ) gridY / width );
	ProjectedCoordinate maxPos( ( double ) ( gridX + 1 ) / width, ( double ) ( gridY + 1 ) / width );
	UnsignedCoordinate min( minPos );
	UnsignedCoordinate max( maxPos );
	if ( gridDistance2( min, max, coordinate ) >= result->gridDistance2 )
		return false;

	qint64 cellNumber = ( qint64( gridX ) << 32 ) + gridY;
	if ( !cache.contains( cellNumber ) ) {
		qint64 position = index->GetIndex( gridX, gridY );
		if ( position == -1 )
			return true;
		gridFile->seek( position );
		int size;
		gridFile->read( (char* ) &size, sizeof( size ) );
		unsigned char* buffer = new unsigned char[size + 8]; // reading buffer + 4 bytes

		gridFile->read( ( char* ) buffer, size );
		gg::Cell* cell = new gg::Cell();
		cell->read( buffer, min, max );
		cache.insert( cellNumber, cell, cell->edges.size() * sizeof( gg::Cell::Edge ) );
		delete[] buffer;
	}
	gg::Cell* cell = cache.object( cellNumber );
	if ( cell == NULL )
		return true;

	UnsignedCoordinate nearestPoint;
	for ( std::vector< gg::Cell::Edge >::const_iterator i = cell->edges.begin(), e = cell->edges.end(); i != e; ++i ) {
		bool found = false;

		for ( int pathID = 1; pathID < i->pathLength; pathID++ ) {
			UnsignedCoordinate sourceCoord = cell->coordinates[pathID + i->pathID - 1];
			UnsignedCoordinate targetCoord = cell->coordinates[pathID + i->pathID];
			double percentage = 0;

			double gd2 = gridDistance2( &nearestPoint, &percentage, sourceCoord, targetCoord, coordinate );

			// Do 2 independent checks:
			//  * gd2 with gridRadius
			//  * gd2 (+ gridHeadingPenalty2) with result->gridDistance2
			if ( gd2 > gridRadius2 || gd2 > result->gridDistance2 ) {
				continue;
			}

			if ( gridHeadingPenalty2 > 0 ) {
				double xDiff = ( double ) targetCoord.x - sourceCoord.x;
				double yDiff = ( double ) targetCoord.y - sourceCoord.y;
				double direction = fmod( atan2( yDiff, xDiff ), 2 * M_PI );
				double penalty = fmod( fabs( direction - heading ), 2 * M_PI );
				if ( penalty > M_PI )
					penalty = 2 * M_PI - penalty;
				if ( i->bidirectional && penalty > M_PI / 2 )
					penalty = M_PI - penalty;
				penalty = penalty / M_PI * gridHeadingPenalty2;
				gd2 += penalty;
			}

			if ( gd2 < result->gridDistance2 ) {
				result->nearestPoint = nearestPoint;
				result->gridDistance2 = gd2;
				result->previousWayCoordinates = pathID;
				result->percentage = percentage;
				found = true;
			}
		}

		if ( found ) {
			result->source = i->source;
			result->target = i->target;
			result->edgeID = i->edgeID;
			path->clear();
			for ( int pathID = 0; pathID < i->pathLength; pathID++ )
				path->push_back( cell->coordinates[pathID + i->pathID] );
		}
	}

	return true;
}
开发者ID:SfietKonstantin,项目名称:monav,代码行数:81,代码来源:gpsgridclient.cpp


示例13: switch

QString Airspace::getInfoString() const
{
  QString text, tempL, tempU;

  QString type;

  switch(m_lLimitType) {
  case MSL:
    tempL.sprintf("%s MSL", m_lLimit.getText(true,0).toLatin1().data());
    break;
  case GND:
    if(m_lLimit.getMeters())
      tempL.sprintf("%s GND", m_lLimit.getText(true,0).toLatin1().data());
    else
      tempL = "GND";
    break;
  case FL:
    tempL.sprintf("FL %d (%s)", (int) rint(m_lLimit.getFeet()/100.), m_lLimit.getText(true,0).toLatin1().data());
    break;
  case STD:
    tempL.sprintf("%s STD", m_lLimit.getText(true,0).toLatin1().data());
    break;
  case UNLTD:
    tempL = QObject::tr("Unlimited");
    break;
  default:
    break;
  }

  switch(m_uLimitType) {
  case MSL:
    if(m_uLimit.getMeters() >= 99999)
      tempU = QObject::tr("Unlimited");
    else
      tempU.sprintf("%s MSL", m_uLimit.getText(true,0).toLatin1().data());
    break;
  case GND:
    tempU.sprintf("%s GND", m_uLimit.getText(true,0).toLatin1().data());
    break;
  case FL:
    tempU.sprintf("FL %d (%s)", (int) rint(m_uLimit.getFeet()/100.), m_uLimit.getText(true,0).toLatin1().data());
    break;
  case STD:
    tempU.sprintf("%s STD", m_uLimit.getText(true,0).toLatin1().data());
    break;
  case UNLTD:
    tempU = QObject::tr("Unlimited");
    break;
  default:
    break;
  }

  text = getTypeName(typeID);

  if( m_flarmAlertZone.isValid() )
    {
      text += " " + FlarmBase::translateAlarmType( m_flarmAlertZone.ZoneType );
    }
  else
    {
      text += " " + name;
    }

  text += QString("<BR>") + "<FONT SIZE=-1>" + tempL + " / " + tempU;

  if( m_flarmAlertZone.isValid() )
    {
      text += ", ";

      if( m_flarmAlertZone.ActivityLimit == 0 )
	{
	  text += QObject::tr("always active");
	}
      else
	{
	  QDateTime dt;
	  dt.setMSecsSinceEpoch( qint64(m_flarmAlertZone.ActivityLimit) * 1000 );

	  QString dtString;

	  if( Time::getTimeUnit() == Time::local )
	    {
	      dtString = dt.toLocalTime().toString("yyyy-MM-dd hh:mm:ss");
	    }
	  else
	    {
	      dtString = dt.toTimeSpec(Qt::UTC).toString("yyyy-MM-dd hh:mm:ss") + " UTC";
	    }

	  text += QObject::tr("active until ") + dtString;
	}
    }

  text += "</FONT>";

  return text;
}
开发者ID:Exadios,项目名称:Cumulus,代码行数:97,代码来源:airspace.cpp


示例14: qint64

qint64 S60AudioPlayerSession::doGetPositionL() const
{
    TTimeIntervalMicroSeconds ms = 0;
    m_player->GetPosition(ms);
    return ms.Int64() / qint64(1000);
}
开发者ID:bavanisp,项目名称:qtmobility-1.1.0,代码行数:6,代码来源:s60audioplayersession.cpp


示例15: qint64

qint64 QProcessPrivate::pipeWriterBytesToWrite() const
{
    return stdinChannel.writer ? stdinChannel.writer->bytesToWrite() : qint64(0);
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:4,代码来源:qprocess_win.cpp


示例16: qint64

/*!
    \internal
*/
qint64 QFSFileEnginePrivate::posFdFh() const
{
    if (fh)
        return qint64(QT_FTELL(fh));
    return QT_LSEEK(fd, 0, SEEK_CUR);
}
开发者ID:prapin,项目名称:qmake-iphone,代码行数:9,代码来源:qfsfileengine.cpp


示例17: UploadDevice

void PropagateUploadFileQNAM::startNextChunk()
{
    if (_propagator->_abortRequested.fetchAndAddRelaxed(0))
        return;

    if (! _jobs.isEmpty() &&  _currentChunk + _startChunk >= _chunkCount - 1) {
        // Don't do parallel upload of chunk if this might be the last chunk because the server cannot handle that
        // https://github.com/owncloud/core/issues/11106
        // We return now and when the _jobs will be finished we will proceed the last chunk
        // NOTE: Some other part of the code such as slotUploadProgress assume also that the last chunk
        // is sent last.
        return;
    }
    quint64 fileSize = _item._size;
    QMap<QByteArray, QByteArray> headers;
    headers["OC-Total-Length"] = QByteArray::number(fileSize);
    headers["OC-Async"] = "1";
    headers["OC-Chunk-Size"]= QByteArray::number(quint64(chunkSize()));
    headers["Content-Type"] = "application/octet-stream";
    headers["X-OC-Mtime"] = QByteArray::number(qint64(_item._modtime));
    if (!_item._etag.isEmpty() && _item._etag != "empty_etag" &&
            _item._instruction != CSYNC_INSTRUCTION_NEW  // On new files never send a If-Match
            ) {
        // We add quotes because the owncloud server always add quotes around the etag, and
        //  csync_owncloud.c's owncloud_file_id always strip the quotes.
        headers["If-Match"] = '"' + _item._etag + '"';
    }

    QString path = _item._file;

    UploadDevice *device = new UploadDevice(&_propagator->_bandwidthManager);
    qint64 chunkStart = 0;
    qint64 currentChunkSize = fileSize;
    if (_chunkCount > 1) {
        int sendingChunk = (_currentChunk + _startChunk) % _chunkCount;
        // XOR with chunk size to make sure everything goes well if chunk size change between runs
        uint transid = _transferId ^ chunkSize();
        path +=  QString("-chunking-%1-%2-%3").arg(transid).arg(_chunkCount).arg(sendingChunk);

        headers["OC-Chunked"] = "1";

        chunkStart = chunkSize() * quint64(sendingChunk);
        currentChunkSize = chunkSize();
        if (sendingChunk == _chunkCount - 1) { // last chunk
            currentChunkSize = (fileSize % chunkSize());
            if( currentChunkSize == 0 ) { // if the last chunk pretents to be 0, its actually the full chunk size.
                currentChunkSize = chunkSize();
            }
        }
    }

    if (! device->prepareAndOpen(_propagator->getFilePath(_item._file), chunkStart, currentChunkSize)) {
        qDebug() << "ERR: Could not prepare upload device: " << device->errorString();
        // Soft error because this is likely caused by the user modifying his files while syncing
        abortWithError( SyncFileItem::SoftError, device->errorString() );
        delete device;
        return;
    }

    // job takes ownership of device via a QScopedPointer. Job deletes itself when finishing
    PUTFileJob* job = new PUTFileJob(_propagator->account(), _propagator->_remoteFolder + path, device, headers, _currentChunk);
    _jobs.append(job);
    connect(job, SIGNAL(finishedSignal()), this, SLOT(slotPutFinished()));
    connect(job, SIGNAL(uploadProgress(qint64,qint64)), this, SLOT(slotUploadProgress(qint64,qint64)));
    connect(job, SIGNAL(uploadProgress(qint64,qint64)), device, SLOT(slotJobUploadProgress(qint64,qint64)));
    connect(job, SIGNAL(destroyed(QObject*)), this, SLOT(slotJobDestroyed(QObject*)));
    job->start();
    _propagator->_activeJobs++;
    _currentChunk++;

    bool parallelChunkUpload = true;
    QByteArray env = qgetenv("OWNCLOUD_PARALLEL_CHUNK");
    if (!env.isEmpty()) {
        parallelChunkUpload = env != "false" && env != "0";
    } else {
        auto version = _propagator->account()->serverVersion();
        auto components = version.split('.');
        int versionNum = (components.value(0).toInt() << 16)
                       + (components.value(1).toInt() << 8)
                       + components.value(2).toInt();
        if (versionNum < 0x080003) {
            // Disable parallel chunk upload severs older than 8.0.3 to avoid too many
            // internal sever errors (#2743, #2938)
            parallelChunkUpload = false;
        }
    }

    if (_currentChunk + _startChunk >= _chunkCount - 1) {
        // Don't do parallel upload of chunk if this might be the last chunk because the server cannot handle that
        // https://github.com/owncloud/core/issues/11106
        parallelChunkUpload = false;
    }

    if (parallelChunkUpload && (_propagator->_activeJobs < _propagator->maximumActiveJob())
            && _currentChunk < _chunkCount ) {
        startNextChunk();
    }
    if (!parallelChunkUpload || _chunkCount - _currentChunk <= 0) {
        emit ready();
    }
//.........这里部分代码省略.........
开发者ID:24killen,项目名称:client,代码行数:101,代码来源:propagateupload.cpp


示例18: QTime

void Download::calculateSpeed() const
{
    if(!m_speedTimer.isValid()) {
        m_speedTimer.start();
        return;
    }

    if(isDownloadFinished()) {
        m_speed = 0;
        m_weightedSpeed = 0;
         

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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