summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2007-07-27 17:42:49 +0000
committerDominik Wenger <domonoky@googlemail.com>2007-07-27 17:42:49 +0000
commit092c178784ca5ebf13feaf4a2d63f46e19dc1c37 (patch)
treeac7c8062d86dc1a49bc89bbd90efee03a7ace130
parentcebd767224b79a897256ba0564e586830f18b6fb (diff)
downloadrockbox-092c178784ca5ebf13feaf4a2d63f46e19dc1c37.tar.gz
rockbox-092c178784ca5ebf13feaf4a2d63f46e19dc1c37.zip
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
-rw-r--r--rbutil/rbutilqt/install.cpp9
-rw-r--r--rbutil/rbutilqt/install.h4
-rw-r--r--rbutil/rbutilqt/installzip.cpp (renamed from rbutil/rbutilqt/installrb.cpp)26
-rw-r--r--rbutil/rbutilqt/installzip.h (renamed from rbutil/rbutilqt/installrb.h)20
-rw-r--r--rbutil/rbutilqt/rbutilqt.pro4
5 files changed, 36 insertions, 27 deletions
diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp
index ee1b21c8e6..948cf2005a 100644
--- a/rbutil/rbutilqt/install.cpp
+++ b/rbutil/rbutilqt/install.cpp
@@ -145,8 +145,13 @@ void Install::accept()
145 } 145 }
146 userSettings->sync(); 146 userSettings->sync();
147 147
148 installer = new RBInstaller(this); 148 installer = new ZipInstaller(this);
149 installer->install(file,fileName,mountPoint,proxy, &dp); 149 installer->setFilename(fileName);
150 installer->setUrl(file);
151 installer->setProxy(proxy);
152 installer->setLogSection("rockboxbase");
153 installer->setMountPoint(mountPoint);
154 installer->install(&dp);
150 155
151 connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool))); 156 connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool)));
152 157
diff --git a/rbutil/rbutilqt/install.h b/rbutil/rbutilqt/install.h
index d453378c30..79dcf0cee7 100644
--- a/rbutil/rbutilqt/install.h
+++ b/rbutil/rbutilqt/install.h
@@ -26,7 +26,7 @@
26 26
27#include "ui_installfrm.h" 27#include "ui_installfrm.h"
28#include "ui_installprogressfrm.h" 28#include "ui_installprogressfrm.h"
29#include "installrb.h" 29#include "installzip.h"
30 30
31class Install : public QDialog 31class Install : public QDialog
32{ 32{
@@ -58,7 +58,7 @@ class Install : public QDialog
58 QString fileName; 58 QString fileName;
59 QString mountPoint; 59 QString mountPoint;
60 QString archived; 60 QString archived;
61 RBInstaller* installer; 61 ZipInstaller* installer;
62 62
63 private slots: 63 private slots:
64 void setCached(bool); 64 void setCached(bool);
diff --git a/rbutil/rbutilqt/installrb.cpp b/rbutil/rbutilqt/installzip.cpp
index 8fa977f524..82e9486d06 100644
--- a/rbutil/rbutilqt/installrb.cpp
+++ b/rbutil/rbutilqt/installzip.cpp
@@ -6,8 +6,8 @@
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * 8 *
9 * Copyright (C) 2007 by Dominik Riebeling 9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: installrb.cpp 13990 2007-07-25 22:26:10Z Dominik Wenger $ 10 * $Id: installzip.cpp 13990 2007-07-25 22:26:10Z Dominik Wenger $
11 * 11 *
12 * All files in this archive are subject to the GNU General Public License. 12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement. 13 * See the file COPYING in the source tree root for full license agreement.
@@ -17,22 +17,19 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include "installrb.h" 20#include "installzip.h"
21 21
22#include "zip/zip.h" 22#include "zip/zip.h"
23#include "zip/unzip.h" 23#include "zip/unzip.h"
24 24
25RBInstaller::RBInstaller(QObject* parent): QObject(parent) 25ZipInstaller::ZipInstaller(QObject* parent): QObject(parent)
26{ 26{
27 27
28} 28}
29 29
30 30
31void RBInstaller::install(QString url,QString file,QString mountpoint, QUrl proxy,Ui::InstallProgressFrm* dp) 31void ZipInstaller::install(Ui::InstallProgressFrm* dp)
32{ 32{
33 m_url=url;
34 m_mountpoint = mountpoint;
35 m_file = file;
36 m_dp = dp; 33 m_dp = dp;
37 34
38 m_dp->listProgress->addItem(tr("Downloading file %1.%2") 35 m_dp->listProgress->addItem(tr("Downloading file %1.%2")
@@ -44,9 +41,9 @@ void RBInstaller::install(QString url,QString file,QString mountpoint, QUrl prox
44 downloadFile.close(); 41 downloadFile.close();
45 // get the real file. 42 // get the real file.
46 getter = new HttpGet(this); 43 getter = new HttpGet(this);
47 getter->setProxy(proxy); 44 getter->setProxy(m_proxy);
48 getter->setFile(&downloadFile); 45 getter->setFile(&downloadFile);
49 getter->getFile(QUrl(url)); 46 getter->getFile(QUrl(m_url));
50 47
51 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 48 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
52 connect(getter, SIGNAL(downloadDone(int, bool)), this, SLOT(downloadRequestFinished(int, bool))); 49 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
54 51
55} 52}
56 53
57void RBInstaller::downloadRequestFinished(int id, bool error) 54void ZipInstaller::downloadRequestFinished(int id, bool error)
58{ 55{
59 qDebug() << "Install::downloadRequestFinished" << id << error; 56 qDebug() << "Install::downloadRequestFinished" << id << error;
60 qDebug() << "error:" << getter->errorString(); 57 qDebug() << "error:" << getter->errorString();
@@ -62,12 +59,13 @@ void RBInstaller::downloadRequestFinished(int id, bool error)
62 downloadDone(error); 59 downloadDone(error);
63} 60}
64 61
65void RBInstaller::downloadDone(bool error) 62void ZipInstaller::downloadDone(bool error)
66{ 63{
67 qDebug() << "Install::downloadDone, error:" << error; 64 qDebug() << "Install::downloadDone, error:" << error;
68 65
69 66
70 // update progress bar 67 // update progress bar
68
71 int max = m_dp->progressBar->maximum(); 69 int max = m_dp->progressBar->maximum();
72 if(max == 0) { 70 if(max == 0) {
73 max = 100; 71 max = 100;
@@ -120,7 +118,7 @@ void RBInstaller::downloadDone(bool error)
120 118
121 QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0); 119 QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
122 120
123 installlog.beginGroup("rockboxbase"); 121 installlog.beginGroup(m_logsection);
124 for(int i = 0; i < zipContents.size(); i++) 122 for(int i = 0; i < zipContents.size(); i++)
125 { 123 {
126 installlog.setValue(zipContents.at(i),installlog.value(zipContents.at(i),0).toInt()+1); 124 installlog.setValue(zipContents.at(i),installlog.value(zipContents.at(i),0).toInt()+1);
@@ -136,7 +134,7 @@ void RBInstaller::downloadDone(bool error)
136 emit done(false); 134 emit done(false);
137} 135}
138 136
139void RBInstaller::updateDataReadProgress(int read, int total) 137void ZipInstaller::updateDataReadProgress(int read, int total)
140{ 138{
141 m_dp->progressBar->setMaximum(total); 139 m_dp->progressBar->setMaximum(total);
142 m_dp->progressBar->setValue(read); 140 m_dp->progressBar->setValue(read);
diff --git a/rbutil/rbutilqt/installrb.h b/rbutil/rbutilqt/installzip.h
index c940fd8731..e3f3b5ad35 100644
--- a/rbutil/rbutilqt/installrb.h
+++ b/rbutil/rbutilqt/installzip.h
@@ -6,8 +6,8 @@
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * 8 *
9 * Copyright (C) 2007 by Dominik Riebeling 9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: installrb.h 13990 2007-07-25 22:26:10Z Dominik Wenger $ 10 * $Id: installzip.h 13990 2007-07-25 22:26:10Z Dominik Wenger $
11 * 11 *
12 * All files in this archive are subject to the GNU General Public License. 12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement. 13 * See the file COPYING in the source tree root for full license agreement.
@@ -29,13 +29,18 @@
29#include "ui_installprogressfrm.h" 29#include "ui_installprogressfrm.h"
30#include "httpget.h" 30#include "httpget.h"
31 31
32class RBInstaller : public QObject 32class ZipInstaller : public QObject
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35public: 35public:
36 RBInstaller(QObject* parent) ; 36 ZipInstaller(QObject* parent) ;
37 ~RBInstaller(){} 37 ~ZipInstaller(){}
38 void install(QString url,QString filename,QString mountpoint, QUrl proxy,Ui::InstallProgressFrm* dp); 38 void install(Ui::InstallProgressFrm* dp);
39 void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
40 void setFilename(QString filename){m_file = filename;}
41 void setUrl(QString url){m_url = url;}
42 void setProxy(QUrl proxy) {m_proxy= proxy;}
43 void setLogSection(QString name) {m_logsection = name;}
39 44
40signals: 45signals:
41 void done(bool error); 46 void done(bool error);
@@ -46,7 +51,8 @@ private slots:
46 void downloadRequestFinished(int, bool); 51 void downloadRequestFinished(int, bool);
47 52
48private: 53private:
49 QString m_url,m_file,m_mountpoint; 54 QString m_url,m_file,m_mountpoint,m_logsection;
55 QUrl m_proxy;
50 56
51 HttpGet *getter; 57 HttpGet *getter;
52 QTemporaryFile downloadFile; 58 QTemporaryFile downloadFile;
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro
index 1676ee422d..1491ab9d69 100644
--- a/rbutil/rbutilqt/rbutilqt.pro
+++ b/rbutil/rbutilqt/rbutilqt.pro
@@ -5,7 +5,7 @@ SOURCES += rbutilqt.cpp \
5 configure.cpp \ 5 configure.cpp \
6 zip/zip.cpp \ 6 zip/zip.cpp \
7 zip/unzip.cpp \ 7 zip/unzip.cpp \
8 installrb.cpp 8 installzip.cpp
9 9
10HEADERS += rbutilqt.h \ 10HEADERS += rbutilqt.h \
11 settings.h \ 11 settings.h \
@@ -18,7 +18,7 @@ HEADERS += rbutilqt.h \
18 zip/unzip_p.h \ 18 zip/unzip_p.h \
19 zip/zip_p.h \ 19 zip/zip_p.h \
20 version.h \ 20 version.h \
21 installrb.h 21 installzip.h
22 22
23TEMPLATE = app 23TEMPLATE = app
24CONFIG += release \ 24CONFIG += release \