Various improvements to the GUI.

* Switched ServerPage to use netMode, rather than tryNetMode. This fixes the Network Status.
 * Added "Advanced Mode" to Settings GeneralPage.
 * Store / Set Advanced Mode via rsConfig::get/setConfigurationOptions.
 * removed %0D%0A from Linux / OSX emails - made it Windows Only.
 * updated GetStartedDialog text.
 * updated Dht and Nat Indicators to accurately reflect Network status. Roughly:
   - DHT. Off:     gray, ERROR:   red, NO RS PEERS:           yellow, GOOD: green.
   - NAT. Offline: gray, BAD NET: red, NO DHT, or FIREWALLED: yellow, GOOD: green
 * disable GetStartedDialog is AdvancedMode is set.
 


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4502 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2011-07-30 17:13:08 +00:00
parent 31ec7a074b
commit 1cb0a9dc21
8 changed files with 230 additions and 57 deletions

View File

@ -528,7 +528,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-241</y>
<y>0</y>
<width>666</width>
<height>746</height>
</rect>
@ -738,11 +738,12 @@ p, li { white-space: pre-wrap; }
&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-size:12pt;&quot;&gt;Be Online at the same time, and Retroshare will automatically connect you!&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-size:12pt;&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-size:12pt;&quot;&gt;Your client needs to find the Retroshare Network before it can make connections.&lt;/span&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-size:12pt;&quot;&gt;This can take up to 30 minutes the first time, so please have some patience.&lt;/span&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-size:12pt;&quot;&gt;The number at the bottom of the GUI indicates the number of Retroshare peers you have found.&lt;/span&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-size:12pt;&quot;&gt;This takes 5-30 minutes the first time you startup Retroshare&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-size:12pt;&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-size:12pt;&quot;&gt;If you don't connect, check your News Feed (on the Friends Tab).&lt;/span&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-size:12pt;&quot;&gt;If your friend rejected your connection - you will be notified here.&lt;/span&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-size:12pt;&quot;&gt;The DHT indicator (in the Status Bar) turnsGreen when it can make connections.&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-size:12pt;&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-size:12pt;&quot;&gt;After a couple of minutes, the NAT indicator (also in the Status Bar) switch to Yellow or Green.&lt;/span&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-size:12pt;&quot;&gt;If it remains Red, then you have a Nasty Firewall, that Retroshare struggles to connect through.&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-size:12pt;&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-size:12pt;&quot;&gt;Look in the Further Help section for more advice about connecting.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@ -812,7 +813,7 @@ p, li { white-space: pre-wrap; }
&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-size:12pt;&quot;&gt;This will speed up connections and allow more people to connect with you &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-size:12pt;&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-size:12pt;&quot;&gt;The easiest way to do this is by enabling UPnP on your Wireless Box or Router.&lt;/span&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-size:12pt;&quot;&gt;As each router is different. Google &amp;quot;Upnp setup [ YOUR ROUTER TYPE ]&amp;quot; for instructions.&lt;/span&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-size:12pt;&quot;&gt;As each router is different, you need to find out your Router Model and Google for instructions.&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-size:12pt;&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-size:12pt;&quot;&gt;If none of this makes sense, don't worry about it Retroshare will still work.&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-size:12pt;&quot;&gt;&lt;/p&gt;

View File

@ -33,6 +33,8 @@
#endif
#include <retroshare/rsplugin.h>
#include <retroshare/rsconfig.h>
#include "rshare.h"
#include "MainWindow.h"
#include "MessengerWindow.h"
@ -192,6 +194,17 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
setWindowTitle(tr("RetroShare %1 a secure decentralised communication platform").arg(retroshareVersion()) + " - " + nameAndLocation);
/* WORK OUT IF WE"RE IN ADVANCED MODE OR NOT */
bool advancedMode = false;
std::string advsetting;
if (rsConfig->getConfigurationOption(RS_CONFIG_ADVANCED, advsetting) && (advsetting == "YES"))
{
advancedMode = true;
}
/* add url handler for RetroShare links */
QDesktopServices::setUrlHandler(RSLINK_SCHEME, this, "linkActivated");
@ -294,8 +307,12 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
#ifdef GETSTARTED_GUI
MainPage *getStartedPage = NULL;
if (!advancedMode)
{
ui.stackPages->add(getStartedPage = new GetStartedDialog(ui.stackPages),
createPageAction(QIcon(IMG_HELP), tr("Getting Started"), grp));
}
#endif

View File

@ -356,11 +356,13 @@ void TextPage::updateOwnCert()
static void sendMail (std::string sAddress, std::string sSubject, std::string sBody)
{
#ifdef Q_WS_WIN
/* search and replace the end of lines with: "%0D%0A" */
size_t loc;
while ((loc = sBody.find("\n")) != sBody.npos) {
sBody.replace(loc, 1, "%0D%0A");
}
#endif
std::string mailstr = "mailto:" + sAddress;
mailstr += "?subject=" + sSubject;

View File

@ -21,7 +21,9 @@
#include <iostream>
#include <rshare.h>
#include <retroshare/rsinit.h>
#include "retroshare/rsinit.h"
#include "retroshare/rsconfig.h"
#include "GeneralPage.h"
#include <util/stringutil.h>
#include <QSystemTrayIcon>
@ -66,6 +68,17 @@ bool GeneralPage::save(QString &errmsg)
RsInit::setAutoLogin(ui.autoLogin->isChecked());
if (ui.checkAdvanced->isChecked())
{
std::string opt("YES");
rsConfig->setConfigurationOption(RS_CONFIG_ADVANCED, opt);
}
else
{
std::string opt("NO");
rsConfig->setConfigurationOption(RS_CONFIG_ADVANCED, opt);
}
return true;
}
@ -88,4 +101,13 @@ void GeneralPage::load()
ui.spinBox->setValue(Settings->getMaxTimeBeforeIdle());
ui.autoLogin->setChecked(RsInit::getAutoLogin());
bool advancedmode = false;
std::string advsetting;
if (rsConfig->getConfigurationOption(RS_CONFIG_ADVANCED, advsetting) && (advsetting == "YES"))
{
advancedmode = true;
}
ui.checkAdvanced->setChecked(advancedmode);
}

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>413</width>
<height>314</height>
<width>362</width>
<height>400</height>
</rect>
</property>
<property name="minimumSize">
@ -499,8 +499,8 @@
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Startup</string>
@ -553,7 +553,23 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>For Advanced Users </string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="checkAdvanced">
<property name="text">
<string>Enable Advanced Mode (Restart Required)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Misc</string>
@ -593,20 +609,7 @@
</layout>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>178</width>
<height>95</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Idle</string>
@ -635,6 +638,19 @@
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>178</width>
<height>95</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>

View File

@ -116,7 +116,7 @@ void ServerPage::load()
/* set net mode */
int netIndex = 0;
switch(detail.tryNetMode)
switch(detail.netMode)
{
case RS_NETMODE_EXT:
netIndex = 2;
@ -267,7 +267,7 @@ void ServerPage::saveAddresses()
break;
}
if (detail.tryNetMode != netMode)
if (detail.netMode != netMode)
rsPeers->setNetworkMode(ownId, netMode);
uint32_t visState = 0;

View File

