mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-14 00:55:46 -04:00
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:
parent
14788b578b
commit
6bc79709e3
18 changed files with 85 additions and 87 deletions
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <retroshare/rsturtle.h>
|
||||
#include <retroshare/rstypes.h>
|
||||
#include "ui_TurtleRouterDialog.h"
|
||||
#include "RsAutoUpdatePage.h"
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <QPoint>
|
||||
#include <retroshare/rsturtle.h>
|
||||
#include <retroshare/rstypes.h>
|
||||
#include "ui_TurtleRouterStatistics.h"
|
||||
#include "RsAutoUpdatePage.h"
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ void NetworkView::updateDisplay()
|
|||
|
||||
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
|
||||
std::cerr << " inserted node " << info.gpg_id << ", type=" << type << ", auth=" << auth << std::endl ;
|
||||
#endif
|
||||
|
|
|
@ -56,7 +56,7 @@ double convertRttToPixels(double maxRTT, double rtt)
|
|||
class RttPlot
|
||||
{
|
||||
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)
|
||||
:mInfo(info), mRefTS(refTS), mMaxRTT(maxRTT), mMinTS(minTS), mMaxTS(maxTS) {}
|
||||
|
||||
|
@ -91,7 +91,7 @@ class RttPlot
|
|||
}
|
||||
|
||||
/* 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 nLines = mInfo.size();
|
||||
for(mit = mInfo.begin(); mit != mInfo.end(); mit++, i++)
|
||||
|
@ -154,7 +154,7 @@ class RttPlot
|
|||
}
|
||||
|
||||
private:
|
||||
const std::map<std::string, std::list<RsRttPongResult> > &mInfo;
|
||||
const std::map<RsPeerId, std::list<RsRttPongResult> > &mInfo;
|
||||
double mRefTS;
|
||||
double mMaxRTT;
|
||||
double mMinTS;
|
||||
|
@ -216,15 +216,15 @@ void RttStatistics::processSettings(bool bLoad)
|
|||
|
||||
void RttStatistics::updateDisplay()
|
||||
{
|
||||
std::map<std::string, std::list<RsRttPongResult> > info;
|
||||
std::map<RsPeerId, std::list<RsRttPongResult> > info;
|
||||
|
||||
if (!rsRtt)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<std::string> idList;
|
||||
std::list<std::string>::iterator it;
|
||||
std::list<RsPeerId> idList;
|
||||
std::list<RsPeerId>::iterator it;
|
||||
|
||||
rsPeers->getOnlineList(idList);
|
||||
|
||||
|
@ -270,11 +270,11 @@ void RttStatistics::updateDisplay()
|
|||
_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())
|
||||
return it->second ;
|
||||
|
@ -295,7 +295,7 @@ RttStatisticsWidget::RttStatisticsWidget(QWidget *parent)
|
|||
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)
|
||||
{
|
||||
//static const int cellx = 6 ;
|
||||
|
|
|
@ -35,7 +35,7 @@ class RttStatistics: public RsAutoUpdatePage, public Ui::RttStatistics
|
|||
~RttStatistics();
|
||||
|
||||
// Cache for peer names.
|
||||
static QString getPeerName(const std::string& peer_id) ;
|
||||
static QString getPeerName(const RsPeerId& peer_id) ;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -56,7 +56,7 @@ class RttStatisticsWidget: public QWidget
|
|||
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);
|
||||
|
||||
private:
|
||||
|
|
|
@ -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)) {
|
||||
setField("errorMessage", tr("Cannot get peer details of PGP key %1").arg(QString::fromStdString(gpgId)));
|
||||
if (!rsPeers->getGPGDetails(gpgId, peerDetails)) {
|
||||
setField("errorMessage", tr("Cannot get peer details of PGP key %1").arg(QString::fromStdString(gpgId.toStdString())));
|
||||
setStartId(Page_ErrorMessage);
|
||||
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) ;
|
||||
|
||||
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->setEnabled(!already_in_keyring) ;
|
||||
|
@ -321,10 +321,10 @@ void ConnectFriendWizard::initializePage(int id)
|
|||
}
|
||||
|
||||
QString ts;
|
||||
std::list<std::string>::iterator it;
|
||||
std::list<RsPgpId>::iterator 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 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)
|
||||
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())
|
||||
{
|
||||
loc += " (";
|
||||
loc += QString::fromStdString(peerDetails.id);
|
||||
loc += QString::fromStdString(peerDetails.id.toStdString());
|
||||
loc += ")";
|
||||
}
|
||||
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())
|
||||
{
|
||||
loc += " (";
|
||||
loc += QString::fromStdString(peerDetails.id);
|
||||
loc += QString::fromStdString(peerDetails.id.toStdString());
|
||||
loc += ")";
|
||||
}
|
||||
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
|
||||
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));
|
||||
error = false;
|
||||
}
|
||||
|
@ -564,23 +564,23 @@ bool ConnectFriendWizard::validateCurrentPage()
|
|||
break;
|
||||
case Page_FriendRecommendations:
|
||||
{
|
||||
std::list<std::string> recommendIds;
|
||||
ui->frec_recommendList->selectedSslIds(recommendIds, false);
|
||||
std::list<RsPeerId> recommendIds;
|
||||
ui->frec_recommendList->selectedSslIds_SSL(recommendIds, false);
|
||||
|
||||
if (recommendIds.empty()) {
|
||||
QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend for recommendation."), QMessageBox::Ok, QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::list<std::string> toIds;
|
||||
ui->frec_toList->selectedSslIds(toIds, false);
|
||||
std::list<RsPeerId> toIds;
|
||||
ui->frec_toList->selectedSslIds_SSL(toIds, false);
|
||||
|
||||
if (toIds.empty()) {
|
||||
QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend as recipient."), QMessageBox::Ok, QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::list<std::string>::iterator toId;
|
||||
std::list<RsPeerId>::iterator toId;
|
||||
for (toId = toIds.begin(); toId != toIds.end(); toId++) {
|
||||
MessageComposer::recommendFriend(recommendIds, *toId, ui->frec_messageEdit->toHtml(), true);
|
||||
}
|
||||
|
@ -659,7 +659,9 @@ void ConnectFriendWizard::accept()
|
|||
|
||||
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))
|
||||
{
|
||||
|
@ -670,7 +672,7 @@ void ConnectFriendWizard::accept()
|
|||
|
||||
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;
|
||||
rsPeers->addFriend(peerDetails.id, peerDetails.gpg_id,serviceFlags()) ;
|
||||
|
@ -687,7 +689,7 @@ void ConnectFriendWizard::accept()
|
|||
rsPeers->assignPeerToGroup(groupId.toStdString(), peerDetails.gpg_id, true);
|
||||
}
|
||||
|
||||
if ((accept_connection) && (peerDetails.id != ""))
|
||||
if ((accept_connection) && (!peerDetails.id.isNull()))
|
||||
{
|
||||
runProgressDialog = true;
|
||||
|
||||
|
@ -722,7 +724,7 @@ void ConnectFriendWizard::accept()
|
|||
|
||||
if (runProgressDialog)
|
||||
{
|
||||
std::string ssl_id = peerDetails.id;
|
||||
RsPeerId ssl_id = peerDetails.id;
|
||||
// its okay if ssl_id is invalid - dialog will show error.
|
||||
ConnectProgressDialog::showProgress(ssl_id);
|
||||
}
|
||||
|
@ -911,7 +913,7 @@ void ConnectFriendWizard::updatePeersList(int index)
|
|||
ui->selectedPeersTW->clearContents();
|
||||
ui->selectedPeersTW->setRowCount(0);
|
||||
|
||||
std::string ownId = rsPeers->getGPGOwnId();
|
||||
RsPgpId ownId = rsPeers->getGPGOwnId();
|
||||
|
||||
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
|
||||
// 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);
|
||||
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) {
|
||||
// its me
|
||||
continue;
|
||||
|
@ -933,7 +935,7 @@ void ConnectFriendWizard::updatePeersList(int index)
|
|||
#endif
|
||||
|
||||
RsPeerDetails details ;
|
||||
if (!rsPeers->getPeerDetails(*it,details)) {
|
||||
if (!rsPeers->getGPGDetails(*it,details)) {
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << " no details." << std::endl ;
|
||||
#endif
|
||||
|
@ -942,9 +944,9 @@ void ConnectFriendWizard::updatePeersList(int index)
|
|||
|
||||
// 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)) {
|
||||
common_friends.push_back(*it2);
|
||||
}
|
||||
|
@ -988,13 +990,13 @@ void ConnectFriendWizard::updatePeersList(int index)
|
|||
if (common_friends.empty()) {
|
||||
qcb->addItem(tr("*** None ***"));
|
||||
} else {
|
||||
for (std::list<std::string>::const_iterator it2(common_friends.begin()); it2 != common_friends.end(); ++it2) {
|
||||
qcb->addItem(QString::fromStdString(*it2));
|
||||
for (std::list<RsPgpId>::const_iterator it2(common_friends.begin()); it2 != common_friends.end(); ++it2) {
|
||||
qcb->addItem(QString::fromStdString( (*it2).toStdString()));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -1016,7 +1018,7 @@ void ConnectFriendWizard::signAllSelectedUsers()
|
|||
std::cerr << "making lots of friends !!" << std::endl;
|
||||
#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()) {
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << "Making friend with " << it->second << std::endl ;
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
~ConnectFriendWizard();
|
||||
|
||||
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 int nextId() const;
|
||||
|
@ -79,8 +79,8 @@ private:
|
|||
QTimer *cleanfriendCertTimer;
|
||||
|
||||
/* FofPage */
|
||||
std::map<QCheckBox*, std::string> _id_boxes;
|
||||
std::map<QCheckBox*, std::string> _gpg_id_boxes;
|
||||
std::map<QCheckBox*, RsPeerId> _id_boxes;
|
||||
std::map<QCheckBox*, RsPgpId> _gpg_id_boxes;
|
||||
|
||||
/* ConclusionPage */
|
||||
QString groupId;
|
||||
|
|
|
@ -36,13 +36,13 @@
|
|||
|
||||
/* 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);
|
||||
|
||||
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);
|
||||
if (it != instances.end())
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ ConnectProgressDialog *ConnectProgressDialog::instance(const std::string& peer_i
|
|||
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)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -68,7 +68,7 @@ ConnectProgressDialog::ConnectProgressDialog(const std::string& id, QWidget *par
|
|||
|
||||
ConnectProgressDialog::~ConnectProgressDialog()
|
||||
{
|
||||
std::map<std::string, ConnectProgressDialog *>::iterator it;
|
||||
std::map<RsPeerId, ConnectProgressDialog *>::iterator it;
|
||||
it = instances.find(mId);
|
||||
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);
|
||||
|
||||
|
|
|
@ -35,13 +35,13 @@ class ConnectProgressDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static void showProgress(const std::string& id);
|
||||
static void showProgress(const RsPeerId& id);
|
||||
|
||||
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();
|
||||
|
||||
static ConnectProgressDialog *instance(const std::string& peer_id);
|
||||
static ConnectProgressDialog *instance(const RsPeerId& peer_id);
|
||||
|
||||
private slots:
|
||||
void updateStatus();
|
||||
|
@ -82,7 +82,7 @@ private:
|
|||
|
||||
QTimer *mTimer;
|
||||
uint32_t mState;
|
||||
std::string mId;
|
||||
RsPeerId mId;
|
||||
time_t mInitTS;
|
||||
|
||||
time_t mContactTS;
|
||||
|
|
|
@ -160,14 +160,14 @@ void GraphWidget::clearGraph()
|
|||
_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->setToolTip(QString::fromUtf8(node_complete_string.c_str())) ;
|
||||
_nodes.push_back(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)
|
||||
node->setPos(it->second) ;
|
||||
else
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <map>
|
||||
#include <QGraphicsView>
|
||||
#include <stdint.h>
|
||||
#include <retroshare/rstypes.h>
|
||||
|
||||
class Node;
|
||||
class Edge;
|
||||
|
@ -72,7 +73,7 @@ public:
|
|||
ELASTIC_NODE_AUTH_UNKNOWN = 0x0002
|
||||
} 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) ;
|
||||
|
||||
void snapshotNodesPositions() ;
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
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)
|
||||
{
|
||||
#ifdef DEBUG_ELASTIC
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#endif
|
||||
#include <QList>
|
||||
|
||||
#include <retroshare/rstypes.h>
|
||||
#include "graphwidget.h"
|
||||
|
||||
class Edge;
|
||||
|
@ -66,13 +67,13 @@ class Node : public QObject, public QGraphicsItem
|
|||
Q_OBJECT
|
||||
|
||||
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);
|
||||
const QList<Edge *>& edges() const;
|
||||
|
||||
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);
|
||||
bool advance();
|
||||
|
@ -108,8 +109,8 @@ private:
|
|||
|
||||
static Node *_selected_node ;
|
||||
|
||||
std::string _ssl_id ;
|
||||
std::string _gpg_id ;
|
||||
RsPeerId _ssl_id ;
|
||||
RsPgpId _gpg_id ;
|
||||
|
||||
static const float MASS_FACTOR = 10 ;
|
||||
static const float FRICTION_FACTOR = 10.8 ;
|
||||
|
|
|
@ -281,8 +281,7 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
|
|||
{
|
||||
/* add file */
|
||||
std::string path;
|
||||
SubFileItem *fi = new SubFileItem(it->mHash, it->mName, path, it->mSize,
|
||||
SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, "");
|
||||
SubFileItem *fi = new SubFileItem(it->mHash, it->mName, path, it->mSize, SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, RsPeerId());
|
||||
mFileItems.push_back(fi);
|
||||
|
||||
/* check if the file is a media file */
|
||||
|
|
|
@ -130,7 +130,7 @@ bool GxsIdDetails::MakeIdDesc(const RsGxsId &id, bool doIcons, QString &str, std
|
|||
if (details.mPgpKnown)
|
||||
{
|
||||
/* 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 += "]";
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ void CreateGxsChannelMsg::pasteLink()
|
|||
|
||||
FileInfo 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
|
||||
not_have.push_back( *it ) ;
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ void CreateGxsChannelMsg::parseRsFileListAttachments(const std::string &attachLi
|
|||
std::string fname;
|
||||
std::string hash;
|
||||
uint64_t size = 0;
|
||||
std::string source;
|
||||
RsPeerId source;
|
||||
|
||||
int i = 0;
|
||||
for(it2 = parts.begin(); it2 != parts.end(); it2++, i++)
|
||||
|
@ -304,7 +304,7 @@ void CreateGxsChannelMsg::parseRsFileListAttachments(const std::string &attachLi
|
|||
size = qsize;
|
||||
break;
|
||||
case 3:
|
||||
source = it2->toStdString();
|
||||
source = RsPeerId(it2->toStdString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -320,15 +320,7 @@ void CreateGxsChannelMsg::parseRsFileListAttachments(const std::string &attachLi
|
|||
if ((ok) && (hash.size() == 40))
|
||||
{
|
||||
std::cerr << "Item Ok" << std::endl;
|
||||
if (source == "Local")
|
||||
{
|
||||
addAttachment(hash, fname, size, true, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
// TEMP NOT ALLOWED UNTIL FT WORKING.
|
||||
addAttachment(hash, fname, size, false, source);
|
||||
}
|
||||
addAttachment(hash, fname, size, source.isNull(), source);
|
||||
}
|
||||
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 */
|
||||
std::cerr << "CreateGxsChannelMsg::addAttachment()";
|
||||
|
@ -416,7 +408,8 @@ void CreateGxsChannelMsg::addAttachment(const std::string &path)
|
|||
|
||||
// only path and filename are valid.
|
||||
// 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);
|
||||
QLayout *layout = fileFrame->layout();
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
~CreateGxsChannelMsg();
|
||||
|
||||
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();
|
||||
|
||||
|
|
|
@ -804,7 +804,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
|
|||
item->setText(COLUMN_THREAD_DATE, text);
|
||||
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);
|
||||
//#TODO
|
||||
#if 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue