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


C++ QueueItem类代码示例

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


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

示例1: throw

Download::Download(UserConnection& conn, QueueItem& qi, const string& path, bool supportsTrees) throw() : Transfer(conn, path, qi.getTTH()),
	tempTarget(qi.getTempTarget()), file(0), treeValid(false)
{
	conn.setDownload(this);

	if(qi.isSet(QueueItem::FLAG_PARTIAL_LIST)) {
		setType(TYPE_PARTIAL_LIST);
	} else if(qi.isSet(QueueItem::FLAG_USER_LIST)) {
		setType(TYPE_FULL_LIST);
	}

	if(qi.getSize() != -1) {
		if(HashManager::getInstance()->getTree(getTTH(), getTigerTree())) {
			setTreeValid(true);
			setSegment(qi.getNextSegment(getTigerTree().getBlockSize(), conn.getChunkSize()));
		} else if(supportsTrees && !qi.getSource(conn.getUser())->isSet(QueueItem::Source::FLAG_NO_TREE) && qi.getSize() > HashManager::MIN_BLOCK_SIZE) {
			// Get the tree unless the file is small (for small files, we'd probably only get the root anyway)
			setType(TYPE_TREE);
			getTigerTree().setFileSize(qi.getSize());
			setSegment(Segment(0, -1));
		} else {
			// Use the root as tree to get some sort of validation at least...
			getTigerTree() = TigerTree(qi.getSize(), qi.getSize(), getTTH());
			setTreeValid(true);
			setSegment(qi.getNextSegment(getTigerTree().getBlockSize(), 0));
		}
	}
}
开发者ID:eiskaltdcpp,项目名称:freedcpp,代码行数:28,代码来源:Download.cpp

示例2: slotBubbleTimeout

void Amor::slotBubbleTimeout()
{
    // has the queue item been displayed for long enough?
    QueueItem *first = mTipsQueue.head();

    if( first->time() > BUBBLE_TIME_STEP && mBubble->isVisible() ) {
        first->setTime( first->time() - BUBBLE_TIME_STEP );
        mBubbleTimer->setSingleShot( true );
        mBubbleTimer->start( BUBBLE_TIME_STEP );
        return;
    }

    // do not do anything if the mouse pointer is in the bubble
    if( mBubble->mouseWithin() ) {
        first->setTime( 500 );                  // show this item for another 500ms
        mBubbleTimer->setSingleShot( true );
        mBubbleTimer->start( BUBBLE_TIME_STEP );
        return;
    }

    // are there any other tips pending?
    if( mTipsQueue.count() > 1 ) {
        mTipsQueue.dequeue();
        showBubble();           // shows the next item in the queue
    }
    else {
        hideBubble( true );     // hideBubble calls dequeue() for itself.
    }
}
开发者ID:Feniks13r,项目名称:amor,代码行数:29,代码来源:amor.cpp

示例3: getCurrentList

