Added TransferPage to Settings

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2140 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-01-27 20:24:49 +00:00
parent da98a8f3ff
commit fb5bbf2e96
10 changed files with 385 additions and 154 deletions

View File

@ -196,7 +196,7 @@ HEADERS += rshare.h \
gui/msgs/textformat.h \
gui/images/retroshare_win.rc.h \
gui/settings/rsharesettings.h \
gui/settings/rsettings.h \
gui/settings/rsettings.h \
gui/toaster/MessageToaster.h \
gui/toaster/OnlineToaster.h \
gui/toaster/ChatToaster.h \
@ -465,6 +465,7 @@ newsettings {
gui/settings/AppearancePage.cpp \
gui/settings/FileAssociationsPage.cpp \
gui/settings/SoundPage.cpp \
gui/settings/TransferPage.cpp \
gui/settings/AddFileAssociationDialog.cpp
HEADERS += gui/settings/rsettingswin.h \
@ -477,7 +478,8 @@ newsettings {
gui/settings/AppearancePage.h \
gui/settings/FileAssociationsPage.h \
gui/settings/SoundPage.h \
gui/settings/AddFileAssociationDialog.h\
gui/settings/TransferPage.h \
gui/settings/AddFileAssociationDialog.h
FORMS += gui/settings/settings.ui \
gui/settings/GeneralPage.ui \
@ -487,6 +489,7 @@ newsettings {
gui/settings/NotifyPage.ui \
gui/settings/CryptoPage.ui \
gui/settings/AppearancePage.ui \
gui/settings/TransferPage.ui \
gui/settings/SoundPage.ui
DEFINES *= NEWSETTINGS

View File

@ -41,10 +41,6 @@ ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags)
connect( ui.netModeComboBox, SIGNAL( activated ( int ) ), this, SLOT( toggleUPnP( ) ) );
connect( ui.allowIpDeterminationCB, SIGNAL( toggled( bool ) ), this, SLOT( toggleIpDetermination(bool) ) );
connect( ui.allowTunnelConnectionCB, SIGNAL( toggled( bool ) ), this, SLOT( toggleTunnelConnection(bool) ) );
connect( ui._showTurtleDialogPB,SIGNAL(clicked()),this,SLOT( showTurtleRouterDialog() )) ;
ui._enableTurtleCB->setChecked(true) ;
ui._enableTurtleCB->setEnabled(false) ;
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
@ -72,11 +68,6 @@ ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags)
#endif
}
void ServerPage::showTurtleRouterDialog()
{
TurtleRouterDialog::showUp() ;
}
void ServerPage::toggleIpDetermination(bool b)
{
rsPeers->allowServerIPDetermination(b) ;
@ -191,83 +182,6 @@ void ServerPage::updateStatus()
/* set the server address */
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
#if 0
/* set status */
std::ostringstream out;
out << "Attempted Network Mode: ";
switch(detail.tryNetMode)
{
case RS_NETMODE_EXT:
out << "External Forwarded Port (UltraPEER Mode)";
break;
case RS_NETMODE_UDP:
out << "Firewalled";
break;
default:
case RS_NETMODE_UPNP:
out << "Automatic: UPnP Forwarded Port";
break;
}
out << std::endl;
out << "Actual Network Mode: ";
switch(detail.netMode)
{
case RS_NETMODE_EXT:
out << "External Forwarded Port (UltraPEER Mode)";
break;
case RS_NETMODE_UDP:
out << "Firewalled";
break;
case RS_NETMODE_UPNP:
out << "Automatic: UPnP Forwarded Port";
break;
default:
case RS_NETMODE_UNREACHABLE:
out << "Unreachable: Firewalled by Symmetric NAT";
break;
}
out << std::endl;
out << "\tLocal Address: " << detail.localAddr;
out << ":" << detail.localPort;
out << std::endl;
out << "\tExternal Address: " << detail.extAddr;
out << ":" << detail.extPort;
out << std::endl;
out << "UPnP Status: ";
out << std::endl;
out << "DHT Status: ";
if (detail.visState & RS_VS_DHT_ON)
out << " Enabled";
else
out << " Disabled";
out << std::endl;
out << "Discovery Status: ";
if (detail.visState & RS_VS_DISC_ON)
out << " Enabled";
else
out << " Disabled";
out << std::endl;
if (detail.netMode == RS_NETMODE_UNREACHABLE)
{
ui.netStatusBox->setTextColor( Qt::red );
}
else
{
ui.netStatusBox->setTextColor( Qt::black );
}
ui.netStatusBox->setText(QString::fromStdString(out.str()));
ui.netStatusBox ->setReadOnly(true);
#endif
}

