simplify setting of proxy value.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14459 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2007-08-26 11:31:55 +00:00
parent 12f466d999
commit b6b10837f2
2 changed files with 22 additions and 53 deletions

View file

@ -110,12 +110,7 @@ void RbUtilQt::downloadInfo()
daily = new HttpGet(this); daily = new HttpGet(this);
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)));
if(userSettings->value("defaults/proxytype") == "manual") daily->setProxy(proxy());
daily->setProxy(QUrl(userSettings->value("defaults/proxy").toString()));
#ifdef __linux
else if(userSettings->value("defaults/proxytype") == "system")
daily->setProxy(QUrl(getenv("http_proxy")));
#endif
qDebug() << "downloading build info"; qDebug() << "downloading build info";
daily->setFile(&buildInfo); daily->setFile(&buildInfo);
@ -260,12 +255,7 @@ void RbUtilQt::install()
Install *installWindow = new Install(this); Install *installWindow = new Install(this);
installWindow->setUserSettings(userSettings); installWindow->setUserSettings(userSettings);
installWindow->setDeviceSettings(devices); installWindow->setDeviceSettings(devices);
if(userSettings->value("defaults/proxytype") == "manual") installWindow->setProxy(proxy());
installWindow->setProxy(QUrl(userSettings->value("defaults/proxy").toString()));
#ifdef __linux
else if(userSettings->value("defaults/proxytype") == "system")
installWindow->setProxy(QUrl(getenv("http_proxy")));
#endif
buildInfo.open(); buildInfo.open();
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
@ -331,13 +321,7 @@ void RbUtilQt::installBl()
blinstaller->setMountPoint(userSettings->value("defaults/mountpoint").toString()); blinstaller->setMountPoint(userSettings->value("defaults/mountpoint").toString());
if(userSettings->value("defaults/proxytype") == "manual") blinstaller->setProxy(proxy());
blinstaller->setProxy(QUrl(userSettings->value("defaults/proxy").toString()));
#ifdef __linux
else if(userSettings->value("defaults/proxytype") == "system")
blinstaller->setProxy(QUrl(getenv("http_proxy")));
#endif
blinstaller->setDevice(platform); blinstaller->setDevice(platform);
blinstaller->setBootloaderMethod(devices->value(platform + "/bootloadermethod").toString()); blinstaller->setBootloaderMethod(devices->value(platform + "/bootloadermethod").toString());
blinstaller->setBootloaderName(devices->value(platform + "/bootloadername").toString()); blinstaller->setBootloaderName(devices->value(platform + "/bootloadername").toString());
@ -363,13 +347,7 @@ void RbUtilQt::installFonts()
installer = new ZipInstaller(this); installer = new ZipInstaller(this);
installer->setUrl(devices->value("font_url").toString()); installer->setUrl(devices->value("font_url").toString());
if(userSettings->value("defaults/proxytype") == "manual") installer->setProxy(proxy());
installer->setProxy(QUrl(userSettings->value("defaults/proxy").toString()));
#ifdef __linux
else if(userSettings->value("defaults/proxytype") == "system")
installer->setProxy(QUrl(getenv("http_proxy")));
#endif
installer->setLogSection("Fonts"); installer->setLogSection("Fonts");
installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); installer->setMountPoint(userSettings->value("defaults/mountpoint").toString());
installer->install(logger); installer->install(logger);
@ -390,7 +368,7 @@ void RbUtilQt::installVoice()
// create zip installer // create zip installer
installer = new ZipInstaller(this); installer = new ZipInstaller(this);
installer->setUnzip(false); installer->setUnzip(false);
buildInfo.open(); buildInfo.open();
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
buildInfo.close(); buildInfo.close();
QString datestring = info.value("dailies/date").toString(); QString datestring = info.value("dailies/date").toString();
@ -399,13 +377,8 @@ void RbUtilQt::installVoice()
userSettings->value("defaults/platform").toString() + "-" + userSettings->value("defaults/platform").toString() + "-" +
datestring + "-english.voice"; datestring + "-english.voice";
qDebug() << voiceurl; qDebug() << voiceurl;
if(userSettings->value("defaults/proxytype") == "manual")
installer->setProxy(QUrl(userSettings->value("defaults/proxy").toString()));
#ifdef __linux
else if(userSettings->value("defaults/proxytype") == "system")
installer->setProxy(QUrl(getenv("http_proxy")));
#endif
installer->setProxy(proxy());
installer->setUrl(voiceurl); installer->setUrl(voiceurl);
installer->setLogSection("Voice"); installer->setLogSection("Voice");
installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); installer->setMountPoint(userSettings->value("defaults/mountpoint").toString());
@ -429,13 +402,7 @@ void RbUtilQt::installDoom()
installer = new ZipInstaller(this); installer = new ZipInstaller(this);
installer->setUrl(devices->value("doom_url").toString()); installer->setUrl(devices->value("doom_url").toString());
if(userSettings->value("defaults/proxytype") == "manual") installer->setProxy(proxy());
installer->setProxy(QUrl(userSettings->value("defaults/proxy").toString()));
#ifdef __linux
else if(userSettings->value("defaults/proxytype") == "system")
installer->setProxy(QUrl(getenv("http_proxy")));
#endif
installer->setLogSection("GameAddons"); installer->setLogSection("GameAddons");
installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); installer->setMountPoint(userSettings->value("defaults/mountpoint").toString());
installer->install(logger); installer->install(logger);
@ -450,12 +417,7 @@ void RbUtilQt::installThemes()
ThemesInstallWindow* tw = new ThemesInstallWindow(this); ThemesInstallWindow* tw = new ThemesInstallWindow(this);
tw->setDeviceSettings(devices); tw->setDeviceSettings(devices);
tw->setUserSettings(userSettings); tw->setUserSettings(userSettings);
if(userSettings->value("defaults/proxytype") == "manual") tw->setProxy(proxy());
tw->setProxy(QUrl(userSettings->value("defaults/proxy").toString()));
#ifdef __linux
else if(userSettings->value("defaults/proxytype") == "system")
tw->setProxy(QUrl(getenv("http_proxy")));
#endif
tw->setModal(true); tw->setModal(true);
tw->show(); tw->show();
} }
@ -536,12 +498,7 @@ void RbUtilQt::downloadManual(void)
logger->show(); logger->show();
installer = new ZipInstaller(this); installer = new ZipInstaller(this);
installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); installer->setMountPoint(userSettings->value("defaults/mountpoint").toString());
if(userSettings->value("defaults/proxytype") == "manual") installer->setProxy(proxy());
installer->setProxy(QUrl(userSettings->value("defaults/proxy").toString()));
#ifdef __linux
else if(userSettings->value("defaults/proxytype") == "system")
installer->setProxy(QUrl(getenv("http_proxy")));
#endif
installer->setLogSection(section); installer->setLogSection(section);
installer->setUrl(manualurl); installer->setUrl(manualurl);
installer->setUnzip(false); installer->setUnzip(false);
@ -590,3 +547,14 @@ void RbUtilQt::installPortable(void)
} }
QUrl RbUtilQt::proxy()
{
if(userSettings->value("defaults/proxytype") == "manual")
return QUrl(userSettings->value("defaults/proxy").toString());
#ifdef __linux
else if(userSettings->value("defaults/proxytype") == "system")
return QUrl(getenv("http_proxy"));
#endif
return QUrl("");
}

View file

@ -51,6 +51,7 @@ class RbUtilQt : public QMainWindow
ProgressLoggerGui *logger; ProgressLoggerGui *logger;
ZipInstaller *installer; ZipInstaller *installer;
BootloaderInstaller* blinstaller; BootloaderInstaller* blinstaller;
QUrl proxy(void);
private slots: private slots:
void about(void); void about(void);