summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2008-03-05 21:12:24 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2008-03-05 21:12:24 +0000
commit5a75184c4abfd2c8fa2a3ee705b94fc800d7b918 (patch)
treedcbb9529aafc259fd8922b471c8ff537bb48a8fe
parent0def1dd23cf1990536122d35ed040173ddaa06ba (diff)
downloadrockbox-5a75184c4abfd2c8fa2a3ee705b94fc800d7b918.tar.gz
rockbox-5a75184c4abfd2c8fa2a3ee705b94fc800d7b918.zip
add global proxy / cache settings to httpget class. This removes the need of passing proxy / cache values around all the time. Each object can still override the global values.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16530 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/rbutilqt/httpget.cpp29
-rw-r--r--rbutil/rbutilqt/httpget.h12
-rw-r--r--rbutil/rbutilqt/install.cpp8
-rw-r--r--rbutil/rbutilqt/install.h2
-rw-r--r--rbutil/rbutilqt/installbootloader.cpp9
-rw-r--r--rbutil/rbutilqt/installbootloader.h2
-rw-r--r--rbutil/rbutilqt/installthemes.cpp16
-rw-r--r--rbutil/rbutilqt/installthemes.h2
-rw-r--r--rbutil/rbutilqt/installzip.cpp8
-rw-r--r--rbutil/rbutilqt/installzip.h4
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp40
-rw-r--r--rbutil/rbutilqt/utils.cpp2
-rw-r--r--rbutil/rbutilqt/voicefile.cpp1
-rw-r--r--rbutil/rbutilqt/voicefile.h2
14 files changed, 63 insertions, 74 deletions
diff --git a/rbutil/rbutilqt/httpget.cpp b/rbutil/rbutilqt/httpget.cpp
index acd8940b77..a45769c246 100644
--- a/rbutil/rbutilqt/httpget.cpp
+++ b/rbutil/rbutilqt/httpget.cpp
@@ -23,6 +23,8 @@
23 23
24#include "httpget.h" 24#include "httpget.h"
25 25
26QDir HttpGet::m_globalCache;
27QUrl HttpGet::m_globalProxy;
26 28
27HttpGet::HttpGet(QObject *parent) 29HttpGet::HttpGet(QObject *parent)
28 : QObject(parent) 30 : QObject(parent)
@@ -36,6 +38,14 @@ HttpGet::HttpGet(QObject *parent)
36 // hint about this in the http response instead of nonsense. 38 // hint about this in the http response instead of nonsense.
37 response = -1; 39 response = -1;
38 40
41 // default to global proxy / cache if not empty.
42 // proxy is automatically enabled, disable it by setting an empty proxy
43 // cache is enabled to be in line, can get disabled with setCache(bool)
44 qDebug() << "setting global proxy / cache";
45 if(!m_globalProxy.isEmpty())
46 setProxy(m_globalProxy);
47 m_usecache = false;
48 m_cachedir = m_globalCache;
39 connect(&http, SIGNAL(done(bool)), this, SLOT(httpDone(bool))); 49 connect(&http, SIGNAL(done(bool)), this, SLOT(httpDone(bool)));
40 connect(&http, SIGNAL(dataReadProgress(int, int)), this, SLOT(httpProgress(int, int))); 50 connect(&http, SIGNAL(dataReadProgress(int, int)), this, SLOT(httpProgress(int, int)));
41 connect(&http, SIGNAL(requestFinished(int, bool)), this, SLOT(httpFinished(int, bool))); 51 connect(&http, SIGNAL(requestFinished(int, bool)), this, SLOT(httpFinished(int, bool)));
@@ -60,13 +70,14 @@ void HttpGet::setCache(QDir d)
60 result = m_cachedir.mkdir("rbutil-cache"); 70 result = m_cachedir.mkdir("rbutil-cache");
61 } 71 }
62 else result = false; 72 else result = false;
63 qDebug() << "HttpGet::setCache(QDir)" << result; 73 qDebug() << "HttpGet::setCache(QDir)" << d << result;
64 m_usecache = result; 74 m_usecache = result;
65} 75}
66 76
67 77
68void HttpGet::setCache(bool c) 78void HttpGet::setCache(bool c)
69{ 79{
80 qDebug() << "setCache(bool)" << c;
70 m_usecache = c; 81 m_usecache = c;
71} 82}
72 83
@@ -91,8 +102,19 @@ void HttpGet::httpProgress(int read, int total)
91 102
92void HttpGet::setProxy(const QUrl &proxy) 103void HttpGet::setProxy(const QUrl &proxy)
93{ 104{
94 qDebug() << "HttpGet::setProxy" << proxy.toString(); 105 qDebug() << "HttpGet::setProxy(QUrl)" << proxy.toString();
95 http.setProxy(proxy.host(), proxy.port(), proxy.userName(), proxy.password()); 106 m_proxy = proxy;
107 http.setProxy(m_proxy.host(), m_proxy.port(), m_proxy.userName(), m_proxy.password());
108}
109
110
111void HttpGet::setProxy(bool enable)
112{
113 qDebug() << "HttpGet::setProxy(bool)" << enable;
114 if(enable)
115 http.setProxy(m_proxy.host(), m_proxy.port(), m_proxy.userName(), m_proxy.password());
116 else
117 http.setProxy("", 0);
96} 118}
97 119
98 120
@@ -171,6 +193,7 @@ bool HttpGet::getFile(const QUrl &url)
171 else { 193 else {
172 qDebug() << "[HTTP] cache DISABLED"; 194 qDebug() << "[HTTP] cache DISABLED";
173 } 195 }
196
174 http.setHost(url.host(), url.port(80)); 197 http.setHost(url.host(), url.port(80));
175 // construct query (if any) 198 // construct query (if any)
176 QList<QPair<QString, QString> > qitems = url.queryItems(); 199 QList<QPair<QString, QString> > qitems = url.queryItems();
diff --git a/rbutil/rbutilqt/httpget.h b/rbutil/rbutilqt/httpget.h
index 4a3d811e05..79522f6e8f 100644
--- a/rbutil/rbutilqt/httpget.h
+++ b/rbutil/rbutilqt/httpget.h
@@ -35,6 +35,7 @@ class HttpGet : public QObject
35 35
36 bool getFile(const QUrl &url); 36 bool getFile(const QUrl &url);
37 void setProxy(const QUrl &url); 37 void setProxy(const QUrl &url);
38 void setProxy(bool);
38 QHttp::Error error(void); 39 QHttp::Error error(void);
39 QString errorString(void); 40 QString errorString(void);
40 void setFile(QFile*); 41 void setFile(QFile*);
@@ -43,6 +44,10 @@ class HttpGet : public QObject
43 int httpResponse(void); 44 int httpResponse(void);
44 QByteArray readAll(void); 45 QByteArray readAll(void);
45 bool isCached() { return cached; } 46 bool isCached() { return cached; }
47 static void setGlobalCache(const QDir d) //< set global cache path
48 { m_globalCache = d; }
49 static void setGlobalProxy(const QUrl p) //< set global proxy value
50 { m_globalProxy = p; }
46 51
47 public slots: 52 public slots:
48 void abort(void); 53 void abort(void);
@@ -61,9 +66,9 @@ class HttpGet : public QObject
61 void httpStarted(int); 66 void httpStarted(int);
62 67
63 private: 68 private:
64 QHttp http; 69 QHttp http; //< download object
65 QFile *outputFile; 70 QFile *outputFile;
66 int response; 71 int response; //< http response
67 int getRequest; 72 int getRequest;
68 QByteArray dataBuffer; 73 QByteArray dataBuffer;
69 bool outputToBuffer; 74 bool outputToBuffer;
@@ -72,6 +77,9 @@ class HttpGet : public QObject
72 QDir m_cachedir; 77 QDir m_cachedir;
73 QString cachefile; 78 QString cachefile;
74 bool cached; 79 bool cached;
80 QUrl m_proxy;
81 static QDir m_globalCache; //< global cache path value
82 static QUrl m_globalProxy; //< global proxy value
75}; 83};
76 84
77#endif 85#endif
diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp
index 1d265404ea..bd59172870 100644
--- a/rbutil/rbutilqt/install.cpp
+++ b/rbutil/rbutilqt/install.cpp
@@ -37,13 +37,6 @@ void Install::setCached(bool cache)
37} 37}
38 38
39 39
40void Install::setProxy(QUrl proxy_url)
41{
42 proxy = proxy_url;
43 qDebug() << "Install::setProxy" << proxy;
44}
45
46
47void Install::accept() 40void Install::accept()
48{ 41{
49 logger = new ProgressLoggerGui(this); 42 logger = new ProgressLoggerGui(this);
@@ -92,7 +85,6 @@ void Install::accept()
92 85
93 installer = new ZipInstaller(this); 86 installer = new ZipInstaller(this);
94 installer->setUrl(file); 87 installer->setUrl(file);
95 installer->setProxy(proxy);
96 installer->setLogSection("Rockbox (Base)"); 88 installer->setLogSection("Rockbox (Base)");
97 if(!settings->cacheDisabled() 89 if(!settings->cacheDisabled()
98 && !ui.radioCurrent->isChecked() 90 && !ui.radioCurrent->isChecked()
diff --git a/rbutil/rbutilqt/install.h b/rbutil/rbutilqt/install.h
index 4d102a0e65..db4c06ced4 100644
--- a/rbutil/rbutilqt/install.h
+++ b/rbutil/rbutilqt/install.h
@@ -32,7 +32,6 @@ class Install : public QDialog
32 Q_OBJECT 32 Q_OBJECT
33 public: 33 public:
34 Install(QWidget *parent = 0); 34 Install(QWidget *parent = 0);
35 void setProxy(QUrl);
36 void setSettings(RbSettings* sett); 35 void setSettings(RbSettings* sett);
37 void setVersionStrings(QMap<QString, QString>); 36 void setVersionStrings(QMap<QString, QString>);
38 37
@@ -42,7 +41,6 @@ class Install : public QDialog
42 private: 41 private:
43 Ui::InstallFrm ui; 42 Ui::InstallFrm ui;
44 ProgressLoggerGui* logger; 43 ProgressLoggerGui* logger;
45 QUrl proxy;
46 RbSettings* settings; 44 RbSettings* settings;
47 QHttp *download; 45 QHttp *download;
48 QFile *target; 46 QFile *target;
diff --git a/rbutil/rbutilqt/installbootloader.cpp b/rbutil/rbutilqt/installbootloader.cpp
index 4b78ee484b..3c6ca82c1b 100644
--- a/rbutil/rbutilqt/installbootloader.cpp
+++ b/rbutil/rbutilqt/installbootloader.cpp
@@ -203,8 +203,6 @@ bool BootloaderInstaller::downloadInfo()
203 connect(infodownloader, SIGNAL(done(bool)), this, SLOT(infoDownloadDone(bool))); 203 connect(infodownloader, SIGNAL(done(bool)), this, SLOT(infoDownloadDone(bool)));
204 connect(infodownloader, SIGNAL(requestFinished(int, bool)), this, SLOT(infoRequestFinished(int, bool))); 204 connect(infodownloader, SIGNAL(requestFinished(int, bool)), this, SLOT(infoRequestFinished(int, bool)));
205 205
206 infodownloader->setProxy(m_proxy);
207
208 qDebug() << "downloading bootloader info"; 206 qDebug() << "downloading bootloader info";
209 infodownloader->setFile(&bootloaderInfo); 207 infodownloader->setFile(&bootloaderInfo);
210 infodownloader->getFile(QUrl(m_bootloaderinfoUrl)); 208 infodownloader->getFile(QUrl(m_bootloaderinfoUrl));
@@ -319,7 +317,6 @@ void BootloaderInstaller::gigabeatPrepare()
319 downloadFile.close(); 317 downloadFile.close();
320 // get the real file. 318 // get the real file.
321 getter = new HttpGet(this); 319 getter = new HttpGet(this);
322 getter->setProxy(m_proxy);
323 getter->setFile(&downloadFile); 320 getter->setFile(&downloadFile);
324 getter->getFile(QUrl(url)); 321 getter->getFile(QUrl(url));
325 // connect signals from HttpGet 322 // connect signals from HttpGet
@@ -462,7 +459,6 @@ void BootloaderInstaller::iaudioPrepare()
462 downloadFile.close(); 459 downloadFile.close();
463 // get the real file. 460 // get the real file.
464 getter = new HttpGet(this); 461 getter = new HttpGet(this);
465 getter->setProxy(m_proxy);
466 getter->setFile(&downloadFile); 462 getter->setFile(&downloadFile);
467 getter->getFile(QUrl(url)); 463 getter->getFile(QUrl(url));
468 // connect signals from HttpGet 464 // connect signals from HttpGet
@@ -519,7 +515,6 @@ void BootloaderInstaller::h10Prepare()
519 downloadFile.close(); 515 downloadFile.close();
520 // get the real file. 516 // get the real file.
521 getter = new HttpGet(this); 517 getter = new HttpGet(this);
522 getter->setProxy(m_proxy);
523 getter->setFile(&downloadFile); 518 getter->setFile(&downloadFile);
524 getter->getFile(QUrl(url)); 519 getter->getFile(QUrl(url));
525 // connect signals from HttpGet 520 // connect signals from HttpGet
@@ -672,7 +667,6 @@ void BootloaderInstaller::mrobe100Prepare()
672 downloadFile.close(); 667 downloadFile.close();
673 // get the real file. 668 // get the real file.
674 getter = new HttpGet(this); 669 getter = new HttpGet(this);
675 getter->setProxy(m_proxy);
676 getter->setFile(&downloadFile); 670 getter->setFile(&downloadFile);
677 getter->getFile(QUrl(url)); 671 getter->getFile(QUrl(url));
678 // connect signals from HttpGet 672 // connect signals from HttpGet
@@ -838,7 +832,6 @@ void BootloaderInstaller::ipodPrepare()
838 downloadFile.close(); 832 downloadFile.close();
839 // get the real file. 833 // get the real file.
840 getter = new HttpGet(this); 834 getter = new HttpGet(this);
841 getter->setProxy(m_proxy);
842 getter->setFile(&downloadFile); 835 getter->setFile(&downloadFile);
843 getter->getFile(QUrl(url)); 836 getter->getFile(QUrl(url));
844 // connect signals from HttpGet 837 // connect signals from HttpGet
@@ -1081,7 +1074,6 @@ void BootloaderInstaller::sansaPrepare()
1081 downloadFile.close(); 1074 downloadFile.close();
1082 // get the real file. 1075 // get the real file.
1083 getter = new HttpGet(this); 1076 getter = new HttpGet(this);
1084 getter->setProxy(m_proxy);
1085 getter->setFile(&downloadFile); 1077 getter->setFile(&downloadFile);
1086 getter->getFile(QUrl(url)); 1078 getter->getFile(QUrl(url));
1087 // connect signals from HttpGet 1079 // connect signals from HttpGet
@@ -1270,7 +1262,6 @@ void BootloaderInstaller::iriverPrepare()
1270 downloadFile.close(); 1262 downloadFile.close();
1271 // get the real file. 1263 // get the real file.
1272 getter = new HttpGet(this); 1264 getter = new HttpGet(this);
1273 getter->setProxy(m_proxy);
1274 getter->setFile(&downloadFile); 1265 getter->setFile(&downloadFile);
1275 getter->getFile(QUrl(url)); 1266 getter->getFile(QUrl(url));
1276 // connect signals from HttpGet 1267 // connect signals from HttpGet
diff --git a/rbutil/rbutilqt/installbootloader.h b/rbutil/rbutilqt/installbootloader.h
index aea118cd7d..a026a35fad 100644
--- a/rbutil/rbutilqt/installbootloader.h
+++ b/rbutil/rbutilqt/installbootloader.h
@@ -51,7 +51,6 @@ public:
51 void uninstall(ProgressloggerInterface* dp); 51 void uninstall(ProgressloggerInterface* dp);
52 52
53 void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;} 53 void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
54 void setProxy(QUrl proxy) {m_proxy= proxy;}
55 void setDevice(QString device) {m_device= device;} //!< the current plattform 54 void setDevice(QString device) {m_device= device;} //!< the current plattform
56 void setBootloaderMethod(QString method) {m_bootloadermethod= method;} 55 void setBootloaderMethod(QString method) {m_bootloadermethod= method;}
57 void setBootloaderName(QString name){m_bootloadername= name;} 56 void setBootloaderName(QString name){m_bootloadername= name;}
@@ -116,7 +115,6 @@ private:
116 115
117 QString m_mountpoint, m_device,m_bootloadermethod,m_bootloadername; 116 QString m_mountpoint, m_device,m_bootloadermethod,m_bootloadername;
118 QString m_bootloaderUrlBase,m_tempfilename,m_origfirmware; 117 QString m_bootloaderUrlBase,m_tempfilename,m_origfirmware;
119 QUrl m_proxy;
120 QString m_bootloaderinfoUrl; 118 QString m_bootloaderinfoUrl;
121 bool m_install; 119 bool m_install;
122 120
diff --git a/rbutil/rbutilqt/installthemes.cpp b/rbutil/rbutilqt/installthemes.cpp
index dac7710713..37e2d9ebd7 100644
--- a/rbutil/rbutilqt/installthemes.cpp
+++ b/rbutil/rbutilqt/installthemes.cpp
@@ -65,9 +65,8 @@ void ThemesInstallWindow::downloadInfo()
65 url = QUrl(settings->themeUrl() + "/rbutilqt.php?res=" + resolution()); 65 url = QUrl(settings->themeUrl() + "/rbutilqt.php?res=" + resolution());
66 qDebug() << "downloadInfo()" << url; 66 qDebug() << "downloadInfo()" << url;
67 qDebug() << url.queryItems(); 67 qDebug() << url.queryItems();
68 getter->setProxy(proxy);
69 if(settings->cacheOffline()) 68 if(settings->cacheOffline())
70 getter->setCache(settings->cachePath()); 69 getter->setCache(true);
71 getter->setFile(&themesInfo); 70 getter->setFile(&themesInfo);
72 getter->getFile(url); 71 getter->getFile(url);
73} 72}
@@ -172,9 +171,8 @@ void ThemesInstallWindow::updateDetails(int row)
172 iniDetails.endGroup(); 171 iniDetails.endGroup();
173 172
174 igetter.abort(); 173 igetter.abort();
175 igetter.setProxy(proxy);
176 if(!settings->cacheDisabled()) 174 if(!settings->cacheDisabled())
177 igetter.setCache(settings->cachePath()); 175 igetter.setCache(true);
178 else 176 else
179 { 177 {
180 if(infocachedir=="") 178 if(infocachedir=="")
@@ -248,13 +246,6 @@ void ThemesInstallWindow::abort()
248} 246}
249 247
250 248
251void ThemesInstallWindow::setProxy(QUrl p)
252{
253 proxy = p;
254 qDebug() << "setProxy()" << proxy;
255}
256
257
258void ThemesInstallWindow::acceptAll() 249void ThemesInstallWindow::acceptAll()
259{ 250{
260 ui.listThemes->selectAll(); 251 ui.listThemes->selectAll();
@@ -299,12 +290,11 @@ void ThemesInstallWindow::accept()
299 290
300 installer = new ZipInstaller(this); 291 installer = new ZipInstaller(this);
301 installer->setUrl(themes); 292 installer->setUrl(themes);
302 installer->setProxy(proxy);
303 installer->setLogSection(names); 293 installer->setLogSection(names);
304 installer->setLogVersion(version); 294 installer->setLogVersion(version);
305 installer->setMountPoint(mountPoint); 295 installer->setMountPoint(mountPoint);
306 if(!settings->cacheDisabled()) 296 if(!settings->cacheDisabled())
307 installer->setCache(settings->cachePath()); 297 installer->setCache(true);
308 installer->install(logger); 298 installer->install(logger);
309 connect(logger, SIGNAL(closed()), this, SLOT(close())); 299 connect(logger, SIGNAL(closed()), this, SLOT(close()));
310} 300}
diff --git a/rbutil/rbutilqt/installthemes.h b/rbutil/rbutilqt/installthemes.h
index 0f7d0f4a6b..0c71ff7376 100644
--- a/rbutil/rbutilqt/installthemes.h
+++ b/rbutil/rbutilqt/installthemes.h
@@ -37,7 +37,6 @@ class ThemesInstallWindow : public QDialog
37 ThemesInstallWindow(QWidget* parent = 0); 37 ThemesInstallWindow(QWidget* parent = 0);
38 ~ThemesInstallWindow(); 38 ~ThemesInstallWindow();
39 void setSettings(RbSettings* sett){settings=sett;} 39 void setSettings(RbSettings* sett){settings=sett;}
40 void setProxy(QUrl);
41 void downloadInfo(void); 40 void downloadInfo(void);
42 void show(void); 41 void show(void);
43 42
@@ -52,7 +51,6 @@ class ThemesInstallWindow : public QDialog
52 HttpGet igetter; 51 HttpGet igetter;
53 QTemporaryFile themesInfo; 52 QTemporaryFile themesInfo;
54 QString resolution(void); 53 QString resolution(void);
55 QUrl proxy;
56 int currentItem; 54 int currentItem;
57 void resizeEvent(QResizeEvent*); 55 void resizeEvent(QResizeEvent*);
58 QByteArray imgData; 56 QByteArray imgData;
diff --git a/rbutil/rbutilqt/installzip.cpp b/rbutil/rbutilqt/installzip.cpp
index 641b057175..3948e7ea75 100644
--- a/rbutil/rbutilqt/installzip.cpp
+++ b/rbutil/rbutilqt/installzip.cpp
@@ -25,7 +25,7 @@
25ZipInstaller::ZipInstaller(QObject* parent): QObject(parent) 25ZipInstaller::ZipInstaller(QObject* parent): QObject(parent)
26{ 26{
27 m_unzip = true; 27 m_unzip = true;
28 m_cache = ""; 28 m_usecache = false;
29} 29}
30 30
31 31
@@ -86,10 +86,8 @@ void ZipInstaller::installStart()
86 downloadFile->close(); 86 downloadFile->close();
87 // get the real file. 87 // get the real file.
88 getter = new HttpGet(this); 88 getter = new HttpGet(this);
89 getter->setProxy(m_proxy); 89 if(m_usecache) {
90 if(m_cache.exists()) { 90 getter->setCache(true);
91 getter->setCache(m_cache);
92
93 } 91 }
94 getter->setFile(downloadFile); 92 getter->setFile(downloadFile);
95 getter->getFile(QUrl(m_url)); 93 getter->getFile(QUrl(m_url));
diff --git a/rbutil/rbutilqt/installzip.h b/rbutil/rbutilqt/installzip.h
index 906fc21013..ece5d88072 100644
--- a/rbutil/rbutilqt/installzip.h
+++ b/rbutil/rbutilqt/installzip.h
@@ -39,7 +39,6 @@ public:
39 void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;} 39 void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
40 void setUrl(QString url){m_urllist = QStringList(url);} 40 void setUrl(QString url){m_urllist = QStringList(url);}
41 void setUrl(QStringList url) { m_urllist = url; } 41 void setUrl(QStringList url) { m_urllist = url; }
42 void setProxy(QUrl proxy) {m_proxy= proxy;}
43 void setLogSection(QString name) {m_loglist = QStringList(name);} 42 void setLogSection(QString name) {m_loglist = QStringList(name);}
44 void setLogSection(QStringList name) { m_loglist = name; } 43 void setLogSection(QStringList name) { m_loglist = name; }
45 void setLogVersion(QString v) { m_verlist = QStringList(v); qDebug() << m_verlist;} 44 void setLogVersion(QString v) { m_verlist = QStringList(v); qDebug() << m_verlist;}
@@ -47,6 +46,7 @@ public:
47 void setUnzip(bool i) { m_unzip = i; } 46 void setUnzip(bool i) { m_unzip = i; }
48 void setTarget(QString t) { m_target = t; } 47 void setTarget(QString t) { m_target = t; }
49 void setCache(QDir c) { m_cache = c; }; 48 void setCache(QDir c) { m_cache = c; };
49 void setCache(bool c) { m_usecache = c; };
50 void setCache(QString c) { m_cache = QDir(c);} 50 void setCache(QString c) { m_cache = QDir(c);}
51 51
52signals: 52signals:
@@ -63,11 +63,11 @@ private:
63 void installSingle(ProgressloggerInterface *dp); 63 void installSingle(ProgressloggerInterface *dp);
64 QString m_url, m_file, m_mountpoint, m_logsection, m_logver; 64 QString m_url, m_file, m_mountpoint, m_logsection, m_logver;
65 QStringList m_urllist, m_loglist, m_verlist; 65 QStringList m_urllist, m_loglist, m_verlist;
66 QUrl m_proxy;
67 bool m_unzip; 66 bool m_unzip;
68 QString m_target; 67 QString m_target;
69 int runner; 68 int runner;
70 QDir m_cache; 69 QDir m_cache;
70 bool m_usecache;
71 71
72 HttpGet *getter; 72 HttpGet *getter;
73 QTemporaryFile *downloadFile; 73 QTemporaryFile *downloadFile;
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index becab29638..c3f088f0a6 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -56,8 +56,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
56 settings->open(); 56 settings->open();
57 57
58 // manual tab 58 // manual tab
59 updateManual(); 59 updateSettings();
60 updateDevice();
61 ui.radioPdf->setChecked(true); 60 ui.radioPdf->setChecked(true);
62 61
63 // info tab 62 // info tab
@@ -132,9 +131,10 @@ void RbUtilQt::downloadInfo()
132 connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 131 connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
133 connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); 132 connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
134 connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); 133 connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort()));
135 daily->setProxy(proxy());
136 if(settings->cacheOffline()) 134 if(settings->cacheOffline())
137 daily->setCache(settings->cachePath()); 135 daily->setCache(true);
136 else
137 daily->setCache(false);
138 qDebug() << "downloading build info"; 138 qDebug() << "downloading build info";
139 daily->setFile(&buildInfo); 139 daily->setFile(&buildInfo);
140 daily->getFile(QUrl(settings->serverConfUrl())); 140 daily->getFile(QUrl(settings->serverConfUrl()));
@@ -159,9 +159,8 @@ void RbUtilQt::downloadDone(bool error)
159 connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool))); 159 connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool)));
160 connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); 160 connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
161 connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); 161 connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort()));
162 bleeding->setProxy(proxy());
163 if(settings->cacheOffline()) 162 if(settings->cacheOffline())
164 bleeding->setCache(settings->cachePath()); 163 bleeding->setCache(true);
165 bleeding->setFile(&bleedingInfo); 164 bleeding->setFile(&bleedingInfo);
166 bleeding->getFile(QUrl(settings->bleedingInfo())); 165 bleeding->getFile(QUrl(settings->bleedingInfo()));
167 166
@@ -252,6 +251,13 @@ void RbUtilQt::updateSettings()
252 qDebug() << "updateSettings()"; 251 qDebug() << "updateSettings()";
253 updateDevice(); 252 updateDevice();
254 updateManual(); 253 updateManual();
254 if(settings->proxyType() == "system") {
255 HttpGet::setGlobalProxy(systemProxy());
256 }
257 else if(settings->proxyType() == "manual") {
258 HttpGet::setGlobalProxy(settings->proxy());
259 }
260 HttpGet::setGlobalCache(settings->cachePath());
255} 261}
256 262
257 263
@@ -452,11 +458,10 @@ bool RbUtilQt::installAuto()
452 458
453 ZipInstaller* installer = new ZipInstaller(this); 459 ZipInstaller* installer = new ZipInstaller(this);
454 installer->setUrl(file); 460 installer->setUrl(file);
455 installer->setProxy(proxy());
456 installer->setLogSection("Rockbox (Base)"); 461 installer->setLogSection("Rockbox (Base)");
457 installer->setLogVersion(myversion); 462 installer->setLogVersion(myversion);
458 if(!settings->cacheDisabled()) 463 if(!settings->cacheDisabled())
459 installer->setCache(settings->cachePath()); 464 installer->setCache(true);
460 installer->setMountPoint(settings->mountpoint()); 465 installer->setMountPoint(settings->mountpoint());
461 installer->install(logger); 466 installer->install(logger);
462 467
@@ -469,7 +474,6 @@ void RbUtilQt::install()
469{ 474{
470 Install *installWindow = new Install(this); 475 Install *installWindow = new Install(this);
471 installWindow->setSettings(settings); 476 installWindow->setSettings(settings);
472 installWindow->setProxy(proxy());
473 477
474 buildInfo.open(); 478 buildInfo.open();
475 QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); 479 QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
@@ -516,7 +520,6 @@ void RbUtilQt::installBootloader()
516 520
517 blinstaller->setMountPoint(settings->mountpoint()); 521 blinstaller->setMountPoint(settings->mountpoint());
518 522
519 blinstaller->setProxy(proxy());
520 blinstaller->setDevice(platform); 523 blinstaller->setDevice(platform);
521 blinstaller->setBootloaderMethod(settings->curBootloaderMethod()); 524 blinstaller->setBootloaderMethod(settings->curBootloaderMethod());
522 blinstaller->setBootloaderName(settings->curBootloaderName()); 525 blinstaller->setBootloaderName(settings->curBootloaderName());
@@ -606,12 +609,11 @@ void RbUtilQt::installFonts()
606 installer = new ZipInstaller(this); 609 installer = new ZipInstaller(this);
607 610
608 installer->setUrl(settings->fontUrl()); 611 installer->setUrl(settings->fontUrl());
609 installer->setProxy(proxy());
610 installer->setLogSection("Fonts"); 612 installer->setLogSection("Fonts");
611 installer->setLogVersion(versmap.value("arch_date")); 613 installer->setLogVersion(versmap.value("arch_date"));
612 installer->setMountPoint(settings->mountpoint()); 614 installer->setMountPoint(settings->mountpoint());
613 if(!settings->cacheDisabled()) 615 if(!settings->cacheDisabled())
614 installer->setCache(settings->cachePath()); 616 installer->setCache(true);
615 installer->install(logger); 617 installer->install(logger);
616} 618}
617 619
@@ -636,14 +638,13 @@ void RbUtilQt::installVoice()
636 versmap.value("arch_date") + "-english.voice"; 638 versmap.value("arch_date") + "-english.voice";
637 qDebug() << voiceurl; 639 qDebug() << voiceurl;
638 640
639 installer->setProxy(proxy());
640 installer->setUrl(voiceurl); 641 installer->setUrl(voiceurl);
641 installer->setLogSection("Voice"); 642 installer->setLogSection("Voice");
642 installer->setLogVersion(versmap.value("arch_date")); 643 installer->setLogVersion(versmap.value("arch_date"));
643 installer->setMountPoint(settings->mountpoint()); 644 installer->setMountPoint(settings->mountpoint());
644 installer->setTarget("/.rockbox/langs/english.voice"); 645 installer->setTarget("/.rockbox/langs/english.voice");
645 if(!settings->cacheDisabled()) 646 if(!settings->cacheDisabled())
646 installer->setCache(settings->cachePath()); 647 installer->setCache(true);
647 installer->install(logger); 648 installer->install(logger);
648 649
649} 650}
@@ -684,12 +685,11 @@ void RbUtilQt::installDoom()
684 installer = new ZipInstaller(this); 685 installer = new ZipInstaller(this);
685 686
686 installer->setUrl(settings->doomUrl()); 687 installer->setUrl(settings->doomUrl());
687 installer->setProxy(proxy());
688 installer->setLogSection("Game Addons"); 688 installer->setLogSection("Game Addons");
689 installer->setLogVersion(versmap.value("arch_date")); 689 installer->setLogVersion(versmap.value("arch_date"));
690 installer->setMountPoint(settings->mountpoint()); 690 installer->setMountPoint(settings->mountpoint());
691 if(!settings->cacheDisabled()) 691 if(!settings->cacheDisabled())
692 installer->setCache(settings->cachePath()); 692 installer->setCache(true);
693 installer->install(logger); 693 installer->install(logger);
694 694
695} 695}
@@ -699,7 +699,6 @@ void RbUtilQt::installThemes()
699 if(chkConfig(true)) return; 699 if(chkConfig(true)) return;
700 ThemesInstallWindow* tw = new ThemesInstallWindow(this); 700 ThemesInstallWindow* tw = new ThemesInstallWindow(this);
701 tw->setSettings(settings); 701 tw->setSettings(settings);
702 tw->setProxy(proxy());
703 tw->setModal(true); 702 tw->setModal(true);
704 tw->show(); 703 tw->show();
705} 704}
@@ -720,8 +719,7 @@ void RbUtilQt::createVoiceFile(void)
720 if(chkConfig(true)) return; 719 if(chkConfig(true)) return;
721 CreateVoiceWindow *installWindow = new CreateVoiceWindow(this); 720 CreateVoiceWindow *installWindow = new CreateVoiceWindow(this);
722 installWindow->setSettings(settings); 721 installWindow->setSettings(settings);
723 installWindow->setProxy(proxy()); 722
724
725 installWindow->show(); 723 installWindow->show();
726 connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo())); 724 connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
727 connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); 725 connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
@@ -747,7 +745,6 @@ void RbUtilQt::uninstallBootloader(void)
747 logger->show(); 745 logger->show();
748 746
749 BootloaderInstaller blinstaller(this); 747 BootloaderInstaller blinstaller(this);
750 blinstaller.setProxy(proxy());
751 blinstaller.setMountPoint(settings->mountpoint()); 748 blinstaller.setMountPoint(settings->mountpoint());
752 blinstaller.setDevice(settings->curPlatform()); 749 blinstaller.setDevice(settings->curPlatform());
753 blinstaller.setBootloaderMethod(settings->curBootloaderMethod()); 750 blinstaller.setBootloaderMethod(settings->curBootloaderMethod());
@@ -802,8 +799,7 @@ void RbUtilQt::downloadManual(void)
802 installer = new ZipInstaller(this); 799 installer = new ZipInstaller(this);
803 installer->setMountPoint(settings->mountpoint()); 800 installer->setMountPoint(settings->mountpoint());
804 if(!settings->cacheDisabled()) 801 if(!settings->cacheDisabled())
805 installer->setCache(settings->cachePath()); 802 installer->setCache(true);
806 installer->setProxy(proxy());
807 installer->setLogSection(section); 803 installer->setLogSection(section);
808 installer->setLogVersion(date); 804 installer->setLogVersion(date);
809 installer->setUrl(manualurl); 805 installer->setUrl(manualurl);
diff --git a/rbutil/rbutilqt/utils.cpp b/rbutil/rbutilqt/utils.cpp
index ee7337b209..18aac68510 100644
--- a/rbutil/rbutilqt/utils.cpp
+++ b/rbutil/rbutilqt/utils.cpp
@@ -52,7 +52,7 @@ bool recRmdir( const QString &dirName )
52} 52}
53 53
54 54
55//Function to get the system proxy 55//! @brief get system proxy value.
56QUrl systemProxy(void) 56QUrl systemProxy(void)
57{ 57{
58#if defined(Q_OS_LINUX) 58#if defined(Q_OS_LINUX)
diff --git a/rbutil/rbutilqt/voicefile.cpp b/rbutil/rbutilqt/voicefile.cpp
index e2944eb79d..08b39fdfef 100644
--- a/rbutil/rbutilqt/voicefile.cpp
+++ b/rbutil/rbutilqt/voicefile.cpp
@@ -90,7 +90,6 @@ bool VoiceFileCreator::createVoiceFile(ProgressloggerInterface* logger)
90 downloadFile->close(); 90 downloadFile->close();
91 // get the real file. 91 // get the real file.
92 getter = new HttpGet(this); 92 getter = new HttpGet(this);
93 getter->setProxy(m_proxy);
94 getter->setFile(downloadFile); 93 getter->setFile(downloadFile);
95 getter->getFile(genlangUrl); 94 getter->getFile(genlangUrl);
96 95
diff --git a/rbutil/rbutilqt/voicefile.h b/rbutil/rbutilqt/voicefile.h
index fb567b32de..611203a134 100644
--- a/rbutil/rbutilqt/voicefile.h
+++ b/rbutil/rbutilqt/voicefile.h
@@ -51,7 +51,6 @@ public:
51 void setTargetId(int id){m_targetid = id;} 51 void setTargetId(int id){m_targetid = id;}
52 void setLang(QString name){m_lang =name;} 52 void setLang(QString name){m_lang =name;}
53 void setWavtrimThreshold(int th){m_wavtrimThreshold = th;} 53 void setWavtrimThreshold(int th){m_wavtrimThreshold = th;}
54 void setProxy(QUrl proxy){m_proxy = proxy;}
55 54
56signals: 55signals:
57 void done(bool error); 56 void done(bool error);
@@ -69,7 +68,6 @@ private:
69 RbSettings* settings; 68 RbSettings* settings;
70 HttpGet *getter; 69 HttpGet *getter;
71 70
72 QUrl m_proxy; //proxy
73 QString filename; //the temporary file 71 QString filename; //the temporary file
74 72
75 QString m_mountpoint; //mountpoint of the device 73 QString m_mountpoint; //mountpoint of the device