mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-23 05:44:45 -04:00
Fix Preferences-Network page IP update.
This commit is contained in:
parent
d112357b77
commit
7d4dd70c36
2 changed files with 40 additions and 3 deletions
|
@ -24,26 +24,27 @@
|
||||||
#include "rshare.h"
|
#include "rshare.h"
|
||||||
#include "rsharesettings.h"
|
#include "rsharesettings.h"
|
||||||
#include "util/i2pcommon.h"
|
#include "util/i2pcommon.h"
|
||||||
#include "util/RsNetUtil.h"
|
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
|
#include "util/RsNetUtil.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "retroshare/rsbanlist.h"
|
#include "retroshare/rsbanlist.h"
|
||||||
#include "retroshare/rsconfig.h"
|
#include "retroshare/rsconfig.h"
|
||||||
#include "retroshare/rsdht.h"
|
#include "retroshare/rsdht.h"
|
||||||
|
#include "retroshare/rsinit.h"
|
||||||
#include "retroshare/rspeers.h"
|
#include "retroshare/rspeers.h"
|
||||||
#include "retroshare/rsturtle.h"
|
#include "retroshare/rsturtle.h"
|
||||||
#include "retroshare/rsinit.h"
|
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QMovie>
|
#include <QMovie>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QTcpSocket>
|
|
||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QTcpSocket>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#define ICON_STATUS_UNKNOWN ":/images/ledoff1.png"
|
#define ICON_STATUS_UNKNOWN ":/images/ledoff1.png"
|
||||||
|
@ -79,6 +80,7 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
|
||||||
, manager(NULL), mOngoingConnectivityCheck(-1)
|
, manager(NULL), mOngoingConnectivityCheck(-1)
|
||||||
, mIsHiddenNode(false), mHiddenType(RS_HIDDEN_TYPE_NONE)
|
, mIsHiddenNode(false), mHiddenType(RS_HIDDEN_TYPE_NONE)
|
||||||
, mBobAccessible(false)
|
, mBobAccessible(false)
|
||||||
|
, mEventHandlerId(0)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
@ -244,8 +246,38 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
|
||||||
// when the network menu is opened and the hidden service tab is already selected updateOutProxyIndicator() won't be called and thus resulting in wrong proxy indicators.
|
// when the network menu is opened and the hidden service tab is already selected updateOutProxyIndicator() won't be called and thus resulting in wrong proxy indicators.
|
||||||
if (ui.tabWidget->currentIndex() == TAB_HIDDEN_SERVICE)
|
if (ui.tabWidget->currentIndex() == TAB_HIDDEN_SERVICE)
|
||||||
updateOutProxyIndicator();
|
updateOutProxyIndicator();
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::NETWORK );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerPage::handleEvent(std::shared_ptr<const RsEvent> e)
|
||||||
|
{
|
||||||
|
if(e->mType != RsEventType::NETWORK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const RsNetworkEvent *ne = dynamic_cast<const RsNetworkEvent*>(e.get());
|
||||||
|
|
||||||
|
if(!ne)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// in any case we update the IPs
|
||||||
|
|
||||||
|
switch(ne->mNetworkEventCode)
|
||||||
|
{
|
||||||
|
case RsNetworkEventCode::LOCAL_IP_UPDATED: // [fallthrough]
|
||||||
|
case RsNetworkEventCode::EXTERNAL_IP_UPDATED: // [fallthrough]
|
||||||
|
RsQThreadUtils::postToObject( [=]()
|
||||||
|
{
|
||||||
|
updateStatus();
|
||||||
|
},this);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ServerPage::saveAndTestInProxy()
|
void ServerPage::saveAndTestInProxy()
|
||||||
{
|
{
|
||||||
saveAddresses();
|
saveAddresses();
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
#include "retroshare-gui/RsAutoUpdatePage.h"
|
#include "retroshare-gui/RsAutoUpdatePage.h"
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
|
|
||||||
|
#include "retroshare/rsevents.h"
|
||||||
|
|
||||||
|
|
||||||
class QNetworkReply;
|
class QNetworkReply;
|
||||||
class QNetworkAccessManager;
|
class QNetworkAccessManager;
|
||||||
|
@ -160,6 +162,9 @@ private:
|
||||||
uint32_t mHiddenType;
|
uint32_t mHiddenType;
|
||||||
bobSettings mBobSettings;
|
bobSettings mBobSettings;
|
||||||
bool mBobAccessible; // keeps track wether bob is accessable or not to en/disable the corresponding buttons
|
bool mBobAccessible; // keeps track wether bob is accessable or not to en/disable the corresponding buttons
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
|
void handleEvent(std::shared_ptr<const RsEvent> event);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !SERVERPAGE_H
|
#endif // !SERVERPAGE_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue