00001 #include <QString> 00002 #include <QList> 00003 #include <QDebug> 00004 #include "updatermanifestthread.h" 00005 #include "manifestparser.h" 00006 00007 UpdaterManifestThread::UpdaterManifestThread() : UpdaterThread() 00008 { 00009 this->data = new ManifestData(); 00010 QObject::connect(&parser, SIGNAL(customError(int)), this, SLOT(parserError(int))); 00011 } 00012 00013 UpdaterManifestThread::~UpdaterManifestThread() 00014 { 00015 if(this->data != NULL) 00016 { 00017 delete this->data; 00018 } 00019 } 00020 00026 void UpdaterManifestThread::run() 00027 { 00028 QStringList downloadList; 00029 00030 qDebug() << "THREAD: run"; 00031 00032 downloadList.append("http://allevo.sourceforge.net/updates/manifest-proposal.xml"); 00033 UpdaterThread::setDownloadList(downloadList); 00034 UpdaterThread::run(); 00035 } 00036 00038 void UpdaterManifestThread::downloadFinishedAction() 00039 { 00040 qDebug() << "THREAD: Manifest downloaded... parsing!"; 00041 00042 if(! this->parser.parse(this->data, "manifest-proposal.xml")) 00043 { 00044 emit errorOccured(); 00045 } 00046 // TODO: delete the local file (atm leave it for debugging) 00047 } 00048 00050 void UpdaterManifestThread::parserError(int code) 00051 { 00052 // TODO: Display error to user?? 00053 qDebug() << "THREAD: Parser error!"; 00054 emit errorOccured(); 00055 }