本文整理汇总了C++中QueueItem::getPriority方法的典型用法代码示例。如果您正苦于以下问题:C++ QueueItem::getPriority方法的具体用法?C++ QueueItem::getPriority怎么用?C++ QueueItem::getPriority使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueueItem
的用法示例。
在下文中一共展示了QueueItem::getPriority方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: btnMoveBottom_clicked
void QueueDialog::btnMoveBottom_clicked()
{
QueueItem* current = (QueueItem*) getCurrentList()->selectedItem();
if(current == 0)
return;
if(current->getPriority() == 0)
return;
QueueItem* previous = (QueueItem*) current->itemBelow();
if(previous == 0)
return;
if(previous->getPriority() == 0)
return;
int p = previous->getPriority();
while(previous != 0 && previous->getPriority() != 0)
{
p = previous->getPriority();
previous->setPriority(p + 1);
previous = (QueueItem*) previous->itemBelow();
}
current->setPriority(p);
getCurrentList()->sort();
}
示例2: 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;
}
示例3: btnDequeue_clicked
void QueueDialog::btnDequeue_clicked()
{
QueueItem* current = (QueueItem*) getCurrentList()->selectedItem();
if(current == 0)
return;
if(current->getPriority() == 0)
return;
current->setPriority(0);
getCurrentList()->sort();
}
示例4: btnMoveUp_clicked
void QueueDialog::btnMoveUp_clicked()
{
QueueItem* current = (QueueItem*) getCurrentList()->selectedItem();
if(current == 0)
return;
if(current->getPriority() == 0)
return;
QueueItem* previous = (QueueItem*) current->itemAbove();
if(previous == 0)
return;
else
{
int tmp = previous->getPriority();
previous->setPriority(current->getPriority());
current->setPriority(tmp);
getCurrentList()->sort();
}
}
示例5: writeQueue
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();
}
示例6: enqueue
void QueueDialog::enqueue(QueueItem* curr)
{
QueueItem* current = curr == 0 ? (QueueItem*) getCurrentList()->selectedItem() : curr;
if(current == 0)
return;
if(current->getPriority() != 0)
return;
QueueItem* item = (QueueItem*) getCurrentList()->firstChild();
if(item == 0)
return;
while(item != 0)
{
if(item->getPriority() != 0)
item->setPriority(item->getPriority() + 1);
item = (QueueItem*) item->itemBelow();
}
current->setPriority(1);
getCurrentList()->sort();
}
示例7: 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;
}
}
}
}
}