| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2016 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 | #ifdef FS_USE_PROXY
|
|---|
| 28 | proxy_type_combo->addItem( tr("HTTP"), QNetworkProxy::HttpProxy);
|
|---|
| 29 | proxy_type_combo->addItem( tr("SOCKS5"), QNetworkProxy::Socks5Proxy);
|
|---|
| 30 |
|
|---|
| 31 | use_proxy_check->setWhatsThis( tr("Enable/disable the use of the proxy.") );
|
|---|
| 32 | proxy_hostname_edit->setWhatsThis( tr("The host name of the proxy.") );
|
|---|
| 33 | proxy_port_spin->setWhatsThis( tr("The port of the proxy.") );
|
|---|
| 34 | proxy_username_edit->setWhatsThis( tr("If the proxy requires authentication, this sets the username.") );
|
|---|
| 35 | proxy_password_edit->setWhatsThis(
|
|---|
| 36 | tr("The password for the proxy. <b>Warning:</b> the password will be saved "
|
|---|
| 37 | "as plain text in the configuration file.") );
|
|---|
| 38 | proxy_type_combo->setWhatsThis( tr("Select the proxy type to be used.") );
|
|---|
| 39 | #else
|
|---|
| 40 | proxy_group->hide();
|
|---|
| 41 | #endif
|
|---|
| 42 |
|
|---|
| 43 | #ifndef OS_SEARCH_WORKAROUND
|
|---|
| 44 | retries_label->hide();
|
|---|
| 45 | retries_spin->hide();
|
|---|
| 46 | #endif
|
|---|
| 47 |
|
|---|
| 48 | #ifndef DOWNLOAD_SUBS
|
|---|
| 49 | misc_group->hide();
|
|---|
| 50 | #endif
|
|---|
| 51 |
|
|---|
| 52 | layout()->setSizeConstraint(QLayout::SetFixedSize);
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | FindSubtitlesConfigDialog::~FindSubtitlesConfigDialog() {
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | void FindSubtitlesConfigDialog::setServer(QString server) {
|
|---|
| 59 | server_edit->setText(server);
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | QString FindSubtitlesConfigDialog::server() {
|
|---|
| 63 | return server_edit->text();
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | #ifdef OS_SEARCH_WORKAROUND
|
|---|
| 67 | void FindSubtitlesConfigDialog::setRetries(int n) {
|
|---|
| 68 | retries_spin->setValue(n);
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|
| 71 | int FindSubtitlesConfigDialog::retries() {
|
|---|
| 72 | return retries_spin->value();
|
|---|
| 73 | }
|
|---|
| 74 | #endif
|
|---|
| 75 |
|
|---|
| 76 | #ifdef DOWNLOAD_SUBS
|
|---|
| 77 | void FindSubtitlesConfigDialog::setAppendLang(bool b) {
|
|---|
| 78 | addlang_check->setChecked(b);
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | bool FindSubtitlesConfigDialog::appendLang() {
|
|---|
| 82 | return addlang_check->isChecked();
|
|---|
| 83 | }
|
|---|
| 84 | #endif
|
|---|
| 85 |
|
|---|
| 86 | #ifdef FS_USE_PROXY
|
|---|
| 87 | void FindSubtitlesConfigDialog::setUseProxy(bool b) {
|
|---|
| 88 | use_proxy_check->setChecked(b);
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | bool FindSubtitlesConfigDialog::useProxy() {
|
|---|
| 92 | return use_proxy_check->isChecked();
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| 95 | void FindSubtitlesConfigDialog::setProxyHostname(QString host) {
|
|---|
| 96 | proxy_hostname_edit->setText(host);
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|
| 99 | QString FindSubtitlesConfigDialog::proxyHostname() {
|
|---|
| 100 | return proxy_hostname_edit->text();
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 | void FindSubtitlesConfigDialog::setProxyPort(int port) {
|
|---|
| 104 | proxy_port_spin->setValue(port);
|
|---|
| 105 | }
|
|---|
| 106 |
|
|---|
| 107 | int FindSubtitlesConfigDialog::proxyPort() {
|
|---|
| 108 | return proxy_port_spin->value();
|
|---|
| 109 | }
|
|---|
| 110 |
|
|---|
| 111 | void FindSubtitlesConfigDialog::setProxyUsername(QString username) {
|
|---|
| 112 | proxy_username_edit->setText(username);
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|
| 115 | QString FindSubtitlesConfigDialog::proxyUsername() {
|
|---|
| 116 | return proxy_username_edit->text();
|
|---|
| 117 | }
|
|---|
| 118 |
|
|---|
| 119 | void FindSubtitlesConfigDialog::setProxyPassword(QString password) {
|
|---|
| 120 | proxy_password_edit->setText(password);
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | QString FindSubtitlesConfigDialog::proxyPassword() {
|
|---|
| 124 | return proxy_password_edit->text();
|
|---|
| 125 | }
|
|---|
| 126 |
|
|---|
| 127 | void FindSubtitlesConfigDialog::setProxyType(int type) {
|
|---|
| 128 | int index = proxy_type_combo->findData(type);
|
|---|
| 129 | if (index == -1) index = 0;
|
|---|
| 130 | proxy_type_combo->setCurrentIndex(index);
|
|---|
| 131 | }
|
|---|
| 132 |
|
|---|
| 133 | int FindSubtitlesConfigDialog::proxyType() {
|
|---|
| 134 | int index = proxy_type_combo->currentIndex();
|
|---|
| 135 | return proxy_type_combo->itemData(index).toInt();
|
|---|
| 136 | }
|
|---|
| 137 | #endif
|
|---|
| 138 |
|
|---|
| 139 | #include "moc_findsubtitlesconfigdialog.cpp"
|
|---|