Merge pull request #2579 from csoler/v0.6-FriendServer2

Improvements on friend server
This commit is contained in:
csoler 2022-02-09 22:20:34 +01:00 committed by GitHub
commit 8105bfcbc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 113 additions and 117 deletions

@ -1 +1 @@
Subproject commit c1feae8b9144adaae8cf4d6c8a441bf41a6d7a95
Subproject commit 5a6f09ee11a34f1c52b5be3f0a440f185b9b2a89

View File

@ -44,6 +44,8 @@ FriendServerControl::FriendServerControl(QWidget *parent)
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
friendServerOnOff_CB->setEnabled(false); // until FS is connected.
if(!rsFriendServer)
{
setEnabled(false);
@ -78,7 +80,7 @@ FriendServerControl::FriendServerControl(QWidget *parent)
QObject::connect(friendServerOnOff_CB,SIGNAL(toggled(bool)),this,SLOT(onOnOffClick(bool)));
QObject::connect(torServerFriendsToRequest_SB,SIGNAL(valueChanged(int)),this,SLOT(onFriendsToRequestChanged(int)));
QObject::connect(torServerAddress_LE,SIGNAL(textChanged(const QString&)),this,SLOT(onOnionAddressEdit(const QString&)));
QObject::connect(torServerAddress_LE,SIGNAL(editingFinished()),this,SLOT(onOnionAddressEdit()));
QObject::connect(torServerPort_SB,SIGNAL(valueChanged(int)),this,SLOT(onOnionPortEdit(int)));
QObject::connect(mConnectionCheckTimer,SIGNAL(timeout()),this,SLOT(checkServerAddress()));
@ -128,7 +130,7 @@ void FriendServerControl::onOnionPortEdit(int)
}
}
void FriendServerControl::onOnionAddressEdit(const QString&)
void FriendServerControl::onOnionAddressEdit()
{
// Setup timer to auto-check the friend server address
mConnectionCheckTimer->stop();
@ -170,11 +172,15 @@ void FriendServerControl::updateFriendServerStatusIcon(bool ok)
{
torServerStatus_LB->setToolTip(tr("Friend server is currently reachable.")) ;
mCheckingServerMovie->setFileName(ICON_STATUS_OK);
friendServerOnOff_CB->setEnabled(true);
}
else
{
rsFriendServer->stopServer();
torServerStatus_LB->setToolTip(tr("The proxy is not enabled or broken.\nAre all services up and running fine??\nAlso check your ports!")) ;
mCheckingServerMovie->setFileName(ICON_STATUS_UNKNOWN);
friendServerOnOff_CB->setChecked(false);
friendServerOnOff_CB->setEnabled(false);
}
mCheckingServerMovie->start();
}

View File

@ -35,7 +35,7 @@ public:
protected slots:
void onOnOffClick(bool b);
void onOnionAddressEdit(const QString&);
void onOnionAddressEdit();
void onOnionPortEdit(int);
void onNbFriendsToRequestsChanged(int n);
void checkServerAddress();

View File

@ -11,89 +11,8 @@
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QCheckBox" name="friendServerOnOff_CB">
<property name="text">
<string>On/Off</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="helpButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Friends to request: </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="torServerFriendsToRequest_SB">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>15</number>
</property>
<property name="value">
<number>5</number>
</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>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
@ -112,9 +31,6 @@
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter here the onion address of the Friend Server that was given to you. The address will be automatically checked after you enter it and a green bullet will appear if the server is online.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>.onion</string>
</property>
<property name="placeholderText">
<string>Onion address of the friend server</string>
</property>
@ -150,8 +66,47 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="helpButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
@ -180,21 +135,60 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<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="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="friendServerOnOff_CB">
<property name="text">
<string>On/Off</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>302</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Friends to request: </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="torServerFriendsToRequest_SB">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>15</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -211,7 +205,7 @@
</layout>
</widget>
<resources>
<include location="images.qrc"/>
<include location="icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -27,6 +27,7 @@
#include <retroshare/rspeers.h>
#include <retroshare/rshistory.h>
#include <retroshare/rsinit.h>
#include "chat/ChatUserNotify.h"
#include "connect/ConnectFriendWizard.h"
@ -92,7 +93,8 @@ FriendsDialog::FriendsDialog(QWidget *parent) : MainPage(parent)
ui.tabWidget->setTabPosition(QTabWidget::North);
#ifdef RS_EMBEDED_FRIEND_SERVER
ui.tabWidget->addTab(friendServerControl = new FriendServerControl(),QIcon(IMAGE_PEERS), tr("Friend Server"));
if(RsAccounts::isTorAuto())
ui.tabWidget->addTab(friendServerControl = new FriendServerControl(),QIcon(IMAGE_PEERS), tr("Friend Server"));
#endif
ui.tabWidget->addTab(networkView = new NetworkView(),QIcon(IMAGE_NETWORK2), tr("Network graph"));
ui.tabWidget->addTab(networkDialog = new NetworkDialog(),QIcon(IMAGE_PEERS), tr("Keyring"));
@ -123,9 +125,8 @@ FriendsDialog::FriendsDialog(QWidget *parent) : MainPage(parent)
// add self nick and Avatar to Friends.
RsPeerDetails pd ;
if (rsPeers->getPeerDetails(rsPeers->getOwnId(),pd)) {
if (rsPeers->getPeerDetails(rsPeers->getOwnId(),pd))
ui.nicknameLabel->setText(QString::fromUtf8(pd.name.c_str()) + " (" + QString::fromUtf8(pd.location.c_str())+")");
}
int H = misc::getFontSizeFactor("HelpButton").height();
QString hlp_str = tr(
@ -258,13 +259,9 @@ void FriendsDialog::loadmypersonalstatus()
QString statustring = QString::fromUtf8(rsMsgs->getCustomStateString().c_str());
if (statustring.isEmpty())
{
ui.mypersonalstatusLabel->setText(tr("Set your status message here."));
}
else
{
ui.mypersonalstatusLabel->setText(statustring);
}
}
void FriendsDialog::clearChatNotify()
@ -281,13 +278,11 @@ void FriendsDialog::statusmessage()
/*static*/ bool FriendsDialog::isGroupChatActive()
{
FriendsDialog *friendsDialog = dynamic_cast<FriendsDialog*>(MainWindow::getPage(MainWindow::Friends));
if (!friendsDialog) {
if (!friendsDialog)
return false;
}
if (friendsDialog->ui.tabWidget->currentWidget() == friendsDialog->ui.groupChatTab) {
if (friendsDialog->ui.tabWidget->currentWidget() == friendsDialog->ui.groupChatTab)
return true;
}
return false;
}

View File

@ -136,6 +136,7 @@ void HomePage::handleEvent(std::shared_ptr<const RsEvent> e)
{
case RsNetworkEventCode::LOCAL_IP_UPDATED: // [fallthrough]
case RsNetworkEventCode::EXTERNAL_IP_UPDATED: // [fallthrough]
case RsNetworkEventCode::DNS_UPDATED: // [fallthrough]
RsQThreadUtils::postToObject( [=]()
{
updateCertificate();
@ -213,7 +214,7 @@ void HomePage::updateOwnCert()
}
QString invite ;
RetroshareInviteFlags invite_flags = RetroshareInviteFlags::CURRENT_IP;
RetroshareInviteFlags invite_flags = RetroshareInviteFlags::CURRENT_IP | RetroshareInviteFlags::DNS;
if(mIncludeAllIPs)
invite_flags |= RetroshareInviteFlags::FULL_IP_HISTORY;

View File

@ -205,9 +205,9 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.discComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(saveAddresses()));
connect(ui.netModeComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(saveAddresses()));
connect(ui.localAddress, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
connect(ui.extAddress, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
connect(ui.dynDNS, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
connect(ui.localAddress, SIGNAL(editingFinished()),this,SLOT(saveAddresses()));
connect(ui.extAddress, SIGNAL(editingFinished()),this,SLOT(saveAddresses()));
connect(ui.dynDNS, SIGNAL(editingFinished()),this,SLOT(saveAddresses()));
connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
connect(ui.hiddenpage_proxyAddress_tor, SIGNAL(editingFinished()),this,SLOT(saveAddresses()));