/*------------------------------------------------------------------------------ -- This file is a part of the QLop Software -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -------------------------------------------------------------------------------*/ /*-- Author : Alexis Jeandet -- Mail : alexis.jeandet@member.fsf.org ----------------------------------------------------------------------------*/ #include "manualproxycfg_gui.h" #include "ui_manualproxycfg_gui.h" #include #include ManualProxyCFG_GUI::ManualProxyCFG_GUI(QWidget *parent) : QWidget(parent), ui(new Ui::ManualProxyCFG_GUI) { ui->setupUi(this); reloadConfig(); } ManualProxyCFG_GUI::~ManualProxyCFG_GUI() { delete ui; } void ManualProxyCFG_GUI::reloadConfig() { this->ui->httpHost->setText(QLopSettings::value(FileDownloader::self(),CFG_PROXY_HTTP_HOST_ENTRY,"").toString()); this->ui->httpPort->setText(QLopSettings::value(FileDownloader::self(),CFG_PROXY_HTTP_PORT_ENTRY,"").toString()); this->ui->httpsHost->setText(QLopSettings::value(FileDownloader::self(),CFG_PROXY_HTTPS_HOST_ENTRY,"").toString()); this->ui->httpsPort->setText(QLopSettings::value(FileDownloader::self(),CFG_PROXY_HTTPS_PORT_ENTRY,"").toString()); this->ui->ftpHost->setText(QLopSettings::value(FileDownloader::self(),CFG_PROXY_FTP_HOST_ENTRY,"").toString()); this->ui->ftpPort->setText(QLopSettings::value(FileDownloader::self(),CFG_PROXY_FTP_PORT_ENTRY,"").toString()); this->ui->socksHost->setText(QLopSettings::value(FileDownloader::self(),CFG_PROXY_SOCKS_HOST_ENTRY,"").toString()); this->ui->socksPort->setText(QLopSettings::value(FileDownloader::self(),CFG_PROXY_SOCKS_PORT_ENTRY,"").toString()); this->ui->IgnoreHosts->setText(QLopSettings::value(FileDownloader::self(),CFG_PROXY_IGNORE_HOSTS_ENTRY,"localhost, 127.0.0.0/8, ::1").toString()); } void ManualProxyCFG_GUI::saveConfig() { QLopSettings::setValue(FileDownloader::self(),CFG_PROXY_HTTP_HOST_ENTRY,this->ui->httpHost->text()); QLopSettings::setValue(FileDownloader::self(),CFG_PROXY_HTTP_PORT_ENTRY,this->ui->httpPort->text()); QLopSettings::setValue(FileDownloader::self(),CFG_PROXY_HTTPS_HOST_ENTRY,this->ui->httpsHost->text()); QLopSettings::setValue(FileDownloader::self(),CFG_PROXY_HTTPS_PORT_ENTRY,this->ui->httpsPort->text()); QLopSettings::setValue(FileDownloader::self(),CFG_PROXY_FTP_HOST_ENTRY,this->ui->ftpHost->text()); QLopSettings::setValue(FileDownloader::self(),CFG_PROXY_FTP_PORT_ENTRY,this->ui->ftpPort->text()); QLopSettings::setValue(FileDownloader::self(),CFG_PROXY_SOCKS_HOST_ENTRY,this->ui->socksHost->text()); QLopSettings::setValue(FileDownloader::self(),CFG_PROXY_SOCKS_PORT_ENTRY,this->ui->socksPort->text()); QLopSettings::setValue(FileDownloader::self(),CFG_PROXY_IGNORE_HOSTS_ENTRY,this->ui->IgnoreHosts->text()); } void ManualProxyCFG_GUI::changeEvent(QEvent *e) { QWidget::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: ui->retranslateUi(this); break; default: break; } }