@ -72,10 +72,29 @@ void DHTStatus::getDHTStatus()
/* now the extra bit .... switch on check boxes */
const RsConfig &config = rsiface->getConfig();
if (!(config.DHTActive))
{
// GRAY.
dhtstatusLabel->setPixmap(QPixmap(":/images/grayled.png"));
dhtstatusLabel->setToolTip(tr("DHT Off"));
spaceLabel->setVisible(false);
dhtnetworkLabel->setVisible(false);
dhtnetworksizeLabel->setVisible(false);
dhtnetworksizeLabel->setText("");
dhtnetworksizeLabel->setToolTip("");
}
else
{
if (config.netDhtOk)
{
dhtstatusLabel->setPixmap(QPixmap(":/images/greenled.png"));
dhtstatusLabel->setToolTip(tr("DHT On"));
#define MIN_RS_NET_SIZE 10
// YELLOW or GREEN.
if (config.netDhtRsNetSize < MIN_RS_NET_SIZE)
{
dhtstatusLabel->setPixmap(QPixmap(":/images/yellowled.png"));
dhtstatusLabel->setToolTip(tr("DHT Searching for Retroshare Peers"));
spaceLabel->setVisible(true);
dhtnetworkLabel->setVisible(true);
@ -86,8 +105,25 @@ void DHTStatus::getDHTStatus()
}
else
{
dhtstatusLabel->setPixmap(QPixmap(":/images/greenled.png"));
dhtstatusLabel->setToolTip(tr("DHT Good"));
spaceLabel->setVisible(true);
dhtnetworkLabel->setVisible(true);
dhtnetworksizeLabel->setVisible(true);
dhtnetworksizeLabel->setText(QString("%1 (%2)").arg(misc::userFriendlyUnit(config.netDhtRsNetSize, 1)).arg(misc::userFriendlyUnit(config.netDhtNetSize, 1)));
dhtnetworksizeLabel->setToolTip(tr("RetroShare users in DHT (Total DHT users)") );
}
}
else
{
// RED - some issue.
dhtstatusLabel->setPixmap(QPixmap(":/images/redled.png"));
dhtstatusLabel->setToolTip(tr("DHT Off"));
dhtstatusLabel->setToolTip(tr("DHT Error"));
spaceLabel->setVisible(false);
dhtnetworkLabel->setVisible(false);
@ -96,6 +132,7 @@ void DHTStatus::getDHTStatus()
dhtnetworksizeLabel->setText("");
dhtnetworksizeLabel->setToolTip("");
}
}
rsiface->unlockData(); /* UnLock Interface */
}

View File

@ -24,7 +24,8 @@
#include "natstatus.h"
#include <retroshare/rsiface.h>
#include "retroshare/rsiface.h"
#include "retroshare/rsconfig.h"
NATStatus::NATStatus(QWidget *parent)
: QWidget(parent)
@ -49,6 +50,81 @@ NATStatus::NATStatus(QWidget *parent)
void NATStatus::getNATStatus()
{
uint32_t netState = rsConfig -> getNetState();
switch(netState)
{
default:
case RSNET_NETSTATE_BAD_UNKNOWN:
{
iconLabel->setPixmap(QPixmap(":/images/yellowled.png"));
iconLabel->setToolTip(tr("Network Status Unknown"));
}
break;
case RSNET_NETSTATE_BAD_OFFLINE:
{
iconLabel->setPixmap(QPixmap(":/images/grayled.png"));
iconLabel->setToolTip(tr("Offline"));
}
break;
// BAD. (RED)
case RSNET_NETSTATE_BAD_NATSYM:
{
iconLabel->setPixmap(QPixmap(":/images/redled.png"));
iconLabel->setToolTip(tr("Nasty Firewall"));
}
break;
case RSNET_NETSTATE_BAD_NODHT_NAT:
{
iconLabel->setPixmap(QPixmap(":/images/redled.png"));
iconLabel->setToolTip(tr("DHT Disabled and Firewalled"));
}
break;
// CAUTION. (ORANGE)
case RSNET_NETSTATE_WARNING_RESTART:
{
iconLabel->setPixmap(QPixmap(":/images/yellowled.png"));
iconLabel->setToolTip(tr("Network Restarting"));
}
break;
case RSNET_NETSTATE_WARNING_NATTED:
{
iconLabel->setPixmap(QPixmap(":/images/yellowled.png"));
iconLabel->setToolTip(tr("Behind Firewall"));
}
break;
case RSNET_NETSTATE_WARNING_NODHT:
{
iconLabel->setPixmap(QPixmap(":/images/yellowled.png"));
iconLabel->setToolTip(tr("DHT Disabled"));
}
break;
// GOOD (GREEN)
case RSNET_NETSTATE_GOOD:
{
iconLabel->setPixmap(QPixmap(":/images/greenled.png"));
iconLabel->setToolTip(tr("OK | RetroShare Server"));
}
break;
}
}
#if 0
void NATStatus::getNATStatus()
{
uint32_t netMode = rsConfig -> getNetworkMode();
uint32_t natType = rsConfig -> getNatTypeMode();
uint32_t natHole = rsConfig -> getNatHoleMode();
rsiface->lockData(); /* Lock Interface */
/* now the extra bit .... switch on check boxes */
@ -111,3 +187,5 @@ void NATStatus::getNATStatus()
rsiface->unlockData(); /* UnLock Interface */
}
#endif