void QueueDialog::btnMoveTop_clicked()
{
	QueueItem* current = (QueueItem*) getCurrentList()->selectedItem();
	if(current == 0)
		return;
	
	if(current->getPriority() == 0)
		return;
	
	QueueItem* previous = (QueueItem*) current->itemAbove();
	
	if(previous == 0)
		return;	
	
	int p = previous->getPriority();
	
	while(previous != 0)
	{
		p = previous->getPriority();
		previous->setPriority(p - 1);
		
		previous = (QueueItem*) previous->itemAbove();
	}
	
	current->setPriority(p);
	getCurrentList()->sort();
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例4: processQueue

void MainWindow::processQueue() {
    if(ui->listWidget_queue->count() == 0)
        return;

    if(!(ui->checkBox_queue_generateNormal->isChecked() ||
         ui->checkBox_queue_generateSpec->isChecked() ||
         ui->checkBox_queue_generateDisplace->isChecked())) {
        QMessageBox::information(this, "Nothing to do", "Select at least one map type to generate from the \"Save\" section");
        return;
    }

    if(!exportPath.isValid()) {
        QMessageBox::information(this, "Invalid Export Path", "Export path is invalid!");
        return;
    }

    //enable stop button
    ui->pushButton_stopProcessingQueue->setEnabled(true);
    //show progress bar and adjust maximum to queue size
    ui->progressBar_Queue->show();
    ui->progressBar_Queue->setMaximum(ui->listWidget_queue->count());

    for(int i = 0; i < ui->listWidget_queue->count() && !stopQueue; i++)
    {
        QueueItem *item = (QueueItem*)(ui->listWidget_queue->item(i));

        //display status
        ui->statusBar->showMessage("Processing Image \"" + item->text() + "\"");
        ui->progressBar_Queue->setValue(i + 1);
        ui->listWidget_queue->item(i)->setSelected(true);

        //load image
        load(item->getUrl());
        
        //save maps
        QUrl exportUrl = QUrl::fromLocalFile(exportPath.toLocalFile() + "/" + item->text());
        std::cout << "[Queue] Image " << i + 1 << " exported: "
                  << exportUrl.toLocalFile().toStdString() << std::endl;
        save(exportUrl);

        //user interface should stay responsive
        QCoreApplication::processEvents();
    }

    //disable stop button
    ui->pushButton_stopProcessingQueue->setEnabled(false);
    stopQueue = false;
    //hide queue progress bar
    ui->progressBar_Queue->hide();

    //enable "Open Export Folder" gui button
    ui->pushButton_openExportFolder->setEnabled(true);
}
开发者ID:magnomatos822,项目名称:NormalmapGenerator,代码行数:53,代码来源:mainwindow.cpp

示例5: compare

int QueueItem::compare(QListViewItem *i, int , bool ) const
{
	QueueItem* it = (QueueItem*) i;
	if(it->getPriority() == torrentPriority)
	{
		const TorrentInterface* ti = it->getTC();
		QString name1 = tc->getStats().torrent_name;
		QString name2 = ti->getStats().torrent_name;
		return name1.compare(name2);
	}
			
	return it->getPriority() < torrentPriority ? -1 : 1;
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例6: while

	void InvokeQueue::runQueue() {
		_isQueued.reset();
		while (1) {
			QueueItem item;
			{
				LockerCS lock(_cs);
				if (_queue.empty()) break;
				item = _queue.front();
				_queue.pop();
			}
			item.func((ULONG_PTR)item.param);
		}
	}
开发者ID:Konnekt,项目名称:staminalib,代码行数:13,代码来源:InvokeQueue.cpp

示例7: CheckQueue

void QueueScriptCoordinator::CheckQueue()
{
	DownloadQueue* pDownloadQueue = DownloadQueue::Lock();
	m_mutexQueue.Lock();

	delete m_pCurItem;

	m_pCurItem = NULL;
	NZBInfo* pCurNZBInfo = NULL;
	Queue::iterator itCurItem = m_Queue.end();

	for (Queue::iterator it = m_Queue.begin(); it != m_Queue.end(); )
	{
		QueueItem* pQueueItem = *it;

		NZBInfo* pNZBInfo = pDownloadQueue->GetQueue()->Find(pQueueItem->GetNZBID());

		// in a case this nzb must not be processed further - delete queue script from queue
		if (!pNZBInfo || pNZBInfo->GetDeleteStatus() != NZBInfo::dsNone ||
			pNZBInfo->GetMarkStatus() == NZBInfo::ksBad)
		{
			delete pQueueItem;
			it = m_Queue.erase(it);
			continue;
		}

		if (!m_pCurItem || pQueueItem->GetEvent() > m_pCurItem->GetEvent())
		{
			m_pCurItem = pQueueItem;
			itCurItem = it;
			pCurNZBInfo = pNZBInfo;
		}

		it++;
	}

	if (m_pCurItem)
	{
		m_Queue.erase(itCurItem);
		StartScript(pCurNZBInfo, m_pCurItem);
	}

	m_mutexQueue.Unlock();
	DownloadQueue::Unlock();
}
开发者ID:ta264,项目名称:nzbget_svn,代码行数:45,代码来源:QueueScript.cpp

示例8: HasJob

bool QueueScriptCoordinator::HasJob(int iNZBID)
{
	m_mutexQueue.Lock();
	bool bWorking = m_pCurItem && m_pCurItem->GetNZBID() == iNZBID;
	if (!bWorking)
	{
		for (Queue::iterator it = m_Queue.begin(); it != m_Queue.end(); it++)
		{
			QueueItem* pQueueItem = *it;
			bWorking = pQueueItem->GetNZBID() == iNZBID;
			if (bWorking)
			{
				break;
			}
		}
	}
	m_mutexQueue.Unlock();

	return bWorking;
}
开发者ID:ta264,项目名称:nzbget_svn,代码行数:20,代码来源:QueueScript.cpp

示例9: worker_thread

static gpointer
worker_thread(gpointer data)
{
	dbg(2, "new file load thread.");
	WfWorker* w = data;

	g_return_val_if_fail(w->msg_queue, NULL);

	g_async_queue_ref(w->msg_queue);

	// check for new work
	while(true){
		QueueItem* job = g_async_queue_pop(w->msg_queue); // blocking
		dbg(2, "starting new job: %p", job);

		Waveform* waveform = g_weak_ref_get(&job->ref);
		if(waveform){
			if(!job->cancelled){
				// note that the job is run directly so that it runs in the worker thread.
				job->work(waveform, job->user_data);
			}
			g_idle_add(worker_unref_waveform, waveform);
		}

		g_timeout_add(1, worker_post,
			WF_NEW(WorkerJob,
				.job = job,
				.worker = w
			)
		);

		g_usleep(100);
	}

	return NULL;
}
开发者ID:ayyi,项目名称:libwaveform,代码行数:36,代码来源:worker.c

示例10: worker_post

	/*
	 *   Do clean-up and notifications in the main thread
	 */
	static bool worker_post(gpointer _wj)
	{
		WorkerJob* wj = _wj;
		QueueItem* job = wj->job;
		WfWorker* w = wj->worker;

		if(!job->cancelled){
			Waveform* waveform = g_weak_ref_get(&job->ref);
			call(job->done, waveform, NULL, job->user_data);
			if(waveform) g_object_unref(waveform);
		}
		if(job->free && job->user_data){
			job->free(job->user_data);
			job->user_data = NULL;
		}

		w->jobs = g_list_remove(w->jobs, job);

		g_weak_ref_set(&job->ref, NULL);
		g_free(job);
		g_free(wj);

		return G_SOURCE_REMOVE;
	}
开发者ID:ayyi,项目名称:libwaveform,代码行数:27,代码来源:worker.c

示例11: while

void QueueDialog::writeQueue()
{
	downloadList->sort();
	seedList->sort();
	
	int p = 0;
	
	QueueItem* item = (QueueItem*) downloadList->lastItem();
	if(item != 0)
	{
		while(item != 0)
		{
			if(item->getPriority() != 0)
				item->setTorrentPriority(++p);
			else
				item->setTorrentPriority(0);
			item = (QueueItem*) item->itemAbove();
		}
	}
	
	item = (QueueItem*) seedList->lastItem();
	if(item == 0)
	{
		qman->orderQueue();
		return;
	}
	
	p = 0;
	
	while(item != 0)
	{
		if(item->getPriority() != 0)
			item->setTorrentPriority(++p);
		else
			item->setTorrentPriority(0);
		item = (QueueItem*) item->itemAbove();
	}
	qman->orderQueue();
}
开发者ID:,项目名称:,代码行数:39,代码来源:

示例12:

Eloquent::QueueItem::QueueItem( const QueueItem& rhs )
: m_Data( rhs.Data() )
, m_Origin( rhs.Origin() )
, m_Destination( rhs.Destination() )
{}
开发者ID:nwehr,项目名称:eloquent-core,代码行数:5,代码来源:QueueItem.cpp

示例13: Transfer

Download::Download(UserConnection& conn, QueueItem& qi) noexcept : Transfer(conn, qi.getTarget(), qi.getTTH()),
	tempTarget(qi.getTempTarget())
{
	conn.setDownload(this);
	
	QueueItem::SourceConstIter source = qi.getSource(getUser());

	if(qi.isSet(QueueItem::FLAG_PARTIAL_LIST)) {
		setType(TYPE_PARTIAL_LIST);
	} else if(qi.isSet(QueueItem::FLAG_USER_LIST)) {
		setType(TYPE_FULL_LIST);
	}

	if(source->isSet(QueueItem::Source::FLAG_PARTIAL))
		setFlag(FLAG_PARTIAL);
	if(qi.isSet(QueueItem::FLAG_CLIENT_VIEW))
		setFlag(FLAG_VIEW);
	if(qi.isSet(QueueItem::FLAG_MATCH_QUEUE))
		setFlag(FLAG_QUEUE);
	if(qi.isSet(QueueItem::FLAG_VIEW_NFO))
		setFlag(FLAG_NFO);
	if(qi.isSet(QueueItem::FLAG_RECURSIVE_LIST))
		setFlag(FLAG_RECURSIVE);
	if(qi.isSet(QueueItem::FLAG_TTHLIST_BUNDLE))
		setFlag(FLAG_TTHLIST_BUNDLE);
	if (qi.getPriority() == QueueItemBase::HIGHEST)
		setFlag(FLAG_HIGHEST_PRIO);

	if (qi.getBundle()) {
		dcassert(!qi.isSet(QueueItem::FLAG_USER_LIST));
		dcassert(!qi.isSet(QueueItem::FLAG_TEXT));
		setBundle(qi.getBundle());
	}
	
	if(getType() == TYPE_FILE && qi.getSize() != -1) {
		if(HashManager::getInstance()->getTree(getTTH(), getTigerTree())) {
			setTreeValid(true);
			setSegment(qi.getNextSegment(getTigerTree().getBlockSize(), conn.getChunkSize(), conn.getSpeed(), source->getPartialSource(), true));
			qi.setBlockSize(getTigerTree().getBlockSize());
		} else if(conn.isSet(UserConnection::FLAG_SUPPORTS_TTHL) && !source->isSet(QueueItem::Source::FLAG_NO_TREE) && qi.getSize() > HashManager::MIN_BLOCK_SIZE) {
			// Get the tree unless the file is small (for small files, we'd probably only get the root anyway)
			setType(TYPE_TREE);
			getTigerTree().setFileSize(qi.getSize());
			setSegment(Segment(0, -1));
		} else {
			// Use the root as tree to get some sort of validation at least...
			getTigerTree() = TigerTree(qi.getSize(), qi.getSize(), getTTH());
			setTreeValid(true);
			setSegment(qi.getNextSegment(getTigerTree().getBlockSize(), 0, 0, source->getPartialSource(), true));
		}
		
		if ((getStartPos() + getSegmentSize()) != qi.getSize() || (conn.getDownload() && conn.getDownload()->isSet(FLAG_CHUNKED))) {
			setFlag(FLAG_CHUNKED);
		}

		if(getSegment().getOverlapped()) {
			setFlag(FLAG_OVERLAP);

			// set overlapped flag to original segment
			for(auto d: qi.getDownloads()) {
				if(d->getSegment().contains(getSegment())) {
					d->setOverlapped(true);
					break;
				}
			}
		}
	}
}
开发者ID:egoitzro,项目名称:airdcnano,代码行数:68,代码来源:Download.cpp

示例14: Transfer

Download::Download(UserConnection& conn, QueueItem& qi, const string& path, bool supportsTrees) noexcept : Transfer(conn, path, qi.getTTH()),
    tempTarget(qi.getTempTarget()), file(0), treeValid(false)
{
    conn.setDownload(this);

    QueueItem::SourceConstIter source = qi.getSource(getUser());

    if(qi.isSet(QueueItem::FLAG_PARTIAL_LIST)) {
        setType(TYPE_PARTIAL_LIST);
    } else if(qi.isSet(QueueItem::FLAG_USER_LIST)) {
        setType(TYPE_FULL_LIST);
    }

    if(getType() == TYPE_FILE && qi.getSize() != -1) {
        if(HashManager::getInstance()->getTree(getTTH(), getTigerTree())) {
            setTreeValid(true);
            setSegment(qi.getNextSegment(getTigerTree().getBlockSize(), conn.getChunkSize(),conn.getSpeed(), source->getPartialSource()));
        } else if(supportsTrees && conn.isSet(UserConnection::FLAG_SUPPORTS_TTHL) && !qi.getSource(conn.getUser())->isSet(QueueItem::Source::FLAG_NO_TREE) && qi.getSize() > HashManager::MIN_BLOCK_SIZE) {
            // Get the tree unless the file is small (for small files, we'd probably only get the root anyway)
            setType(TYPE_TREE);
            getTigerTree().setFileSize(qi.getSize());
            setSegment(Segment(0, -1));
        } else {
            // Use the root as tree to get some sort of validation at least...
            getTigerTree() = TigerTree(qi.getSize(), qi.getSize(), getTTH());
            setTreeValid(true);
            setSegment(qi.getNextSegment(getTigerTree().getBlockSize(), 0, 0, source->getPartialSource()));
        }

        if(getSegment().getOverlapped()) {
            setFlag(FLAG_OVERLAP);

            // set overlapped flag to original segment
            for(DownloadList::const_iterator i = qi.getDownloads().begin(); i != qi.getDownloads().end(); ++i) {
                if((*i)->getSegment().contains(getSegment())) {
                    (*i)->setOverlapped(true);
                    break;
                }
            }
        }
    }
}
开发者ID:bhaavanmerchant,项目名称:eiskaltdcpp,代码行数:42,代码来源:Download.cpp

示例15: time

void QueueScriptCoordinator::EnqueueScript(NZBInfo* pNZBInfo, EEvent eEvent)
{
	if (!m_bHasQueueScripts)
	{
		return;
	}

	m_mutexQueue.Lock();

	if (eEvent == qeNzbDownloaded)
	{
		// delete all other queued scripts for this nzb
		for (Queue::iterator it = m_Queue.begin(); it != m_Queue.end(); )
		{
			QueueItem* pQueueItem = *it;
			if (pQueueItem->GetNZBID() == pNZBInfo->GetID())
			{
				delete pQueueItem;
				it = m_Queue.erase(it);
				continue;
			}
			it++;
		}
	}

	// respect option "EventInterval"
	time_t tCurTime = time(NULL);
	if (eEvent == qeFileDownloaded &&
		(g_pOptions->GetEventInterval() == -1 ||
		 (g_pOptions->GetEventInterval() > 0 && tCurTime - pNZBInfo->GetQueueScriptTime() > 0 &&
		 (int)(tCurTime - pNZBInfo->GetQueueScriptTime()) < g_pOptions->GetEventInterval())))
	{
		m_mutexQueue.Unlock();
		return;
	}

	for (ScriptConfig::Scripts::iterator it = g_pScriptConfig->GetScripts()->begin(); it != g_pScriptConfig->GetScripts()->end(); it++)
	{
		ScriptConfig::Script* pScript = *it;

		if (!pScript->GetQueueScript())
		{
			continue;
		}

		bool bUseScript = false;

		// check queue-scripts
		const char* szQueueScript = g_pOptions->GetQueueScript();
		if (!Util::EmptyStr(szQueueScript))
		{
			// split szQueueScript into tokens
			Tokenizer tok(szQueueScript, ",;");
			while (const char* szScriptName = tok.Next())
			{
				if (Util::SameFilename(szScriptName, pScript->GetName()))
				{
					bUseScript = true;
					break;
				}
			}
		}

		// check post-processing-scripts
		if (!bUseScript)
		{
			for (NZBParameterList::iterator it = pNZBInfo->GetParameters()->begin(); it != pNZBInfo->GetParameters()->end(); it++)
			{
				NZBParameter* pParameter = *it;
				const char* szVarname = pParameter->GetName();
				if (strlen(szVarname) > 0 && szVarname[0] != '*' && szVarname[strlen(szVarname)-1] == ':' &&
					(!strcasecmp(pParameter->GetValue(), "yes") ||
					 !strcasecmp(pParameter->GetValue(), "on") ||
					 !strcasecmp(pParameter->GetValue(), "1")))
				{
					char szScriptName[1024];
					strncpy(szScriptName, szVarname, 1024);
					szScriptName[1024-1] = '\0';
					szScriptName[strlen(szScriptName)-1] = '\0'; // remove trailing ':'
					if (Util::SameFilename(szScriptName, pScript->GetName()))
					{
						bUseScript = true;
						break;
					}
				}
			}
		}

		bUseScript &= Util::EmptyStr(pScript->GetQueueEvents()) || strstr(pScript->GetQueueEvents(), QUEUE_EVENT_NAMES[eEvent]);

		if (bUseScript)
		{
			bool bAlreadyQueued = false;
			if (eEvent == qeFileDownloaded)
			{
				// check if this script is already queued for this nzb
				for (Queue::iterator it2 = m_Queue.begin(); it2 != m_Queue.end(); it2++)
				{
					QueueItem* pQueueItem = *it2;
					if (pQueueItem->GetNZBID() == pNZBInfo->GetID() && pQueueItem->GetScript() == pScript)
//.........这里部分代码省略.........
开发者ID:ta264,项目名称:nzbget_svn,代码行数:101,代码来源:QueueScript.cpp


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