forked from len0rd/rockbox
rbutilqt: reworked and renamed the installrb class/files to generic installzip, so it can be used for things like Fonts.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14027 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
cebd767224
commit
092c178784
5 changed files with 36 additions and 27 deletions
|
@ -145,8 +145,13 @@ void Install::accept()
|
|||
}
|
||||
userSettings->sync();
|
||||
|
||||
installer = new RBInstaller(this);
|
||||
installer->install(file,fileName,mountPoint,proxy, &dp);
|
||||
installer = new ZipInstaller(this);
|
||||
installer->setFilename(fileName);
|
||||
installer->setUrl(file);
|
||||
installer->setProxy(proxy);
|
||||
installer->setLogSection("rockboxbase");
|
||||
installer->setMountPoint(mountPoint);
|
||||
installer->install(&dp);
|
||||
|
||||
connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool)));
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "ui_installfrm.h"
|
||||
#include "ui_installprogressfrm.h"
|
||||
#include "installrb.h"
|
||||
#include "installzip.h"
|
||||
|
||||
class Install : public QDialog
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ class Install : public QDialog
|
|||
QString fileName;
|
||||
QString mountPoint;
|
||||
QString archived;
|
||||
RBInstaller* installer;
|
||||
ZipInstaller* installer;
|
||||
|
||||
private slots:
|
||||
void setCached(bool);
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Riebeling
|
||||
* $Id: installrb.cpp 13990 2007-07-25 22:26:10Z Dominik Wenger $
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: installzip.cpp 13990 2007-07-25 22:26:10Z Dominik Wenger $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
|
@ -17,22 +17,19 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "installrb.h"
|
||||
#include "installzip.h"
|
||||
|
||||
#include "zip/zip.h"
|
||||
#include "zip/unzip.h"
|
||||
|
||||
RBInstaller::RBInstaller(QObject* parent): QObject(parent)
|
||||
ZipInstaller::ZipInstaller(QObject* parent): QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void RBInstaller::install(QString url,QString file,QString mountpoint, QUrl proxy,Ui::InstallProgressFrm* dp)
|
||||
void ZipInstaller::install(Ui::InstallProgressFrm* dp)
|
||||
{
|
||||
m_url=url;
|
||||
m_mountpoint = mountpoint;
|
||||
m_file = file;
|
||||
m_dp = dp;
|
||||
|
||||
m_dp->listProgress->addItem(tr("Downloading file %1.%2")
|
||||
|
@ -44,9 +41,9 @@ void RBInstaller::install(QString url,QString file,QString mountpoint, QUrl prox
|
|||
downloadFile.close();
|
||||
// get the real file.
|
||||
getter = new HttpGet(this);
|
||||
getter->setProxy(proxy);
|
||||
getter->setProxy(m_proxy);
|
||||
getter->setFile(&downloadFile);
|
||||
getter->getFile(QUrl(url));
|
||||
getter->getFile(QUrl(m_url));
|
||||
|
||||
connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
||||
connect(getter, SIGNAL(downloadDone(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
|
||||
|
@ -54,7 +51,7 @@ void RBInstaller::install(QString url,QString file,QString mountpoint, QUrl prox
|
|||
|
||||
}
|
||||
|
||||
void RBInstaller::downloadRequestFinished(int id, bool error)
|
||||
void ZipInstaller::downloadRequestFinished(int id, bool error)
|
||||
{
|
||||
qDebug() << "Install::downloadRequestFinished" << id << error;
|
||||
qDebug() << "error:" << getter->errorString();
|
||||
|
@ -62,12 +59,13 @@ void RBInstaller::downloadRequestFinished(int id, bool error)
|
|||
downloadDone(error);
|
||||
}
|
||||
|
||||
void RBInstaller::downloadDone(bool error)
|
||||
void ZipInstaller::downloadDone(bool error)
|
||||
{
|
||||
qDebug() << "Install::downloadDone, error:" << error;
|
||||
|
||||
|
||||
// update progress bar
|
||||
|
||||
int max = m_dp->progressBar->maximum();
|
||||
if(max == 0) {
|
||||
max = 100;
|
||||
|
@ -120,7 +118,7 @@ void RBInstaller::downloadDone(bool error)
|
|||
|
||||
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
|
||||
|
||||
installlog.beginGroup("rockboxbase");
|
||||
installlog.beginGroup(m_logsection);
|
||||
for(int i = 0; i < zipContents.size(); i++)
|
||||
{
|
||||
installlog.setValue(zipContents.at(i),installlog.value(zipContents.at(i),0).toInt()+1);
|
||||
|
@ -136,7 +134,7 @@ void RBInstaller::downloadDone(bool error)
|
|||
emit done(false);
|
||||
}
|
||||
|
||||
void RBInstaller::updateDataReadProgress(int read, int total)
|
||||
void ZipInstaller::updateDataReadProgress(int read, int total)
|
||||
{
|
||||
m_dp->progressBar->setMaximum(total);
|
||||
m_dp->progressBar->setValue(read);
|
|
@ -6,8 +6,8 @@
|
|||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Riebeling
|
||||
* $Id: installrb.h 13990 2007-07-25 22:26:10Z Dominik Wenger $
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: installzip.h 13990 2007-07-25 22:26:10Z Dominik Wenger $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
|
@ -29,13 +29,18 @@
|
|||
#include "ui_installprogressfrm.h"
|
||||
#include "httpget.h"
|
||||
|
||||
class RBInstaller : public QObject
|
||||
class ZipInstaller : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RBInstaller(QObject* parent) ;
|
||||
~RBInstaller(){}
|
||||
void install(QString url,QString filename,QString mountpoint, QUrl proxy,Ui::InstallProgressFrm* dp);
|
||||
ZipInstaller(QObject* parent) ;
|
||||
~ZipInstaller(){}
|
||||
void install(Ui::InstallProgressFrm* dp);
|
||||
void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
|
||||
void setFilename(QString filename){m_file = filename;}
|
||||
void setUrl(QString url){m_url = url;}
|
||||
void setProxy(QUrl proxy) {m_proxy= proxy;}
|
||||
void setLogSection(QString name) {m_logsection = name;}
|
||||
|
||||
signals:
|
||||
void done(bool error);
|
||||
|
@ -46,7 +51,8 @@ private slots:
|
|||
void downloadRequestFinished(int, bool);
|
||||
|
||||
private:
|
||||
QString m_url,m_file,m_mountpoint;
|
||||
QString m_url,m_file,m_mountpoint,m_logsection;
|
||||
QUrl m_proxy;
|
||||
|
||||
HttpGet *getter;
|
||||
QTemporaryFile downloadFile;
|
|
@ -5,7 +5,7 @@ SOURCES += rbutilqt.cpp \
|
|||
configure.cpp \
|
||||
zip/zip.cpp \
|
||||
zip/unzip.cpp \
|
||||
installrb.cpp
|
||||
installzip.cpp
|
||||
|
||||
HEADERS += rbutilqt.h \
|
||||
settings.h \
|
||||
|
@ -18,7 +18,7 @@ HEADERS += rbutilqt.h \
|
|||
zip/unzip_p.h \
|
||||
zip/zip_p.h \
|
||||
version.h \
|
||||
installrb.h
|
||||
installzip.h
|
||||
|
||||
TEMPLATE = app
|
||||
CONFIG += release \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue