示例#1
0
void KDEProjectsReaderTest::testsProperParse()
{
    KDEProjectsModel m;
    KDEProjectsReader reader(&m, 0);

    if(reader.hasErrors())
        qDebug() << "errors:" << reader.errors();

    QVERIFY(!reader.hasErrors());

    WAIT_FOR_SIGNAL(&reader,downloadDone());

    for(int i=0; i<m.rowCount(); i++) {
        QStandardItem* item = m.item(i,0);
        qDebug() << ":::::" << item->text() << item->icon() << item->data(KDEProjectsModel::VcsLocationRole);

        QVERIFY(item);
        QVERIFY(!item->text().isEmpty());

        QVariant urls = item->data(KDEProjectsModel::VcsLocationRole);
        QVERIFY(urls.isValid());
        QVERIFY(urls.canConvert(QVariant::Map));
        QVariantMap mapurls=urls.toMap();
        for(QVariantMap::const_iterator it=mapurls.constBegin(), itEnd=mapurls.constEnd(); it!=itEnd; ++it) {
            QVERIFY(!it.key().isEmpty());
            QVERIFY(!it.value().toString().isEmpty());
        }

        QVERIFY(!item->data(KDEProjectsModel::VcsLocationRole).toMap().isEmpty());
    }
}
示例#2
0
void BootloaderInstallBase::downloadBlFinish(bool error)
{
    qDebug() << "[BootloaderInstallBase] Downloading bootloader finished, error:"
             << error;

    // update progress bar
    emit logProgress(100, 100);

    if(m_http.httpResponse() != 200) {
        emit logItem(tr("Download error: received HTTP error %1.")
                .arg(m_http.errorString()), LOGERROR);
        emit done(true);
        return;
    }
    if(error) {
        emit logItem(tr("Download error: %1")
                .arg(m_http.error()), LOGERROR);
        emit done(true);
        return;
    }
    else if(m_http.isCached())
        emit logItem(tr("Download finished (cache used)."), LOGOK);
    else
        emit logItem(tr("Download finished."), LOGOK);

    QCoreApplication::processEvents();
    m_blversion = m_http.timestamp();
    emit downloadDone();
}
示例#3
0
bool BootloaderInstallMi4::install(void)
{
    emit logItem(tr("Downloading bootloader"), LOGINFO);
    qDebug() << "[BootloaderInstallMi4] installing bootloader";
    downloadBlStart(m_blurl);
    connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
    return true;
}
void CWizDownloadObjectData::onDownloadObjectDataCompleted(const WIZOBJECTDATA& data)
{
    CWizApi::onDownloadObjectDataCompleted(data);
    m_data.arrayData = data.arrayData;
    //callClientLogout();

    m_bInited = false;

    Q_EMIT downloadDone(true);
}
void CWizDownloadObjectData::onXmlRpcError(const QString& strMethodName,
                                           WizXmlRpcError err,
                                           int errorCode,
                                           const QString& errorMessage)
{
    CWizApi::onXmlRpcError(strMethodName, err, errorCode, errorMessage);
    Q_EMIT downloadDone(false);

    m_bInited = false;
}
示例#6
0
bool BootloaderInstallTcc::install(void)
{
    if(m_offile.isEmpty())
        return false;

    // Download firmware from server
    emit logItem(tr("Downloading bootloader file"), LOGINFO);

    connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
    downloadBlStart(m_blurl);

    return true;
}
void CWizObjectDataDownloaderHost::on_downloader_finished()
{
    CWizObjectDataDownloader* downloader = qobject_cast<CWizObjectDataDownloader*>(sender());
    WIZOBJECTDATA data = downloader->data();
    bool bSucceed = downloader->succeed();

    m_mapDownloading.remove(data.strObjectGUID);

    qDebug() << "[downloader host] download object finished"
             << data.strDisplayName << " left: "
             << m_mapObject.size() + m_mapDownloading.size();

    Q_EMIT downloadDone(data, bSucceed);

    downloadObject();

    downloader->deleteLater();
}
示例#8
0
void TileDownloader::startImgDownloader_4(){
    setProgress(current_tile_index,tiles_to_load.size());

    if(image_buffer.size() >= buffer_size){
        writeImagesToDisk();
    }

    disconnect(fdl_4, SIGNAL (downloaded()), this, SLOT (loadAndSaveImage_4()));
    if(current_tile_index < tiles_to_load.size()){
        current_tile_index_4 = current_tile_index;
        current_tile_index += 1;

        connect(fdl_4, SIGNAL (downloaded()), this, SLOT (loadAndSaveImage_4()));
        fdl_4->download(getnextUrl(current_tile_index_4));
    }
    else{
        downloadDone();
    }
}
void SlideShare::saveFile()
{
    qDebug() << ">>>>>>>>> SlideShare::saveFile()";
    if(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 302) {
        reply = manager.get(QNetworkRequest(reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl()));
        connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SIGNAL(downloadProgress(qint64, qint64)));
        connect(reply, SIGNAL(finished()), this, SLOT(saveFile()));
        return;
    }

    QFile file(*saveFileName);
    file.open(QFile::WriteOnly);

    file.write(reply->readAll());
    file.close();


    emit downloadDone();
}
示例#10
0
/** Start bootloader installation.
 */
