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();
mThreadId.clear();
mParentId.clear();
mAuthorId.clear();
mOrigMsgId.clear();
mMsgName.clear();
mServiceString.clear();
mAuthorId.clear();
signSet.TlvClear();
mMsgName.clear();
mPublishTs = 0;
mMsgFlags = 0;
mServiceString.clear();
mMsgStatus = 0;
mMsgSize = 0;
mChildTs = 0;
recvTS = 0;
mHash.clear();
validated = false;
}
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_SECURITY_IP = 0x2000;
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_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_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_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_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_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_OUT = RS_FEED_TYPE_SECURITY | 0x0004;
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_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_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_INTERNAL_ERROR = RS_FEED_TYPE_SECURITY | 0x0007;

View File

@ -2,7 +2,7 @@
#define RETROSHARE_RTT_INTERFACE_H
/*
* libretroshare/src/retroshare: rsrtt.h
* libretroshare/src/retroshare: rsrtt.h
*
* RetroShare C++ Interface.
*
@ -58,6 +58,7 @@ class RsRtt
virtual ~RsRtt() { return; }
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/pqistore.h"
#include "pqi/p3linkmgr.h"
#include "rsserver/p3face.h"
#include "services/p3rtt.h"
#include "rsitems/rsrttitems.h"
#include <sys/time.h>
#include <math.h>
/****
* #define DEBUG_RTT 1
@ -358,7 +360,26 @@ int p3rtt::storePongResult(const RsPeerId& id, uint32_t counter, double recv_ts,
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;
}
@ -379,7 +400,16 @@ uint32_t p3rtt::getPongResults(const RsPeerId& id, int n, std::list<RsRttPongRes
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)
{

View File

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

View File

@ -22,6 +22,7 @@
#include "GenCertDialog.h"
#include <QAbstractEventDispatcher>
#include <QLineEdit>
#include <QFileDialog>
#include <QGraphicsOpacityEffect>
#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\""));
//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_input->setVisible(generate_new);
@ -421,7 +419,15 @@ void GenCertDialog::genPerson()
RsPgpId PGPId;
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.size() < RSID_MINIMUM_NICKNAME_SIZE)

View File

@ -217,13 +217,17 @@ void NewsFeed::updateDisplay()
if (flags & RS_FEED_TYPE_PEER)
addFeedItemPeerDisconnect(fi);
break;
case RS_FEED_ITEM_PEER_HELLO:
if (flags & RS_FEED_TYPE_PEER)
addFeedItemPeerHello(fi);
break;
case RS_FEED_ITEM_PEER_NEW:
if (flags & RS_FEED_TYPE_PEER)
addFeedItemPeerNew(fi);
break;
case RS_FEED_ITEM_PEER_HELLO:
case RS_FEED_ITEM_PEER_OFFSET:
if (flags & RS_FEED_TYPE_PEER)
addFeedItemPeerHello(fi);
addFeedItemPeerOffset(fi);
break;
case RS_FEED_ITEM_SEC_CONNECT_ATTEMPT:
@ -412,8 +416,9 @@ void NewsFeed::testFeeds(uint notifyFlags)
instance->addFeedItemPeerConnect(fi);
instance->addFeedItemPeerDisconnect(fi);
instance->addFeedItemPeerNew(fi);
instance->addFeedItemPeerHello(fi);
instance->addFeedItemPeerNew(fi);
instance->addFeedItemPeerOffset(fi);
break;
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)
: mType(type), mSslId(sslId), mIpAddr(ipAddr), mIpAddrReported(ipAddrReported)
{
mPeerItem = dynamic_cast<PeerItem*>(feedItem);
mSecItem = dynamic_cast<SecurityItem*>(feedItem);
mSecurityIpItem = dynamic_cast<SecurityIpItem*>(feedItem);
}
@ -914,6 +920,7 @@ struct AddFeedItemIfUniqueData
const RsPeerId &mSslId;
const std::string& mIpAddr;
const std::string& mIpAddrReported;
PeerItem *mPeerItem;
SecurityItem *mSecItem;
SecurityIpItem *mSecurityIpItem;
};
@ -925,6 +932,14 @@ static bool addFeedItemIfUniqueCallback(FeedItem *feedItem, void *data)
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) {
SecurityItem *secitem = dynamic_cast<SecurityItem*>(feedItem);
if (secitem && secitem->isSame(findData->mSslId, findData->mType)) {
@ -955,7 +970,7 @@ void NewsFeed::addFeedItemIfUnique(FeedItem *item, int itemType, const RsPeerId
return;
}
ui->feedWidget->removeFeedItem(item);
ui->feedWidget->removeFeedItem(feedItem);
}
addFeedItem(item);
@ -1017,6 +1032,20 @@ void NewsFeed::addFeedItemPeerNew(const RsFeedItem &fi)
#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)
{
/* make new widget */

View File

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

View File

@ -48,6 +48,7 @@
#include "gui/common/FilesDefs.h"
#include "gui/common/Emoticons.h"
#include "gui/chat/ChatLobbyDialog.h"
#include "gui/gxs/GxsIdDetails.h"
#include "util/misc.h"
#include "util/HandleRichText.h"
#include "gui/chat/ChatUserNotify.h"//For BradCast
@ -65,6 +66,8 @@
#define FMM 2.5//fontMetricsMultiplicator
#define PERSONID "PersonId:"
/*****
* #define CHAT_DEBUG 1
*****/
@ -587,6 +590,9 @@ bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
if (ui->textBrowser->checkImage(helpEvent->pos(), 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()){
@ -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 {
if (event->type() == QEvent::WindowActivate) {
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));
//replace Name anchors with GXS Id
QString strGxsId = "";
if (!gxsId.isNull())
if (!gxsId.isNull()) {
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());
textCursor.movePosition(QTextCursor::End);

View File

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

View File

@ -34,6 +34,7 @@
#include <retroshare/rsmsgs.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsrtt.h>
/*****
* #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()
{
if (!rsPeers)
@ -95,6 +106,9 @@ void PeerItem::updateItemStatic()
case PEER_TYPE_NEW_FOF:
title = tr("Friend of Friend");
break;
case PEER_TYPE_OFFSET:
title = tr("Friend Time Offset");
break;
default:
title = tr("Peer");
break;
@ -111,8 +125,14 @@ void PeerItem::updateItemStatic()
/* expanded Info */
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()));
if (rsRtt)
{
double offset = rsRtt->getMeanOffset(RsPeerId(mPeerId));
offsetLabel->setText(QString::number(offset,'f',2).append(" s"));
}
}
else
{
@ -187,6 +207,13 @@ void PeerItem::updateItem()
{
sendmsgButton->setEnabled(false);
}
if (rsRtt)
{
double offset = rsRtt->getMeanOffset(RsPeerId(mPeerId));
offsetLabel->setText(QString::number(offset,'f',2).append(" s"));
}
}
/* 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_HELLO = 0x0003; /* failed Connect Attempt */
const uint32_t PEER_TYPE_NEW_FOF = 0x0004; /* new Friend of Friend */
const uint32_t PEER_TYPE_OFFSET = 0x0005; /* received time offset */
class FeedHolder;
@ -43,6 +44,8 @@ public:
void updateItemStatic();
bool isSame(const RsPeerId &peerId, uint32_t type);
protected:
/* FeedItem */
virtual void doExpand(bool open);

View File

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

View File

@ -1844,11 +1844,23 @@ void GxsForumThreadWidget::setMsgReadStatus(QList<QTreeWidgetItem*> &rows, bool
// LIKE THIS BELOW...
//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;
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 */
mIgnoredMsgId.push_back(RsGxsMessageId(msgId));

View File

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

View File

@ -10,9 +10,9 @@
<height>546</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="RelayPageVLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="topHLayout">
<item>
<widget class="QCheckBox" name="enableCheckBox">
<property name="text">
@ -21,7 +21,7 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<spacer name="topLeftHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -41,7 +41,7 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<spacer name="topRightHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -56,14 +56,14 @@
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="relayOptionGBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Relay options</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="relayOptionGBoxGLayout">
<property name="leftMargin">
<number>0</number>
</property>
@ -80,7 +80,7 @@
<number>0</number>
</property>
<item row="0" column="0">
<spacer name="horizontalSpacer_2">
<spacer name="optionHeaderLHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -93,14 +93,14 @@
</spacer>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="headerNumberLabel">
<property name="text">
<string>Number</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<spacer name="optionHeaderRHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -113,28 +113,28 @@
</spacer>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_12">
<widget class="QLabel" name="headerBandwidthLabel">
<property name="text">
<string>Bandwidth per link</string>
</property>
</widget>
</item>
<item row="0" column="4" rowspan="7">
<widget class="Line" name="line_2">
<widget class="Line" name="totalVLine">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QLabel" name="label_13">
<widget class="QLabel" name="headerTotalLabel">
<property name="text">
<string>Total Bandwidth</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="2">
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="friendLabel">
<property name="text">
<string>Friends</string>
</property>
@ -154,7 +154,7 @@
</widget>
</item>
<item row="1" column="2" rowspan="2">
<widget class="QLabel" name="label_9">
<widget class="QLabel" name="xFriendLabel">
<property name="text">
<string notr="true">x</string>
</property>
@ -184,7 +184,7 @@
</widget>
</item>
<item row="3" column="0" rowspan="2">
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="fofLabel">
<property name="text">
<string>Friends of Friends</string>
</property>
@ -198,7 +198,7 @@
</widget>
</item>
<item row="3" column="2" rowspan="2">
<widget class="QLabel" name="label_10">
<widget class="QLabel" name="xFOFLabel">
<property name="text">
<string notr="true">x</string>
</property>
@ -228,7 +228,7 @@
</widget>
</item>
<item row="5" column="0" rowspan="2">
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="generalLabel">
<property name="text">
<string>General</string>
</property>
@ -242,7 +242,7 @@
</widget>
</item>
<item row="5" column="2" rowspan="2">
<widget class="QLabel" name="label_11">
<widget class="QLabel" name="xGeneralLabel">
<property name="text">
<string notr="true">x</string>
</property>
@ -272,12 +272,19 @@
</widget>
</item>
<item row="7" column="0" colspan="6">
<widget class="Line" name="line">
<widget class="Line" name="totalHLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</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">
<widget class="QLineEdit" name="noTotalLineEdit">
<property name="focusPolicy">
@ -288,15 +295,8 @@
</property>
</widget>
</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">
<spacer name="horizontalSpacer_3">
<spacer name="totalHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -318,6 +318,26 @@
</property>
</widget>
</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>
</widget>
</item>
@ -326,7 +346,17 @@
<property name="title">
<string>Relay Server Setup</string>
</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">
<widget class="QCheckBox" name="keyOkBox">
<property name="enabled">
@ -347,16 +377,6 @@
</property>
</widget>
</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">
<widget class="QTreeWidget" name="serverTreeWidget">
<column>
@ -377,7 +397,7 @@
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<spacer name="mainVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>

View File

@ -26,7 +26,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="tabNetConf">
<attribute name="title">
@ -418,6 +418,21 @@
</item>
</layout>
</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>
</item>
</layout>