diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2008-03-05 21:12:24 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2008-03-05 21:12:24 +0000 |
commit | 5a75184c4abfd2c8fa2a3ee705b94fc800d7b918 (patch) | |
tree | dcbb9529aafc259fd8922b471c8ff537bb48a8fe /rbutil/rbutilqt/rbutilqt.cpp | |
parent | 0def1dd23cf1990536122d35ed040173ddaa06ba (diff) | |
download | rockbox-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
Diffstat (limited to 'rbutil/rbutilqt/rbutilqt.cpp')
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 40 |
1 files changed, 18 insertions, 22 deletions
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); |