View File

@ -48,7 +48,6 @@ private slots:
void toggleUPnP();
void toggleIpDetermination(bool) ;
void toggleTunnelConnection(bool) ;
void showTurtleRouterDialog();
private:

View File

@ -823,67 +823,6 @@ behind a firewall or a VPN.</string>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>F2F routing</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="_enableTurtleCB">
<property name="text">
<string>enable anonymous F2F routing</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="_showTurtleDialogPB">
<property name="text">
<string>Show router statistics</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTextEdit" name="textEdit">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt; font-weight:600;&quot;&gt;RetroShare&lt;/span&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt;&quot;&gt; is capable of transfering data and search requests between peers that are not necessarily friends. This traffic however only transits through a connected list of friends and is anonymous.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:8pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt;&quot;&gt;If want to you use &lt;/span&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt; font-weight:600;&quot;&gt;RetroShare&lt;/span&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt;&quot;&gt; to anonymously share and download files, leaving this checked drastically increases your download scope, and participate into the overall network bandwidth. &lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:8pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt;&quot;&gt;You can separately setup share flags for each shared directory:&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;-qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; font-family:'Sans'; font-size:8pt;&quot; style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Browsable by friends&lt;/span&gt;: files are browsable from your direct friends.&lt;/li&gt;
&lt;li style=&quot; font-family:'Sans'; font-size:8pt;&quot; style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Anonymously shared&lt;/span&gt;: files can be downloaded by anybody through anonymous tunnels.&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

View File

