merged upstream/master

This commit is contained in:
csoler 2017-05-02 22:41:01 +02:00
commit f006146ee4
17 changed files with 344 additions and 113 deletions

View file

@ -239,17 +239,21 @@ void RsGxsMsgMetaData::clear()
mMsgId.clear(); mMsgId.clear();
mThreadId.clear(); mThreadId.clear();
mParentId.clear(); mParentId.clear();
mAuthorId.clear();
mOrigMsgId.clear(); mOrigMsgId.clear();
mMsgName.clear(); mAuthorId.clear();
mServiceString.clear();
signSet.TlvClear(); signSet.TlvClear();
mMsgName.clear();
mPublishTs = 0; mPublishTs = 0;
mMsgFlags = 0; mMsgFlags = 0;
mServiceString.clear();
mMsgStatus = 0; mMsgStatus = 0;
mMsgSize = 0;
mChildTs = 0; mChildTs = 0;
recvTS = 0; recvTS = 0;
mHash.clear();
validated = false;
} }
bool RsGxsMsgMetaData::serialise(void *data, uint32_t *size) bool RsGxsMsgMetaData::serialise(void *data, uint32_t *size)

View file

@ -78,15 +78,16 @@ const uint32_t RS_FEED_TYPE_SECURITY = 0x0800;
const uint32_t RS_FEED_TYPE_POSTED = 0x1000; const uint32_t RS_FEED_TYPE_POSTED = 0x1000;
const uint32_t RS_FEED_TYPE_SECURITY_IP = 0x2000; const uint32_t RS_FEED_TYPE_SECURITY_IP = 0x2000;
const uint32_t RS_FEED_ITEM_PEER_CONNECT = RS_FEED_TYPE_PEER | 0x0001; const uint32_t RS_FEED_ITEM_PEER_CONNECT = RS_FEED_TYPE_PEER | 0x0001;
const uint32_t RS_FEED_ITEM_PEER_DISCONNECT = RS_FEED_TYPE_PEER | 0x0002; const uint32_t RS_FEED_ITEM_PEER_DISCONNECT = RS_FEED_TYPE_PEER | 0x0002;
const uint32_t RS_FEED_ITEM_PEER_HELLO = RS_FEED_TYPE_PEER | 0x0003; const uint32_t RS_FEED_ITEM_PEER_HELLO = RS_FEED_TYPE_PEER | 0x0003;
const uint32_t RS_FEED_ITEM_PEER_NEW = RS_FEED_TYPE_PEER | 0x0004; const uint32_t RS_FEED_ITEM_PEER_NEW = RS_FEED_TYPE_PEER | 0x0004;
const uint32_t RS_FEED_ITEM_PEER_OFFSET = RS_FEED_TYPE_PEER | 0x0005;
const uint32_t RS_FEED_ITEM_SEC_CONNECT_ATTEMPT = RS_FEED_TYPE_SECURITY | 0x0001; const uint32_t RS_FEED_ITEM_SEC_CONNECT_ATTEMPT = RS_FEED_TYPE_SECURITY | 0x0001;
const uint32_t RS_FEED_ITEM_SEC_AUTH_DENIED = RS_FEED_TYPE_SECURITY | 0x0002; const uint32_t RS_FEED_ITEM_SEC_AUTH_DENIED = RS_FEED_TYPE_SECURITY | 0x0002;
const uint32_t RS_FEED_ITEM_SEC_UNKNOWN_IN = RS_FEED_TYPE_SECURITY | 0x0003; const uint32_t RS_FEED_ITEM_SEC_UNKNOWN_IN = RS_FEED_TYPE_SECURITY | 0x0003;
const uint32_t RS_FEED_ITEM_SEC_UNKNOWN_OUT = RS_FEED_TYPE_SECURITY | 0x0004; const uint32_t RS_FEED_ITEM_SEC_UNKNOWN_OUT = RS_FEED_TYPE_SECURITY | 0x0004;
const uint32_t RS_FEED_ITEM_SEC_WRONG_SIGNATURE = RS_FEED_TYPE_SECURITY | 0x0005; const uint32_t RS_FEED_ITEM_SEC_WRONG_SIGNATURE = RS_FEED_TYPE_SECURITY | 0x0005;
const uint32_t RS_FEED_ITEM_SEC_BAD_CERTIFICATE = RS_FEED_TYPE_SECURITY | 0x0006; const uint32_t RS_FEED_ITEM_SEC_BAD_CERTIFICATE = RS_FEED_TYPE_SECURITY | 0x0006;
const uint32_t RS_FEED_ITEM_SEC_INTERNAL_ERROR = RS_FEED_TYPE_SECURITY | 0x0007; const uint32_t RS_FEED_ITEM_SEC_INTERNAL_ERROR = RS_FEED_TYPE_SECURITY | 0x0007;

View file

@ -2,7 +2,7 @@
#define RETROSHARE_RTT_INTERFACE_H #define RETROSHARE_RTT_INTERFACE_H
/* /*
* libretroshare/src/retroshare: rsrtt.h * libretroshare/src/retroshare: rsrtt.h
* *
* RetroShare C++ Interface. * RetroShare C++ Interface.
* *
@ -58,6 +58,7 @@ class RsRtt
virtual ~RsRtt() { return; } virtual ~RsRtt() { return; }
virtual uint32_t getPongResults(const RsPeerId& id, int n, std::list<RsRttPongResult> &results) = 0; virtual uint32_t getPongResults(const RsPeerId& id, int n, std::list<RsRttPongResult> &results) = 0;
virtual double getMeanOffset(const RsPeerId& id) = 0;
}; };

View file

@ -30,11 +30,13 @@
#include "pqi/pqibin.h" #include "pqi/pqibin.h"
#include "pqi/pqistore.h" #include "pqi/pqistore.h"
#include "pqi/p3linkmgr.h" #include "pqi/p3linkmgr.h"
#include "rsserver/p3face.h"
#include "services/p3rtt.h" #include "services/p3rtt.h"
#include "rsitems/rsrttitems.h" #include "rsitems/rsrttitems.h"
#include <sys/time.h> #include <sys/time.h>
#include <math.h>
/**** /****
* #define DEBUG_RTT 1 * #define DEBUG_RTT 1
@ -358,7 +360,26 @@ int p3rtt::storePongResult(const RsPeerId& id, uint32_t counter, double recv_ts,
peerInfo->mPongResults.pop_front(); peerInfo->mPongResults.pop_front();
} }
/* should do calculations */ //Wait at least 20 pongs before compute mean time offset
if(peerInfo->mPongResults.size() > 20)
{
double mean = 0;
for(std::list<RsRttPongResult>::const_iterator prIt = peerInfo->mPongResults.begin(), end = peerInfo->mPongResults.end(); prIt != end; ++ prIt)
{
mean += prIt->mOffset;
}
peerInfo->mCurrentMeanOffset = mean / peerInfo->mPongResults.size();
if(fabs(peerInfo->mCurrentMeanOffset) > 120)
{
p3Notify *notify = RsServer::notify();
if (notify)
{
//notify->AddPopupMessage(RS_POPUP_OFFSET, eerInfo->mId.toStdString(),"", "Time Offset: ");
notify->AddFeedItem(RS_FEED_ITEM_PEER_OFFSET, peerInfo->mId.toStdString());
}
std::cerr << "(WW) Peer:" << peerInfo->mId << " get time offset more than two minutes with you!!!" << std::endl;
}
}
return 1; return 1;
} }
@ -379,7 +400,16 @@ uint32_t p3rtt::getPongResults(const RsPeerId& id, int n, std::list<RsRttPongRes
return i ; return i ;
} }
double p3rtt::getMeanOffset(const RsPeerId &id)
{
RsStackMutex stack(mRttMtx); /****** LOCKED MUTEX *******/
RttPeerInfo *peer = locked_GetPeerInfo(id);
if(peer)
return peer->mCurrentMeanOffset;
else
return 0;
}
RttPeerInfo *p3rtt::locked_GetPeerInfo(const RsPeerId& id) RttPeerInfo *p3rtt::locked_GetPeerInfo(const RsPeerId& id)
{ {

View file

@ -46,6 +46,7 @@ class RttPeerInfo
double mCurrentPingTS; double mCurrentPingTS;
double mCurrentPingCounter; double mCurrentPingCounter;
bool mCurrentPongRecvd; bool mCurrentPongRecvd;
double mCurrentMeanOffset;
uint32_t mLostPongs; uint32_t mLostPongs;
uint32_t mSentPings; uint32_t mSentPings;
@ -69,6 +70,7 @@ virtual RsServiceInfo getServiceInfo();
/***** overloaded from rsRtt *****/ /***** overloaded from rsRtt *****/
virtual uint32_t getPongResults(const RsPeerId& id, int n, std::list<RsRttPongResult> &results); virtual uint32_t getPongResults(const RsPeerId& id, int n, std::list<RsRttPongResult> &results);
virtual double getMeanOffset(const RsPeerId &id);
/***** overloaded from p3Service *****/ /***** overloaded from p3Service *****/

View file

@ -22,6 +22,7 @@
#include "GenCertDialog.h" #include "GenCertDialog.h"
#include <QAbstractEventDispatcher> #include <QAbstractEventDispatcher>
#include <QLineEdit>
#include <QFileDialog> #include <QFileDialog>
#include <QGraphicsOpacityEffect> #include <QGraphicsOpacityEffect>
#include <QMessageBox> #include <QMessageBox>
@ -269,9 +270,6 @@ void GenCertDialog::setupState()
//ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to create a profile and associate a node with it. To do so please fill out this form.\nAlternatively you can import a (previously exported) profile. Just uncheck \"Create a new profile\"")); //ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to create a profile and associate a node with it. To do so please fill out this form.\nAlternatively you can import a (previously exported) profile. Just uncheck \"Create a new profile\""));
//no_gpg_key_label->setVisible(false); //no_gpg_key_label->setVisible(false);
ui.nickname_label->setVisible(adv_state) ;
ui.nickname_input->setVisible(adv_state) ;
ui.name_label->setVisible(true); ui.name_label->setVisible(true);
ui.name_input->setVisible(generate_new); ui.name_input->setVisible(generate_new);
@ -421,7 +419,15 @@ void GenCertDialog::genPerson()
RsPgpId PGPId; RsPgpId PGPId;
bool isHiddenLoc = false; bool isHiddenLoc = false;
mGXSNickname = ui.nickname_input->text(); if(ui.nickname_input->isVisible())
{
mGXSNickname = ui.nickname_input->text();
}
else
{
mGXSNickname = ui.node_input->text();
}
if (!mGXSNickname.isEmpty()) if (!mGXSNickname.isEmpty())
{ {
if (mGXSNickname.size() < RSID_MINIMUM_NICKNAME_SIZE) if (mGXSNickname.size() < RSID_MINIMUM_NICKNAME_SIZE)

View file

@ -217,13 +217,17 @@ void NewsFeed::updateDisplay()
if (flags & RS_FEED_TYPE_PEER) if (flags & RS_FEED_TYPE_PEER)
addFeedItemPeerDisconnect(fi); addFeedItemPeerDisconnect(fi);
break; break;
case RS_FEED_ITEM_PEER_HELLO:
if (flags & RS_FEED_TYPE_PEER)
addFeedItemPeerHello(fi);
break;
case RS_FEED_ITEM_PEER_NEW: case RS_FEED_ITEM_PEER_NEW:
if (flags & RS_FEED_TYPE_PEER) if (flags & RS_FEED_TYPE_PEER)
addFeedItemPeerNew(fi); addFeedItemPeerNew(fi);
break; break;
case RS_FEED_ITEM_PEER_HELLO: case RS_FEED_ITEM_PEER_OFFSET:
if (flags & RS_FEED_TYPE_PEER) if (flags & RS_FEED_TYPE_PEER)
addFeedItemPeerHello(fi); addFeedItemPeerOffset(fi);
break; break;
case RS_FEED_ITEM_SEC_CONNECT_ATTEMPT: case RS_FEED_ITEM_SEC_CONNECT_ATTEMPT:
@ -412,8 +416,9 @@ void NewsFeed::testFeeds(uint notifyFlags)
instance->addFeedItemPeerConnect(fi); instance->addFeedItemPeerConnect(fi);
instance->addFeedItemPeerDisconnect(fi); instance->addFeedItemPeerDisconnect(fi);
instance->addFeedItemPeerNew(fi);
instance->addFeedItemPeerHello(fi); instance->addFeedItemPeerHello(fi);
instance->addFeedItemPeerNew(fi);
instance->addFeedItemPeerOffset(fi);
break; break;
case RS_FEED_TYPE_SECURITY: case RS_FEED_TYPE_SECURITY:
@ -906,6 +911,7 @@ struct AddFeedItemIfUniqueData
AddFeedItemIfUniqueData(FeedItem *feedItem, int type, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported) AddFeedItemIfUniqueData(FeedItem *feedItem, int type, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported)
: mType(type), mSslId(sslId), mIpAddr(ipAddr), mIpAddrReported(ipAddrReported) : mType(type), mSslId(sslId), mIpAddr(ipAddr), mIpAddrReported(ipAddrReported)
{ {
mPeerItem = dynamic_cast<PeerItem*>(feedItem);
mSecItem = dynamic_cast<SecurityItem*>(feedItem); mSecItem = dynamic_cast<SecurityItem*>(feedItem);
mSecurityIpItem = dynamic_cast<SecurityIpItem*>(feedItem); mSecurityIpItem = dynamic_cast<SecurityIpItem*>(feedItem);
} }
@ -914,6 +920,7 @@ struct AddFeedItemIfUniqueData
const RsPeerId &mSslId; const RsPeerId &mSslId;
const std::string& mIpAddr; const std::string& mIpAddr;
const std::string& mIpAddrReported; const std::string& mIpAddrReported;
PeerItem *mPeerItem;
SecurityItem *mSecItem; SecurityItem *mSecItem;
SecurityIpItem *mSecurityIpItem; SecurityIpItem *mSecurityIpItem;
}; };
@ -925,6 +932,14 @@ static bool addFeedItemIfUniqueCallback(FeedItem *feedItem, void *data)
return false; return false;
} }
if (findData->mPeerItem) {
PeerItem *peerItem = dynamic_cast<PeerItem*>(feedItem);
if (peerItem && peerItem->isSame(findData->mSslId, findData->mType)) {
return true;
}
return false;
}
if (findData->mSecItem) { if (findData->mSecItem) {
SecurityItem *secitem = dynamic_cast<SecurityItem*>(feedItem); SecurityItem *secitem = dynamic_cast<SecurityItem*>(feedItem);
if (secitem && secitem->isSame(findData->mSslId, findData->mType)) { if (secitem && secitem->isSame(findData->mSslId, findData->mType)) {
@ -955,7 +970,7 @@ void NewsFeed::addFeedItemIfUnique(FeedItem *item, int itemType, const RsPeerId
return; return;
} }
ui->feedWidget->removeFeedItem(item); ui->feedWidget->removeFeedItem(feedItem);
} }
addFeedItem(item); addFeedItem(item);
@ -1017,6 +1032,20 @@ void NewsFeed::addFeedItemPeerNew(const RsFeedItem &fi)
#endif #endif
} }
void NewsFeed::addFeedItemPeerOffset(const RsFeedItem &fi)
{
/* make new widget */
PeerItem *pi = new PeerItem(this, NEWSFEED_PEERLIST, RsPeerId(fi.mId1), PEER_TYPE_OFFSET, false);
/* add to layout */
addFeedItemIfUnique(pi, PEER_TYPE_OFFSET, RsPeerId(fi.mId1), "", "", false);
#ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemPeerOffset()";
std::cerr << std::endl;
#endif
}
void NewsFeed::addFeedItemSecurityConnectAttempt(const RsFeedItem &fi) void NewsFeed::addFeedItemSecurityConnectAttempt(const RsFeedItem &fi)
{ {
/* make new widget */ /* make new widget */

View file

@ -87,8 +87,9 @@ private:
void addFeedItemPeerConnect(const RsFeedItem &fi); void addFeedItemPeerConnect(const RsFeedItem &fi);
void addFeedItemPeerDisconnect(const RsFeedItem &fi); void addFeedItemPeerDisconnect(const RsFeedItem &fi);
void addFeedItemPeerNew(const RsFeedItem &fi);
void addFeedItemPeerHello(const RsFeedItem &fi); void addFeedItemPeerHello(const RsFeedItem &fi);
void addFeedItemPeerNew(const RsFeedItem &fi);
void addFeedItemPeerOffset(const RsFeedItem &fi);
void addFeedItemSecurityConnectAttempt(const RsFeedItem &fi); void addFeedItemSecurityConnectAttempt(const RsFeedItem &fi);
void addFeedItemSecurityAuthDenied(const RsFeedItem &fi); void addFeedItemSecurityAuthDenied(const RsFeedItem &fi);

View file

@ -48,6 +48,7 @@
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "gui/common/Emoticons.h" #include "gui/common/Emoticons.h"
#include "gui/chat/ChatLobbyDialog.h" #include "gui/chat/ChatLobbyDialog.h"
#include "gui/gxs/GxsIdDetails.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "gui/chat/ChatUserNotify.h"//For BradCast #include "gui/chat/ChatUserNotify.h"//For BradCast
@ -65,6 +66,8 @@
#define FMM 2.5//fontMetricsMultiplicator #define FMM 2.5//fontMetricsMultiplicator
#define PERSONID "PersonId:"
/***** /*****
* #define CHAT_DEBUG 1 * #define CHAT_DEBUG 1
*****/ *****/
@ -587,6 +590,9 @@ bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
if (ui->textBrowser->checkImage(helpEvent->pos(), imageStr)) { if (ui->textBrowser->checkImage(helpEvent->pos(), imageStr)) {
toolTipText = imageStr; toolTipText = imageStr;
} }
} else if (toolTipText.startsWith(PERSONID)){
toolTipText = toolTipText.replace(PERSONID, tr("Person id: ") );
toolTipText = toolTipText.append(tr("\nDouble click on it to add his name on text writer.") );
} }
} }
if (!toolTipText.isEmpty()){ if (!toolTipText.isEmpty()){
@ -664,6 +670,39 @@ bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
} }
} }
} }
} else if (obj == ui->textBrowser->viewport()) {
if (event->type() == QEvent::MouseButtonDblClick) {
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
QTextCursor cursor = ui->textBrowser->cursorForPosition(mouseEvent->pos());
cursor.select(QTextCursor::WordUnderCursor);
if (!cursor.selectedText().isEmpty()){
QRegExp rx("<a name=\"(.*)\"",Qt::CaseSensitive, QRegExp::RegExp2);
rx.setMinimal(true);
QString sel=cursor.selection().toHtml();
QStringList anchors;
int pos=0;
while ((pos = rx.indexIn(sel,pos)) != -1) {
anchors << rx.cap(1);
pos += rx.matchedLength();
}
if (!anchors.isEmpty()){
if (anchors.at(0).startsWith(PERSONID)){
RsGxsId mId = RsGxsId(QString(anchors.at(0)).replace(PERSONID,"").toStdString());
if(!mId.isNull()) {
RsIdentityDetails details;
if (rsIdentity->getIdDetails(mId, details)){
QString text = QString("@").append(GxsIdDetails::getName(details)).append(" ");
ui->chatTextEdit->textCursor().insertText(text);
}
}
}
}
}
}
} else { } else {
if (event->type() == QEvent::WindowActivate) { if (event->type() == QEvent::WindowActivate) {
if (isVisible() && (window() == NULL || window()->isActiveWindow())) { if (isVisible() && (window() == NULL || window()->isActiveWindow())) {
@ -963,9 +1002,13 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const RsGxsId gx
formatMsg.replace(QString("<a name=\"time\">"),QString("<a name=\"%1\">").arg(timeStamp)); formatMsg.replace(QString("<a name=\"time\">"),QString("<a name=\"%1\">").arg(timeStamp));
//replace Name anchors with GXS Id //replace Name anchors with GXS Id
QString strGxsId = ""; QString strGxsId = "";
if (!gxsId.isNull()) if (!gxsId.isNull()) {
strGxsId = QString::fromStdString(gxsId.toStdString()); strGxsId = QString::fromStdString(gxsId.toStdString());
formatMsg.replace(QString("<a name=\"name\">"),QString("<a name=\"Person Id: %1\">").arg(strGxsId)); formatMsg.replace(QString("<a name=\"name\">")
,QString("<a name=\"").append(PERSONID).append("%1\">").arg(strGxsId) );
} else {
formatMsg.replace(QString("<a name=\"name\">"),"");
}
QTextCursor textCursor = QTextCursor(ui->textBrowser->textCursor()); QTextCursor textCursor = QTextCursor(ui->textBrowser->textCursor());
textCursor.movePosition(QTextCursor::End); textCursor.movePosition(QTextCursor::End);

View file

@ -1816,25 +1816,26 @@ void FriendList::importFriendlistClicked()
*/ */
bool FriendList::importExportFriendlistFileDialog(QString &fileName, bool import) bool FriendList::importExportFriendlistFileDialog(QString &fileName, bool import)
{ {
if(!misc::getSaveFileName(this, bool res = true;
RshareSettings::LASTDIR_CERT, if (import) {
(import ? tr("Select file for importing your friendlist from") : res = misc::getOpenFileName(this, RshareSettings::LASTDIR_CERT
tr("Select a file for exporting your friendlist to")), , tr("Select file for importing your friendlist from")
tr("XML File (*.xml);;All Files (*)"), , tr("XML File (*.xml);;All Files (*)")
fileName, , fileName
NULL, , QFileDialog::DontConfirmOverwrite
(import ? QFileDialog::DontConfirmOverwrite : (QFileDialog::Options)0) );
)) { } else {
// show error to user res = misc::getSaveFileName(this, RshareSettings::LASTDIR_CERT
QMessageBox mbox; , tr("Select a file for exporting your friendlist to")
mbox.setIcon(QMessageBox::Warning); , tr("XML File (*.xml);;All Files (*)")
mbox.setText(tr("Error")); , fileName, NULL
mbox.setInformativeText(tr("Failed to get a file!")); , (QFileDialog::Options)0
mbox.setStandardButtons(QMessageBox::Ok); );
mbox.exec(); }
return false; if ( res && !fileName.endsWith(".xml",Qt::CaseInsensitive) )
} fileName = fileName.append(".xml");
return true;
return res;
} }
/** /**

View file

@ -34,6 +34,7 @@
#include <retroshare/rsmsgs.h> #include <retroshare/rsmsgs.h>
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rsrtt.h>
/***** /*****
* #define DEBUG_ITEM 1 * #define DEBUG_ITEM 1
@ -68,6 +69,16 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId,
} }
bool PeerItem::isSame(const RsPeerId &peerId, uint32_t type)
{
if ((mPeerId == peerId) && (mType == type))
{
return true;
}
return false;
}
void PeerItem::updateItemStatic() void PeerItem::updateItemStatic()
{ {
if (!rsPeers) if (!rsPeers)
@ -95,6 +106,9 @@ void PeerItem::updateItemStatic()
case PEER_TYPE_NEW_FOF: case PEER_TYPE_NEW_FOF:
title = tr("Friend of Friend"); title = tr("Friend of Friend");
break; break;
case PEER_TYPE_OFFSET:
title = tr("Friend Time Offset");
break;
default: default:
title = tr("Peer"); title = tr("Peer");
break; break;
@ -111,8 +125,14 @@ void PeerItem::updateItemStatic()
/* expanded Info */ /* expanded Info */
nameLabel->setText(QString::fromUtf8(details.name.c_str())); nameLabel->setText(QString::fromUtf8(details.name.c_str()));
idLabel->setText(QString::fromStdString(details.id.toStdString())); idLabel->setText(QString::fromStdString(details.id.toStdString()));
locLabel->setText(QString::fromUtf8(details.location.c_str())); locLabel->setText(QString::fromUtf8(details.location.c_str()));
if (rsRtt)
{
double offset = rsRtt->getMeanOffset(RsPeerId(mPeerId));
offsetLabel->setText(QString::number(offset,'f',2).append(" s"));
}
} }
else else
{ {
@ -187,6 +207,13 @@ void PeerItem::updateItem()
{ {
sendmsgButton->setEnabled(false); sendmsgButton->setEnabled(false);
} }
if (rsRtt)
{
double offset = rsRtt->getMeanOffset(RsPeerId(mPeerId));
offsetLabel->setText(QString::number(offset,'f',2).append(" s"));
}
} }
/* slow Tick */ /* slow Tick */

View file

@ -30,6 +30,7 @@ const uint32_t PEER_TYPE_STD = 0x0001;
const uint32_t PEER_TYPE_CONNECT = 0x0002; const uint32_t PEER_TYPE_CONNECT = 0x0002;
const uint32_t PEER_TYPE_HELLO = 0x0003; /* failed Connect Attempt */ const uint32_t PEER_TYPE_HELLO = 0x0003; /* failed Connect Attempt */
const uint32_t PEER_TYPE_NEW_FOF = 0x0004; /* new Friend of Friend */ const uint32_t PEER_TYPE_NEW_FOF = 0x0004; /* new Friend of Friend */
const uint32_t PEER_TYPE_OFFSET = 0x0005; /* received time offset */
class FeedHolder; class FeedHolder;
@ -43,6 +44,8 @@ public:
void updateItemStatic(); void updateItemStatic();
bool isSame(const RsPeerId &peerId, uint32_t type);
protected: protected:
/* FeedItem */ /* FeedItem */
virtual void doExpand(bool open); virtual void doExpand(bool open);

View file

@ -7,11 +7,20 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>476</width> <width>476</width>
<height>247</height> <height>250</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout"> <layout class="QGridLayout" name="PeerItemGLayout">
<property name="margin"> <property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number> <number>1</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
@ -95,13 +104,13 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Sunken</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QGridLayout"> <layout class="QGridLayout" name="frameGLayout">
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QFrame" name="peerFrame"> <widget class="QFrame" name="peerFrame">
<layout class="QGridLayout"> <layout class="QGridLayout" name="peerFrameGLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -128,7 +137,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<layout class="QGridLayout"> <layout class="QGridLayout" name="peerNameGLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="StyledLabel" name="peerNameLabel"> <widget class="StyledLabel" name="peerNameLabel">
<property name="text"> <property name="text">
@ -165,9 +174,9 @@
</layout> </layout>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="lastHLayout">
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="lastHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -204,9 +213,9 @@
</layout> </layout>
</item> </item>
<item row="1" column="1" colspan="2"> <item row="1" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="buttonHLayout">
<item> <item>
<spacer> <spacer name="buttonHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -317,13 +326,13 @@
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QFrame" name="expandFrame"> <widget class="QFrame" name="expandFrame">
<layout class="QGridLayout"> <layout class="QGridLayout" name="expandFrameGLayout">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="expandFrameHLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="textVLayout">
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="nameText">
<property name="font"> <property name="font">
<font> <font>
<weight>75</weight> <weight>75</weight>
@ -336,7 +345,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="idText">
<property name="font"> <property name="font">
<font> <font>
<weight>75</weight> <weight>75</weight>
@ -349,7 +358,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="trustText">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -368,7 +377,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="locText">
<property name="font"> <property name="font">
<font> <font>
<weight>75</weight> <weight>75</weight>
@ -381,7 +390,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="ipText">
<property name="font"> <property name="font">
<font> <font>
<weight>75</weight> <weight>75</weight>
@ -394,7 +403,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="connText">
<property name="font"> <property name="font">
<font> <font>
<weight>75</weight> <weight>75</weight>
@ -407,7 +416,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="typeLabel"> <widget class="QLabel" name="statusText">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -426,10 +435,30 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="offsetText">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Time offset:</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="labelVLayout">
<item> <item>
<widget class="QLabel" name="nameLabel"> <widget class="QLabel" name="nameLabel">
<property name="sizePolicy"> <property name="sizePolicy">
@ -509,6 +538,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="offsetLabel">
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
@ -531,17 +567,17 @@
</action> </action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>StyledLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledLabel.h</header>
</customwidget>
<customwidget> <customwidget>
<class>AvatarWidget</class> <class>AvatarWidget</class>
<extends>QLabel</extends> <extends>QLabel</extends>
<header>gui/common/AvatarWidget.h</header> <header>gui/common/AvatarWidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>StyledLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledLabel.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>

View file

@ -1844,11 +1844,23 @@ void GxsForumThreadWidget::setMsgReadStatus(QList<QTreeWidgetItem*> &rows, bool
// LIKE THIS BELOW... // LIKE THIS BELOW...
//std::string grpId = (*Row)->data(COLUMN_THREAD_DATA, ROLE_THREAD_GROUPID).toString().toStdString(); //std::string grpId = (*Row)->data(COLUMN_THREAD_DATA, ROLE_THREAD_GROUPID).toString().toStdString();
RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), RsGxsMessageId(msgId)); RsGxsGrpMsgIdPair msgPair = std::make_pair( groupId(), RsGxsMessageId(msgId) );
uint32_t token; uint32_t token;
rsGxsForums->setMessageReadStatus(token, msgPair, read); rsGxsForums->setMessageReadStatus(token, msgPair, read);
// Look if older version exist to mark them too
QMap<RsGxsMessageId,QVector<QPair<time_t,RsGxsMessageId> > >::const_iterator it = mPostVersions.find(mOrigThreadId) ;
if(it != mPostVersions.end())
{
std::cerr << (*it).size() << " versions found " << std::endl;
for(int i=0;i<(*it).size();++i)
{
msgPair = std::make_pair( groupId(), (*it)[i].second );
rsGxsForums->setMessageReadStatus(token, msgPair, read);
}
}
/* Add message id to ignore list for the next updateDisplay */ /* Add message id to ignore list for the next updateDisplay */
mIgnoredMsgId.push_back(RsGxsMessageId(msgId)); mIgnoredMsgId.push_back(RsGxsMessageId(msgId));

View file

@ -209,7 +209,7 @@ void RelayPage::updateEnabled()
if (ui.enableCheckBox->isChecked()) if (ui.enableCheckBox->isChecked())
{ {
ui.groupBox->setEnabled(true); ui.relayOptionGBox->setEnabled(true);
if (ui.serverCheckBox->isChecked()) if (ui.serverCheckBox->isChecked())
{ {
std::cerr << "RelayPage::updateEnabled() Both Enabled" << std::endl; std::cerr << "RelayPage::updateEnabled() Both Enabled" << std::endl;
@ -224,7 +224,7 @@ void RelayPage::updateEnabled()
else else
{ {
std::cerr << "RelayPage::updateEnabled() Both Disabled" << std::endl; std::cerr << "RelayPage::updateEnabled() Both Disabled" << std::endl;
ui.groupBox->setEnabled(false); ui.relayOptionGBox->setEnabled(false);
ui.serverGroupBox->setEnabled(false); ui.serverGroupBox->setEnabled(false);
} }

View file

@ -10,9 +10,9 @@
<height>546</height> <height>546</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="RelayPageVLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="topHLayout">
<item> <item>
<widget class="QCheckBox" name="enableCheckBox"> <widget class="QCheckBox" name="enableCheckBox">
<property name="text"> <property name="text">
@ -21,7 +21,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_5"> <spacer name="topLeftHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -41,7 +41,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_4"> <spacer name="topRightHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -56,14 +56,14 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="relayOptionGBox">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="title"> <property name="title">
<string>Relay options</string> <string>Relay options</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="relayOptionGBoxGLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -80,7 +80,7 @@
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<spacer name="horizontalSpacer_2"> <spacer name="optionHeaderLHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -93,14 +93,14 @@
</spacer> </spacer>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="headerNumberLabel">
<property name="text"> <property name="text">
<string>Number</string> <string>Number</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
<spacer name="horizontalSpacer"> <spacer name="optionHeaderRHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -113,28 +113,28 @@
</spacer> </spacer>
</item> </item>
<item row="0" column="3"> <item row="0" column="3">
<widget class="QLabel" name="label_12"> <widget class="QLabel" name="headerBandwidthLabel">
<property name="text"> <property name="text">
<string>Bandwidth per link</string> <string>Bandwidth per link</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="4" rowspan="7"> <item row="0" column="4" rowspan="7">
<widget class="Line" name="line_2"> <widget class="Line" name="totalVLine">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="5"> <item row="0" column="5">
<widget class="QLabel" name="label_13"> <widget class="QLabel" name="headerTotalLabel">
<property name="text"> <property name="text">
<string>Total Bandwidth</string> <string>Total Bandwidth</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" rowspan="2"> <item row="1" column="0" rowspan="2">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="friendLabel">
<property name="text"> <property name="text">
<string>Friends</string> <string>Friends</string>
</property> </property>
@ -154,7 +154,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="2" rowspan="2"> <item row="1" column="2" rowspan="2">
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="xFriendLabel">
<property name="text"> <property name="text">
<string notr="true">x</string> <string notr="true">x</string>
</property> </property>
@ -184,7 +184,7 @@
</widget> </widget>
</item> </item>
<item row="3" column="0" rowspan="2"> <item row="3" column="0" rowspan="2">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="fofLabel">
<property name="text"> <property name="text">
<string>Friends of Friends</string> <string>Friends of Friends</string>
</property> </property>
@ -198,7 +198,7 @@
</widget> </widget>
</item> </item>
<item row="3" column="2" rowspan="2"> <item row="3" column="2" rowspan="2">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="xFOFLabel">
<property name="text"> <property name="text">
<string notr="true">x</string> <string notr="true">x</string>
</property> </property>
@ -228,7 +228,7 @@
</widget> </widget>
</item> </item>
<item row="5" column="0" rowspan="2"> <item row="5" column="0" rowspan="2">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="generalLabel">
<property name="text"> <property name="text">
<string>General</string> <string>General</string>
</property> </property>
@ -242,7 +242,7 @@
</widget> </widget>
</item> </item>
<item row="5" column="2" rowspan="2"> <item row="5" column="2" rowspan="2">
<widget class="QLabel" name="label_11"> <widget class="QLabel" name="xGeneralLabel">
<property name="text"> <property name="text">
<string notr="true">x</string> <string notr="true">x</string>
</property> </property>
@ -272,12 +272,19 @@
</widget> </widget>
</item> </item>
<item row="7" column="0" colspan="6"> <item row="7" column="0" colspan="6">
<widget class="Line" name="line"> <widget class="Line" name="totalHLine">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0">
<widget class="QLabel" name="totalLabel">
<property name="text">
<string>Total:</string>
</property>
</widget>
</item>
<item row="8" column="1"> <item row="8" column="1">
<widget class="QLineEdit" name="noTotalLineEdit"> <widget class="QLineEdit" name="noTotalLineEdit">
<property name="focusPolicy"> <property name="focusPolicy">
@ -288,15 +295,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Total:</string>
</property>
</widget>
</item>
<item row="8" column="2" colspan="2"> <item row="8" column="2" colspan="2">
<spacer name="horizontalSpacer_3"> <spacer name="totalHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -318,6 +318,26 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0" colspan="6">
<widget class="QLabel" name="warningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"> border: 1px solid #DCDC41;
border-radius: 6px;
background: #FFFFD7;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
</string>
</property>
<property name="text">
<string>Warning: This bandwidth adds up to the max bandwidth.</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -326,7 +346,17 @@
<property name="title"> <property name="title">
<string>Relay Server Setup</string> <string>Relay Server Setup</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="serverGroupBoxGLayout">
<item row="0" column="0">
<widget class="QLineEdit" name="DhtLineEdit">
<property name="inputMask">
<string notr="true">HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QCheckBox" name="keyOkBox"> <widget class="QCheckBox" name="keyOkBox">
<property name="enabled"> <property name="enabled">
@ -347,16 +377,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QLineEdit" name="DhtLineEdit">
<property name="inputMask">
<string notr="true">HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2"> <item row="1" column="0" colspan="2">
<widget class="QTreeWidget" name="serverTreeWidget"> <widget class="QTreeWidget" name="serverTreeWidget">
<column> <column>
@ -377,7 +397,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="mainVSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>

View file

@ -26,7 +26,7 @@
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tabNetConf"> <widget class="QWidget" name="tabNetConf">
<attribute name="title"> <attribute name="title">
@ -418,6 +418,21 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="5" column="1" rowspan="2" colspan="3">
<widget class="QLabel" name="label_warningBandwidth">
<property name="styleSheet">
<string notr="true"> border: 1px solid #DCDC41;
border-radius: 6px;
background: #FFFFD7;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
</string>
</property>
<property name="text">
<string>WARNING:
These values don't take into account the Relays.</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>