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


C++ StoredTransferJob::url方法代码示例

本文整理汇总了C++中kio::StoredTransferJob::url方法的典型用法代码示例。如果您正苦于以下问题:C++ StoredTransferJob::url方法的具体用法?C++ StoredTransferJob::url怎么用?C++ StoredTransferJob::url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kio::StoredTransferJob的用法示例。


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

示例1: downloadFinished

    void Core::downloadFinished(KJob* job)
    {
        KIO::StoredTransferJob* j = (KIO::StoredTransferJob*)job;
        int err = j->error();
        if (err == KIO::ERR_USER_CANCELED)
            return;

        if (err)
        {
            gui->errorMsg(j);
        }
        else
        {
            // load in the file (target is always local)
            QString group;
            QMap<KUrl, QString>::iterator i = add_to_groups.find(j->url());
            if (i != add_to_groups.end())
            {
                group = i.value();
                add_to_groups.erase(i);
            }

            QString dir = locationHint(group);
            if (dir != QString::null)
                loadFromData(j->data(), dir, group, false, j->url());
        }
    }
开发者ID:zidel,项目名称:ktorrent,代码行数:27,代码来源:core.cpp

示例2: onAnnounceResult

void HTTPTracker::onAnnounceResult(KIO::Job* j)
{
    if (j->error())
    {
        KIO::StoredTransferJob* st = (KIO::StoredTransferJob*)j;
        KURL u = st->url();
        active_job = 0;

        Out(SYS_TRK|LOG_IMPORTANT) << "Error : " << st->errorString() << endl;
        if (u.queryItem("event") != "stopped")
        {
            failures++;
            requestFailed(j->errorString());
        }
        else
        {
            stopDone();
        }
    }
    else
    {
        KIO::StoredTransferJob* st = (KIO::StoredTransferJob*)j;
        KURL u = st->url();
        active_job = 0;

        if (u.queryItem("event") != "stopped")
        {
            try
            {
                if (updateData(st->data()))
                {
                    failures = 0;
                    peersReady(this);
                    requestOK();
                    if (u.queryItem("event") == "started")
                        started = true;
                }
            }
            catch (bt::Error & err)
            {
                failures++;
                requestFailed(i18n("Invalid response from tracker"));
            }
            event = QString::null;
        }
        else
        {
            failures = 0;
            stopDone();
        }
    }
    doAnnounceQueue();
}
开发者ID:,项目名称:,代码行数:53,代码来源:

示例3: downloadFinishedSilently

    void Core::downloadFinishedSilently(KJob* job)
    {
        KIO::StoredTransferJob* j = (KIO::StoredTransferJob*)job;
        int err = j->error();
        if (err == KIO::ERR_USER_CANCELED)
        {
            // do nothing
        }
        else if (err)
        {
            canNotLoadSilently(j->errorString());
        }
        else
        {
            QString dir;
            if (custom_save_locations.contains(j))
            {
                // we have a custom save location so save to that
                dir = custom_save_locations[j].toLocalFile();
                custom_save_locations.remove(j);
            }
            else if (!Settings::useSaveDir())
            {
                // incase save dir is not set, use home director
                Out(SYS_GEN | LOG_NOTICE) << "Cannot load " << j->url() << " silently, default save location not set !" << endl;
                Out(SYS_GEN | LOG_NOTICE) << "Using home directory instead !" << endl;
                dir = QDir::homePath();
            }
            else
            {
                dir = Settings::saveDir().toLocalFile();
            }

            QString group;
            QMap<KUrl, QString>::iterator i = add_to_groups.find(j->url());
            if (i != add_to_groups.end())
            {
                group = i.value();
                add_to_groups.erase(i);
            }


            if (dir != QString::null)
                loadFromData(j->data(), dir, group, true, j->url());
        }
    }
开发者ID:zidel,项目名称:ktorrent,代码行数:46,代码来源:core.cpp

示例4: slotImageFetched

void MediaManager::slotImageFetched( KJob * job )
{
    KIO::StoredTransferJob *baseJob = qobject_cast<KIO::StoredTransferJob *>( job );
    QString remote = d->queue.value(job);
    d->queue.remove( job );
    if ( job->error() ) {
        kDebug() << "Job error: " << job->error() << "\t" << job->errorString();
        QString errMsg = i18n( "Cannot download image from %1.",
                               job->errorString() );
        emit fetchError( remote, errMsg );
    } else {
        QPixmap p;
        if( !baseJob->data().startsWith(QByteArray("<?xml version=\"")) &&
            p.loadFromData( baseJob->data() ) ) {
            d->cache.insert( remote, p );
            emit imageFetched( remote, p );
        } else {
            kDebug()<<"Parse Error: \nBase Url:"<<baseJob->url()<<"\ndata:"<<baseJob->data();
            emit fetchError( remote, i18n( "The download failed. The returned file is corrupted." ) );
        }
    }
}
开发者ID:Boris-de,项目名称:choqok,代码行数:22,代码来源:mediamanager.cpp

示例5: slotJobResult

void ThumbnailPicker::slotJobResult( KJob *job ) {
    KIO::StoredTransferJob *stjob = (KIO::StoredTransferJob*)job;

    //Update Progressbar
    if ( ! ui->SearchProgress->isHidden() ) {
        ui->SearchProgress->setValue(ui->SearchProgress->value()+1);
        if ( ui->SearchProgress->value() == ui->SearchProgress->maximum() ) {
            ui->SearchProgress->hide();
            ui->SearchLabel->setText( i18n( "Search results:" ) );
        }
    }

    //If there was a problem, just return silently without adding image to list.
    if ( job->error() ) {
        qDebug() << " error=" << job->error();
        job->kill();
        return;
    }

    QPixmap *pm = new QPixmap();
    pm->loadFromData( stjob->data() );

    uint w = pm->width();
    uint h = pm->height();
    uint pad = 0; /*FIXME LATER 4* QDialogBase::marginHint() + 2*ui->SearchLabel->height() + QDialogBase::actionButton( QDialogBase::Ok )->height() + 25;*/
    uint hDesk = QApplication::desktop()->availableGeometry().height() - pad;

    if ( h > hDesk )
        *pm = pm->scaled( w*hDesk/h, hDesk, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );

    PixList.append( pm );

    //Add 50x50 image and URL to listbox
    //ui->ImageList->insertItem( shrinkImage( PixList.last(), 50 ),
    //		cjob->srcURLs().first().prettyUrl() );
    ui->ImageList->addItem( new QListWidgetItem ( QIcon(shrinkImage( PixList.last(), 50 )), stjob->url().url()));
}
开发者ID:Bugsbane,项目名称:kstars,代码行数:37,代码来源:thumbnailpicker.cpp


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