dos2unix files and add a missing line in the header comment.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14014 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2007-07-26 21:16:42 +00:00
parent 992ffc83be
commit 31848ac8bd
2 changed files with 100 additions and 98 deletions

View file

@ -1,4 +1,6 @@
/*************************************************************************** /***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
@ -13,29 +15,29 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied. * KIND, either express or implied.
* *
****************************************************************************/ ****************************************************************************/
#include "installrb.h" #include "installrb.h"
#include "zip/zip.h" #include "zip/zip.h"
#include "zip/unzip.h" #include "zip/unzip.h"
RBInstaller::RBInstaller(QObject* parent): QObject(parent) RBInstaller::RBInstaller(QObject* parent): QObject(parent)
{ {
} }
void RBInstaller::install(QString url,QString file,QString mountpoint, QUrl proxy,Ui::InstallProgressFrm* dp) void RBInstaller::install(QString url,QString file,QString mountpoint, QUrl proxy,Ui::InstallProgressFrm* dp)
{ {
m_url=url; m_url=url;
m_mountpoint = mountpoint; m_mountpoint = mountpoint;
m_file = file; m_file = file;
m_dp = dp; m_dp = dp;
m_dp->listProgress->addItem(tr("Downloading file %1.%2") m_dp->listProgress->addItem(tr("Downloading file %1.%2")
.arg(QFileInfo(m_url).baseName(), QFileInfo(m_url).completeSuffix())); .arg(QFileInfo(m_url).baseName(), QFileInfo(m_url).completeSuffix()));
// temporary file needs to be opened to get the filename // temporary file needs to be opened to get the filename
downloadFile.open(); downloadFile.open();
m_file = downloadFile.fileName(); m_file = downloadFile.fileName();
@ -43,28 +45,28 @@ void RBInstaller::install(QString url,QString file,QString mountpoint, QUrl prox
// get the real file. // get the real file.
getter = new HttpGet(this); getter = new HttpGet(this);
getter->setProxy(proxy); getter->setProxy(proxy);
getter->setFile(&downloadFile); getter->setFile(&downloadFile);
getter->getFile(QUrl(url)); getter->getFile(QUrl(url));
connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
connect(getter, SIGNAL(downloadDone(int, bool)), this, SLOT(downloadRequestFinished(int, bool))); connect(getter, SIGNAL(downloadDone(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
} }
void RBInstaller::downloadRequestFinished(int id, bool error) void RBInstaller::downloadRequestFinished(int id, bool error)
{ {
qDebug() << "Install::downloadRequestFinished" << id << error; qDebug() << "Install::downloadRequestFinished" << id << error;
qDebug() << "error:" << getter->errorString(); qDebug() << "error:" << getter->errorString();
downloadDone(error); downloadDone(error);
} }
void RBInstaller::downloadDone(bool error) void RBInstaller::downloadDone(bool error)
{ {
qDebug() << "Install::downloadDone, error:" << error; qDebug() << "Install::downloadDone, error:" << error;
// update progress bar // update progress bar
int max = m_dp->progressBar->maximum(); int max = m_dp->progressBar->maximum();
if(max == 0) { if(max == 0) {
@ -84,13 +86,13 @@ void RBInstaller::downloadDone(bool error)
emit done(true); emit done(true);
return; return;
} }
else m_dp->listProgress->addItem(tr("Download finished.")); else m_dp->listProgress->addItem(tr("Download finished."));
// unzip downloaded file // unzip downloaded file
qDebug() << "about to unzip the downloaded file" << m_file << "to" << m_mountpoint; qDebug() << "about to unzip the downloaded file" << m_file << "to" << m_mountpoint;
m_dp->listProgress->addItem(tr("Extracting file.")); m_dp->listProgress->addItem(tr("Extracting file."));
qDebug() << "file to unzip: " << m_file; qDebug() << "file to unzip: " << m_file;
UnZip::ErrorCode ec; UnZip::ErrorCode ec;
UnZip uz; UnZip uz;
@ -101,8 +103,8 @@ void RBInstaller::downloadDone(bool error)
m_dp->buttonAbort->setText(tr("&Ok")); m_dp->buttonAbort->setText(tr("&Ok"));
emit done(false); emit done(false);
return; return;
} }
ec = uz.extractAll(m_mountpoint); ec = uz.extractAll(m_mountpoint);
if(ec != UnZip::Ok) { if(ec != UnZip::Ok) {
m_dp->listProgress->addItem(tr("Extracting failed: %1.") m_dp->listProgress->addItem(tr("Extracting failed: %1.")
@ -112,8 +114,8 @@ void RBInstaller::downloadDone(bool error)
return; return;
} }
m_dp->listProgress->addItem(tr("creating installation log")); m_dp->listProgress->addItem(tr("creating installation log"));
QStringList zipContents = uz.fileList(); QStringList zipContents = uz.fileList();
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0); QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
@ -129,16 +131,16 @@ void RBInstaller::downloadDone(bool error)
downloadFile.remove(); downloadFile.remove();
m_dp->listProgress->addItem(tr("Extraction finished successfully.")); m_dp->listProgress->addItem(tr("Extraction finished successfully."));
m_dp->buttonAbort->setText(tr("&Ok")); m_dp->buttonAbort->setText(tr("&Ok"));
emit done(false); emit done(false);
} }
void RBInstaller::updateDataReadProgress(int read, int total) void RBInstaller::updateDataReadProgress(int read, int total)
{ {
m_dp->progressBar->setMaximum(total); m_dp->progressBar->setMaximum(total);
m_dp->progressBar->setValue(read); m_dp->progressBar->setValue(read);
qDebug() << "progress:" << read << "/" << total; qDebug() << "progress:" << read << "/" << total;
} }

View file

@ -15,46 +15,46 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied. * KIND, either express or implied.
* *
****************************************************************************/ ****************************************************************************/
#ifndef INSTALLRB_H #ifndef INSTALLRB_H
#define INSTALLRB_H #define INSTALLRB_H
#include <QtGui> #include <QtGui>
#include <QtNetwork> #include <QtNetwork>
#include "ui_installprogressfrm.h" #include "ui_installprogressfrm.h"
#include "httpget.h" #include "httpget.h"
class RBInstaller : public QObject class RBInstaller : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
RBInstaller(QObject* parent) ; RBInstaller(QObject* parent) ;
~RBInstaller(){} ~RBInstaller(){}
void install(QString url,QString filename,QString mountpoint, QUrl proxy,Ui::InstallProgressFrm* dp); void install(QString url,QString filename,QString mountpoint, QUrl proxy,Ui::InstallProgressFrm* dp);
signals: signals:
void done(bool error); void done(bool error);
private slots: private slots:
void updateDataReadProgress(int, int); void updateDataReadProgress(int, int);
void downloadDone(bool); void downloadDone(bool);
void downloadRequestFinished(int, bool); void downloadRequestFinished(int, bool);
private: private:
QString m_url,m_file,m_mountpoint; QString m_url,m_file,m_mountpoint;
HttpGet *getter; HttpGet *getter;
QTemporaryFile downloadFile; QTemporaryFile downloadFile;
Ui::InstallProgressFrm* m_dp; Ui::InstallProgressFrm* m_dp;
}; };
#endif #endif