| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2012 Ricardo Villalba <[email protected]>
|
|---|
| 3 |
|
|---|
| 4 | This program is free software; you can redistribute it and/or modify
|
|---|
| 5 | it under the terms of the GNU General Public License as published by
|
|---|
| 6 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 7 | (at your option) any later version.
|
|---|
| 8 |
|
|---|
| 9 | This program is distributed in the hope that it will be useful,
|
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | GNU General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU General Public License
|
|---|
| 15 | along with this program; if not, write to the Free Software
|
|---|
| 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 17 | */
|
|---|
| 18 |
|
|---|
| 19 | #include "findsubtitlesconfigdialog.h"
|
|---|
| 20 | #include <QNetworkProxy>
|
|---|
| 21 |
|
|---|
| 22 | FindSubtitlesConfigDialog::FindSubtitlesConfigDialog( QWidget* parent, Qt::WindowFlags f )
|
|---|
| 23 | : QDialog(parent, f)
|
|---|
| 24 | {
|
|---|
| 25 | setupUi(this);
|
|---|
| 26 |
|
|---|
| 27 | proxy_type_combo->addItem( tr("Http"), QNetworkProxy::HttpProxy);
|
|---|
| 28 | proxy_type_combo->addItem( tr("Socks5"), QNetworkProxy::Socks5Proxy);
|
|---|
| 29 |
|
|---|
| 30 | use_proxy_check->setWhatsThis( tr("Enable/disable the use of the proxy.") );
|
|---|
| 31 | proxy_hostname_edit->setWhatsThis( tr("The host name of the proxy.") );
|
|---|
| 32 | proxy_port_spin->setWhatsThis( tr("The port of the proxy.") );
|
|---|
| 33 | proxy_username_edit->setWhatsThis( tr("If the proxy requires authentication, this sets the username.") );
|
|---|
| 34 | proxy_password_edit->setWhatsThis(
|
|---|
| 35 | tr("The password for the proxy. <b>Warning:</b> the password will be saved "
|
|---|
| 36 | "as plain text in the configuration file.") );
|
|---|
| 37 | proxy_type_combo->setWhatsThis( tr("Select the proxy type to be used.") );
|
|---|
| 38 |
|
|---|
| 39 | layout()->setSizeConstraint(QLayout::SetFixedSize);
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | FindSubtitlesConfigDialog::~FindSubtitlesConfigDialog() {
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | void FindSubtitlesConfigDialog::setServer(QString server) {
|
|---|
| 46 | server_edit->setText(server);
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | QString FindSubtitlesConfigDialog::server() {
|
|---|
| 50 | return server_edit->text();
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | void FindSubtitlesConfigDialog::setUseProxy(bool b) {
|
|---|
| 54 | use_proxy_check->setChecked(b);
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | bool FindSubtitlesConfigDialog::useProxy() {
|
|---|
| 58 | return use_proxy_check->isChecked();
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | void FindSubtitlesConfigDialog::setProxyHostname(QString host) {
|
|---|
| 62 | proxy_hostname_edit->setText(host);
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | QString FindSubtitlesConfigDialog::proxyHostname() {
|
|---|
| 66 | return proxy_hostname_edit->text();
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 | void FindSubtitlesConfigDialog::setProxyPort(int port) {
|
|---|
| 70 | proxy_port_spin->setValue(port);
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | int FindSubtitlesConfigDialog::proxyPort() {
|
|---|
| 74 | return proxy_port_spin->value();
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | void FindSubtitlesConfigDialog::setProxyUsername(QString username) {
|
|---|
| 78 | proxy_username_edit->setText(username);
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | QString FindSubtitlesConfigDialog::proxyUsername() {
|
|---|
| 82 | return proxy_username_edit->text();
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 | void FindSubtitlesConfigDialog::setProxyPassword(QString password) {
|
|---|
| 86 | proxy_password_edit->setText(password);
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | QString FindSubtitlesConfigDialog::proxyPassword() {
|
|---|
| 90 | return proxy_password_edit->text();
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 | void FindSubtitlesConfigDialog::setProxyType(int type) {
|
|---|
| 94 | int index = proxy_type_combo->findData(type);
|
|---|
| 95 | if (index == -1) index = 0;
|
|---|
| 96 | proxy_type_combo->setCurrentIndex(index);
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|
| 99 | int FindSubtitlesConfigDialog::proxyType() {
|
|---|
| 100 | int index = proxy_type_combo->currentIndex();
|
|---|
| 101 | return proxy_type_combo->itemData(index).toInt();
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | #include "moc_findsubtitlesconfigdialog.cpp"
|
|---|