summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/configure.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2020-07-27 18:40:44 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2020-08-06 22:58:19 +0200
commit04d289fe02f3dbe35d53d73b0f3ad5ce84c7e23d (patch)
tree2b4ced5f729175b6138593d30ab373b90103b412 /rbutil/rbutilqt/configure.cpp
parentfeb028ac37ddd2db0408328d65154e5110bf331d (diff)
downloadrockbox-04d289fe02f3dbe35d53d73b0f3ad5ce84c7e23d.tar.gz
rockbox-04d289fe02f3dbe35d53d73b0f3ad5ce84c7e23d.tar.bz2
rockbox-04d289fe02f3dbe35d53d73b0f3ad5ce84c7e23d.zip
rbutil: Use SpinBox for Proxy port value.
No need to use a validator on a LineEdit, simply use a SpinBox and disable the up / down icons. Change-Id: Ie47c5929a071dc95ed9d6f28c2417fc6dd5323fe
Diffstat (limited to 'rbutil/rbutilqt/configure.cpp')
-rw-r--r--rbutil/rbutilqt/configure.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index bcb52304e4..cc8b0ff976 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -56,10 +56,6 @@ Config::Config(QWidget *parent,int index) : QDialog(parent)
ui.setupUi(this);
ui.tabConfiguration->setCurrentIndex(index);
ui.radioManualProxy->setChecked(true);
- QRegExpValidator *proxyValidator = new QRegExpValidator(this);
- QRegExp validate("[0-9]*");
- proxyValidator->setRegExp(validate);
- ui.proxyPort->setValidator(proxyValidator);
// build language list and sort alphabetically
QStringList langs = findLanguageFiles();
@@ -134,7 +130,7 @@ void Config::accept()
proxy.setUserName(ui.proxyUser->text());
proxy.setPassword(ui.proxyPass->text());
proxy.setHost(ui.proxyHost->text());
- proxy.setPort(ui.proxyPort->text().toInt());
+ proxy.setPort(ui.proxyPort->value());
}
// Encode the password using base64 before storing it to the configuration
@@ -253,9 +249,7 @@ void Config::setUserSettings()
QByteArray pw = QByteArray::fromBase64(proxy.password().toUtf8());
proxy.setPassword(pw);
- if(proxy.port() > 0)
- ui.proxyPort->setText(QString("%1").arg(proxy.port()));
- else ui.proxyPort->setText("");
+ ui.proxyPort->setValue(proxy.port());
ui.proxyHost->setText(proxy.host());
ui.proxyUser->setText(proxy.userName());
ui.proxyPass->setText(proxy.password());
@@ -512,13 +506,13 @@ void Config::setSystemProxy(bool checked)
proxy.setUserName(ui.proxyUser->text());
proxy.setPassword(ui.proxyPass->text());
proxy.setHost(ui.proxyHost->text());
- proxy.setPort(ui.proxyPort->text().toInt());
+ proxy.setPort(ui.proxyPort->value());
// show system values in input box
QUrl envproxy = System::systemProxy();
LOG_INFO() << "setting system proxy" << envproxy;
ui.proxyHost->setText(envproxy.host());
- ui.proxyPort->setText(QString("%1").arg(envproxy.port()));
+ ui.proxyPort->setValue(envproxy.port());
ui.proxyUser->setText(envproxy.userName());
ui.proxyPass->setText(envproxy.password());
@@ -543,9 +537,7 @@ void Config::setSystemProxy(bool checked)
}
else {
ui.proxyHost->setText(proxy.host());
- if(proxy.port() > 0)
- ui.proxyPort->setText(QString("%1").arg(proxy.port()));
- else ui.proxyPort->setText("");
+ ui.proxyPort->setValue(proxy.port());
ui.proxyUser->setText(proxy.userName());
ui.proxyPass->setText(proxy.password());
}