diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-07-27 18:40:44 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-08-06 22:58:19 +0200 |
commit | 04d289fe02f3dbe35d53d73b0f3ad5ce84c7e23d (patch) | |
tree | 2b4ced5f729175b6138593d30ab373b90103b412 | |
parent | feb028ac37ddd2db0408328d65154e5110bf331d (diff) | |
download | rockbox-04d289f.tar.gz rockbox-04d289f.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
-rw-r--r-- | rbutil/rbutilqt/configure.cpp | 18 | ||||
-rw-r--r-- | rbutil/rbutilqt/configurefrm.ui | 13 |
2 files changed, 15 insertions, 16 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()); } diff --git a/rbutil/rbutilqt/configurefrm.ui b/rbutil/rbutilqt/configurefrm.ui index b0111ac940..22536de461 100644 --- a/rbutil/rbutilqt/configurefrm.ui +++ b/rbutil/rbutilqt/configurefrm.ui @@ -223,9 +223,6 @@ <item row="2" column="1" colspan="2"> <widget class="QLineEdit" name="proxyUser"/> </item> - <item row="1" column="1" colspan="2"> - <widget class="QLineEdit" name="proxyPort"/> - </item> <item row="0" column="1" colspan="2"> <widget class="QLineEdit" name="proxyHost"> <property name="frame"> @@ -233,6 +230,16 @@ </property> </widget> </item> + <item row="1" column="1" colspan="2"> + <widget class="QSpinBox" name="proxyPort"> + <property name="buttonSymbols"> + <enum>QAbstractSpinBox::NoButtons</enum> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + </item> </layout> </widget> </item> |