Beispiel #1
0
bool QPostItem::finished(int partId)
{
    QItem::finished(partId);
    partialLines = 0;

    if (partsToDo == 0)
    {
        if (etaTimer)
            etaTimer->stop();

        if (totalParts > failedParts)
        {
            listItem->setText(2, tr("Waiting for decoding..."));
            listItem->setText(3, "");
            listItem->setText(4, "");

            processing = true;
            emit decodeMe(this);
        }
        else
            emit decodeNotNeeded(this, false, QString::null, tr("Nothing downloaded to decode"));

        return true;
    }
    else
    {
        if (workingThreads == 0)
            etaTimer->stop();

        listItem->setText(
                3,
                QString::number(totalParts - partsToDo) + '/'
                        + QString::number(failedParts) + '/' + QString::number(
                        totalParts));

        if (((QAbstractItemView*)listItem->treeWidget())->sizeHintForColumn(3) > col3width)
        {
            col3width = ((QAbstractItemView*)listItem->treeWidget())->sizeHintForColumn(3);
            listItem->treeWidget()->resizeColumnToContents(3);
        }

        return false;
    }
}
Beispiel #2
0
int QPostItem::error(int partId, QString & error)
{
    parts[partId]->status = QItem::Failed_Part;
    // 	parts[partId]->job->status=Job::Failed_Job;

    //Check if there is another server for the part.
    //Yes->tell the qManager to re-queue
    //No-> if this was the last part, send

    //Delete the server from the part
    serverArticleNos[partId].remove(parts[partId]->qId);
    //check if there are other parts
    workingThreads--;
    if (workingThreads == 0)
    {
        listItem->setText(2, tr("Queued"));
        etaTimer->stop();
    }
    else
        listItem->setText(2,
                tr("Processing (") + QString::number(workingThreads) + ")");

    if (serverArticleNos[partId].count() != 0)        
    {
        Servers* servers = quban->getServers();

        QMapIterator<quint16,quint64> it(serverArticleNos[partId]);
        while (it.hasNext())
        {
            it.next();
            if (servers->contains(it.key())) // it should ...
            {
                if (servers->value(it.key())->getServerType() != NntpHost::dormantServer )
                {
                    //Yes, re-queue me
                    return QItem::RequeMe;
                }
            }
        }
    }

    partsToDo--;
    failedParts++;
    parts[partId]->listItem->setText(2, tr("Failed"));
    parts[partId]->listItem->setText(3, error);
    //No, check if this was the last part...
    if (partsToDo == 0)
    {
        //last part, remove from queue
        status = QItem::Finished_Item;
        listItem->setText(2, tr("Waiting for decoding..."));
        listItem->setText(3, "");
        if (etaTimer)
        {
            etaTimer->stop();
        }
        emit decodeMe(this);
        return QItem::Finished;
    }
    else
    {
        //there are other parts, continue
        // 			listItem->setText(3, QString::number(partsToDo) + " parts left");
        listItem->setText(
                    3,
                    QString::number(totalParts - partsToDo) + '/'
                    + QString::number(failedParts) + '/'
                    + QString::number(totalParts));

        if (((QAbstractItemView*)listItem->treeWidget())->sizeHintForColumn(3) > col3width)
        {
            col3width = ((QAbstractItemView*)listItem->treeWidget())->sizeHintForColumn(3);
            listItem->treeWidget()->resizeColumnToContents(3);
        }

        return QItem::Continue;
    }

    return -1;
}
Beispiel #3
0
void QVideoDecoder::startDecoding()
{
	emit decodeMe();
	//m_decode_timer = startTimer(10);
}