with new proxy dialog

master
Marc Wäckerlin 16 years ago
parent 0d00344e30
commit 56c94548c0
  1. 3
      makefile.am
  2. 89
      proxyface/gui/proxy.hxx
  3. 214
      proxyface/gui/proxy.ui
  4. 21
      proxyface/qmake.pro

@ -1,4 +1,5 @@
nobase_include_HEADERS = autoproxy.hxx proxyface/unix.hxx proxyface/windoze.hxx
nobase_include_HEADERS = autoproxy.hxx proxyface/unix.hxx \
proxyface/windoze.hxx proxyface/gui/proxy.hxx
MAINTAINERCLEANFILES = configure makefile.in ltmain.sh missing \
aclocal.m4 install-sh

@ -0,0 +1,89 @@
/*! @file
@id $Id$
*/
// 1 2 3 4 5 6 7 8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
#ifndef PROXY_HXX
#define PROXY_HXX
#include <ui_proxy.h>
#include <QtGui/QDialog>
#include <QtGui/QPushButton>
#include <QtNetwork/QNetworkProxy>
#include <QtCore/QSettings>
#include <QtCore/QDebug>
class Proxy: public QDialog, private Ui::Proxy {
Q_OBJECT
public:
Proxy(QWidget* p=0): QDialog(p) {
setupUi(this);
QSettings s("SwissSign", "ProxySettings");
_type->setCurrentIndex(s.value("default-type", 0).toInt());
_url->setText(s.value("default-server", QString()).toString());
_port->setValue(s.value("default-port", 80).toInt());
accept();
}
public:
void acceptValues() {
QNetworkProxy::ProxyType type(QNetworkProxy::NoProxy);
switch (_type->currentIndex()) {
case 0: type=QNetworkProxy::HttpProxy; break;
case 1: type=QNetworkProxy::Socks5Proxy; break;
}
QNetworkProxy::setApplicationProxy
(QNetworkProxy(type, _url->text(), _port->value()));
qDebug()<<"Proxy:"
<<(QNetworkProxy::applicationProxy().type()
==QNetworkProxy::NoProxy
?trUtf8("Kein Proxy")
:QNetworkProxy::applicationProxy().type()
==QNetworkProxy::HttpProxy
?trUtf8("HTTP:")
:QNetworkProxy::applicationProxy().type()
==QNetworkProxy::Socks5Proxy
?trUtf8("Socks5Proxy:")
:trUtf8("System"))
<<(QNetworkProxy::applicationProxy().type()
==QNetworkProxy::NoProxy ||
QNetworkProxy::applicationProxy().type()
==QNetworkProxy::DefaultProxy
?QString()
:trUtf8("%1:%2", "proxy host/port")
.arg(QNetworkProxy::applicationProxy().hostName())
.arg(QNetworkProxy::applicationProxy().port()));
}
public Q_SLOTS:
void on__save_clicked(bool=false) {
s.setValue("default-type", _type->currentIndex());
s.setValue("default-server", _url->text());
s.setValue("default-port", _port->value());
acceptValues();
}
void on__clear_clicked(bool=false) {
s.clear();
_type->setCurrentIndex(0);
_url->setText("");
_port->setValue(80);
acceptValues();
}
virtual void accept() {
acceptValues();
QDialog::accept();
}
};
#endif

@ -0,0 +1,214 @@
<ui version="4.0" >
<class>Proxy</class>
<widget class="QDialog" name="Proxy" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>486</width>
<height>340</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<string>Proxy Konfiguration</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>Proxy Konfiguration</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QWidget" native="1" name="widget" >
<property name="enabled" >
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Typ:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="_type" >
<item>
<property name="text" >
<string>direkt oder automatisch</string>
</property>
</item>
<item>
<property name="text" >
<string>HTTP</string>
</property>
</item>
<item>
<property name="text" >
<string>Socks5</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_14" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>URL:</string>
</property>
<property name="buddy" >
<cstring>_url</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="_url" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_15" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Port:</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QSpinBox" name="_port" >
<property name="maximum" >
<number>10000</number>
</property>
<property name="value" >
<number>80</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Einstellungen lokal speichern</string>
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
<widget class="QPushButton" name="_save" >
<property name="text" >
<string>Speichern</string>
</property>
</widget>
</item>
<item rowspan="2" row="0" column="1" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Wenn Sie die Einstellungen speichern, werden sie auf diesem Computer in Ihrem Profil abgelegt.</string>
</property>
<property name="textFormat" >
<enum>Qt::PlainText</enum>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QPushButton" name="_clear" >
<property name="text" >
<string>Löschen</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="_buttons" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>_buttons</sender>
<signal>accepted()</signal>
<receiver>Proxy</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>338</x>
<y>752</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>_buttons</sender>
<signal>rejected()</signal>
<receiver>Proxy</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>406</x>
<y>752</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -0,0 +1,21 @@
win32 {
QMAKE_INCDIR += ${HOME}/.wine/drive_c/MicrosoftSDK/include
QMAKE_LIBS += winhttp.a
}
unix {
QMAKE_LIBS += proxy dl
}
macx {
QMAKE_LIBS += proxy dl
QMAKE_INCDIR += /opt/local/include
QMAKE_LIBDIR += /opt/local/lib
CONFIG += x86
}
FORMS = proxyface/gui/proxy.ui
HEADERS = proxyface/unix.hxx proxyface/windoze.hxx \
proxyface/gui/proxy.hxx \
autoproxy.hxx
CONFIG += release
QT += network
TEMPLATE = lib
TARGET = proxyface
Loading…
Cancel
Save