2018-12-25 15:34:59 -05:00
/*******************************************************************************
* gui / QuikStartWizard . cpp *
* *
* Copyright ( c ) 2006 Retroshare Team < retroshare . project @ gmail . com > *
* *
* This program is free software : you can redistribute it and / or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation , either version 3 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 Affero General Public License for more details . *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program . If not , see < https : //www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-01-08 08:00:00 -05:00
# include "QuickStartWizard.h"
# include <QFileDialog>
# include <QSettings>
# include <QCheckBox>
# include <QMessageBox>
# include <QComboBox>
2010-01-13 15:42:51 -05:00
# include <QHeaderView>
2010-01-08 08:00:00 -05:00
2010-08-06 05:40:23 -04:00
# include <retroshare/rsfiles.h>
2012-11-25 15:26:32 -05:00
# include <retroshare/rsconfig.h>
2010-08-06 05:40:23 -04:00
# include <retroshare/rspeers.h>
2012-11-02 09:52:29 -04:00
# include <retroshare/rstypes.h>
2010-05-11 16:02:52 -04:00
# include "settings/rsharesettings.h"
2013-10-19 09:25:06 -04:00
# include "util/QtVersion.h"
2010-01-08 08:00:00 -05:00
QuickStartWizard : : QuickStartWizard ( QWidget * parent ) :
QDialog ( parent )
{
ui . setupUi ( this ) ;
2012-08-24 06:49:08 -04:00
ui . headerFrame - > setHeaderImage ( QPixmap ( " :/images/rs_wizard.png " ) ) ;
ui . headerFrame - > setHeaderText ( " RetroShare " ) ;
2010-01-08 08:00:00 -05:00
ui . pagesWizard - > setCurrentIndex ( 0 ) ;
2010-01-27 17:31:25 -05:00
loadNetwork ( ) ;
2010-01-08 08:00:00 -05:00
loadShare ( ) ;
loadGeneral ( ) ;
2010-01-27 17:31:25 -05:00
// ui.checkBoxF2FRouting->setChecked(true) ;
// ui.checkBoxF2FRouting->setEnabled(false) ;
2010-01-08 08:00:00 -05:00
connect ( ui . netModeComboBox , SIGNAL ( activated ( int ) ) , this , SLOT ( toggleUPnP ( ) ) ) ;
2010-01-27 17:31:25 -05:00
// connect( ui.checkBoxTunnelConnection, SIGNAL( toggled( bool ) ), this, SLOT( toggleTunnelConnection(bool) ) );
2010-01-08 08:00:00 -05:00
2010-01-27 17:31:25 -05:00
// bool b = rsPeers->getAllowTunnelConnection() ;
// ui.checkBoxTunnelConnection->setChecked(b) ;
2010-01-08 08:00:00 -05:00
2015-06-26 04:14:09 -04:00
QHeaderView_setSectionResizeModeColumn ( ui . shareddirList - > horizontalHeader ( ) , 0 , QHeaderView : : Stretch ) ;
QHeaderView_setSectionResizeModeColumn ( ui . shareddirList - > horizontalHeader ( ) , 2 , QHeaderView : : Interactive ) ;
2010-01-08 08:00:00 -05:00
ui . shareddirList - > horizontalHeader ( ) - > resizeSection ( 0 , 360 ) ;
ui . shareddirList - > horizontalHeader ( ) - > setStretchLastSection ( false ) ;
/* Hide platform specific features */
2015-08-29 15:31:01 -04:00
# ifndef Q_OS_WIN
2010-01-08 08:00:00 -05:00
ui . checkBoxRunRetroshareAtSystemStartup - > setVisible ( false ) ;
2010-12-13 15:34:07 -05:00
ui . chkRunRetroshareAtSystemStartupMinimized - > setVisible ( false ) ;
# endif
2010-01-08 08:00:00 -05:00
}
QuickStartWizard : : ~ QuickStartWizard ( )
{
}
void QuickStartWizard : : changeEvent ( QEvent * e )
{
switch ( e - > type ( ) ) {
case QEvent : : LanguageChange :
ui . retranslateUi ( this ) ;
break ;
default :
break ;
}
}
void QuickStartWizard : : on_pushButtonWelcomeNext_clicked ( )
{
2010-01-27 17:31:25 -05:00
ui . pagesWizard - > setCurrentIndex ( 1 ) ;
2010-01-08 08:00:00 -05:00
}
void QuickStartWizard : : on_pushButtonWelcomeExit_clicked ( )
{
2010-01-27 17:31:25 -05:00
close ( ) ;
2010-01-08 08:00:00 -05:00
}
void QuickStartWizard : : on_pushButtonConnectionBack_clicked ( )
{
2010-01-27 17:31:25 -05:00
ui . pagesWizard - > setCurrentIndex ( 0 ) ;
2010-01-08 08:00:00 -05:00
}
void QuickStartWizard : : on_pushButtonConnectionNext_clicked ( )
{
2010-01-27 17:31:25 -05:00
/* Check if netMode has changed */
int netMode = 0 ;
switch ( ui . netModeComboBox - > currentIndex ( ) )
{
case 2 :
netMode = RS_NETMODE_EXT ;
break ;
case 1 :
netMode = RS_NETMODE_UDP ;
break ;
default :
case 0 :
netMode = RS_NETMODE_UPNP ;
break ;
}
std : : cerr < < " ui.netModeComboBox->currentIndex() " < < ui . netModeComboBox - > currentIndex ( ) < < std : : endl ;
rsPeers - > setNetworkMode ( rsPeers - > getOwnId ( ) , netMode ) ;
/* Check if vis has changed */
2013-09-29 03:10:19 -04:00
uint16_t vs_disc = 0 ;
uint16_t vs_dht = 0 ;
switch ( ui . discoveryComboBox - > currentIndex ( ) )
{
case 0 :
vs_disc = RS_VS_DISC_FULL ;
vs_dht = RS_VS_DHT_FULL ;
break ;
case 1 :
vs_disc = RS_VS_DISC_FULL ;
vs_dht = RS_VS_DHT_OFF ;
break ;
case 2 :
vs_disc = RS_VS_DISC_OFF ;
vs_dht = RS_VS_DHT_FULL ;
break ;
case 3 :
default :
vs_disc = RS_VS_DISC_OFF ;
vs_dht = RS_VS_DHT_OFF ;
break ;
}
2010-01-27 17:31:25 -05:00
RsPeerDetails detail ;
if ( ! rsPeers - > getPeerDetails ( rsPeers - > getOwnId ( ) , detail ) )
{
return ;
}
2013-09-29 03:10:19 -04:00
if ( ( vs_disc ! = detail . vs_disc ) | | ( vs_dht ! = detail . vs_dht ) )
{
rsPeers - > setVisState ( rsPeers - > getOwnId ( ) , vs_disc , vs_dht ) ;
}
2012-11-25 15:26:32 -05:00
rsConfig - > SetMaxDataRates ( ui . doubleSpinBoxDownloadSpeed - > value ( ) , ui . doubleSpinBoxUploadSpeed - > value ( ) ) ;
2010-01-27 17:31:25 -05:00
ui . pagesWizard - > setCurrentIndex ( 2 ) ;
2010-01-08 08:00:00 -05:00
}
void QuickStartWizard : : on_pushButtonConnectionExit_clicked ( )
{
2017-01-25 10:36:28 -05:00
//on_pushButtonConnectionNext_clicked();
2010-01-27 17:31:25 -05:00
close ( ) ;
2010-01-08 08:00:00 -05:00
}
void QuickStartWizard : : on_pushButtonSharesBack_clicked ( )
{
2010-01-27 17:31:25 -05:00
ui . pagesWizard - > setCurrentIndex ( 1 ) ;
2010-01-08 08:00:00 -05:00
}
void QuickStartWizard : : on_pushButtonSharesNext_clicked ( )
{
2010-01-27 17:31:25 -05:00
ui . pagesWizard - > setCurrentIndex ( 3 ) ;
2010-01-08 08:00:00 -05:00
}
void QuickStartWizard : : on_pushButtonSharesExit_clicked ( )
{
2010-01-27 17:31:25 -05:00
close ( ) ;
2010-01-08 08:00:00 -05:00
}
2015-10-24 11:05:12 -04:00
void QuickStartWizard : : on_pushButtonStyleBack_clicked ( )
2010-01-08 08:00:00 -05:00
{
2010-02-06 16:55:34 -05:00
ui . pagesWizard - > setCurrentIndex ( 2 ) ;
2010-01-08 08:00:00 -05:00
}
2015-10-24 11:05:12 -04:00
void QuickStartWizard : : on_pushButtonStyleNext_clicked ( )
{
ui . pagesWizard - > setCurrentIndex ( 4 ) ;
}
void QuickStartWizard : : on_pushButtonStyleExit_clicked ( )
{
close ( ) ;
}
void QuickStartWizard : : on_pushButtonSystemBack_clicked ( )
{
ui . pagesWizard - > setCurrentIndex ( 3 ) ;
}
2010-01-08 08:00:00 -05:00
void QuickStartWizard : : on_pushButtonSystemFinish_clicked ( )
{
2010-12-13 15:34:07 -05:00
Settings - > setStartMinimized ( ui . checkBoxStartMinimized - > isChecked ( ) ) ;
Settings - > setValue ( " doQuit " , ui . checkBoxQuit - > isChecked ( ) ) ;
2015-08-29 15:31:01 -04:00
# ifdef Q_OS_WIN
2010-12-11 17:46:14 -05:00
Settings - > setRunRetroshareOnBoot ( ui . checkBoxRunRetroshareAtSystemStartup - > isChecked ( ) , ui . chkRunRetroshareAtSystemStartupMinimized - > isChecked ( ) ) ;
2010-12-13 15:34:07 -05:00
# endif
2010-01-08 08:00:00 -05:00
saveChanges ( ) ;
2010-01-27 17:31:25 -05:00
close ( ) ;
2010-01-08 08:00:00 -05:00
}
void QuickStartWizard : : on_pushButtonSystemExit_clicked ( )
{
close ( ) ;
}
void QuickStartWizard : : on_pushButtonSharesAdd_clicked ( )
{
/* select a dir
*/
QString qdir = QFileDialog : : getExistingDirectory ( this , tr ( " Select A Folder To Share " ) , " " ,
QFileDialog : : ShowDirsOnly | QFileDialog : : DontResolveSymlinks ) ;
/* add it to the server */
std : : string dir = qdir . toStdString ( ) ;
if ( dir ! = " " )
{
SharedDirInfo sdi ;
sdi . filename = dir ;
2016-10-31 09:26:01 -04:00
sdi . shareflags = DIR_FLAGS_BROWSABLE | DIR_FLAGS_ANONYMOUS_DOWNLOAD ;
2010-01-08 08:00:00 -05:00
rsFiles - > addSharedDirectory ( sdi ) ;
messageBoxOk ( tr ( " Shared Directory Added! " ) ) ;
loadShare ( ) ;
}
}
void QuickStartWizard : : on_pushButtonSharesRemove_clicked ( )
{
/* id current dir */
/* ask for removal */
QTableWidget * listWidget = ui . shareddirList ;
int row = listWidget - > currentRow ( ) ;
QTableWidgetItem * qdir = listWidget - > item ( row , 0 ) ;
QString queryWrn ;
queryWrn . clear ( ) ;
2015-06-12 04:27:26 -04:00
queryWrn . append ( tr ( " Do you really want to stop sharing this directory ? " ) ) ;
2010-01-08 08:00:00 -05:00
if ( qdir )
{
if ( ( QMessageBox : : question ( this , tr ( " Warning! " ) , queryWrn , QMessageBox : : Ok | QMessageBox : : No , QMessageBox : : Ok ) ) = = QMessageBox : : Ok )
{
rsFiles - > removeSharedDirectory ( qdir - > text ( ) . toStdString ( ) ) ;
loadShare ( ) ;
}
else
return ;
}
}
2011-03-08 15:05:36 -05:00
void QuickStartWizard : : on_shareIncomingDirectory_clicked ( )
{
rsFiles - > shareDownloadDirectory ( ui . shareIncomingDirectory - > isChecked ( ) ) ;
loadShare ( ) ;
}
2010-01-08 08:00:00 -05:00
void QuickStartWizard : : loadShare ( )
{
std : : cerr < < " ShareManager:: In load !!!!! " < < std : : endl ;
std : : list < SharedDirInfo > : : const_iterator it ;
std : : list < SharedDirInfo > dirs ;
rsFiles - > getSharedDirectories ( dirs ) ;
2011-03-08 15:05:36 -05:00
ui . shareIncomingDirectory - > setChecked ( rsFiles - > getShareDownloadDirectory ( ) ) ;
2010-01-08 08:00:00 -05:00
/* get a link to the table */
QTableWidget * listWidget = ui . shareddirList ;
/* remove old items ??? */
listWidget - > clearContents ( ) ;
listWidget - > setRowCount ( 0 ) ;
connect ( this , SIGNAL ( itemClicked ( QTableWidgetItem * ) ) , this , SLOT ( updateFlags ( QTableWidgetItem * ) ) ) ;
int row = 0 ;
2014-10-21 18:33:02 -04:00
for ( it = dirs . begin ( ) ; it ! = dirs . end ( ) ; + + it , + + row )
2010-01-08 08:00:00 -05:00
{
listWidget - > insertRow ( row ) ;
listWidget - > setItem ( row , 0 , new QTableWidgetItem ( QString : : fromStdString ( ( * it ) . filename ) ) ) ;
# ifdef USE_COMBOBOX
QComboBox * cb = new QComboBox ;
2014-07-10 14:37:21 -04:00
cb - > addItem ( tr ( " Network Wide " ) ) ;
cb - > addItem ( tr ( " Browsable " ) ) ;
cb - > addItem ( tr ( " Universal " ) ) ;
2010-01-08 08:00:00 -05:00
2014-12-22 10:44:47 -05:00
cb - > setToolTip ( tr ( " Please decide whether this directory is \n * Network Wide: \t anonymously shared over the network (including your friends) \n * Browsable: \t browsable by your friends \n * Universal: \t \t both " ) ) ;
2010-01-08 08:00:00 -05:00
// TODO
// - set combobox current value depending on what rsFiles reports.
// - use a signal mapper to get the correct row that contains the combo box sending the signal:
// mapper = new SignalMapper(this) ;
//
// for(all cb)
// {
// signalMapper->setMapping(cb,...)
// }
//
int index = 0 ;
index + = ( ( * it ) . shareflags & RS_FILE_HINTS_NETWORK_WIDE ) > 0 ;
index + = ( ( ( * it ) . shareflags & RS_FILE_HINTS_BROWSABLE ) > 0 ) * 2 ;
listWidget - > setCellWidget ( row , 1 , cb ) ;
if ( index < 1 | | index > 3 )
std : : cerr < < " ******* ERROR IN FILE SHARING FLAGS. Flags = " < < ( * it ) . shareflags < < " *********** " < < std : : endl ;
else
index - - ;
cb - > setCurrentIndex ( index ) ;
# else
QCheckBox * cb1 = new QCheckBox ;
QCheckBox * cb2 = new QCheckBox ;
2016-10-31 09:26:01 -04:00
cb1 - > setChecked ( ( * it ) . shareflags & DIR_FLAGS_ANONYMOUS_DOWNLOAD ) ;
cb2 - > setChecked ( ( * it ) . shareflags & DIR_FLAGS_BROWSABLE ) ;
2010-01-08 08:00:00 -05:00
2014-07-10 14:37:21 -04:00
cb1 - > setToolTip ( tr ( " If checked, the share is anonymously shared to anybody. " ) ) ;
cb2 - > setToolTip ( tr ( " If checked, the share is browsable by your friends. " ) ) ;
2010-01-08 08:00:00 -05:00
listWidget - > setCellWidget ( row , 1 , cb1 ) ;
listWidget - > setCellWidget ( row , 2 , cb2 ) ;
QObject : : connect ( cb1 , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateFlags ( bool ) ) ) ;
QObject : : connect ( cb2 , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateFlags ( bool ) ) ) ;
# endif
}
//ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory()));
listWidget - > update ( ) ; /* update display */
update ( ) ;
}
void QuickStartWizard : : updateFlags ( bool b )
{
std : : cerr < < " Updating flags (b= " < < b < < " ) !!! " < < std : : endl ;
std : : list < SharedDirInfo > : : iterator it ;
std : : list < SharedDirInfo > dirs ;
rsFiles - > getSharedDirectories ( dirs ) ;
int row = 0 ;
2014-10-21 18:33:02 -04:00
for ( it = dirs . begin ( ) ; it ! = dirs . end ( ) ; + + it , + + row )
2010-01-08 08:00:00 -05:00
{
std : : cerr < < " Looking for row= " < < row < < " , file= " < < ( * it ) . filename < < " , flags= " < < ( * it ) . shareflags < < std : : endl ;
2012-11-02 09:52:29 -04:00
FileStorageFlags current_flags ( 0u ) ;
2016-10-31 09:26:01 -04:00
current_flags | = ( dynamic_cast < QCheckBox * > ( ui . shareddirList - > cellWidget ( row , 1 ) ) ) - > isChecked ( ) ? DIR_FLAGS_ANONYMOUS_DOWNLOAD : ( FileStorageFlags ) 0u ;
current_flags | = ( dynamic_cast < QCheckBox * > ( ui . shareddirList - > cellWidget ( row , 2 ) ) ) - > isChecked ( ) ? DIR_FLAGS_BROWSABLE : ( FileStorageFlags ) 0u ;
2010-01-08 08:00:00 -05:00
2012-11-02 09:52:29 -04:00
if ( ( ( * it ) . shareflags ^ current_flags ) . toUInt32 ( ) )
2010-01-08 08:00:00 -05:00
{
( * it ) . shareflags = current_flags ;
rsFiles - > updateShareFlags ( * it ) ; // modifies the flags
std : : cout < < " Updating share flags for directory " < < ( * it ) . filename < < std : : endl ;
}
}
}
bool QuickStartWizard : : messageBoxOk ( QString msg )
{
2010-11-16 04:31:30 -05:00
QMessageBox mb ( " Share Manager InfoBox! " , msg , QMessageBox : : Information , QMessageBox : : Ok , 0 , 0 , this ) ;
2010-01-08 08:00:00 -05:00
mb . exec ( ) ;
return true ;
}
/*void QuickStartWizard::showEvent(QShowEvent *event)
{
if ( ! event - > spontaneous ( ) )
{
loadsharelist ( ) ;
}
} */
/** Loads the settings for this page */
void
QuickStartWizard : : loadGeneral ( )
{
2015-08-29 15:31:01 -04:00
# ifdef Q_OS_WIN
2010-12-11 17:46:14 -05:00
bool minimized ;
ui . checkBoxRunRetroshareAtSystemStartup - > setChecked ( Settings - > runRetroshareOnBoot ( minimized ) ) ;
ui . chkRunRetroshareAtSystemStartupMinimized - > setChecked ( minimized ) ;
2010-12-13 15:34:07 -05:00
# endif
ui . checkBoxStartMinimized - > setChecked ( Settings - > getStartMinimized ( ) ) ;
ui . checkBoxQuit - > setChecked ( Settings - > value ( " doQuit " , false ) . toBool ( ) ) ;
2010-01-08 08:00:00 -05:00
2015-10-24 11:05:12 -04:00
ui . rbtPageOnToolBar - > setChecked ( Settings - > getPageButtonLoc ( ) ) ;
ui . rbtPageOnListItem - > setChecked ( ! Settings - > getPageButtonLoc ( ) ) ;
2010-05-20 17:53:27 -04:00
//ui.checkBoxQuickWizard->setChecked(settings.value(QString::fromUtf8("FirstRun"), false).toBool());
2010-01-08 08:00:00 -05:00
}
2010-01-27 17:31:25 -05:00
//bool QuickStartWizard::firstRunWizard() const {
// if(ui.checkBoxQuickWizard->isChecked()) return true;
// return ui.checkBoxQuickWizard->isChecked();
//}
2010-01-12 17:46:18 -05:00
2010-01-08 08:00:00 -05:00
/** Loads the settings for this page */
void QuickStartWizard : : loadNetwork ( )
{
/* load up configuration from rsPeers */
RsPeerDetails detail ;
if ( ! rsPeers - > getPeerDetails ( rsPeers - > getOwnId ( ) , detail ) )
{
return ;
}
/* set net mode */
int netIndex = 0 ;
2012-02-11 07:49:09 -05:00
switch ( detail . netMode )
2010-01-08 08:00:00 -05:00
{
case RS_NETMODE_EXT :
netIndex = 2 ;
break ;
case RS_NETMODE_UDP :
netIndex = 1 ;
break ;
2015-11-21 05:57:50 -05:00
case RS_NETMODE_HIDDEN :
ui . netModeLabel - > hide ( ) ;
ui . netModeComboBox - > hide ( ) ;
ui . discoveryLabel - > hide ( ) ;
ui . discoveryComboBox - > hide ( ) ;
2017-01-25 10:36:28 -05:00
ui . netModeComboBox - > insertItem ( 3 , " Hidden Node " ) ;
netIndex = 3 ;
2015-11-21 05:57:50 -05:00
break ;
2010-01-08 08:00:00 -05:00
default :
case RS_NETMODE_UPNP :
netIndex = 0 ;
break ;
}
ui . netModeComboBox - > setCurrentIndex ( netIndex ) ;
2010-11-08 11:27:48 -05:00
/* DHT + Discovery: (public)
* Discovery only : ( private )
* DHT only : ( inverted )
* None : ( dark net )
*/
netIndex = 3 ; // NONE.
2013-09-29 03:10:19 -04:00
if ( detail . vs_dht ! = RS_VS_DISC_OFF )
2010-01-08 08:00:00 -05:00
{
2013-09-29 03:10:19 -04:00
if ( detail . vs_disc ! = RS_VS_DISC_OFF )
2010-11-08 11:27:48 -05:00
{
netIndex = 0 ; // PUBLIC
}
else
{
netIndex = 2 ; // INVERTED
}
2010-01-08 08:00:00 -05:00
}
2010-11-08 11:27:48 -05:00
else
{
2013-09-29 03:10:19 -04:00
if ( detail . vs_disc ! = RS_VS_DISC_OFF )
2010-11-08 11:27:48 -05:00
{
netIndex = 1 ; // PRIVATE
}
else
{
netIndex = 3 ; // NONE
}
}
2010-01-08 08:00:00 -05:00
ui . discoveryComboBox - > setCurrentIndex ( netIndex ) ;
2013-09-29 03:10:19 -04:00
int dlrate = 0 ;
2012-11-25 15:26:32 -05:00
int ulrate = 0 ;
rsConfig - > GetMaxDataRates ( dlrate , ulrate ) ;
ui . doubleSpinBoxDownloadSpeed - > setValue ( dlrate ) ;
ui . doubleSpinBoxUploadSpeed - > setValue ( ulrate ) ;
2010-01-08 08:00:00 -05:00
}
void QuickStartWizard : : saveChanges ( )
{
QString str ;
2010-05-10 16:38:59 -04:00
//bool saveAddr = false;
2010-01-08 08:00:00 -05:00
2015-10-24 11:05:12 -04:00
Settings - > setPageButtonLoc ( ui . rbtPageOnToolBar - > isChecked ( ) ) ;
2010-01-08 08:00:00 -05:00
RsPeerDetails detail ;
2014-03-17 16:56:06 -04:00
RsPeerId ownId = rsPeers - > getOwnId ( ) ;
2010-01-08 08:00:00 -05:00
if ( ! rsPeers - > getPeerDetails ( ownId , detail ) )
{
return ;
}
/* Check if netMode has changed */
int netMode = 0 ;
2010-01-27 17:31:25 -05:00
int netIndex = ui . netModeComboBox - > currentIndex ( ) ;
std : : cerr < < " ui.netModeComboBox->currentIndex() " < < ui . netModeComboBox - > currentIndex ( ) < < std : : endl ;
switch ( netIndex )
2010-01-08 08:00:00 -05:00
{
2017-01-25 10:36:28 -05:00
case 3 :
netMode = RS_NETMODE_HIDDEN ;
break ;
2010-01-08 08:00:00 -05:00
case 2 :
netMode = RS_NETMODE_EXT ;
break ;
case 1 :
netMode = RS_NETMODE_UDP ;
break ;
default :
case 0 :
2010-11-08 11:27:48 -05:00
netMode = RS_NETMODE_UPNP ;
2010-01-08 08:00:00 -05:00
break ;
}
2010-11-08 11:27:48 -05:00
rsPeers - > setNetworkMode ( ownId , netMode ) ;
2013-09-29 03:10:19 -04:00
/* Check if vis has changed */
uint16_t vs_disc = 0 ;
uint16_t vs_dht = 0 ;
switch ( ui . discoveryComboBox - > currentIndex ( ) )
{
case 0 :
vs_disc = RS_VS_DISC_FULL ;
vs_dht = RS_VS_DHT_FULL ;
break ;
case 1 :
vs_disc = RS_VS_DISC_FULL ;
vs_dht = RS_VS_DHT_OFF ;
break ;
case 2 :
vs_disc = RS_VS_DISC_OFF ;
vs_dht = RS_VS_DHT_FULL ;
break ;
case 3 :
default :
vs_disc = RS_VS_DISC_OFF ;
vs_dht = RS_VS_DHT_OFF ;
break ;
}
if ( ( vs_disc ! = detail . vs_disc ) | | ( vs_dht ! = detail . vs_dht ) )
{
rsPeers - > setVisState ( ownId , vs_disc , vs_dht ) ;
}
2010-01-08 08:00:00 -05:00
/*if (0 != netIndex)
{
saveAddr = true ;
} */
/*if (saveAddr)
{
rsPeers - > setLocalAddress ( rsPeers - > getOwnId ( ) , ui . localAddress - > text ( ) . toStdString ( ) , ui . localPort - > value ( ) ) ;
rsPeers - > setExtAddress ( rsPeers - > getOwnId ( ) , ui . extAddress - > text ( ) . toStdString ( ) , ui . extPort - > value ( ) ) ;
} */
2012-11-25 15:26:32 -05:00
rsConfig - > SetMaxDataRates ( ui . doubleSpinBoxDownloadSpeed - > value ( ) , ui . doubleSpinBoxUploadSpeed - > value ( ) ) ;
2010-01-08 08:00:00 -05:00
loadNetwork ( ) ;
}
2010-01-27 17:31:25 -05:00
//void QuickStartWizard::toggleTunnelConnection(bool b)
//{
// std::cerr << "QuickStartWizard::toggleTunnelConnection() set tunnel to : " << b << std::endl;
// rsPeers->allowTunnelConnection(b) ;
//}