Changeset a023fd2


Ignore:
Timestamp:
01/29/10 15:16:05 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
6645e1f
Parents:
5007fde
Message:

implemented 'proxy settings' dialog

  • user can secify proxy for network communication
Location:
src
Files:
5 added
6 edited

Legend:

Unmodified
Added
Removed
  • src/app/app.pro

    r5007fde ra023fd2  
    1717}
    1818
    19 SOURCES += main.cpp
     19HEADERS += appsettings.h
     20
     21SOURCES += main.cpp \
     22           appsettings.cpp
    2023
    2124RESOURCES += ../icons.qrc \
  • src/gui/gui.pro

    r5007fde ra023fd2  
    4545    conflictsdialog.ui \
    4646    tabcontainer.ui \
    47     mapwindow.ui
     47    mapwindow.ui \
     48    proxysettingsdialog.ui
    4849
    4950HEADERS += roomstabcontainer.h \
     
    6263    tabwidget.h \
    6364    tabcontainer.h \
    64     mapwindow.h
     65    mapwindow.h \
     66    proxysettingsdialog.h
    6567
    6668SOURCES += roomstabcontainer.cpp \
     
    7981    tabwidget.cpp \
    8082    tabcontainer.cpp \
    81     mapwindow.cpp
     83    mapwindow.cpp \
     84    proxysettingsdialog.cpp
    8285
    8386maemo {
  • src/gui/importschedulewidget.cpp

    r5007fde ra023fd2  
    22
    33#include <schedulexmlparser.h>
     4#include "proxysettingsdialog.h"
    45
    56#include <QDir>
     
    1011#include <QNetworkReply>
    1112#include <QDebug>
     13#include <appsettings.h>
    1214
    1315const QString SCHEDULE_URL = "http://fosdem.org/2010/schedule/xml";
     16
     17const QString PROXY_USERNAME;
     18const QString PROXY_PASSWD;
    1419
    1520ImportScheduleWidget::ImportScheduleWidget(QWidget *aParent)
     
    2934    connect(online, SIGNAL(clicked()), SLOT(downloadSchedule()));
    3035
     36    connect(proxySettings, SIGNAL(clicked()), SLOT(setupProxy()));
    3137    mNetworkAccessManager = new QNetworkAccessManager(this);
    3238    connect(mNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkQueryFinished(QNetworkReply*)));
     
    8187void ImportScheduleWidget::networkQueryFinished(QNetworkReply *aReply)
    8288{
    83     qDebug() << "ImportScheduleWidget::networkQueryFinished()";
    84 
    8589    if ( aReply->error() != QNetworkReply::NoError )
    8690    {
     
    9599void ImportScheduleWidget::downloadSchedule()
    96100{
    97     qDebug() << "downloading schedule";
    98 
    99101    QNetworkRequest request;
    100102    request.setUrl(QUrl(SCHEDULE_URL));
     
    107109    online->hide();
    108110    progressBar->show();
     111    proxySettings->hide();
    109112
    110113    int confId = mXmlParser->parseData(aData);
     
    113116    browse->show();
    114117    online->show();
     118    proxySettings->show();
    115119    importScheduleLabel->setText("Import schedule: ");
    116120
     
    118122}
    119123
     124void ImportScheduleWidget::setupProxy()
     125{
     126    ProxySettingsDialog dialog;
     127    dialog.exec();
     128
     129    qDebug() << "Setting-up proxy: " << AppSettings::proxyAddress() << ":" << AppSettings::proxyPort();
     130    QNetworkProxy proxy(
     131            AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy,
     132            AppSettings::proxyAddress(),
     133            AppSettings::proxyPort(),
     134            PROXY_USERNAME,
     135            PROXY_PASSWD);
     136    QNetworkProxy::setApplicationProxy(proxy);
     137
     138    mNetworkAccessManager->setProxy(QNetworkProxy::applicationProxy());
     139}
     140
  • src/gui/importschedulewidget.h

    r5007fde ra023fd2  
    2121        void networkQueryFinished(QNetworkReply *aReply);
    2222        void downloadSchedule();
     23        void setupProxy();
    2324    signals:
    2425        void scheduleImported(int confId);
  • src/gui/importschedulewidget.ui

    r5007fde ra023fd2  
    66    <x>0</x>
    77    <y>0</y>
    8     <width>634</width>
     8    <width>662</width>
    99    <height>66</height>
    1010   </rect>
     
    6969     </item>
    7070     <item>
     71      <widget class="QToolButton" name="proxySettings" >
     72       <property name="text" >
     73        <string>...</string>
     74       </property>
     75       <property name="autoRaise" >
     76        <bool>true</bool>
     77       </property>
     78      </widget>
     79     </item>
     80     <item>
    7181      <widget class="QPushButton" name="browse" >
    7282       <property name="sizePolicy" >
  • src/gui/mainwindow.cpp

    r5007fde ra023fd2  
    2222
    2323#include <tabcontainer.h>
    24 
    25 const QString PROXY_URL("192.168.0.252");
    26 const quint16 PROXY_PORT = 4040;
     24#include <appsettings.h>
     25
    2726const QString PROXY_USERNAME;
    2827const QString PROXY_PASSWD;
    29 const bool DIRECT_CONNECTION = false;
    3028
    3129MainWindow::MainWindow(int aEventId, QWidget *aParent)
     
    3432    setupUi(this);
    3533
    36     qDebug() << "Setting-up proxy: " << PROXY_URL << ":" << PROXY_PORT;
    37     QNetworkProxy proxy(DIRECT_CONNECTION ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy,
    38             PROXY_URL, PROXY_PORT, PROXY_USERNAME, PROXY_PASSWD);
     34    qDebug() << "Setting-up proxy: " << AppSettings::proxyAddress() << ":" << AppSettings::proxyPort();
     35    QNetworkProxy proxy(
     36            AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy,
     37            AppSettings::proxyAddress(),
     38            AppSettings::proxyPort(),
     39            PROXY_USERNAME,
     40            PROXY_PASSWD);
    3941    QNetworkProxy::setApplicationProxy(proxy);
    4042
Note: See TracChangeset for help on using the changeset viewer.