summaryrefslogtreecommitdiff
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2013-03-09 19:37:40 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2013-03-09 19:38:08 +0100
commitaf58d04e35ba004968cb7a9caa75bfa86ecd5c65 (patch)
treedaf08e48468282b89d38b419b7b77303cf98e740 /rbutil
parente50066718c98308ff11f086e71d2546f850cf94a (diff)
downloadrockbox-af58d04e35ba004968cb7a9caa75bfa86ecd5c65.tar.gz
rockbox-af58d04e35ba004968cb7a9caa75bfa86ecd5c65.zip
ZipInstaller: rename some member variables to be in line with the rest.
Also change the double inclusion protection to match the filename. Change-Id: I5bb64afdb62c87057867f9f9d683f0df239d2efc
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/base/zipinstaller.cpp40
-rw-r--r--rbutil/rbutilqt/base/zipinstaller.h10
2 files changed, 24 insertions, 26 deletions
diff --git a/rbutil/rbutilqt/base/zipinstaller.cpp b/rbutil/rbutilqt/base/zipinstaller.cpp
index 39a41564c9..e24199408e 100644
--- a/rbutil/rbutilqt/base/zipinstaller.cpp
+++ b/rbutil/rbutilqt/base/zipinstaller.cpp
@@ -25,7 +25,7 @@ ZipInstaller::ZipInstaller(QObject* parent): QObject(parent)
25{ 25{
26 m_unzip = true; 26 m_unzip = true;
27 m_usecache = false; 27 m_usecache = false;
28 getter = 0; 28 m_getter = 0;
29} 29}
30 30
31 31
@@ -83,23 +83,23 @@ void ZipInstaller::installStart()
83 // make sure to get a fresh one on each run. 83 // make sure to get a fresh one on each run.
84 // making this a parent of the temporary file ensures the file gets deleted 84 // making this a parent of the temporary file ensures the file gets deleted
85 // after the class object gets destroyed. 85 // after the class object gets destroyed.
86 downloadFile = new QTemporaryFile(this); 86 m_downloadFile = new QTemporaryFile(this);
87 downloadFile->open(); 87 m_downloadFile->open();
88 m_file = downloadFile->fileName(); 88 m_file = m_downloadFile->fileName();
89 downloadFile->close(); 89 m_downloadFile->close();
90 // get the real file. 90 // get the real file.
91 if(getter != 0) getter->deleteLater(); 91 if(m_getter != 0) m_getter->deleteLater();
92 getter = new HttpGet(this); 92 m_getter = new HttpGet(this);
93 if(m_usecache) { 93 if(m_usecache) {
94 getter->setCache(true); 94 m_getter->setCache(true);
95 } 95 }
96 getter->setFile(downloadFile); 96 m_getter->setFile(m_downloadFile);
97 97
98 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 98 connect(m_getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
99 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SIGNAL(logProgress(int, int))); 99 connect(m_getter, SIGNAL(dataReadProgress(int, int)), this, SIGNAL(logProgress(int, int)));
100 connect(this, SIGNAL(internalAborted()), getter, SLOT(abort())); 100 connect(this, SIGNAL(internalAborted()), m_getter, SLOT(abort()));
101 101
102 getter->getFile(QUrl(m_url)); 102 m_getter->getFile(QUrl(m_url));
103} 103}
104 104
105 105
@@ -110,16 +110,16 @@ void ZipInstaller::downloadDone(bool error)
110 // update progress bar 110 // update progress bar
111 111
112 emit logProgress(1, 1); 112 emit logProgress(1, 1);
113 if(getter->httpResponse() != 200 && !getter->isCached()) { 113 if(m_getter->httpResponse() != 200 && !m_getter->isCached()) {
114 emit logItem(tr("Download error: received HTTP error %1.") 114 emit logItem(tr("Download error: received HTTP error %1.")
115 .arg(getter->httpResponse()),LOGERROR); 115 .arg(m_getter->httpResponse()),LOGERROR);
116 emit done(true); 116 emit done(true);
117 return; 117 return;
118 } 118 }
119 if(getter->isCached()) 119 if(m_getter->isCached())
120 emit logItem(tr("Cached file used."), LOGINFO); 120 emit logItem(tr("Cached file used."), LOGINFO);
121 if(error) { 121 if(error) {
122 emit logItem(tr("Download error: %1").arg(getter->errorString()), LOGERROR); 122 emit logItem(tr("Download error: %1").arg(m_getter->errorString()), LOGERROR);
123 emit done(true); 123 emit done(true);
124 return; 124 return;
125 } 125 }
@@ -161,14 +161,14 @@ void ZipInstaller::downloadDone(bool error)
161 emit logItem(tr("Installing file."), LOGINFO); 161 emit logItem(tr("Installing file."), LOGINFO);
162 qDebug() << "[ZipInstall] saving downloaded file (no extraction)"; 162 qDebug() << "[ZipInstall] saving downloaded file (no extraction)";
163 163
164 downloadFile->open(); // copy fails if file is not opened (filename issue?) 164 m_downloadFile->open(); // copy fails if file is not opened (filename issue?)
165 // make sure the required path is existing 165 // make sure the required path is existing
166 QString path = QFileInfo(m_mountpoint + m_target).absolutePath(); 166 QString path = QFileInfo(m_mountpoint + m_target).absolutePath();
167 QDir p; 167 QDir p;
168 p.mkpath(path); 168 p.mkpath(path);
169 // QFile::copy() doesn't overwrite files, so remove old one first 169 // QFile::copy() doesn't overwrite files, so remove old one first
170 QFile(m_mountpoint + m_target).remove(); 170 QFile(m_mountpoint + m_target).remove();
171 if(!downloadFile->copy(m_mountpoint + m_target)) { 171 if(!m_downloadFile->copy(m_mountpoint + m_target)) {
172 emit logItem(tr("Installing file failed."), LOGERROR); 172 emit logItem(tr("Installing file failed."), LOGERROR);
173 emit done(true); 173 emit done(true);
174 return; 174 return;
@@ -179,7 +179,7 @@ void ZipInstaller::downloadDone(bool error)
179 } 179 }
180 if(m_logver.isEmpty()) { 180 if(m_logver.isEmpty()) {
181 // if no version info is set use the timestamp of the server file. 181 // if no version info is set use the timestamp of the server file.
182 m_logver = getter->timestamp().toString(Qt::ISODate); 182 m_logver = m_getter->timestamp().toString(Qt::ISODate);
183 } 183 }
184 184
185 emit logItem(tr("Creating installation log"),LOGINFO); 185 emit logItem(tr("Creating installation log"),LOGINFO);
diff --git a/rbutil/rbutilqt/base/zipinstaller.h b/rbutil/rbutilqt/base/zipinstaller.h
index e15bbcf783..4ea08fbe53 100644
--- a/rbutil/rbutilqt/base/zipinstaller.h
+++ b/rbutil/rbutilqt/base/zipinstaller.h
@@ -19,10 +19,8 @@
19 ****************************************************************************/ 19 ****************************************************************************/
20 20
21 21
22#ifndef INSTALLZIP_H 22#ifndef ZIPINSTALLER_H
23#define INSTALLZIP_H 23#define ZIPINSTALLER_H
24
25
26 24
27#include <QtCore> 25#include <QtCore>
28 26
@@ -75,8 +73,8 @@ private:
75 QDir m_cache; 73 QDir m_cache;
76 bool m_usecache; 74 bool m_usecache;
77 75
78 HttpGet *getter; 76 HttpGet *m_getter;
79 QTemporaryFile *downloadFile; 77 QTemporaryFile *m_downloadFile;
80}; 78};
81 79
82 80