mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
linux: respect http_proxy value for "system" proxy settings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14062 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
82373b246e
commit
d77a7eaaac
4 changed files with 90 additions and 26 deletions
|
|
@ -22,6 +22,10 @@
|
|||
#include "configure.h"
|
||||
#include "ui_configurefrm.h"
|
||||
|
||||
#ifdef __linux
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#define DEFAULT_LANG "English (builtin)"
|
||||
|
||||
Config::Config(QWidget *parent) : QDialog(parent)
|
||||
|
|
@ -33,9 +37,9 @@ Config::Config(QWidget *parent) : QDialog(parent)
|
|||
QRegExp validate("[0-9]*");
|
||||
proxyValidator->setRegExp(validate);
|
||||
ui.proxyPort->setValidator(proxyValidator);
|
||||
|
||||
ui.radioSystemProxy->setEnabled(false); // not implemented yet
|
||||
|
||||
#ifndef __linux
|
||||
ui.radioSystemProxy->setEnabled(false); // only on linux for now
|
||||
#endif
|
||||
// build language list and sort alphabetically
|
||||
QStringList langs = findLanguageFiles();
|
||||
for(int i = 0; i < langs.size(); ++i)
|
||||
|
|
@ -52,6 +56,7 @@ Config::Config(QWidget *parent) : QDialog(parent)
|
|||
connect(ui.buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
|
||||
connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(abort()));
|
||||
connect(ui.radioNoProxy, SIGNAL(toggled(bool)), this, SLOT(setNoProxy(bool)));
|
||||
connect(ui.radioSystemProxy, SIGNAL(toggled(bool)), this, SLOT(setSystemProxy(bool)));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -59,13 +64,13 @@ void Config::accept()
|
|||
{
|
||||
qDebug() << "Config::accept()";
|
||||
// proxy: save entered proxy values, not displayed.
|
||||
QUrl proxy;
|
||||
proxy.setScheme("http");
|
||||
proxy.setUserName(ui.proxyUser->text());
|
||||
proxy.setPassword(ui.proxyPass->text());
|
||||
proxy.setHost(ui.proxyHost->text());
|
||||
proxy.setPort(ui.proxyPort->text().toInt());
|
||||
|
||||
if(ui.radioManualProxy->isChecked()) {
|
||||
proxy.setScheme("http");
|
||||
proxy.setUserName(ui.proxyUser->text());
|
||||
proxy.setPassword(ui.proxyPass->text());
|
||||
proxy.setHost(ui.proxyHost->text());
|
||||
proxy.setPort(ui.proxyPort->text().toInt());
|
||||
}
|
||||
userSettings->setValue("defaults/proxy", proxy.toString());
|
||||
qDebug() << "new proxy:" << proxy;
|
||||
// proxy type
|
||||
|
|
@ -141,6 +146,39 @@ void Config::setNoProxy(bool checked)
|
|||
}
|
||||
|
||||
|
||||
void Config::setSystemProxy(bool checked)
|
||||
{
|
||||
bool i = !checked;
|
||||
ui.proxyPort->setEnabled(i);
|
||||
ui.proxyHost->setEnabled(i);
|
||||
ui.proxyUser->setEnabled(i);
|
||||
ui.proxyPass->setEnabled(i);
|
||||
if(checked) {
|
||||
// save values in input box
|
||||
proxy.setScheme("http");
|
||||
proxy.setUserName(ui.proxyUser->text());
|
||||
proxy.setPassword(ui.proxyPass->text());
|
||||
proxy.setHost(ui.proxyHost->text());
|
||||
proxy.setPort(ui.proxyPort->text().toInt());
|
||||
// show system values in input box
|
||||
#ifdef __linux
|
||||
QUrl envproxy = QUrl(getenv("http_proxy"));
|
||||
ui.proxyHost->setText(envproxy.host());
|
||||
ui.proxyPort->setText(QString("%1").arg(envproxy.port()));
|
||||
ui.proxyUser->setText(envproxy.userName());
|
||||
ui.proxyPass->setText(envproxy.password());
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
ui.proxyHost->setText(proxy.host());
|
||||
ui.proxyPort->setText(QString("%1").arg(proxy.port()));
|
||||
ui.proxyUser->setText(proxy.userName());
|
||||
ui.proxyPass->setText(proxy.password());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
QStringList Config::findLanguageFiles()
|
||||
{
|
||||
QDir dir(programPath + "/");
|
||||
|
|
|
|||
|
|
@ -45,9 +45,11 @@ class Config : public QDialog
|
|||
QMap<QString, QString> lang;
|
||||
QString language;
|
||||
QString programPath;
|
||||
QUrl proxy;
|
||||
|
||||
private slots:
|
||||
void setNoProxy(bool);
|
||||
void setSystemProxy(bool);
|
||||
void updateLanguage(void);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class Install : public QDialog
|
|||
void setDetailsStable(bool);
|
||||
void setDetailsArchived(bool);
|
||||
void done(bool);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@
|
|||
#include "installbootloader.h"
|
||||
#include "installzipwindow.h"
|
||||
|
||||
#ifdef __linux
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
|
||||
{
|
||||
QString programPath = qApp->arguments().at(0);
|
||||
|
|
@ -86,7 +90,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
|
|||
ui.buttonComplete->setEnabled(false);
|
||||
ui.buttonDetect->setEnabled(false);
|
||||
|
||||
initIpodpatcher();
|
||||
initIpodpatcher();
|
||||
downloadInfo();
|
||||
|
||||
}
|
||||
|
|
@ -100,6 +104,10 @@ void RbUtilQt::downloadInfo()
|
|||
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
|
||||
|
||||
qDebug() << "downloading build info";
|
||||
daily->setFile(&buildInfo);
|
||||
|
|
@ -218,6 +226,10 @@ void RbUtilQt::install()
|
|||
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->setMountPoint(userSettings->value("defaults/mountpoint").toString());
|
||||
|
||||
buildInfo.open();
|
||||
|
|
@ -243,6 +255,10 @@ void RbUtilQt::installBl()
|
|||
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->setMountPoint(userSettings->value("defaults/mountpoint").toString());
|
||||
|
||||
installWindow->show();
|
||||
|
|
@ -250,30 +266,38 @@ void RbUtilQt::installBl()
|
|||
|
||||
void RbUtilQt::installFonts()
|
||||
{
|
||||
InstallZipWindow* installWindow = new InstallZipWindow(this);
|
||||
installWindow->setUserSettings(userSettings);
|
||||
InstallZipWindow* installWindow = new InstallZipWindow(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->setMountPoint(userSettings->value("defaults/mountpoint").toString());
|
||||
installWindow->setLogSection("Fonts");
|
||||
installWindow->setUrl(devices->value("font_url").toString());
|
||||
installWindow->setWindowTitle("Font Installation");
|
||||
installWindow->show();
|
||||
|
||||
installWindow->setLogSection("Fonts");
|
||||
installWindow->setUrl(devices->value("font_url").toString());
|
||||
installWindow->setWindowTitle("Font Installation");
|
||||
installWindow->show();
|
||||
|
||||
}
|
||||
|
||||
void RbUtilQt::installDoom()
|
||||
{
|
||||
InstallZipWindow* installWindow = new InstallZipWindow(this);
|
||||
installWindow->setUserSettings(userSettings);
|
||||
InstallZipWindow* installWindow = new InstallZipWindow(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->setMountPoint(userSettings->value("defaults/mountpoint").toString());
|
||||
installWindow->setLogSection("Doom");
|
||||
installWindow->setUrl(devices->value("doom_url").toString());
|
||||
installWindow->setWindowTitle("Doom Installation");
|
||||
installWindow->show();
|
||||
|
||||
installWindow->setLogSection("Doom");
|
||||
installWindow->setUrl(devices->value("doom_url").toString());
|
||||
installWindow->setWindowTitle("Doom Installation");
|
||||
installWindow->show();
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue