From fb5bbf2e961cacee7dc71f4b872e6728307682af Mon Sep 17 00:00:00 2001 From: defnax Date: Wed, 27 Jan 2010 20:24:49 +0000 Subject: [PATCH] Added TransferPage to Settings git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2140 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/RetroShare.pro | 7 +- .../src/gui/settings/ServerPage.cpp | 86 -------- retroshare-gui/src/gui/settings/ServerPage.h | 1 - retroshare-gui/src/gui/settings/ServerPage.ui | 61 ------ .../src/gui/settings/TransferPage.cpp | 116 +++++++++++ .../src/gui/settings/TransferPage.h | 59 ++++++ .../src/gui/settings/TransferPage.ui | 183 ++++++++++++++++++ .../src/gui/settings/rsettingswin.cpp | 6 + .../src/gui/settings/rsettingswin.h | 2 +- retroshare-gui/src/gui/settings/settings.ui | 18 +- 10 files changed, 385 insertions(+), 154 deletions(-) create mode 100644 retroshare-gui/src/gui/settings/TransferPage.cpp create mode 100644 retroshare-gui/src/gui/settings/TransferPage.h create mode 100644 retroshare-gui/src/gui/settings/TransferPage.ui diff --git a/retroshare-gui/src/RetroShare.pro b/retroshare-gui/src/RetroShare.pro index e435cd57f..44459ea08 100644 --- a/retroshare-gui/src/RetroShare.pro +++ b/retroshare-gui/src/RetroShare.pro @@ -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 diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp index 5f16415f3..f4896d01b 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.cpp +++ b/retroshare-gui/src/gui/settings/ServerPage.cpp @@ -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 - - - } diff --git a/retroshare-gui/src/gui/settings/ServerPage.h b/retroshare-gui/src/gui/settings/ServerPage.h index 9736664c6..7e10244c4 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.h +++ b/retroshare-gui/src/gui/settings/ServerPage.h @@ -48,7 +48,6 @@ private slots: void toggleUPnP(); void toggleIpDetermination(bool) ; void toggleTunnelConnection(bool) ; - void showTurtleRouterDialog(); private: diff --git a/retroshare-gui/src/gui/settings/ServerPage.ui b/retroshare-gui/src/gui/settings/ServerPage.ui index 05e658bed..a3b8ca4d2 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.ui +++ b/retroshare-gui/src/gui/settings/ServerPage.ui @@ -823,67 +823,6 @@ behind a firewall or a VPN. - - - F2F routing - - - - - - - - enable anonymous F2F routing - - - true - - - - - - - Show router statistics - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - true - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:8pt; font-weight:600;">RetroShare</span><span style=" font-family:'Sans'; font-size:8pt;"> 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.</span></p> -<p style="-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;"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:8pt;">If want to you use </span><span style=" font-family:'Sans'; font-size:8pt; font-weight:600;">RetroShare</span><span style=" font-family:'Sans'; font-size:8pt;"> to anonymously share and download files, leaving this checked drastically increases your download scope, and participate into the overall network bandwidth. </span></p> -<p style="-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;"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:8pt;">You can separately setup share flags for each shared directory:</span></p> -<ul style="-qt-list-indent: 1;"><li style=" font-family:'Sans'; font-size:8pt;" style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Browsable by friends</span>: files are browsable from your direct friends.</li> -<li style=" font-family:'Sans'; font-size:8pt;" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Anonymously shared</span>: files can be downloaded by anybody through anonymous tunnels.</li></ul></body></html> - - - - - diff --git a/retroshare-gui/src/gui/settings/TransferPage.cpp b/retroshare-gui/src/gui/settings/TransferPage.cpp new file mode 100644 index 000000000..d37a88b4d --- /dev/null +++ b/retroshare-gui/src/gui/settings/TransferPage.cpp @@ -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 + +#include "rshare.h" + +#include +#include + +#include "rsiface/rsiface.h" +#include "rsiface/rspeers.h" + +#include + +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; + } + + +} + + + diff --git a/retroshare-gui/src/gui/settings/TransferPage.h b/retroshare-gui/src/gui/settings/TransferPage.h new file mode 100644 index 000000000..ac37fbe1e --- /dev/null +++ b/retroshare-gui/src/gui/settings/TransferPage.h @@ -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 + +#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 + diff --git a/retroshare-gui/src/gui/settings/TransferPage.ui b/retroshare-gui/src/gui/settings/TransferPage.ui new file mode 100644 index 000000000..536562fc6 --- /dev/null +++ b/retroshare-gui/src/gui/settings/TransferPage.ui @@ -0,0 +1,183 @@ + + + TransferPage + + + + 0 + 0 + 433 + 340 + + + + Form + + + + + + 0 + + + + Transfer + + + + + + Transfer options + + + + + + Queue Size: + + + + + + + 1 + + + 7 + + + + + + + Maximum Download speed per file: + + + + + + + kB/s + + + 100000 + + + 1024 + + + + + + + Default chunk strategy: + + + + + + + + Streaming + + + + + Random + + + + + + + + + + + Show Cache Transfers + + + + + + + Qt::Vertical + + + + 248 + 138 + + + + + + + + + F2F Routing + + + + + + + + enable anonymous F2F routing + + + true + + + + + + + Show router statistics + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:8pt; font-weight:600;">RetroShare</span><span style=" font-family:'Sans'; font-size:8pt;"> 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.</span></p> +<p style="-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;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:8pt;">If want to you use </span><span style=" font-family:'Sans'; font-size:8pt; font-weight:600;">RetroShare</span><span style=" font-family:'Sans'; font-size:8pt;"> to anonymously share and download files, leaving this checked drastically increases your download scope, and participate into the overall network bandwidth. </span></p> +<p style="-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;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:8pt;">You can separately setup share flags for each shared directory:</span></p> +<ul style="-qt-list-indent: 1;"><li style=" font-family:'Sans'; font-size:8pt;" style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Browsable by friends</span>: files are browsable from your direct friends.</li> +<li style=" font-family:'Sans'; font-size:8pt;" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Anonymously shared</span>: files can be downloaded by anybody through anonymous tunnels.</li></ul></body></html> + + + + + + + + + + + + diff --git a/retroshare-gui/src/gui/settings/rsettingswin.cpp b/retroshare-gui/src/gui/settings/rsettingswin.cpp index 7d240f45c..8bcd44cf8 100644 --- a/retroshare-gui/src/gui/settings/rsettingswin.cpp +++ b/retroshare-gui/src/gui/settings/rsettingswin.cpp @@ -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")); diff --git a/retroshare-gui/src/gui/settings/rsettingswin.h b/retroshare-gui/src/gui/settings/rsettingswin.h index 4e354b381..e898e65fa 100755 --- a/retroshare-gui/src/gui/settings/rsettingswin.h +++ b/retroshare-gui/src/gui/settings/rsettingswin.h @@ -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); diff --git a/retroshare-gui/src/gui/settings/settings.ui b/retroshare-gui/src/gui/settings/settings.ui index 3f7d58822..d19f7de40 100755 --- a/retroshare-gui/src/gui/settings/settings.ui +++ b/retroshare-gui/src/gui/settings/settings.ui @@ -28,7 +28,7 @@ - 110 + 130 16777215 @@ -95,6 +95,15 @@ :/images/server_24x24.png:/images/server_24x24.png + + + Transfer + + + + :/images/ktorrent32.png:/images/ktorrent32.png + + Directories @@ -157,13 +166,16 @@ - 32 - 32 + 24 + 24 + + true +