@ -0,0 +1,116 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2010 RetroShare Team
*
* 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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "TransferPage.h"
#include <gui/TurtleRouterDialog.h>
#include "rshare.h"
#include <iostream>
#include <sstream>
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
#include <QTimer>
TransferPage::TransferPage(QWidget * parent, Qt::WFlags flags)
: ConfigPage(parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
connect( ui._showTurtleDialogPB,SIGNAL(clicked()),this,SLOT( showTurtleRouterDialog() )) ;
ui._enableTurtleCB->setChecked(true) ;
ui._enableTurtleCB->setEnabled(false) ;
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
timer->start(1000);
updateStatus();
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
void TransferPage::showTurtleRouterDialog()
{
TurtleRouterDialog::showUp() ;
}
void
TransferPage::closeEvent (QCloseEvent * event)
{
QWidget::closeEvent(event);
}
/** Saves the changes on this page */
bool
TransferPage::save(QString &errmsg)
{
/* save the server address */
/* save local address */
/* save the url for DNS access */
/* restart server */
/* save all? */
//saveAddresses();
return true;
}
/** Loads the settings for this page */
void TransferPage::load()
{
/* load up configuration from rsPeers */
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
{
return;
}
}
/** Loads the settings for this page */
void TransferPage::updateStatus()
{
/* load up configuration from rsPeers */
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
{
return;
}
}

View File

@ -0,0 +1,59 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2010 RetroShare Team
*
* 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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef TRANSFERPAGE_H
# define TRANSFERPAGE_H
# include <QtGui/QWidget>
#include "configpage.h"
#include "ui_TransferPage.h"
class TransferPage: public ConfigPage
{
Q_OBJECT
public:
TransferPage(QWidget * parent = 0, Qt::WFlags flags = 0);
~TransferPage() {}
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
public slots:
void updateStatus();
private slots:
void showTurtleRouterDialog();
private:
void closeEvent (QCloseEvent * event);
Ui::TransferPage ui;
};
#endif // !TRANSFERPAGE_H

View File

@ -0,0 +1,183 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TransferPage</class>
<widget class="QWidget" name="TransferPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>433</width>
<height>340</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="Seite">
<attribute name="title">
<string>Transfer</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Transfer options</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Queue Size:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="queuespinBox">
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>7</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Maximum Download speed per file:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="downspeedspinBox">
<property name="suffix">
<string> kB/s</string>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>1024</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Default chunk strategy:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="strategycomboBox">
<item>
<property name="text">
<string>Streaming</string>
</property>
</item>
<item>
<property name="text">
<string>Random</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Show Cache Transfers</string>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>248</width>
<height>138</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>F2F Routing</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="_enableTurtleCB">
<property name="text">
<string>enable anonymous F2F routing</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="_showTurtleDialogPB">
<property name="text">
<string>Show router statistics</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTextEdit" name="textEdit">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt; font-weight:600;&quot;&gt;RetroShare&lt;/span&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt;&quot;&gt; is capable of transfering data and search requests between peers that are not necessarily friends. This traffic however only transits through a connected list of friends and is anonymous.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:8pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt;&quot;&gt;If want to you use &lt;/span&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt; font-weight:600;&quot;&gt;RetroShare&lt;/span&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt;&quot;&gt; to anonymously share and download files, leaving this checked drastically increases your download scope, and participate into the overall network bandwidth. &lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:8pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:8pt;&quot;&gt;You can separately setup share flags for each shared directory:&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;-qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; font-family:'Sans'; font-size:8pt;&quot; style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Browsable by friends&lt;/span&gt;: files are browsable from your direct friends.&lt;/li&gt;
&lt;li style=&quot; font-family:'Sans'; font-size:8pt;&quot; style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Anonymously shared&lt;/span&gt;: files can be downloaded by anybody through anonymous tunnels.&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -28,6 +28,7 @@
#include "AppearancePage.h"
#include "FileAssociationsPage.h"
#include "SoundPage.h"
#include "TransferPage.h"
#define IMAGE_GENERAL ":/images/kcmsystem24.png"
@ -61,6 +62,7 @@ RSettingsWin::initStackedWidget()
stackedWidget->addWidget(new GeneralPage(false));
stackedWidget->addWidget(new ServerPage());
stackedWidget->addWidget(new TransferPage());
stackedWidget->addWidget(new DirectoriesPage());
stackedWidget->addWidget(new NotifyPage());
stackedWidget->addWidget(new CryptoPage());
@ -90,6 +92,10 @@ RSettingsWin::setNewPage(int page)
text = tr("Server");
pageicon->setPixmap(QPixmap(":/images/server_24x24.png"));
break;
case Transfer:
text = tr("Transfer");
pageicon->setPixmap(QPixmap(":/images/ktorrent32.png"));
break;
case Notify:
text = tr("Notify");
pageicon->setPixmap(QPixmap(":/images/status_unknown.png"));

View File

@ -31,7 +31,7 @@ class RSettingsWin: public QDialog, private Ui::Settings
Q_OBJECT
public:
enum PageType { General = 0, Server,
enum PageType { General = 0, Server, Transfer,
Directories, Notify, Security, Appearance, Fileassociations, Sound };
RSettingsWin(QWidget * parent = 0, Qt::WFlags flags = 0);

View File

@ -28,7 +28,7 @@
</property>
<property name="maximumSize">
<size>
<width>110</width>
<width>130</width>
<height>16777215</height>
</size>
</property>
@ -95,6 +95,15 @@
<normaloff>:/images/server_24x24.png</normaloff>:/images/server_24x24.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Transfer</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/ktorrent32.png</normaloff>:/images/ktorrent32.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Directories</string>
@ -157,13 +166,16 @@
<widget class="QLabel" name="pageicon">
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">