summaryrefslogtreecommitdiffstats
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2007-08-26 11:31:55 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2007-08-26 11:31:55 +0000
commitb6b10837f286a2e9948191c413ad2e7cda7df8e7 (patch)
treecf83540480a1aba0f5321d6283a78ec78da57ea7 /rbutil
parent12f466d999be50066abbd4b268b817aacd5b7b77 (diff)
downloadrockbox-b6b10837f286a2e9948191c413ad2e7cda7df8e7.tar.gz
rockbox-b6b10837f286a2e9948191c413ad2e7cda7df8e7.zip
simplify setting of proxy value.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14459 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp74
-rw-r--r--rbutil/rbutilqt/rbutilqt.h1
2 files changed, 22 insertions, 53 deletions
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 3b84c83c39..a0dc521a69 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -110,12 +110,7 @@ void RbUtilQt::downloadInfo()
daily = new HttpGet(this);
connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
- if(userSettings->value("defaults/proxytype") == "manual")
- daily->setProxy(QUrl(userSettings->value("defaults/proxy").toString()));
-#ifdef __linux
- else if(userSettings->value("defaults/proxytype") == "system")
- daily->setProxy(QUrl(getenv("http_proxy")));
-#endif
+ daily->setProxy(proxy());
qDebug() << "downloading build info";
daily->setFile(&buildInfo);
@@ -260,12 +255,7 @@ void RbUtilQt::install()
Install *installWindow = new Install(this);
installWindow->setUserSettings(userSettings);
installWindow->setDeviceSettings(devices);
- if(userSettings->value("defaults/proxytype") == "manual")
- installWindow->setProxy(QUrl(userSettings->value("defaults/proxy").toString()));
-#ifdef __linux
- else if(userSettings->value("defaults/proxytype") == "system")
- installWindow->setProxy(QUrl(getenv("http_proxy")));
-#endif
+ installWindow->setProxy(proxy());
buildInfo.open();
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
@@ -331,13 +321,7 @@ void RbUtilQt::installBl()
blinstaller->setMountPoint(userSettings->value("defaults/mountpoint").toString());
- if(userSettings->value("defaults/proxytype") == "manual")
- 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->setProxy(proxy());
blinstaller->setDevice(platform);
blinstaller->setBootloaderMethod(devices->value(platform + "/bootloadermethod").toString());
blinstaller->setBootloaderName(devices->value(platform + "/bootloadername").toString());
@@ -361,15 +345,9 @@ void RbUtilQt::installFonts()
// create zip installer
installer = new ZipInstaller(this);
-
+
installer->setUrl(devices->value("font_url").toString());
- 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->setLogSection("Fonts");
installer->setMountPoint(userSettings->value("defaults/mountpoint").toString());
installer->install(logger);
@@ -390,7 +368,7 @@ void RbUtilQt::installVoice()
// create zip installer
installer = new ZipInstaller(this);
installer->setUnzip(false);
- buildInfo.open();
+buildInfo.open();
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
buildInfo.close();
QString datestring = info.value("dailies/date").toString();
@@ -399,13 +377,8 @@ void RbUtilQt::installVoice()
userSettings->value("defaults/platform").toString() + "-" +
datestring + "-english.voice";
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->setLogSection("Voice");
installer->setMountPoint(userSettings->value("defaults/mountpoint").toString());
@@ -429,13 +402,7 @@ void RbUtilQt::installDoom()
installer = new ZipInstaller(this);
installer->setUrl(devices->value("doom_url").toString());
- 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->setLogSection("GameAddons");
installer->setMountPoint(userSettings->value("defaults/mountpoint").toString());
installer->install(logger);
@@ -450,12 +417,7 @@ void RbUtilQt::installThemes()
ThemesInstallWindow* tw = new ThemesInstallWindow(this);
tw->setDeviceSettings(devices);
tw->setUserSettings(userSettings);
- if(userSettings->value("defaults/proxytype") == "manual")
- 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->setProxy(proxy());
tw->setModal(true);
tw->show();
}
@@ -536,12 +498,7 @@ void RbUtilQt::downloadManual(void)
logger->show();
installer = new ZipInstaller(this);
installer->setMountPoint(userSettings->value("defaults/mountpoint").toString());
- 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->setLogSection(section);
installer->setUrl(manualurl);
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("");
+}
+
diff --git a/rbutil/rbutilqt/rbutilqt.h b/rbutil/rbutilqt/rbutilqt.h
index 0fb2bc915e..1a6dda8259 100644
--- a/rbutil/rbutilqt/rbutilqt.h
+++ b/rbutil/rbutilqt/rbutilqt.h
@@ -51,6 +51,7 @@ class RbUtilQt : public QMainWindow
ProgressLoggerGui *logger;
ZipInstaller *installer;
BootloaderInstaller* blinstaller;
+ QUrl proxy(void);
private slots:
void about(void);