void DroneshareUploadDialog::startLogUpload(const QString& vehicleUuid) { m_droneshareUpload = new DroneshareUpload(); m_droneshareUpload->uploadLog(m_filename, m_username, m_password, vehicleUuid, DroneshareAPIKey); connect(m_droneshareUpload, SIGNAL(uploadComplete(QString)), this, SLOT(uploadComplete(QString))); connect(m_droneshareUpload, SIGNAL(uploadFailed(QString,QString)), this, SLOT(uploadFailed(QString,QString))); connect(m_droneshareUpload, SIGNAL(uploadProgress(int,int)), this, SLOT(uploadProgress(int,int))); ui->statusLabel->setText(tr("Uploading\n%1").arg(m_filename)); }
bool atWrapper::diff( QString basedir, QString dir, QString target ) { //Comparing the two specified files, and then uploading them to //the ftp server if they differ basedir += "/" + dir; QString one = basedir + ".baseline/" + target; QString two = basedir + "/" + target; QFile file( one ); file.open( QIODevice::ReadOnly ); QByteArray contentsOfOne = file.readAll(); file.close(); file.setFileName( two ); file.open( QIODevice::ReadOnly ); QByteArray contentsOfTwo = file.readAll(); file.close(); if ( contentsOfTwo.size() == 0 ) { qDebug() << "No test result found for baseline: " << one; file.setFileName( one ); file.open( QIODevice::ReadOnly ); file.copy( basedir + ".failed/" + target + "_missing" ); uploadFailed( dir + ".failed", target + "_missing", contentsOfTwo ); return false; } if ( ( memcmp( contentsOfOne, contentsOfTwo, contentsOfOne.size() ) ) == 0 ) return true; else { qDebug() << "Sorry, the result did not match: " << one; file.setFileName( two ); file.open( QIODevice::ReadOnly ); file.copy( basedir + ".failed/" + target ); file.close(); uploadFailed( dir + ".failed", target, contentsOfTwo ); uploadDiff( basedir, dir, target ); return false; } }
void atWrapper::uploadDiff( QString basedir, QString dir, QString filename ) { qDebug() << basedir; QImage im1( basedir + ".baseline/" + filename ); QImage im2( basedir + "/" + filename ); QImage im3(im1.size(), QImage::Format_ARGB32); im1 = im1.convertToFormat(QImage::Format_ARGB32); im2 = im2.convertToFormat(QImage::Format_ARGB32); for ( int y=0; y<im1.height(); ++y ) { uint *s = (uint *) im1.scanLine(y); uint *d = (uint *) im2.scanLine(y); uint *w = (uint *) im3.scanLine(y); for ( int x=0; x<im1.width(); ++x ) { if (*s != *d) *w = 0xff000000; else *w = 0xffffffff; w++; s++; d++; } } im3.save( basedir + ".diff/" + filename ,"PNG"); QFile file( basedir + ".diff/" + filename ); file.open( QIODevice::ReadOnly ); QByteArray contents = file.readAll(); file.close(); uploadFailed( dir + ".diff", filename, contents ); }