bool BootloaderInstallSansa::install(void)
{
    if(sansa_sectorbuf == NULL) {
        emit logItem(tr("Error: can't allocate buffer memory!"), LOGERROR);
        return false;
        emit done(true);
    }

    emit logItem(tr("Searching for Sansa"), LOGINFO);

    struct sansa_t sansa;

    int n = sansa_scan(&sansa);
    if(n == -1) {
        emit logItem(tr("Permission for disc access denied!\n"
                "This is required to install the bootloader"),
                LOGERROR);
        emit done(true);
        return false;
    }
    if(n == 0) {
        emit logItem(tr("No Sansa detected!"), LOGERROR);
        emit done(true);
        return false;
    }
    if(sansa.hasoldbootloader) {
        emit logItem(tr("OLD ROCKBOX INSTALLATION DETECTED, ABORTING.\n"
               "You must reinstall the original Sansa firmware before running\n"
               "sansapatcher for the first time.\n"
               "See http://www.rockbox.org/wiki/SansaE200Install\n"),
               LOGERROR);
        emit done(true);
        return false;
    }
    emit logItem(tr("Downloading bootloader file"), LOGINFO);

    downloadBlStart(m_blurl);
    connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
    return true;
}
示例#11
0
wordsImporter::wordsImporter(bool backTrans, QString src, QString dst, QObject * parent)
	 : QObject(parent)
	 , backTranslation(backTrans)
{
	words      = new wordsBuilder (QString("%1-%2-%2").arg(src).arg(dst));
	cleanWords = new wordsBuilder (QString("%1-%2-%2").arg(src).arg(dst));
	backtransl = new wordsBuilder (QString("%1-%2-%2").arg(src).arg(dst));
	pica	   = new picturesDownloader();
	sndUrl     = new soundUrlExtractor(QString("%1-%2").arg(src).arg(dst));
	sndDownloader = new urlDownloader ();

	connect (this, SIGNAL(wowNewWord(QString)), words, SLOT(add(QString)), Qt::QueuedConnection);
	connect (words, SIGNAL(cleanWord(QString)), cleanWords, SLOT(add(QString)), Qt::QueuedConnection);
	connect (cleanWords, SIGNAL(cleanWord(QString, QByteArray)), this, SLOT(returnWord(QString, QByteArray)), Qt::QueuedConnection);
	connect (this, SIGNAL(translateItBack(QString)), backtransl, SLOT(add(QString)), Qt::QueuedConnection);

	connect (this, SIGNAL(picturize(QString)), pica, SLOT(add(QString)), Qt::QueuedConnection);
	connect (this, SIGNAL(soundize(QString)), sndUrl, SLOT(add(QString)), Qt::QueuedConnection);
	connect (sndUrl, SIGNAL(downloadUrl(QString, QUrl)), sndDownloader, SLOT(add(QString, QUrl)), Qt::QueuedConnection);
	
	connect (sndDownloader, SIGNAL(downloadDone(QString, QByteArray)), this, SLOT(saveSnd(QString, QByteArray)), Qt::QueuedConnection);
	connect (backtransl, SIGNAL(cleanWord(QString, QByteArray)), this, SLOT(saveCard(QString, QByteArray)), Qt::QueuedConnection);
}
void ThemesInstallWindow::downloadDone(int id, bool error)
{
    downloadDone(error);
    qDebug() << "[Themes] Download" << id << "done, error:" << error;
}
bool BootloaderInstallHex::install(void)
{
    if(m_offile.isEmpty())
        return false;
    m_hashindex = -1;

    // md5sum hex file
    emit logItem(tr("checking MD5 hash of input file ..."), LOGINFO);
    QByteArray filedata;
    // read hex file into QByteArray
    QFile file(m_offile);
    file.open(QIODevice::ReadOnly);
    filedata = file.readAll();
    file.close();
    QString hash = QCryptographicHash::hash(filedata,
            QCryptographicHash::Md5).toHex();
    qDebug() << "[BootloaderInstallHex] hexfile hash:" << hash;
    if(file.error() != QFile::NoError) {
        emit logItem(tr("Could not verify original firmware file"), LOGERROR);
        emit done(true);
        return false;
    }
    // check hash and figure model from md5sum
    int i = sizeof(md5sums) / sizeof(struct md5s);
    m_model = 4;
    // 3: h300, 2: h120, 1: h100, 0:invalid
    while(i--) {
        if(md5sums[i].orig == 0)
            m_model--;
        if(!qstrcmp(md5sums[i].orig, hash.toAscii()))
            break;
    }
    if(i < 0) {
        emit logItem(tr("Firmware file not recognized."), LOGERROR);
        return false;
    }
    else {
        emit logItem(tr("MD5 hash ok"), LOGOK);
        m_hashindex = i;
    }

    // check model agains download link.
    QString match[] = {"", "h100", "h120", "h300"};
    if(!m_blurl.path().contains(match[m_model])) {
        emit logItem(tr("Firmware file doesn't match selected player."),
        LOGERROR);
        return false;
    }

    emit logItem(tr("Descrambling file"), LOGINFO);
    m_descrambled.open();
    int result;
    result = iriver_decode(m_offile.toAscii().data(),
        m_descrambled.fileName().toAscii().data(), FALSE, STRIP_NONE);
    qDebug() << "[BootloaderInstallHex] iriver_decode" << result;

    if(result < 0) {
        emit logItem(tr("Error in descramble: %1").arg(scrambleError(result)), LOGERROR);
        return false;
    }

    // download firmware from server
    emit logItem(tr("Downloading bootloader file"), LOGINFO);
    connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));

    downloadBlStart(m_blurl);
    return true;
}
void CWizDownloadObjectData::onClientLogout()
{
    Q_EMIT downloadDone(true);
}