forked from len0rd/rockbox
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
This commit is contained in:
parent
0def1dd23c
commit
5a75184c4a
14 changed files with 63 additions and 74 deletions
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
#include "httpget.h"
|
#include "httpget.h"
|
||||||
|
|
||||||
|
QDir HttpGet::m_globalCache;
|
||||||
|
QUrl HttpGet::m_globalProxy;
|
||||||
|
|
||||||
HttpGet::HttpGet(QObject *parent)
|
HttpGet::HttpGet(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
|
@ -36,6 +38,14 @@ HttpGet::HttpGet(QObject *parent)
|
||||||
// hint about this in the http response instead of nonsense.
|
// hint about this in the http response instead of nonsense.
|
||||||
response = -1;
|
response = -1;
|
||||||
|
|
||||||
|
// default to global proxy / cache if not empty.
|
||||||
|
// proxy is automatically enabled, disable it by setting an empty proxy
|
||||||
|
// cache is enabled to be in line, can get disabled with setCache(bool)
|
||||||
|
qDebug() << "setting global proxy / cache";
|
||||||
|
if(!m_globalProxy.isEmpty())
|
||||||
|
setProxy(m_globalProxy);
|
||||||
|
m_usecache = false;
|
||||||
|
m_cachedir = m_globalCache;
|
||||||
connect(&http, SIGNAL(done(bool)), this, SLOT(httpDone(bool)));
|
connect(&http, SIGNAL(done(bool)), this, SLOT(httpDone(bool)));
|
||||||
connect(&http, SIGNAL(dataReadProgress(int, int)), this, SLOT(httpProgress(int, int)));
|
connect(&http, SIGNAL(dataReadProgress(int, int)), this, SLOT(httpProgress(int, int)));
|
||||||
connect(&http, SIGNAL(requestFinished(int, bool)), this, SLOT(httpFinished(int, bool)));
|
connect(&http, SIGNAL(requestFinished(int, bool)), this, SLOT(httpFinished(int, bool)));
|
||||||
|
@ -60,13 +70,14 @@ void HttpGet::setCache(QDir d)
|
||||||
result = m_cachedir.mkdir("rbutil-cache");
|
result = m_cachedir.mkdir("rbutil-cache");
|
||||||
}
|
}
|
||||||
else result = false;
|
else result = false;
|
||||||
qDebug() << "HttpGet::setCache(QDir)" << result;
|
qDebug() << "HttpGet::setCache(QDir)" << d << result;
|
||||||
m_usecache = result;
|
m_usecache = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void HttpGet::setCache(bool c)
|
void HttpGet::setCache(bool c)
|
||||||
{
|
{
|
||||||
|
qDebug() << "setCache(bool)" << c;
|
||||||
m_usecache = c;
|
m_usecache = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,8 +102,19 @@ void HttpGet::httpProgress(int read, int total)
|
||||||
|
|
||||||
void HttpGet::setProxy(const QUrl &proxy)
|
void HttpGet::setProxy(const QUrl &proxy)
|
||||||
{
|
{
|
||||||
qDebug() << "HttpGet::setProxy" << proxy.toString();
|
qDebug() << "HttpGet::setProxy(QUrl)" << proxy.toString();
|
||||||
http.setProxy(proxy.host(), proxy.port(), proxy.userName(), proxy.password());
|
m_proxy = proxy;
|
||||||
|
http.setProxy(m_proxy.host(), m_proxy.port(), m_proxy.userName(), m_proxy.password());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void HttpGet::setProxy(bool enable)
|
||||||
|
{
|
||||||
|
qDebug() << "HttpGet::setProxy(bool)" << enable;
|
||||||
|
if(enable)
|
||||||
|
http.setProxy(m_proxy.host(), m_proxy.port(), m_proxy.userName(), m_proxy.password());
|
||||||
|
else
|
||||||
|
http.setProxy("", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,6 +193,7 @@ bool HttpGet::getFile(const QUrl &url)
|
||||||
else {
|
else {
|
||||||
qDebug() << "[HTTP] cache DISABLED";
|
qDebug() << "[HTTP] cache DISABLED";
|
||||||
}
|
}
|
||||||
|
|
||||||
http.setHost(url.host(), url.port(80));
|
http.setHost(url.host(), url.port(80));
|
||||||
// construct query (if any)
|
// construct query (if any)
|
||||||
QList<QPair<QString, QString> > qitems = url.queryItems();
|
QList<QPair<QString, QString> > qitems = url.queryItems();
|
||||||
|
|
|
@ -35,6 +35,7 @@ class HttpGet : public QObject
|
||||||
|
|
||||||
bool getFile(const QUrl &url);
|
bool getFile(const QUrl &url);
|
||||||
void setProxy(const QUrl &url);
|
void setProxy(const QUrl &url);
|
||||||
|
void setProxy(bool);
|
||||||
QHttp::Error error(void);
|
QHttp::Error error(void);
|
||||||
QString errorString(void);
|
QString errorString(void);
|
||||||
void setFile(QFile*);
|
void setFile(QFile*);
|
||||||
|
@ -43,6 +44,10 @@ class HttpGet : public QObject
|
||||||
int httpResponse(void);
|
int httpResponse(void);
|
||||||
QByteArray readAll(void);
|
QByteArray readAll(void);
|
||||||
bool isCached() { return cached; }
|
bool isCached() { return cached; }
|
||||||
|
static void setGlobalCache(const QDir d) //< set global cache path
|
||||||
|
{ m_globalCache = d; }
|
||||||
|
static void setGlobalProxy(const QUrl p) //< set global proxy value
|
||||||
|
{ m_globalProxy = p; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void abort(void);
|
void abort(void);
|
||||||
|
@ -61,9 +66,9 @@ class HttpGet : public QObject
|
||||||
void httpStarted(int);
|
void httpStarted(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHttp http;
|
QHttp http; //< download object
|
||||||
QFile *outputFile;
|
QFile *outputFile;
|
||||||
int response;
|
int response; //< http response
|
||||||
int getRequest;
|
int getRequest;
|
||||||
QByteArray dataBuffer;
|
QByteArray dataBuffer;
|
||||||
bool outputToBuffer;
|
bool outputToBuffer;
|
||||||
|
@ -72,6 +77,9 @@ class HttpGet : public QObject
|
||||||
QDir m_cachedir;
|
QDir m_cachedir;
|
||||||
QString cachefile;
|
QString cachefile;
|
||||||
bool cached;
|
bool cached;
|
||||||
|
QUrl m_proxy;
|
||||||
|
static QDir m_globalCache; //< global cache path value
|
||||||
|
static QUrl m_globalProxy; //< global proxy value
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,13 +37,6 @@ void Install::setCached(bool cache)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Install::setProxy(QUrl proxy_url)
|
|
||||||
{
|
|
||||||
proxy = proxy_url;
|
|
||||||
qDebug() << "Install::setProxy" << proxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Install::accept()
|
void Install::accept()
|
||||||
{
|
{
|
||||||
logger = new ProgressLoggerGui(this);
|
logger = new ProgressLoggerGui(this);
|
||||||
|
@ -92,7 +85,6 @@ void Install::accept()
|
||||||
|
|
||||||
installer = new ZipInstaller(this);
|
installer = new ZipInstaller(this);
|
||||||
installer->setUrl(file);
|
installer->setUrl(file);
|
||||||
installer->setProxy(proxy);
|
|
||||||
installer->setLogSection("Rockbox (Base)");
|
installer->setLogSection("Rockbox (Base)");
|
||||||
if(!settings->cacheDisabled()
|
if(!settings->cacheDisabled()
|
||||||
&& !ui.radioCurrent->isChecked()
|
&& !ui.radioCurrent->isChecked()
|
||||||
|
|
|
@ -32,7 +32,6 @@ class Install : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Install(QWidget *parent = 0);
|
Install(QWidget *parent = 0);
|
||||||
void setProxy(QUrl);
|
|
||||||
void setSettings(RbSettings* sett);
|
void setSettings(RbSettings* sett);
|
||||||
void setVersionStrings(QMap<QString, QString>);
|
void setVersionStrings(QMap<QString, QString>);
|
||||||
|
|
||||||
|
@ -42,7 +41,6 @@ class Install : public QDialog
|
||||||
private:
|
private:
|
||||||
Ui::InstallFrm ui;
|
Ui::InstallFrm ui;
|
||||||
ProgressLoggerGui* logger;
|
ProgressLoggerGui* logger;
|
||||||
QUrl proxy;
|
|
||||||
RbSettings* settings;
|
RbSettings* settings;
|
||||||
QHttp *download;
|
QHttp *download;
|
||||||
QFile *target;
|
QFile *target;
|
||||||
|
|
|
@ -203,8 +203,6 @@ bool BootloaderInstaller::downloadInfo()
|
||||||
connect(infodownloader, SIGNAL(done(bool)), this, SLOT(infoDownloadDone(bool)));
|
connect(infodownloader, SIGNAL(done(bool)), this, SLOT(infoDownloadDone(bool)));
|
||||||
connect(infodownloader, SIGNAL(requestFinished(int, bool)), this, SLOT(infoRequestFinished(int, bool)));
|
connect(infodownloader, SIGNAL(requestFinished(int, bool)), this, SLOT(infoRequestFinished(int, bool)));
|
||||||
|
|
||||||
infodownloader->setProxy(m_proxy);
|
|
||||||
|
|
||||||
qDebug() << "downloading bootloader info";
|
qDebug() << "downloading bootloader info";
|
||||||
infodownloader->setFile(&bootloaderInfo);
|
infodownloader->setFile(&bootloaderInfo);
|
||||||
infodownloader->getFile(QUrl(m_bootloaderinfoUrl));
|
infodownloader->getFile(QUrl(m_bootloaderinfoUrl));
|
||||||
|
@ -319,7 +317,6 @@ void BootloaderInstaller::gigabeatPrepare()
|
||||||
downloadFile.close();
|
downloadFile.close();
|
||||||
// get the real file.
|
// get the real file.
|
||||||
getter = new HttpGet(this);
|
getter = new HttpGet(this);
|
||||||
getter->setProxy(m_proxy);
|
|
||||||
getter->setFile(&downloadFile);
|
getter->setFile(&downloadFile);
|
||||||
getter->getFile(QUrl(url));
|
getter->getFile(QUrl(url));
|
||||||
// connect signals from HttpGet
|
// connect signals from HttpGet
|
||||||
|
@ -462,7 +459,6 @@ void BootloaderInstaller::iaudioPrepare()
|
||||||
downloadFile.close();
|
downloadFile.close();
|
||||||
// get the real file.
|
// get the real file.
|
||||||
getter = new HttpGet(this);
|
getter = new HttpGet(this);
|
||||||
getter->setProxy(m_proxy);
|
|
||||||
getter->setFile(&downloadFile);
|
getter->setFile(&downloadFile);
|
||||||
getter->getFile(QUrl(url));
|
getter->getFile(QUrl(url));
|
||||||
// connect signals from HttpGet
|
// connect signals from HttpGet
|
||||||
|
@ -519,7 +515,6 @@ void BootloaderInstaller::h10Prepare()
|
||||||
downloadFile.close();
|
downloadFile.close();
|
||||||
// get the real file.
|
// get the real file.
|
||||||
getter = new HttpGet(this);
|
getter = new HttpGet(this);
|
||||||
getter->setProxy(m_proxy);
|
|
||||||
getter->setFile(&downloadFile);
|
getter->setFile(&downloadFile);
|
||||||
getter->getFile(QUrl(url));
|
getter->getFile(QUrl(url));
|
||||||
// connect signals from HttpGet
|
// connect signals from HttpGet
|
||||||
|
@ -672,7 +667,6 @@ void BootloaderInstaller::mrobe100Prepare()
|
||||||
downloadFile.close();
|
downloadFile.close();
|
||||||
// get the real file.
|
// get the real file.
|
||||||
getter = new HttpGet(this);
|
getter = new HttpGet(this);
|
||||||
getter->setProxy(m_proxy);
|
|
||||||
getter->setFile(&downloadFile);
|
getter->setFile(&downloadFile);
|
||||||
getter->getFile(QUrl(url));
|
getter->getFile(QUrl(url));
|
||||||
// connect signals from HttpGet
|
// connect signals from HttpGet
|
||||||
|
@ -838,7 +832,6 @@ void BootloaderInstaller::ipodPrepare()
|
||||||
downloadFile.close();
|
downloadFile.close();
|
||||||
// get the real file.
|
// get the real file.
|
||||||
getter = new HttpGet(this);
|
getter = new HttpGet(this);
|
||||||
getter->setProxy(m_proxy);
|
|
||||||
getter->setFile(&downloadFile);
|
getter->setFile(&downloadFile);
|
||||||
getter->getFile(QUrl(url));
|
getter->getFile(QUrl(url));
|
||||||
// connect signals from HttpGet
|
// connect signals from HttpGet
|
||||||
|
@ -1081,7 +1074,6 @@ void BootloaderInstaller::sansaPrepare()
|
||||||
downloadFile.close();
|
downloadFile.close();
|
||||||
// get the real file.
|
// get the real file.
|
||||||
getter = new HttpGet(this);
|
getter = new HttpGet(this);
|
||||||
getter->setProxy(m_proxy);
|
|
||||||
getter->setFile(&downloadFile);
|
getter->setFile(&downloadFile);
|
||||||
getter->getFile(QUrl(url));
|
getter->getFile(QUrl(url));
|
||||||
// connect signals from HttpGet
|
// connect signals from HttpGet
|
||||||
|
@ -1270,7 +1262,6 @@ void BootloaderInstaller::iriverPrepare()
|
||||||
downloadFile.close();
|
downloadFile.close();
|
||||||
// get the real file.
|
// get the real file.
|
||||||
getter = new HttpGet(this);
|
getter = new HttpGet(this);
|
||||||
getter->setProxy(m_proxy);
|
|
||||||
getter->setFile(&downloadFile);
|
getter->setFile(&downloadFile);
|
||||||
getter->getFile(QUrl(url));
|
getter->getFile(QUrl(url));
|
||||||
// connect signals from HttpGet
|
// connect signals from HttpGet
|
||||||
|
|
|
@ -51,7 +51,6 @@ public:
|
||||||
void uninstall(ProgressloggerInterface* dp);
|
void uninstall(ProgressloggerInterface* dp);
|
||||||
|
|
||||||
void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
|
void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
|
||||||
void setProxy(QUrl proxy) {m_proxy= proxy;}
|
|
||||||
void setDevice(QString device) {m_device= device;} //!< the current plattform
|
void setDevice(QString device) {m_device= device;} //!< the current plattform
|
||||||
void setBootloaderMethod(QString method) {m_bootloadermethod= method;}
|
void setBootloaderMethod(QString method) {m_bootloadermethod= method;}
|
||||||
void setBootloaderName(QString name){m_bootloadername= name;}
|
void setBootloaderName(QString name){m_bootloadername= name;}
|
||||||
|
@ -116,7 +115,6 @@ private:
|
||||||
|
|
||||||
QString m_mountpoint, m_device,m_bootloadermethod,m_bootloadername;
|
QString m_mountpoint, m_device,m_bootloadermethod,m_bootloadername;
|
||||||
QString m_bootloaderUrlBase,m_tempfilename,m_origfirmware;
|
QString m_bootloaderUrlBase,m_tempfilename,m_origfirmware;
|
||||||
QUrl m_proxy;
|
|
||||||
QString m_bootloaderinfoUrl;
|
QString m_bootloaderinfoUrl;
|
||||||
bool m_install;
|
bool m_install;
|
||||||
|
|
||||||
|
|
|
@ -65,9 +65,8 @@ void ThemesInstallWindow::downloadInfo()
|
||||||
url = QUrl(settings->themeUrl() + "/rbutilqt.php?res=" + resolution());
|
url = QUrl(settings->themeUrl() + "/rbutilqt.php?res=" + resolution());
|
||||||
qDebug() << "downloadInfo()" << url;
|
qDebug() << "downloadInfo()" << url;
|
||||||
qDebug() << url.queryItems();
|
qDebug() << url.queryItems();
|
||||||
getter->setProxy(proxy);
|
|
||||||
if(settings->cacheOffline())
|
if(settings->cacheOffline())
|
||||||
getter->setCache(settings->cachePath());
|
getter->setCache(true);
|
||||||
getter->setFile(&themesInfo);
|
getter->setFile(&themesInfo);
|
||||||
getter->getFile(url);
|
getter->getFile(url);
|
||||||
}
|
}
|
||||||
|
@ -172,9 +171,8 @@ void ThemesInstallWindow::updateDetails(int row)
|
||||||
iniDetails.endGroup();
|
iniDetails.endGroup();
|
||||||
|
|
||||||
igetter.abort();
|
igetter.abort();
|
||||||
igetter.setProxy(proxy);
|
|
||||||
if(!settings->cacheDisabled())
|
if(!settings->cacheDisabled())
|
||||||
igetter.setCache(settings->cachePath());
|
igetter.setCache(true);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(infocachedir=="")
|
if(infocachedir=="")
|
||||||
|
@ -248,13 +246,6 @@ void ThemesInstallWindow::abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ThemesInstallWindow::setProxy(QUrl p)
|
|
||||||
{
|
|
||||||
proxy = p;
|
|
||||||
qDebug() << "setProxy()" << proxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ThemesInstallWindow::acceptAll()
|
void ThemesInstallWindow::acceptAll()
|
||||||
{
|
{
|
||||||
ui.listThemes->selectAll();
|
ui.listThemes->selectAll();
|
||||||
|
@ -299,12 +290,11 @@ void ThemesInstallWindow::accept()
|
||||||
|
|
||||||
installer = new ZipInstaller(this);
|
installer = new ZipInstaller(this);
|
||||||
installer->setUrl(themes);
|
installer->setUrl(themes);
|
||||||
installer->setProxy(proxy);
|
|
||||||
installer->setLogSection(names);
|
installer->setLogSection(names);
|
||||||
installer->setLogVersion(version);
|
installer->setLogVersion(version);
|
||||||
installer->setMountPoint(mountPoint);
|
installer->setMountPoint(mountPoint);
|
||||||
if(!settings->cacheDisabled())
|
if(!settings->cacheDisabled())
|
||||||
installer->setCache(settings->cachePath());
|
installer->setCache(true);
|
||||||
installer->install(logger);
|
installer->install(logger);
|
||||||
connect(logger, SIGNAL(closed()), this, SLOT(close()));
|
connect(logger, SIGNAL(closed()), this, SLOT(close()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ class ThemesInstallWindow : public QDialog
|
||||||
ThemesInstallWindow(QWidget* parent = 0);
|
ThemesInstallWindow(QWidget* parent = 0);
|
||||||
~ThemesInstallWindow();
|
~ThemesInstallWindow();
|
||||||
void setSettings(RbSettings* sett){settings=sett;}
|
void setSettings(RbSettings* sett){settings=sett;}
|
||||||
void setProxy(QUrl);
|
|
||||||
void downloadInfo(void);
|
void downloadInfo(void);
|
||||||
void show(void);
|
void show(void);
|
||||||
|
|
||||||
|
@ -52,7 +51,6 @@ class ThemesInstallWindow : public QDialog
|
||||||
HttpGet igetter;
|
HttpGet igetter;
|
||||||
QTemporaryFile themesInfo;
|
QTemporaryFile themesInfo;
|
||||||
QString resolution(void);
|
QString resolution(void);
|
||||||
QUrl proxy;
|
|
||||||
int currentItem;
|
int currentItem;
|
||||||
void resizeEvent(QResizeEvent*);
|
void resizeEvent(QResizeEvent*);
|
||||||
QByteArray imgData;
|
QByteArray imgData;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
ZipInstaller::ZipInstaller(QObject* parent): QObject(parent)
|
ZipInstaller::ZipInstaller(QObject* parent): QObject(parent)
|
||||||
{
|
{
|
||||||
m_unzip = true;
|
m_unzip = true;
|
||||||
m_cache = "";
|
m_usecache = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,10 +86,8 @@ void ZipInstaller::installStart()
|
||||||
downloadFile->close();
|
downloadFile->close();
|
||||||
// get the real file.
|
// get the real file.
|
||||||
getter = new HttpGet(this);
|
getter = new HttpGet(this);
|
||||||
getter->setProxy(m_proxy);
|
if(m_usecache) {
|
||||||
if(m_cache.exists()) {
|
getter->setCache(true);
|
||||||
getter->setCache(m_cache);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
getter->setFile(downloadFile);
|
getter->setFile(downloadFile);
|
||||||
getter->getFile(QUrl(m_url));
|
getter->getFile(QUrl(m_url));
|
||||||
|
|
|
@ -39,7 +39,6 @@ public:
|
||||||
void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
|
void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
|
||||||
void setUrl(QString url){m_urllist = QStringList(url);}
|
void setUrl(QString url){m_urllist = QStringList(url);}
|
||||||
void setUrl(QStringList url) { m_urllist = url; }
|
void setUrl(QStringList url) { m_urllist = url; }
|
||||||
void setProxy(QUrl proxy) {m_proxy= proxy;}
|
|
||||||
void setLogSection(QString name) {m_loglist = QStringList(name);}
|
void setLogSection(QString name) {m_loglist = QStringList(name);}
|
||||||
void setLogSection(QStringList name) { m_loglist = name; }
|
void setLogSection(QStringList name) { m_loglist = name; }
|
||||||
void setLogVersion(QString v) { m_verlist = QStringList(v); qDebug() << m_verlist;}
|
void setLogVersion(QString v) { m_verlist = QStringList(v); qDebug() << m_verlist;}
|
||||||
|
@ -47,6 +46,7 @@ public:
|
||||||
void setUnzip(bool i) { m_unzip = i; }
|
void setUnzip(bool i) { m_unzip = i; }
|
||||||
void setTarget(QString t) { m_target = t; }
|
void setTarget(QString t) { m_target = t; }
|
||||||
void setCache(QDir c) { m_cache = c; };
|
void setCache(QDir c) { m_cache = c; };
|
||||||
|
void setCache(bool c) { m_usecache = c; };
|
||||||
void setCache(QString c) { m_cache = QDir(c);}
|
void setCache(QString c) { m_cache = QDir(c);}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -63,11 +63,11 @@ private:
|
||||||
void installSingle(ProgressloggerInterface *dp);
|
void installSingle(ProgressloggerInterface *dp);
|
||||||
QString m_url, m_file, m_mountpoint, m_logsection, m_logver;
|
QString m_url, m_file, m_mountpoint, m_logsection, m_logver;
|
||||||
QStringList m_urllist, m_loglist, m_verlist;
|
QStringList m_urllist, m_loglist, m_verlist;
|
||||||
QUrl m_proxy;
|
|
||||||
bool m_unzip;
|
bool m_unzip;
|
||||||
QString m_target;
|
QString m_target;
|
||||||
int runner;
|
int runner;
|
||||||
QDir m_cache;
|
QDir m_cache;
|
||||||
|
bool m_usecache;
|
||||||
|
|
||||||
HttpGet *getter;
|
HttpGet *getter;
|
||||||
QTemporaryFile *downloadFile;
|
QTemporaryFile *downloadFile;
|
||||||
|
|
|
@ -56,8 +56,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
|
||||||
settings->open();
|
settings->open();
|
||||||
|
|
||||||
// manual tab
|
// manual tab
|
||||||
updateManual();
|
updateSettings();
|
||||||
updateDevice();
|
|
||||||
ui.radioPdf->setChecked(true);
|
ui.radioPdf->setChecked(true);
|
||||||
|
|
||||||
// info tab
|
// info tab
|
||||||
|
@ -132,9 +131,10 @@ void RbUtilQt::downloadInfo()
|
||||||
connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
||||||
connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
|
connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
|
||||||
connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort()));
|
connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort()));
|
||||||
daily->setProxy(proxy());
|
|
||||||
if(settings->cacheOffline())
|
if(settings->cacheOffline())
|
||||||
daily->setCache(settings->cachePath());
|
daily->setCache(true);
|
||||||
|
else
|
||||||
|
daily->setCache(false);
|
||||||
qDebug() << "downloading build info";
|
qDebug() << "downloading build info";
|
||||||
daily->setFile(&buildInfo);
|
daily->setFile(&buildInfo);
|
||||||
daily->getFile(QUrl(settings->serverConfUrl()));
|
daily->getFile(QUrl(settings->serverConfUrl()));
|
||||||
|
@ -159,9 +159,8 @@ void RbUtilQt::downloadDone(bool error)
|
||||||
connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool)));
|
connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool)));
|
||||||
connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
|
connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
|
||||||
connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort()));
|
connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort()));
|
||||||
bleeding->setProxy(proxy());
|
|
||||||
if(settings->cacheOffline())
|
if(settings->cacheOffline())
|
||||||
bleeding->setCache(settings->cachePath());
|
bleeding->setCache(true);
|
||||||
bleeding->setFile(&bleedingInfo);
|
bleeding->setFile(&bleedingInfo);
|
||||||
bleeding->getFile(QUrl(settings->bleedingInfo()));
|
bleeding->getFile(QUrl(settings->bleedingInfo()));
|
||||||
|
|
||||||
|
@ -252,6 +251,13 @@ void RbUtilQt::updateSettings()
|
||||||
qDebug() << "updateSettings()";
|
qDebug() << "updateSettings()";
|
||||||
updateDevice();
|
updateDevice();
|
||||||
updateManual();
|
updateManual();
|
||||||
|
if(settings->proxyType() == "system") {
|
||||||
|
HttpGet::setGlobalProxy(systemProxy());
|
||||||
|
}
|
||||||
|
else if(settings->proxyType() == "manual") {
|
||||||
|
HttpGet::setGlobalProxy(settings->proxy());
|
||||||
|
}
|
||||||
|
HttpGet::setGlobalCache(settings->cachePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -452,11 +458,10 @@ bool RbUtilQt::installAuto()
|
||||||
|
|
||||||
ZipInstaller* installer = new ZipInstaller(this);
|
ZipInstaller* installer = new ZipInstaller(this);
|
||||||
installer->setUrl(file);
|
installer->setUrl(file);
|
||||||
installer->setProxy(proxy());
|
|
||||||
installer->setLogSection("Rockbox (Base)");
|
installer->setLogSection("Rockbox (Base)");
|
||||||
installer->setLogVersion(myversion);
|
installer->setLogVersion(myversion);
|
||||||
if(!settings->cacheDisabled())
|
if(!settings->cacheDisabled())
|
||||||
installer->setCache(settings->cachePath());
|
installer->setCache(true);
|
||||||
installer->setMountPoint(settings->mountpoint());
|
installer->setMountPoint(settings->mountpoint());
|
||||||
installer->install(logger);
|
installer->install(logger);
|
||||||
|
|
||||||
|
@ -469,7 +474,6 @@ void RbUtilQt::install()
|
||||||
{
|
{
|
||||||
Install *installWindow = new Install(this);
|
Install *installWindow = new Install(this);
|
||||||
installWindow->setSettings(settings);
|
installWindow->setSettings(settings);
|
||||||
installWindow->setProxy(proxy());
|
|
||||||
|
|
||||||
buildInfo.open();
|
buildInfo.open();
|
||||||
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
|
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
|
||||||
|
@ -516,7 +520,6 @@ void RbUtilQt::installBootloader()
|
||||||
|
|
||||||
blinstaller->setMountPoint(settings->mountpoint());
|
blinstaller->setMountPoint(settings->mountpoint());
|
||||||
|
|
||||||
blinstaller->setProxy(proxy());
|
|
||||||
blinstaller->setDevice(platform);
|
blinstaller->setDevice(platform);
|
||||||
blinstaller->setBootloaderMethod(settings->curBootloaderMethod());
|
blinstaller->setBootloaderMethod(settings->curBootloaderMethod());
|
||||||
blinstaller->setBootloaderName(settings->curBootloaderName());
|
blinstaller->setBootloaderName(settings->curBootloaderName());
|
||||||
|
@ -606,12 +609,11 @@ void RbUtilQt::installFonts()
|
||||||
installer = new ZipInstaller(this);
|
installer = new ZipInstaller(this);
|
||||||
|
|
||||||
installer->setUrl(settings->fontUrl());
|
installer->setUrl(settings->fontUrl());
|
||||||
installer->setProxy(proxy());
|
|
||||||
installer->setLogSection("Fonts");
|
installer->setLogSection("Fonts");
|
||||||
installer->setLogVersion(versmap.value("arch_date"));
|
installer->setLogVersion(versmap.value("arch_date"));
|
||||||
installer->setMountPoint(settings->mountpoint());
|
installer->setMountPoint(settings->mountpoint());
|
||||||
if(!settings->cacheDisabled())
|
if(!settings->cacheDisabled())
|
||||||
installer->setCache(settings->cachePath());
|
installer->setCache(true);
|
||||||
installer->install(logger);
|
installer->install(logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,14 +638,13 @@ void RbUtilQt::installVoice()
|
||||||
versmap.value("arch_date") + "-english.voice";
|
versmap.value("arch_date") + "-english.voice";
|
||||||
qDebug() << voiceurl;
|
qDebug() << voiceurl;
|
||||||
|
|
||||||
installer->setProxy(proxy());
|
|
||||||
installer->setUrl(voiceurl);
|
installer->setUrl(voiceurl);
|
||||||
installer->setLogSection("Voice");
|
installer->setLogSection("Voice");
|
||||||
installer->setLogVersion(versmap.value("arch_date"));
|
installer->setLogVersion(versmap.value("arch_date"));
|
||||||
installer->setMountPoint(settings->mountpoint());
|
installer->setMountPoint(settings->mountpoint());
|
||||||
installer->setTarget("/.rockbox/langs/english.voice");
|
installer->setTarget("/.rockbox/langs/english.voice");
|
||||||
if(!settings->cacheDisabled())
|
if(!settings->cacheDisabled())
|
||||||
installer->setCache(settings->cachePath());
|
installer->setCache(true);
|
||||||
installer->install(logger);
|
installer->install(logger);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -684,12 +685,11 @@ void RbUtilQt::installDoom()
|
||||||
installer = new ZipInstaller(this);
|
installer = new ZipInstaller(this);
|
||||||
|
|
||||||
installer->setUrl(settings->doomUrl());
|
installer->setUrl(settings->doomUrl());
|
||||||
installer->setProxy(proxy());
|
|
||||||
installer->setLogSection("Game Addons");
|
installer->setLogSection("Game Addons");
|
||||||
installer->setLogVersion(versmap.value("arch_date"));
|
installer->setLogVersion(versmap.value("arch_date"));
|
||||||
installer->setMountPoint(settings->mountpoint());
|
installer->setMountPoint(settings->mountpoint());
|
||||||
if(!settings->cacheDisabled())
|
if(!settings->cacheDisabled())
|
||||||
installer->setCache(settings->cachePath());
|
installer->setCache(true);
|
||||||
installer->install(logger);
|
installer->install(logger);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -699,7 +699,6 @@ void RbUtilQt::installThemes()
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(true)) return;
|
||||||
ThemesInstallWindow* tw = new ThemesInstallWindow(this);
|
ThemesInstallWindow* tw = new ThemesInstallWindow(this);
|
||||||
tw->setSettings(settings);
|
tw->setSettings(settings);
|
||||||
tw->setProxy(proxy());
|
|
||||||
tw->setModal(true);
|
tw->setModal(true);
|
||||||
tw->show();
|
tw->show();
|
||||||
}
|
}
|
||||||
|
@ -720,7 +719,6 @@ void RbUtilQt::createVoiceFile(void)
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(true)) return;
|
||||||
CreateVoiceWindow *installWindow = new CreateVoiceWindow(this);
|
CreateVoiceWindow *installWindow = new CreateVoiceWindow(this);
|
||||||
installWindow->setSettings(settings);
|
installWindow->setSettings(settings);
|
||||||
installWindow->setProxy(proxy());
|
|
||||||
|
|
||||||
installWindow->show();
|
installWindow->show();
|
||||||
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
|
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
|
||||||
|
@ -747,7 +745,6 @@ void RbUtilQt::uninstallBootloader(void)
|
||||||
logger->show();
|
logger->show();
|
||||||
|
|
||||||
BootloaderInstaller blinstaller(this);
|
BootloaderInstaller blinstaller(this);
|
||||||
blinstaller.setProxy(proxy());
|
|
||||||
blinstaller.setMountPoint(settings->mountpoint());
|
blinstaller.setMountPoint(settings->mountpoint());
|
||||||
blinstaller.setDevice(settings->curPlatform());
|
blinstaller.setDevice(settings->curPlatform());
|
||||||
blinstaller.setBootloaderMethod(settings->curBootloaderMethod());
|
blinstaller.setBootloaderMethod(settings->curBootloaderMethod());
|
||||||
|
@ -802,8 +799,7 @@ void RbUtilQt::downloadManual(void)
|
||||||
installer = new ZipInstaller(this);
|
installer = new ZipInstaller(this);
|
||||||
installer->setMountPoint(settings->mountpoint());
|
installer->setMountPoint(settings->mountpoint());
|
||||||
if(!settings->cacheDisabled())
|
if(!settings->cacheDisabled())
|
||||||
installer->setCache(settings->cachePath());
|
installer->setCache(true);
|
||||||
installer->setProxy(proxy());
|
|
||||||
installer->setLogSection(section);
|
installer->setLogSection(section);
|
||||||
installer->setLogVersion(date);
|
installer->setLogVersion(date);
|
||||||
installer->setUrl(manualurl);
|
installer->setUrl(manualurl);
|
||||||
|
|
|
@ -52,7 +52,7 @@ bool recRmdir( const QString &dirName )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Function to get the system proxy
|
//! @brief get system proxy value.
|
||||||
QUrl systemProxy(void)
|
QUrl systemProxy(void)
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX)
|
||||||
|
|
|
@ -90,7 +90,6 @@ bool VoiceFileCreator::createVoiceFile(ProgressloggerInterface* logger)
|
||||||
downloadFile->close();
|
downloadFile->close();
|
||||||
// get the real file.
|
// get the real file.
|
||||||
getter = new HttpGet(this);
|
getter = new HttpGet(this);
|
||||||
getter->setProxy(m_proxy);
|
|
||||||
getter->setFile(downloadFile);
|
getter->setFile(downloadFile);
|
||||||
getter->getFile(genlangUrl);
|
getter->getFile(genlangUrl);
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ public:
|
||||||
void setTargetId(int id){m_targetid = id;}
|
void setTargetId(int id){m_targetid = id;}
|
||||||
void setLang(QString name){m_lang =name;}
|
void setLang(QString name){m_lang =name;}
|
||||||
void setWavtrimThreshold(int th){m_wavtrimThreshold = th;}
|
void setWavtrimThreshold(int th){m_wavtrimThreshold = th;}
|
||||||
void setProxy(QUrl proxy){m_proxy = proxy;}
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void done(bool error);
|
void done(bool error);
|
||||||
|
@ -69,7 +68,6 @@ private:
|
||||||
RbSettings* settings;
|
RbSettings* settings;
|
||||||
HttpGet *getter;
|
HttpGet *getter;
|
||||||
|
|
||||||
QUrl m_proxy; //proxy
|
|
||||||
QString filename; //the temporary file
|
QString filename; //the temporary file
|
||||||
|
|
||||||
QString m_mountpoint; //mountpoint of the device
|
QString m_mountpoint; //mountpoint of the device
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue