ID cleaning. Saving progress.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-IdCleaning@7123 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-02-16 17:31:26 +00:00
parent 14788b578b
commit 6bc79709e3
18 changed files with 85 additions and 87 deletions

View file

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <retroshare/rsturtle.h> #include <retroshare/rsturtle.h>
#include <retroshare/rstypes.h>
#include "ui_TurtleRouterDialog.h" #include "ui_TurtleRouterDialog.h"
#include "RsAutoUpdatePage.h" #include "RsAutoUpdatePage.h"

View file

@ -23,6 +23,7 @@
#include <QPoint> #include <QPoint>
#include <retroshare/rsturtle.h> #include <retroshare/rsturtle.h>
#include <retroshare/rstypes.h>
#include "ui_TurtleRouterStatistics.h" #include "ui_TurtleRouterStatistics.h"
#include "RsAutoUpdatePage.h" #include "RsAutoUpdatePage.h"

View file

@ -179,7 +179,7 @@ void NetworkView::updateDisplay()
if(info.friend_level <= _max_friend_level && _node_ids.find(info.gpg_id) == _node_ids.end()) if(info.friend_level <= _max_friend_level && _node_ids.find(info.gpg_id) == _node_ids.end())
{ {
_node_ids[info.gpg_id] = ui.graphicsView->addNode(" "+detail.name, detail.name+"@"+detail.gpg_id.toStdString(),type,auth,"",info.gpg_id.toStdString()); _node_ids[info.gpg_id] = ui.graphicsView->addNode(" "+detail.name, detail.name+"@"+detail.gpg_id.toStdString(),type,auth,RsPeerId(),info.gpg_id);
#ifdef DEBUG_NETWORKVIEW #ifdef DEBUG_NETWORKVIEW
std::cerr << " inserted node " << info.gpg_id << ", type=" << type << ", auth=" << auth << std::endl ; std::cerr << " inserted node " << info.gpg_id << ", type=" << type << ", auth=" << auth << std::endl ;
#endif #endif

View file

@ -56,7 +56,7 @@ double convertRttToPixels(double maxRTT, double rtt)
class RttPlot class RttPlot
{ {
public: public:
RttPlot(const std::map<std::string, std::list<RsRttPongResult> > &info, RttPlot(const std::map<RsPeerId, std::list<RsRttPongResult> > &info,
double refTS, double maxRTT, double minTS, double maxTS) double refTS, double maxRTT, double minTS, double maxTS)
:mInfo(info), mRefTS(refTS), mMaxRTT(maxRTT), mMinTS(minTS), mMaxTS(maxTS) {} :mInfo(info), mRefTS(refTS), mMaxRTT(maxRTT), mMinTS(minTS), mMaxTS(maxTS) {}
@ -91,7 +91,7 @@ class RttPlot
} }
/* draw a different line for each peer */ /* draw a different line for each peer */
std::map<std::string, std::list<RsRttPongResult> >::const_iterator mit; std::map<RsPeerId, std::list<RsRttPongResult> >::const_iterator mit;
int i = 0; int i = 0;
int nLines = mInfo.size(); int nLines = mInfo.size();
for(mit = mInfo.begin(); mit != mInfo.end(); mit++, i++) for(mit = mInfo.begin(); mit != mInfo.end(); mit++, i++)
@ -154,7 +154,7 @@ class RttPlot
} }
private: private:
const std::map<std::string, std::list<RsRttPongResult> > &mInfo; const std::map<RsPeerId, std::list<RsRttPongResult> > &mInfo;
double mRefTS; double mRefTS;
double mMaxRTT; double mMaxRTT;
double mMinTS; double mMinTS;
@ -216,15 +216,15 @@ void RttStatistics::processSettings(bool bLoad)
void RttStatistics::updateDisplay() void RttStatistics::updateDisplay()
{ {
std::map<std::string, std::list<RsRttPongResult> > info; std::map<RsPeerId, std::list<RsRttPongResult> > info;
if (!rsRtt) if (!rsRtt)
{ {
return; return;
} }
std::list<std::string> idList; std::list<RsPeerId> idList;
std::list<std::string>::iterator it; std::list<RsPeerId>::iterator it;
rsPeers->getOnlineList(idList); rsPeers->getOnlineList(idList);
@ -270,11 +270,11 @@ void RttStatistics::updateDisplay()
_tst_CW->update(); _tst_CW->update();
} }
QString RttStatistics::getPeerName(const std::string& peer_id) QString RttStatistics::getPeerName(const RsPeerId& peer_id)
{ {
static std::map<std::string, QString> names ; static std::map<RsPeerId, QString> names ;
std::map<std::string,QString>::const_iterator it = names.find(peer_id) ; std::map<RsPeerId,QString>::const_iterator it = names.find(peer_id) ;
if( it != names.end()) if( it != names.end())
return it->second ; return it->second ;
@ -295,7 +295,7 @@ RttStatisticsWidget::RttStatisticsWidget(QWidget *parent)
maxHeight = 0 ; maxHeight = 0 ;
} }
void RttStatisticsWidget::updateRttStatistics(const std::map<std::string, std::list<RsRttPongResult> >& info, void RttStatisticsWidget::updateRttStatistics(const std::map<RsPeerId, std::list<RsRttPongResult> >& info,
double maxRTT, double minTS, double maxTS) double maxRTT, double minTS, double maxTS)
{ {
//static const int cellx = 6 ; //static const int cellx = 6 ;

View file

@ -35,7 +35,7 @@ class RttStatistics: public RsAutoUpdatePage, public Ui::RttStatistics
~RttStatistics(); ~RttStatistics();
// Cache for peer names. // Cache for peer names.
static QString getPeerName(const std::string& peer_id) ; static QString getPeerName(const RsPeerId& peer_id) ;
private: private:
@ -56,7 +56,7 @@ class RttStatisticsWidget: public QWidget
virtual void resizeEvent(QResizeEvent *event); virtual void resizeEvent(QResizeEvent *event);
void updateRttStatistics(const std::map<std::string, std::list<RsRttPongResult> >& info, void updateRttStatistics(const std::map<RsPeerId, std::list<RsRttPongResult> >& info,
double maxRTT, double minTS, double maxTS); double maxRTT, double minTS, double maxTS);
private: private:

View file

@ -149,10 +149,10 @@ void ConnectFriendWizard::setCertificate(const QString &certificate, bool friend
} }
} }
void ConnectFriendWizard::setGpgId(const std::string &gpgId, const std::string &sslId, bool friendRequest) void ConnectFriendWizard::setGpgId(const RsPgpId &gpgId, const RsPeerId &sslId, bool friendRequest)
{ {
if (!rsPeers->getPeerDetails(gpgId, peerDetails)) { if (!rsPeers->getGPGDetails(gpgId, peerDetails)) {
setField("errorMessage", tr("Cannot get peer details of PGP key %1").arg(QString::fromStdString(gpgId))); setField("errorMessage", tr("Cannot get peer details of PGP key %1").arg(QString::fromStdString(gpgId.toStdString())));
setStartId(Page_ErrorMessage); setStartId(Page_ErrorMessage);
return; return;
} }
@ -262,7 +262,7 @@ void ConnectFriendWizard::initializePage(int id)
ui->_direct_transfer_CB_2 ->setChecked(peerDetails.service_perm_flags & RS_SERVICE_PERM_DIRECT_DL) ; ui->_direct_transfer_CB_2 ->setChecked(peerDetails.service_perm_flags & RS_SERVICE_PERM_DIRECT_DL) ;
RsPeerDetails tmp_det ; RsPeerDetails tmp_det ;
bool already_in_keyring = rsPeers->getPeerDetails(peerDetails.gpg_id, tmp_det) ; bool already_in_keyring = rsPeers->getGPGDetails(peerDetails.gpg_id, tmp_det) ;
ui->addKeyToKeyring_CB->setChecked(true) ; ui->addKeyToKeyring_CB->setChecked(true) ;
ui->addKeyToKeyring_CB->setEnabled(!already_in_keyring) ; ui->addKeyToKeyring_CB->setEnabled(!already_in_keyring) ;
@ -321,10 +321,10 @@ void ConnectFriendWizard::initializePage(int id)
} }
QString ts; QString ts;
std::list<std::string>::iterator it; std::list<RsPgpId>::iterator it;
for (it = peerDetails.gpgSigners.begin(); it != peerDetails.gpgSigners.end(); ++it) { for (it = peerDetails.gpgSigners.begin(); it != peerDetails.gpgSigners.end(); ++it) {
{ {
std::string peer_name = rsPeers->getPeerName(*it) ; std::string peer_name = rsPeers->getGPGName(*it) ;
// This is baaaad code. We should handle this kind of errors with proper exceptions. // This is baaaad code. We should handle this kind of errors with proper exceptions.
// This happens because signers from a unknown key cannt be found in the keyring, including // This happens because signers from a unknown key cannt be found in the keyring, including
@ -333,7 +333,7 @@ void ConnectFriendWizard::initializePage(int id)
if(peer_name == "[Unknown PGP Cert name]" && *it == peerDetails.gpg_id) if(peer_name == "[Unknown PGP Cert name]" && *it == peerDetails.gpg_id)
peer_name = peerDetails.name ; peer_name = peerDetails.name ;
ts += QString("%1<%2>\n").arg(QString::fromUtf8(peer_name.c_str()), QString::fromStdString(*it)); ts += QString("%1<%2>\n").arg(QString::fromUtf8(peer_name.c_str()), QString::fromStdString( (*it).toStdString()));
} }
} }
@ -344,14 +344,14 @@ void ConnectFriendWizard::initializePage(int id)
if (!loc.isEmpty()) if (!loc.isEmpty())
{ {
loc += " ("; loc += " (";
loc += QString::fromStdString(peerDetails.id); loc += QString::fromStdString(peerDetails.id.toStdString());
loc += ")"; loc += ")";
} }
else else
{ {
if (!peerDetails.id.empty()) if (!peerDetails.id.isNull())
{ {
loc += QString::fromStdString(peerDetails.id); loc += QString::fromStdString(peerDetails.id.toStdString());
} }
} }
@ -401,14 +401,14 @@ void ConnectFriendWizard::initializePage(int id)
if (!loc.isEmpty()) if (!loc.isEmpty())
{ {
loc += " ("; loc += " (";
loc += QString::fromStdString(peerDetails.id); loc += QString::fromStdString(peerDetails.id.toStdString());
loc += ")"; loc += ")";
} }
else else
{ {
if (!peerDetails.id.empty()) if (!peerDetails.id.isNull())
{ {
loc += QString::fromStdString(peerDetails.id); loc += QString::fromStdString(peerDetails.id.toStdString());
} }
} }
@ -533,9 +533,9 @@ bool ConnectFriendWizard::validateCurrentPage()
} }
// search for peer id in string // search for peer id in string
std::string rsidstr = PeerDefs::idFromRsid(rsidstring, false); RsPeerId rsidstr = PeerDefs::idFromRsid(rsidstring, false);
if (rsidstr.empty() || !rsPeers->getPeerDetails(rsidstr, peerDetails)) { if (rsidstr.isNull() || !rsPeers->getPeerDetails(rsidstr, peerDetails)) {
setField("errorMessage", tr("This Peer %1 is not available in your Network").arg(rsidstring)); setField("errorMessage", tr("This Peer %1 is not available in your Network").arg(rsidstring));
error = false; error = false;
} }
@ -564,23 +564,23 @@ bool ConnectFriendWizard::validateCurrentPage()
break; break;
case Page_FriendRecommendations: case Page_FriendRecommendations:
{ {
std::list<std::string> recommendIds; std::list<RsPeerId> recommendIds;
ui->frec_recommendList->selectedSslIds(recommendIds, false); ui->frec_recommendList->selectedSslIds_SSL(recommendIds, false);
if (recommendIds.empty()) { if (recommendIds.empty()) {
QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend for recommendation."), QMessageBox::Ok, QMessageBox::Ok); QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend for recommendation."), QMessageBox::Ok, QMessageBox::Ok);
return false; return false;
} }
std::list<std::string> toIds; std::list<RsPeerId> toIds;
ui->frec_toList->selectedSslIds(toIds, false); ui->frec_toList->selectedSslIds_SSL(toIds, false);
if (toIds.empty()) { if (toIds.empty()) {
QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend as recipient."), QMessageBox::Ok, QMessageBox::Ok); QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend as recipient."), QMessageBox::Ok, QMessageBox::Ok);
return false; return false;
} }
std::list<std::string>::iterator toId; std::list<RsPeerId>::iterator toId;
for (toId = toIds.begin(); toId != toIds.end(); toId++) { for (toId = toIds.begin(); toId != toIds.end(); toId++) {
MessageComposer::recommendFriend(recommendIds, *toId, ui->frec_messageEdit->toHtml(), true); MessageComposer::recommendFriend(recommendIds, *toId, ui->frec_messageEdit->toHtml(), true);
} }
@ -659,7 +659,9 @@ void ConnectFriendWizard::accept()
if (!mCertificate.empty() && add_key_to_keyring) if (!mCertificate.empty() && add_key_to_keyring)
{ {
std::string pgp_id,ssl_id,error_string ; RsPgpId pgp_id ;
RsPeerId ssl_id ;
std::string error_string ;
if(!rsPeers->loadCertificateFromString(mCertificate,ssl_id,pgp_id,error_string)) if(!rsPeers->loadCertificateFromString(mCertificate,ssl_id,pgp_id,error_string))
{ {
@ -670,7 +672,7 @@ void ConnectFriendWizard::accept()
bool runProgressDialog = false; bool runProgressDialog = false;
if(accept_connection && !peerDetails.gpg_id.empty()) if(accept_connection && !peerDetails.gpg_id.isNull())
{ {
std::cerr << "ConclusionPage::validatePage() accepting GPG key for connection." << std::endl; std::cerr << "ConclusionPage::validatePage() accepting GPG key for connection." << std::endl;
rsPeers->addFriend(peerDetails.id, peerDetails.gpg_id,serviceFlags()) ; rsPeers->addFriend(peerDetails.id, peerDetails.gpg_id,serviceFlags()) ;
@ -687,7 +689,7 @@ void ConnectFriendWizard::accept()
rsPeers->assignPeerToGroup(groupId.toStdString(), peerDetails.gpg_id, true); rsPeers->assignPeerToGroup(groupId.toStdString(), peerDetails.gpg_id, true);
} }
if ((accept_connection) && (peerDetails.id != "")) if ((accept_connection) && (!peerDetails.id.isNull()))
{ {
runProgressDialog = true; runProgressDialog = true;
@ -722,7 +724,7 @@ void ConnectFriendWizard::accept()
if (runProgressDialog) if (runProgressDialog)
{ {
std::string ssl_id = peerDetails.id; RsPeerId ssl_id = peerDetails.id;
// its okay if ssl_id is invalid - dialog will show error. // its okay if ssl_id is invalid - dialog will show error.
ConnectProgressDialog::showProgress(ssl_id); ConnectProgressDialog::showProgress(ssl_id);
} }
@ -911,7 +913,7 @@ void ConnectFriendWizard::updatePeersList(int index)
ui->selectedPeersTW->clearContents(); ui->selectedPeersTW->clearContents();
ui->selectedPeersTW->setRowCount(0); ui->selectedPeersTW->setRowCount(0);
std::string ownId = rsPeers->getGPGOwnId(); RsPgpId ownId = rsPeers->getGPGOwnId();
int row = 0; int row = 0;
@ -920,9 +922,9 @@ void ConnectFriendWizard::updatePeersList(int index)
// We have to use this trick because signers are given by their names instead of their ids. That's a cause // We have to use this trick because signers are given by their names instead of their ids. That's a cause
// for some confusion when two peers have the same name. // for some confusion when two peers have the same name.
// //
std::list<std::string> gpg_ids; std::list<RsPgpId> gpg_ids;
rsPeers->getGPGAllList(gpg_ids); rsPeers->getGPGAllList(gpg_ids);
for (std::list<std::string>::const_iterator it(gpg_ids.begin()); it != gpg_ids.end(); ++it) { for (std::list<RsPgpId>::const_iterator it(gpg_ids.begin()); it != gpg_ids.end(); ++it) {
if (*it == ownId) { if (*it == ownId) {
// its me // its me
continue; continue;
@ -933,7 +935,7 @@ void ConnectFriendWizard::updatePeersList(int index)
#endif #endif
RsPeerDetails details ; RsPeerDetails details ;
if (!rsPeers->getPeerDetails(*it,details)) { if (!rsPeers->getGPGDetails(*it,details)) {
#ifdef FRIEND_WIZARD_DEBUG #ifdef FRIEND_WIZARD_DEBUG
std::cerr << " no details." << std::endl ; std::cerr << " no details." << std::endl ;
#endif #endif
@ -942,9 +944,9 @@ void ConnectFriendWizard::updatePeersList(int index)
// determine common friends // determine common friends
std::list<std::string> common_friends; std::list<RsPgpId> common_friends;
for (std::list<std::string>::const_iterator it2(details.gpgSigners.begin()); it2 != details.gpgSigners.end(); ++it2) { for (std::list<RsPgpId>::const_iterator it2(details.gpgSigners.begin()); it2 != details.gpgSigners.end(); ++it2) {
if(rsPeers->isGPGAccepted(*it2)) { if(rsPeers->isGPGAccepted(*it2)) {
common_friends.push_back(*it2); common_friends.push_back(*it2);
} }
@ -988,13 +990,13 @@ void ConnectFriendWizard::updatePeersList(int index)
if (common_friends.empty()) { if (common_friends.empty()) {
qcb->addItem(tr("*** None ***")); qcb->addItem(tr("*** None ***"));
} else { } else {
for (std::list<std::string>::const_iterator it2(common_friends.begin()); it2 != common_friends.end(); ++it2) { for (std::list<RsPgpId>::const_iterator it2(common_friends.begin()); it2 != common_friends.end(); ++it2) {
qcb->addItem(QString::fromStdString(*it2)); qcb->addItem(QString::fromStdString( (*it2).toStdString()));
} }
} }
ui->selectedPeersTW->setCellWidget(row, 2, qcb); ui->selectedPeersTW->setCellWidget(row, 2, qcb);
ui->selectedPeersTW->setItem(row, 3, new QTableWidgetItem(QString::fromStdString(details.id))); ui->selectedPeersTW->setItem(row, 3, new QTableWidgetItem(QString::fromStdString(details.id.toStdString())));
++row; ++row;
} }
} }
@ -1016,7 +1018,7 @@ void ConnectFriendWizard::signAllSelectedUsers()
std::cerr << "making lots of friends !!" << std::endl; std::cerr << "making lots of friends !!" << std::endl;
#endif #endif
for (std::map<QCheckBox*, std::string>::const_iterator it(_id_boxes.begin()); it != _id_boxes.end(); ++it) { for (std::map<QCheckBox*, RsPeerId>::const_iterator it(_id_boxes.begin()); it != _id_boxes.end(); ++it) {
if (it->first->isChecked()) { if (it->first->isChecked()) {
#ifdef FRIEND_WIZARD_DEBUG #ifdef FRIEND_WIZARD_DEBUG
std::cerr << "Making friend with " << it->second << std::endl ; std::cerr << "Making friend with " << it->second << std::endl ;

View file

@ -31,7 +31,7 @@ public:
~ConnectFriendWizard(); ~ConnectFriendWizard();
void setCertificate(const QString &certificate, bool friendRequest); void setCertificate(const QString &certificate, bool friendRequest);
void setGpgId(const std::string &gpgId, const std::string &sslId, bool friendRequest); void setGpgId(const RsPgpId &gpgId, const RsPeerId &sslId, bool friendRequest);
virtual bool validateCurrentPage(); virtual bool validateCurrentPage();
virtual int nextId() const; virtual int nextId() const;
@ -79,8 +79,8 @@ private:
QTimer *cleanfriendCertTimer; QTimer *cleanfriendCertTimer;
/* FofPage */ /* FofPage */
std::map<QCheckBox*, std::string> _id_boxes; std::map<QCheckBox*, RsPeerId> _id_boxes;
std::map<QCheckBox*, std::string> _gpg_id_boxes; std::map<QCheckBox*, RsPgpId> _gpg_id_boxes;
/* ConclusionPage */ /* ConclusionPage */
QString groupId; QString groupId;

View file

@ -36,13 +36,13 @@
/* maintain one static dialog per SSL ID */ /* maintain one static dialog per SSL ID */
static std::map<std::string, ConnectProgressDialog *> instances; static std::map<RsPeerId, ConnectProgressDialog *> instances;
int calcProgress(time_t now, time_t start, int period50, int period75, int period100); int calcProgress(time_t now, time_t start, int period50, int period75, int period100);
ConnectProgressDialog *ConnectProgressDialog::instance(const std::string& peer_id) ConnectProgressDialog *ConnectProgressDialog::instance(const RsPeerId& peer_id)
{ {
std::map<std::string, ConnectProgressDialog *>::iterator it; std::map<RsPeerId, ConnectProgressDialog *>::iterator it;
it = instances.find(peer_id); it = instances.find(peer_id);
if (it != instances.end()) if (it != instances.end())
{ {
@ -54,7 +54,7 @@ ConnectProgressDialog *ConnectProgressDialog::instance(const std::string& peer_i
return d; return d;
} }
ConnectProgressDialog::ConnectProgressDialog(const std::string& id, QWidget *parent, Qt::WindowFlags flags) ConnectProgressDialog::ConnectProgressDialog(const RsPeerId& id, QWidget *parent, Qt::WindowFlags flags)
:QDialog(parent, flags), mId(id), ui(new Ui::ConnectProgressDialog) :QDialog(parent, flags), mId(id), ui(new Ui::ConnectProgressDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -68,7 +68,7 @@ ConnectProgressDialog::ConnectProgressDialog(const std::string& id, QWidget *par
ConnectProgressDialog::~ConnectProgressDialog() ConnectProgressDialog::~ConnectProgressDialog()
{ {
std::map<std::string, ConnectProgressDialog *>::iterator it; std::map<RsPeerId, ConnectProgressDialog *>::iterator it;
it = instances.find(mId); it = instances.find(mId);
if (it != instances.end()) if (it != instances.end())
{ {
@ -76,7 +76,7 @@ ConnectProgressDialog::~ConnectProgressDialog()
} }
} }
void ConnectProgressDialog::showProgress(const std::string& peer_id) void ConnectProgressDialog::showProgress(const RsPeerId& peer_id)
{ {
ConnectProgressDialog *d = instance(peer_id); ConnectProgressDialog *d = instance(peer_id);

View file

@ -35,13 +35,13 @@ class ConnectProgressDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
static void showProgress(const std::string& id); static void showProgress(const RsPeerId& id);
private: private:
ConnectProgressDialog(const std::string& id, QWidget *parent = 0, Qt::WindowFlags flags = 0); ConnectProgressDialog(const RsPeerId& id, QWidget *parent = 0, Qt::WindowFlags flags = 0);
~ConnectProgressDialog(); ~ConnectProgressDialog();
static ConnectProgressDialog *instance(const std::string& peer_id); static ConnectProgressDialog *instance(const RsPeerId& peer_id);
private slots: private slots:
void updateStatus(); void updateStatus();
@ -82,7 +82,7 @@ private:
QTimer *mTimer; QTimer *mTimer;
uint32_t mState; uint32_t mState;
std::string mId; RsPeerId mId;
time_t mInitTS; time_t mInitTS;
time_t mContactTS; time_t mContactTS;

View file

@ -160,14 +160,14 @@ void GraphWidget::clearGraph()
_friction_factor = 1.0f ; _friction_factor = 1.0f ;
} }
GraphWidget::NodeId GraphWidget::addNode(const std::string& node_short_string,const std::string& node_complete_string,NodeType type,AuthType auth,const std::string& ssl_id,const std::string& gpg_id) GraphWidget::NodeId GraphWidget::addNode(const std::string& node_short_string,const std::string& node_complete_string,NodeType type,AuthType auth,const RsPeerId& ssl_id,const RsPgpId& gpg_id)
{ {
Node *node = new Node(node_short_string,type,auth,this,ssl_id,gpg_id); Node *node = new Node(node_short_string,type,auth,this,ssl_id,gpg_id);
node->setToolTip(QString::fromUtf8(node_complete_string.c_str())) ; node->setToolTip(QString::fromUtf8(node_complete_string.c_str())) ;
_nodes.push_back(node) ; _nodes.push_back(node) ;
scene()->addItem(node); scene()->addItem(node);
std::map<std::string,QPointF>::const_iterator it(_node_cached_positions.find(gpg_id)) ; std::map<std::string,QPointF>::const_iterator it(_node_cached_positions.find(gpg_id.toStdString())) ;
if(_node_cached_positions.end() != it) if(_node_cached_positions.end() != it)
node->setPos(it->second) ; node->setPos(it->second) ;
else else

View file

@ -45,6 +45,7 @@
#include <map> #include <map>
#include <QGraphicsView> #include <QGraphicsView>
#include <stdint.h> #include <stdint.h>
#include <retroshare/rstypes.h>
class Node; class Node;
class Edge; class Edge;
@ -72,7 +73,7 @@ public:
ELASTIC_NODE_AUTH_UNKNOWN = 0x0002 ELASTIC_NODE_AUTH_UNKNOWN = 0x0002
} AuthType ; } AuthType ;
NodeId addNode(const std::string& NodeShortText,const std::string& nodeCompleteText,NodeType type,AuthType auth,const std::string& ssl_id,const std::string& gpg_id) ; NodeId addNode(const std::string& NodeShortText,const std::string& nodeCompleteText,NodeType type,AuthType auth,const RsPeerId& ssl_id,const RsPgpId& gpg_id) ;
EdgeId addEdge(NodeId n1,NodeId n2) ; EdgeId addEdge(NodeId n1,NodeId n2) ;
void snapshotNodesPositions() ; void snapshotNodesPositions() ;

View file

@ -64,7 +64,7 @@
Node *Node::_selected_node = NULL ; Node *Node::_selected_node = NULL ;
Node::Node(const std::string& node_string,GraphWidget::NodeType type,GraphWidget::AuthType auth,GraphWidget *graphWidget,const std::string& ssl_id,const std::string& gpg_id) Node::Node(const std::string& node_string,GraphWidget::NodeType type,GraphWidget::AuthType auth,GraphWidget *graphWidget,const RsPeerId& ssl_id,const RsPgpId& gpg_id)
: graph(graphWidget),_desc_string(node_string),_type(type),_auth(auth),_ssl_id(ssl_id),_gpg_id(gpg_id) : graph(graphWidget),_desc_string(node_string),_type(type),_auth(auth),_ssl_id(ssl_id),_gpg_id(gpg_id)
{ {
#ifdef DEBUG_ELASTIC #ifdef DEBUG_ELASTIC

View file

@ -50,6 +50,7 @@
#endif #endif
#include <QList> #include <QList>
#include <retroshare/rstypes.h>
#include "graphwidget.h" #include "graphwidget.h"
class Edge; class Edge;
@ -66,13 +67,13 @@ class Node : public QObject, public QGraphicsItem
Q_OBJECT Q_OBJECT
public: public:
Node(const std::string& node_string,GraphWidget::NodeType type,GraphWidget::AuthType auth,GraphWidget *graphWidget,const std::string& ssl_id,const std::string& gpg_id); Node(const std::string& node_string,GraphWidget::NodeType type,GraphWidget::AuthType auth,GraphWidget *graphWidget,const RsPeerId& ssl_id,const RsPgpId& gpg_id);
void addEdge(Edge *edge); void addEdge(Edge *edge);
const QList<Edge *>& edges() const; const QList<Edge *>& edges() const;
int type() const { return Type; } int type() const { return Type; }
const std::string& idString() const { return _gpg_id ; } std::string idString() const { return _gpg_id.toStdString() ; }
void calculateForces(const double *data,int width,int height,int W,int H,float x,float y,float speedf); void calculateForces(const double *data,int width,int height,int W,int H,float x,float y,float speedf);
bool advance(); bool advance();
@ -108,8 +109,8 @@ private:
static Node *_selected_node ; static Node *_selected_node ;
std::string _ssl_id ; RsPeerId _ssl_id ;
std::string _gpg_id ; RsPgpId _gpg_id ;
static const float MASS_FACTOR = 10 ; static const float MASS_FACTOR = 10 ;
static const float FRICTION_FACTOR = 10.8 ; static const float FRICTION_FACTOR = 10.8 ;

View file

@ -281,8 +281,7 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
{ {
/* add file */ /* add file */
std::string path; std::string path;
SubFileItem *fi = new SubFileItem(it->mHash, it->mName, path, it->mSize, SubFileItem *fi = new SubFileItem(it->mHash, it->mName, path, it->mSize, SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, RsPeerId());
SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, "");
mFileItems.push_back(fi); mFileItems.push_back(fi);
/* check if the file is a media file */ /* check if the file is a media file */

View file

@ -130,7 +130,7 @@ bool GxsIdDetails::MakeIdDesc(const RsGxsId &id, bool doIcons, QString &str, std
if (details.mPgpKnown) if (details.mPgpKnown)
{ {
/* look up real name */ /* look up real name */
std::string authorName = rsPeers->getPeerName(details.mPgpId); std::string authorName = rsPeers->getGPGName(details.mPgpId);
str += QString::fromUtf8(authorName.c_str()); str += QString::fromUtf8(authorName.c_str());
str += "]"; str += "]";

View file

@ -124,7 +124,7 @@ void CreateGxsChannelMsg::pasteLink()
FileInfo info ; FileInfo info ;
if(rsFiles->alreadyHaveFile( (*it).hash().toStdString(),info ) ) if(rsFiles->alreadyHaveFile( (*it).hash().toStdString(),info ) )
addAttachment((*it).hash().toStdString(), (*it).name().toUtf8().constData(), (*it).size(), true, "") ; addAttachment((*it).hash().toStdString(), (*it).name().toUtf8().constData(), (*it).size(), true, RsPeerId()) ;
else else
not_have.push_back( *it ) ; not_have.push_back( *it ) ;
} }
@ -285,7 +285,7 @@ void CreateGxsChannelMsg::parseRsFileListAttachments(const std::string &attachLi
std::string fname; std::string fname;
std::string hash; std::string hash;
uint64_t size = 0; uint64_t size = 0;
std::string source; RsPeerId source;
int i = 0; int i = 0;
for(it2 = parts.begin(); it2 != parts.end(); it2++, i++) for(it2 = parts.begin(); it2 != parts.end(); it2++, i++)
@ -304,7 +304,7 @@ void CreateGxsChannelMsg::parseRsFileListAttachments(const std::string &attachLi
size = qsize; size = qsize;
break; break;
case 3: case 3:
source = it2->toStdString(); source = RsPeerId(it2->toStdString());
break; break;
} }
} }
@ -320,15 +320,7 @@ void CreateGxsChannelMsg::parseRsFileListAttachments(const std::string &attachLi
if ((ok) && (hash.size() == 40)) if ((ok) && (hash.size() == 40))
{ {
std::cerr << "Item Ok" << std::endl; std::cerr << "Item Ok" << std::endl;
if (source == "Local") addAttachment(hash, fname, size, source.isNull(), source);
{
addAttachment(hash, fname, size, true, "");
}
else
{
// TEMP NOT ALLOWED UNTIL FT WORKING.
addAttachment(hash, fname, size, false, source);
}
} }
else else
{ {
@ -338,7 +330,7 @@ void CreateGxsChannelMsg::parseRsFileListAttachments(const std::string &attachLi
} }
void CreateGxsChannelMsg::addAttachment(const std::string &hash, const std::string &fname, uint64_t size, bool local, const std::string &srcId) void CreateGxsChannelMsg::addAttachment(const std::string &hash, const std::string &fname, uint64_t size, bool local, const RsPeerId &srcId)
{ {
/* add a SubFileItem to the attachment section */ /* add a SubFileItem to the attachment section */
std::cerr << "CreateGxsChannelMsg::addAttachment()"; std::cerr << "CreateGxsChannelMsg::addAttachment()";
@ -416,7 +408,8 @@ void CreateGxsChannelMsg::addAttachment(const std::string &path)
// only path and filename are valid. // only path and filename are valid.
// destroyed when fileFrame (this subfileitem) is destroyed // destroyed when fileFrame (this subfileitem) is destroyed
SubFileItem *file = new SubFileItem(hash, filename, path, size, flags, mChannelId); //SubFileItem *file = new SubFileItem(hash, filename, path, size, flags, mChannelId);
SubFileItem *file = new SubFileItem(hash, filename, path, size, flags, RsPeerId());
mAttachments.push_back(file); mAttachments.push_back(file);
QLayout *layout = fileFrame->layout(); QLayout *layout = fileFrame->layout();

View file

@ -44,7 +44,7 @@ public:
~CreateGxsChannelMsg(); ~CreateGxsChannelMsg();
void addAttachment(const std::string &path); void addAttachment(const std::string &path);
void addAttachment(const std::string &hash, const std::string &fname, uint64_t size, bool local, const std::string &srcId); void addAttachment(const std::string &hash, const std::string &fname, uint64_t size, bool local, const RsPeerId &srcId);
void newChannelMsg(); void newChannelMsg();

View file

@ -804,7 +804,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
item->setText(COLUMN_THREAD_DATE, text); item->setText(COLUMN_THREAD_DATE, text);
item->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort); item->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort);
item->setText(COLUMN_THREAD_AUTHOR, QString::fromStdString(msg.mMeta.mAuthorId)); item->setText(COLUMN_THREAD_AUTHOR, QString::fromStdString(msg.mMeta.mAuthorId.toStdString()));
//item->setId(msg.mMeta.mAuthorId, COLUMN_THREAD_AUTHOR); //item->setId(msg.mMeta.mAuthorId, COLUMN_THREAD_AUTHOR);
//#TODO //#TODO
#if 0 #if 0