diff --git a/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp b/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp index 57bdbb512..073670be7 100644 --- a/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp +++ b/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp @@ -101,11 +101,9 @@ CreateCircleDialog::~CreateCircleDialog() void CreateCircleDialog::editExistingId(const RsGxsGroupId &circleId, const bool &clearList /*= true*/) { - std::cerr << "CreateCircleDialog::editExistingId() : " << circleId; - std::cerr << std::endl; - /* load this circle */ mIsExistingCircle = true; + mClearList = clearList; requestCircle(circleId); @@ -240,15 +238,6 @@ void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails) QString nickname = QString::fromUtf8(gxs_details.mNickname.c_str()); QString idtype = tr("Anon Id"); - /** Can we have known peers on mUnknownPeers (TODO) - if (gxs_details.mPgpKnown) { - RsPeerDetails details; - rsPeers->getGPGDetails(gxs_details.mPgpId, details); - idtype = QString::fromUtf8(details.name.c_str()); - }else{ - idtype = tr("PGP Linked Id"); - }//if (gxs_details.mPgpKnown)*/ - addMember(keyId, idtype, nickname); }//if(!gxs_id.isNull() && rsIdentity->getIdDetails(gxs_id,gxs_details)) @@ -487,7 +476,7 @@ void CreateCircleDialog::loadCircle(uint32_t token) QTreeWidget *tree = ui.treeWidget_membership; - if (!mClearList) tree->clear(); + if (mClearList) tree->clear(); std::vector groups; if (!rsGxsCircles->getGroupData(token, groups)) { diff --git a/retroshare-gui/src/gui/People/CircleWidget.cpp b/retroshare-gui/src/gui/People/CircleWidget.cpp index 5a57e604a..038038ae7 100644 --- a/retroshare-gui/src/gui/People/CircleWidget.cpp +++ b/retroshare-gui/src/gui/People/CircleWidget.cpp @@ -13,12 +13,11 @@ CircleWidget::CircleWidget(QString name/*=QString()*/ ui(new Ui::CircleWidget) { ui->setupUi(this); - std::string desc_string = _group_info.mGroupName ; - QString cirName = QString::fromUtf8(desc_string.c_str()); - if (name=="") m_myName = cirName; + m_myName = name; ui->label->setText(m_myName); + ui->label->setToolTip(m_myName); _scene = new QGraphicsScene(this); - _scene->addText(tr("Empty %1").arg(getName())); + _scene->addText(tr("Empty Circle")); ui->graphicsView->setScene(_scene); //To grab events @@ -48,8 +47,9 @@ void CircleWidget::updateData(const RsGroupMetaData& gxs_group_info QString cirName = QString::fromUtf8(desc_string.c_str()); m_myName = cirName; ui->label->setText(m_myName); + ui->label->setToolTip(m_myName); update(); - }//if (gxs_group_info!=_group_info) + }//if (_group_info != gxs_group_info) if (_circle_details != details) { _circle_details=details; @@ -67,10 +67,9 @@ void CircleWidget::updateData(const RsGroupMetaData& gxs_group_info for (itAllowedPeers it = _circle_details.mAllowedPeers.begin() ; it != _circle_details.mAllowedPeers.end() ; ++it ) { - RsPgpId id = it->first; - emit askForPGPIdentityWidget(id); + RsPgpId pgp_id = it->first; + emit askForPGPIdentityWidget(pgp_id); - ///** (TODO) Is it needed? std::list gxs_id_list = it->second; typedef std::list::const_iterator itGxsId; for (itGxsId curs=gxs_id_list.begin() @@ -81,7 +80,6 @@ void CircleWidget::updateData(const RsGroupMetaData& gxs_group_info emit askForGXSIdentityWidget(gxs_id); }//if(!gxs_id.isNull()) }//for (itGxsId curs=gxs_id_list.begin() - //*// }//for (itAllowedPeers it = _circle_details.mAllowedPeers.begin() update(); @@ -122,14 +120,25 @@ const QPixmap CircleWidget::getDragImage() void CircleWidget::addIdent(IdentityWidget *item) { if (item){ - RsGxsId id = RsGxsId(item->groupInfo().mMeta.mGroupId); + std::string id; + if (item->haveGXSId()) { + id =item->groupInfo().mMeta.mGroupId.toStdString(); + } else {//if (item->haveGXSId()) + id =item->keyId().toStdString(); + }//else (item->haveGXSId()) if (!_list.contains(id)){ _list[id] = item; + connect(item,SIGNAL(imageUpdated()), this, SLOT(updateIdImage())); updateScene(); - }//if (!list.contains(item)) + }//if (!_list.contains(id)) }//if (item) } +void CircleWidget::updateIdImage() +{ + updateScene(); +} + void CircleWidget::updateScene() { const qreal PI = qAtan(1.0)*4; @@ -151,7 +160,7 @@ void CircleWidget::updateScene() qreal sizeY = topleftY*2; int curs = 0; - typedef QMap::const_iterator itList; + typedef QMap::const_iterator itList; for (itList it=_list.constBegin(); it!=_list.constEnd(); ++it){ QPixmap pix = it.value()->getImage(); pix = pix.scaled(sizeX, sizeY); @@ -159,6 +168,15 @@ void CircleWidget::updateScene() qreal x = (qCos(curs*pitch)*radiusX)-(sizeX/2)+topleftX+radiusX; qreal y = (qSin(curs*pitch)*radiusY)-(sizeY/2)+topleftY+radiusY; item->setPos(QPointF(x, y)); + + QString name = it.value()->getName(); + QString idKey = it.value()->keyId(); + QString gxsId = it.value()->gxsId(); + if (idKey == gxsId) gxsId.clear(); + item->setToolTip(name.append("\n") + .append(idKey).append(gxsId.isEmpty()?"":"\n") + .append(gxsId)); ++curs; }//for (itList it=_list.constBegin(); it!=_list.constEnd(); ++it) + emit imageUpdated(); } diff --git a/retroshare-gui/src/gui/People/CircleWidget.h b/retroshare-gui/src/gui/People/CircleWidget.h index ad598798c..08b6ad6dc 100644 --- a/retroshare-gui/src/gui/People/CircleWidget.h +++ b/retroshare-gui/src/gui/People/CircleWidget.h @@ -31,7 +31,7 @@ public: //End Properties void addIdent(IdentityWidget* item); - const QMap idents() const {return _list;} + const QMap idents() const {return _list;} const RsGroupMetaData& groupInfo() const { return _group_info;} const RsGxsCircleDetails& circleDetails() const {return _circle_details;} @@ -40,11 +40,14 @@ signals: void askForGXSIdentityWidget(RsGxsId gxs_id); void askForPGPIdentityWidget(RsPgpId pgp_id); +private slots: + void updateIdImage(); + private: void updateScene(); QGraphicsScene* _scene; - QMap _list; + QMap _list; RsGroupMetaData _group_info ; RsGxsCircleDetails _circle_details ; diff --git a/retroshare-gui/src/gui/People/CircleWidget.ui b/retroshare-gui/src/gui/People/CircleWidget.ui index 4fe6c38fc..870fa536a 100644 --- a/retroshare-gui/src/gui/People/CircleWidget.ui +++ b/retroshare-gui/src/gui/People/CircleWidget.ui @@ -54,13 +54,19 @@ - + 0 15 + + + 200 + 16777215 + + TextLabel @@ -71,6 +77,14 @@ + + + ElidedLabel + QLabel +
gui/common/ElidedLabel.h
+ 1 +
+
diff --git a/retroshare-gui/src/gui/People/IdentityWidget.cpp b/retroshare-gui/src/gui/People/IdentityWidget.cpp index 9bda820b4..2c49c0e2e 100644 --- a/retroshare-gui/src/gui/People/IdentityWidget.cpp +++ b/retroshare-gui/src/gui/People/IdentityWidget.cpp @@ -8,68 +8,34 @@ #include #include -IdentityWidget::IdentityWidget(const RsGxsIdGroup &gxs_group_info, QString name/*=QString()*/, QWidget *parent/*=0*/) : +IdentityWidget::IdentityWidget(QString name/*=QString()*/, QWidget *parent/*=0*/) : FlowLayoutItem(name, parent), - _group_info(gxs_group_info), ui(new Ui::IdentityWidget) { ui->setupUi(this); - _isGXS=true; + _haveGXSId = false; + _havePGPDetail = false; - std::string desc_string = _group_info.mMeta.mGroupName ; - QString idName = QString::fromUtf8(desc_string.c_str()); - if (name=="") m_myName = idName; + m_myName = name; ui->labelName->setText(m_myName); + ui->labelName->setToolTip(m_myName); QFont font = ui->labelName->font(); font.setItalic(false); - ui->labelKeyId->setText(QString::fromStdString(_group_info.mMeta.mGroupId.toStdString())); ui->labelName->setFont(font); + + _keyId=""; + ui->labelKeyId->setText(_keyId); + ui->labelKeyId->setToolTip(_keyId); ui->labelKeyId->setVisible(false); - ui->pbAdd->setVisible(false); - _scene = new QGraphicsScene(this); - /// (TODO) Get real ident icon - QImage image = GxsIdDetails::makeDefaultIcon(RsGxsId(_group_info.mMeta.mGroupId)); - _scene->addPixmap(QPixmap::fromImage(image.scaled(ui->graphicsView->width(),ui->graphicsView->height()))); - //scene->setBackgroundBrush(QBrush(QColor(qrand()%255,qrand()%255,qrand()%255))); - //scene->addText(QString("Hello, %1").arg(getName())); - ui->graphicsView->setScene(_scene); - - //To grab events - ui->graphicsView->setEnabled(false); - - ui->graphicsView->setAlignment(Qt::AlignLeft | Qt::AlignTop); - - setIsCurrent(false); - setIsSelected(false); - setAcceptDrops(true); -} - -IdentityWidget::IdentityWidget(const RsPeerDetails &pgp_details, QString name/*=QString()*/, QWidget *parent/*=0*/) : - FlowLayoutItem(name, parent), - _details(pgp_details), - ui(new Ui::IdentityWidget) -{ - ui->setupUi(this); - _isGXS=false; - - QString idName = QString::fromUtf8(pgp_details.name.c_str()); - if (name=="") m_myName = idName; - ui->labelName->setText(m_myName); - QFont font = ui->labelName->font(); - font.setItalic(true); - ui->labelKeyId->setText(QString::fromStdString(pgp_details.gpg_id.toStdString())); - ui->labelName->setFont(font); - ui->labelKeyId->setVisible(false); + ui->labelGXSId->setText(_keyId); + ui->labelGXSId->setToolTip(_keyId); + ui->labelGXSId->setVisible(false); ui->pbAdd->setVisible(false); + QObject::connect(ui->pbAdd, SIGNAL(clicked()), this, SLOT(pbAdd_clicked())); + _scene = new QGraphicsScene(this); - /// (TODO) Get real ident icon - QPixmap avatar; - AvatarDefs::getAvatarFromSslId(pgp_details.id.toStdString(), avatar); - _scene->addPixmap(avatar.scaled(ui->graphicsView->width(),ui->graphicsView->height())); - //scene->setBackgroundBrush(QBrush(QColor(qrand()%255,qrand()%255,qrand()%255))); - //scene->addText(QString("Hello, %1").arg(getName())); ui->graphicsView->setScene(_scene); //To grab events @@ -88,6 +54,92 @@ IdentityWidget::~IdentityWidget() delete ui; } +void IdentityWidget::updateData(const RsGxsIdGroup &gxs_group_info) +{ + if (_group_info.mMeta.mGroupId != gxs_group_info.mMeta.mGroupId) { + _group_info = gxs_group_info; + _haveGXSId = true; + + m_myName = QString::fromUtf8(_group_info.mMeta.mGroupName.c_str()); + ui->labelName->setText(m_myName); + if (_havePGPDetail) { + ui->labelName->setToolTip(tr("GXS name: ").append(m_myName).append("\n") + .append(tr("PGP name: ").append(_nickname))); + } else {//if (m_myName != _nickname) + ui->labelName->setToolTip(tr("GXS name: ").append(m_myName)); + }//else (m_myName != _nickname) + + + _gxsId = QString::fromStdString(_group_info.mMeta.mGroupId.toStdString()); + ui->labelGXSId->setText(_gxsId); + ui->labelGXSId->setToolTip(tr("GXS id: ").append(_gxsId)); + + if (!_havePGPDetail) { + QFont font = ui->labelName->font(); + font.setItalic(false); + ui->labelName->setFont(font); + + _keyId=QString::fromStdString(_group_info.mMeta.mGroupId.toStdString()); + ui->labelKeyId->setText(_keyId); + ui->labelKeyId->setToolTip(tr("GXS id: ").append(_keyId)); + ui->labelKeyId->setVisible(false); + + /// (TODO) Get real ident icon + QImage image = GxsIdDetails::makeDefaultIcon(RsGxsId(_group_info.mMeta.mGroupId)); + if (_avatar != image) { + _avatar = image; + _scene->clear(); + _scene->addPixmap(QPixmap::fromImage(image.scaled(ui->graphicsView->width(),ui->graphicsView->height()))); + emit imageUpdated(); + }//if (_avatar != image) + }//if (!_havePGPDetail) + + }//if (_group_info != gxs_group_info) +} + +void IdentityWidget::updateData(const RsPeerDetails &pgp_details) +{ + if (_details.id != pgp_details.id) + { + _details = pgp_details; + _havePGPDetail = true; + + _nickname = QString::fromUtf8(_details.name.c_str()); + if (!_haveGXSId) m_myName = _nickname; + ui->labelName->setText(m_myName); + if (_haveGXSId) { + ui->labelName->setToolTip(tr("GXS name: ").append(m_myName).append("\n") + .append(tr("PGP name: ").append(_nickname))); + } else {//if (m_myName != _nickname) + ui->labelName->setToolTip(tr("PGP name: ").append(_nickname)); + }//else (m_myName != _nickname) + + QFont font = ui->labelName->font(); + font.setItalic(true); + ui->labelName->setFont(font); + + _keyId = QString::fromStdString(_details.gpg_id.toStdString()); + ui->labelKeyId->setText(_keyId); + ui->labelKeyId->setToolTip(tr("PGP id: ").append(_keyId)); + + QPixmap avatar; + AvatarDefs::getAvatarFromGpgId(_details.gpg_id.toStdString(), avatar); + if (_avatar != avatar.toImage()) { + _avatar = avatar.toImage(); + _scene->clear(); + _scene->addPixmap(avatar.scaled(ui->graphicsView->width(),ui->graphicsView->height())); + emit imageUpdated(); + }//if (_avatar != avatar.toImage()) + + }//if (_details != gpg_details) +} + +void IdentityWidget::updateData(const RsGxsIdGroup &gxs_group_info, const RsPeerDetails &pgp_details) +{ + updateData(gxs_group_info); + updateData(pgp_details); +} + QSize IdentityWidget::sizeHint() { QSize size; @@ -136,6 +188,7 @@ void IdentityWidget::setIsCurrent(bool value) { m_isCurrent=value; ui->labelKeyId->setVisible(value); + ui->labelGXSId->setVisible(value && (_haveGXSId && _havePGPDetail)); ui->pbAdd->setVisible(value); } /* @@ -143,3 +196,8 @@ bool IdentityWidget::isCurrent() { return m_isCurrent; }*/ + +void IdentityWidget::pbAdd_clicked() +{ + emit addButtonClicked(); +} diff --git a/retroshare-gui/src/gui/People/IdentityWidget.h b/retroshare-gui/src/gui/People/IdentityWidget.h index e6fc57845..8daebc6c1 100644 --- a/retroshare-gui/src/gui/People/IdentityWidget.h +++ b/retroshare-gui/src/gui/People/IdentityWidget.h @@ -2,8 +2,9 @@ #define IDENTITYWIDGET_H #include "gui/common/FlowLayout.h" -#include +#include #include +#include #include #include @@ -16,9 +17,13 @@ class IdentityWidget : public FlowLayoutItem Q_OBJECT public: - explicit IdentityWidget(const RsGxsIdGroup& gxs_group_info, QString name = QString(), QWidget *parent = 0); - explicit IdentityWidget(const RsPeerDetails& gpg_details, QString name = QString(), QWidget *parent = 0); + explicit IdentityWidget(QString name = QString() + , QWidget *parent = 0); ~IdentityWidget(); + void updateData(const RsGxsIdGroup& gxs_group_info); + void updateData(const RsPeerDetails& pgp_details); + void updateData(const RsGxsIdGroup& gxs_group_info + , const RsPeerDetails& pgp_details); //Start QWidget Properties QSize sizeHint(); @@ -26,20 +31,36 @@ public: virtual const QPixmap getImage(); virtual const QPixmap getDragImage(); virtual void setIsSelected(bool value); - //virtual bool isSelected(); virtual void setIsCurrent(bool value); - //virtual bool isCurrent(); - //End Properties - const bool isGXS() { return _isGXS; } + + bool haveGXSId() { return _haveGXSId; } + bool havePGPDetail() { return _havePGPDetail; } const RsGxsIdGroup& groupInfo() const { return _group_info; } const RsPeerDetails& details() const { return _details; } + const QString keyId() const { return _keyId; } + const QString idtype() const { return _idtype; } + const QString nickname() const { return _nickname; } + const QString gxsId() const { return _gxsId; } + +signals: + void addButtonClicked(); + +private slots: + void pbAdd_clicked(); private: - bool _isGXS; + bool _haveGXSId; + bool _havePGPDetail; RsGxsIdGroup _group_info; RsPeerDetails _details; QGraphicsScene* _scene; + QImage _avatar; + + QString _keyId; + QString _idtype; + QString _nickname; + QString _gxsId; Ui::IdentityWidget *ui; }; diff --git a/retroshare-gui/src/gui/People/IdentityWidget.ui b/retroshare-gui/src/gui/People/IdentityWidget.ui index 169bb9318..27a6a6610 100644 --- a/retroshare-gui/src/gui/People/IdentityWidget.ui +++ b/retroshare-gui/src/gui/People/IdentityWidget.ui @@ -7,7 +7,7 @@ 0 0 102 - 153 + 158 @@ -54,13 +54,19 @@ - + 0 15 + + + 100 + 16777215 + + Name @@ -73,7 +79,13 @@ - + + + + 0 + 15 + + 100 @@ -88,6 +100,28 @@ + + + + + 0 + 15 + + + + + 100 + 16777215 + + + + GXSId + + + Qt::AlignCenter + + + @@ -98,5 +132,13 @@ + + + ElidedLabel + QLabel +
gui/common/ElidedLabel.h
+ 1 +
+
diff --git a/retroshare-gui/src/gui/People/PeopleDialog.cpp b/retroshare-gui/src/gui/People/PeopleDialog.cpp index 3d24429bb..a1c445283 100644 --- a/retroshare-gui/src/gui/People/PeopleDialog.cpp +++ b/retroshare-gui/src/gui/People/PeopleDialog.cpp @@ -21,51 +21,25 @@ * */ -#include #include "PeopleDialog.h" #include "gui/Circles/CreateCircleDialog.h" -#include "gui/gxs/GxsIdTreeWidgetItem.h" #include "gui/common/FlowLayout.h" -#include "gui/common/UIStateHelper.h" +#include "gui/settings/rsharesettings.h" -#include -#include -#include +#include "retroshare/rspeers.h" +#include "retroshare/rsidentity.h" +#include "retroshare/rsgxscircles.h" #include "retroshare/rsgxsflags.h" -//#include "IdentityItem.h" -//#include "CircleItem.h" - #include +#include +#include /****** - * #define ID_DEBUG 1 + * #define PEOPLE_DIALOG_DEBUG 1 *****/ -// Data Requests. -#define IDDIALOG_IDLIST 1 -#define IDDIALOG_IDDETAILS 2 -#define IDDIALOG_REPLIST 3 -#define IDDIALOG_REFRESH 4 - -/**************************************************************** - */ - -#define RSID_COL_NICKNAME 0 -#define RSID_COL_KEYID 1 -#define RSID_COL_IDTYPE 2 - -#define RSIDREP_COL_NAME 0 -#define RSIDREP_COL_OPINION 1 -#define RSIDREP_COL_COMMENT 2 -#define RSIDREP_COL_REPUTATION 3 - -#define RSID_FILTER_YOURSELF 0x0001 -#define RSID_FILTER_FRIENDS 0x0002 -#define RSID_FILTER_OTHERS 0x0004 -#define RSID_FILTER_PSEUDONYMS 0x0008 -#define RSID_FILTER_ALL 0xffff const uint32_t PeopleDialog::PD_IDLIST = 0x0001 ; const uint32_t PeopleDialog::PD_IDDETAILS = 0x0002 ; @@ -78,133 +52,81 @@ PeopleDialog::PeopleDialog(QWidget *parent) { setupUi(this); - mStateHelper = new UIStateHelper(this); + /* Setup TokenQueue */ mIdentityQueue = new TokenQueue(rsIdentity->getTokenService(), this); mCirclesQueue = new TokenQueue(rsGxsCircles->getTokenService(), this); //need erase QtCreator Layout first(for Win) - delete id->layout(); + delete idExternal->layout(); + delete idInternal->layout(); //QT Designer don't accept Custom Layout, maybe on QT5 - _flowLayout = new FlowLayout(id); + _flowLayoutExt = new FlowLayout(idExternal); + _flowLayoutInt = new FlowLayout(idInternal); - //First Get Item created in Qt Designer - int count = id->children().count(); + {//First Get Item created in Qt Designer for External + int count = idExternal->children().count(); + for (int curs = 0; curs < count; ++curs){ + QObject *obj = idExternal->children().at(curs); + QWidget *wid = qobject_cast(obj); + if (wid) _flowLayoutExt->addWidget(wid); + }//for (int curs = 0; curs < count; ++curs) + }//End First Get Item created in Qt Designer for External + + {//First Get Item created in Qt Designer for Internal + int count = idInternal->children().count(); for (int curs = 0; curs < count; ++curs){ - QObject *obj = id->children().at(curs); + QObject *obj = idInternal->children().at(curs); QWidget *wid = qobject_cast(obj); - if (wid) _flowLayout->addWidget(wid); + if (wid) _flowLayoutInt->addWidget(wid); }//for (int curs = 0; curs < count; ++curs) + }//End First Get Item created in Qt Designer for Internal - pictureFlowWidget->setAcceptDrops(true); - QObject::connect(pictureFlowWidget, SIGNAL(centerIndexChanged(int)), this, SLOT(pf_centerIndexChanged(int))); - QObject::connect(pictureFlowWidget, SIGNAL(mouseMoveOverSlideEvent(QMouseEvent*,int)), this, SLOT(pf_mouseMoveOverSlideEvent(QMouseEvent*,int))); - QObject::connect(pictureFlowWidget, SIGNAL(dragEnterEventOccurs(QDragEnterEvent*)), this, SLOT(pf_dragEnterEventOccurs(QDragEnterEvent*))); - QObject::connect(pictureFlowWidget, SIGNAL(dragMoveEventOccurs(QDragMoveEvent*)), this, SLOT(pf_dragMoveEventOccurs(QDragMoveEvent*))); - QObject::connect(pictureFlowWidget, SIGNAL(dropEventOccurs(QDropEvent*)), this, SLOT(pf_dropEventOccurs(QDropEvent*))); - pictureFlowWidget->setMinimumHeight(60); - pictureFlowWidget->setSlideSizeRatio(4/4.0); + pictureFlowWidgetExternal->setAcceptDrops(true); + QObject::connect(pictureFlowWidgetExternal, SIGNAL(centerIndexChanged(int)), this, SLOT(pf_centerIndexChanged(int))); + QObject::connect(pictureFlowWidgetExternal, SIGNAL(mouseMoveOverSlideEvent(QMouseEvent*,int)), this, SLOT(pf_mouseMoveOverSlideEvent(QMouseEvent*,int))); + QObject::connect(pictureFlowWidgetExternal, SIGNAL(dragEnterEventOccurs(QDragEnterEvent*)), this, SLOT(pf_dragEnterEventOccurs(QDragEnterEvent*))); + QObject::connect(pictureFlowWidgetExternal, SIGNAL(dragMoveEventOccurs(QDragMoveEvent*)), this, SLOT(pf_dragMoveEventOccurs(QDragMoveEvent*))); + QObject::connect(pictureFlowWidgetExternal, SIGNAL(dropEventOccurs(QDropEvent*)), this, SLOT(pf_dropEventOccursExt(QDropEvent*))); + pictureFlowWidgetExternal->setMinimumHeight(60); + pictureFlowWidgetExternal->setSlideSizeRatio(4/4.0); -#if 0 - /* Setup UI helper */ - mStateHelper = new UIStateHelper(this); - mStateHelper->addWidget(IDDIALOG_IDLIST, ui.treeWidget_IdList); - mStateHelper->addLoadPlaceholder(IDDIALOG_IDLIST, ui.treeWidget_IdList, false); - mStateHelper->addClear(IDDIALOG_IDLIST, ui.treeWidget_IdList); + pictureFlowWidgetInternal->setAcceptDrops(true); + QObject::connect(pictureFlowWidgetInternal, SIGNAL(centerIndexChanged(int)), this, SLOT(pf_centerIndexChanged(int))); + QObject::connect(pictureFlowWidgetInternal, SIGNAL(mouseMoveOverSlideEvent(QMouseEvent*,int)), this, SLOT(pf_mouseMoveOverSlideEvent(QMouseEvent*,int))); + QObject::connect(pictureFlowWidgetInternal, SIGNAL(dragEnterEventOccurs(QDragEnterEvent*)), this, SLOT(pf_dragEnterEventOccurs(QDragEnterEvent*))); + QObject::connect(pictureFlowWidgetInternal, SIGNAL(dragMoveEventOccurs(QDragMoveEvent*)), this, SLOT(pf_dragMoveEventOccurs(QDragMoveEvent*))); + QObject::connect(pictureFlowWidgetInternal, SIGNAL(dropEventOccurs(QDropEvent*)), this, SLOT(pf_dropEventOccursInt(QDropEvent*))); + pictureFlowWidgetInternal->setMinimumHeight(60); + pictureFlowWidgetInternal->setSlideSizeRatio(4/4.0); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.lineEdit_Nickname); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.lineEdit_KeyId); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.lineEdit_GpgHash); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.lineEdit_GpgId); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.lineEdit_GpgName); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.toolButton_Reputation); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.toolButton_Delete); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.toolButton_EditId); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.line_RatingOverall); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.line_RatingImplicit); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.line_RatingOwn); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.line_RatingPeers); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.repModButton); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.repMod_Accept); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.repMod_Ban); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.repMod_Negative); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.repMod_Positive); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.repMod_Custom); - mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui.repMod_spinBox); - - mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui.lineEdit_Nickname); - mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui.lineEdit_GpgName); - mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui.lineEdit_KeyId); - mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui.lineEdit_GpgHash); - mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui.lineEdit_GpgId); - mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui.lineEdit_GpgName); - mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui.line_RatingOverall); - mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui.line_RatingImplicit); - mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui.line_RatingOwn); - mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui.line_RatingPeers); - - mStateHelper->addClear(IDDIALOG_IDDETAILS, ui.lineEdit_Nickname); - mStateHelper->addClear(IDDIALOG_IDDETAILS, ui.lineEdit_GpgName); - mStateHelper->addClear(IDDIALOG_IDDETAILS, ui.lineEdit_KeyId); - mStateHelper->addClear(IDDIALOG_IDDETAILS, ui.lineEdit_GpgHash); - mStateHelper->addClear(IDDIALOG_IDDETAILS, ui.lineEdit_GpgId); - mStateHelper->addClear(IDDIALOG_IDDETAILS, ui.lineEdit_GpgName); - mStateHelper->addClear(IDDIALOG_IDDETAILS, ui.line_RatingOverall); - mStateHelper->addClear(IDDIALOG_IDDETAILS, ui.line_RatingImplicit); - mStateHelper->addClear(IDDIALOG_IDDETAILS, ui.line_RatingOwn); - mStateHelper->addClear(IDDIALOG_IDDETAILS, ui.line_RatingPeers); - - //mStateHelper->addWidget(IDDIALOG_REPLIST, ui.treeWidget_RepList); - //mStateHelper->addLoadPlaceholder(IDDIALOG_REPLIST, ui.treeWidget_RepList); - //mStateHelper->addClear(IDDIALOG_REPLIST, ui.treeWidget_RepList); - - /* Connect signals */ - connect(ui.toolButton_NewId, SIGNAL(clicked()), this, SLOT(addIdentity())); - connect(ui.todoPushButton, SIGNAL(clicked()), this, SLOT(todo())); - connect(ui.toolButton_EditId, SIGNAL(clicked()), this, SLOT(editIdentity())); - connect(ui.treeWidget_IdList, SIGNAL(itemSelectionChanged()), this, SLOT(updateSelection())); - - connect(ui.filterComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterComboBoxChanged())); - connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString))); - connect(ui.repModButton, SIGNAL(clicked()), this, SLOT(modifyReputation())); - - /* Add filter types */ - ui.filterComboBox->addItem(tr("All"), RSID_FILTER_ALL); - ui.filterComboBox->addItem(tr("Yourself"), RSID_FILTER_YOURSELF); - ui.filterComboBox->addItem(tr("Friends / Friends of Friends"), RSID_FILTER_FRIENDS); - ui.filterComboBox->addItem(tr("Others"), RSID_FILTER_OTHERS); - ui.filterComboBox->addItem(tr("Pseudonyms"), RSID_FILTER_PSEUDONYMS); - ui.filterComboBox->setCurrentIndex(0); - - /* Add filter actions */ - QTreeWidgetItem *headerItem = ui.treeWidget_IdList->headerItem(); - QString headerText = headerItem->text(RSID_COL_NICKNAME); - ui.filterLineEdit->addFilter(QIcon(), headerText, RSID_COL_NICKNAME, QString("%1 %2").arg(tr("Search"), headerText)); - headerText = headerItem->text(RSID_COL_KEYID); - ui.filterLineEdit->addFilter(QIcon(), headerItem->text(RSID_COL_KEYID), RSID_COL_KEYID, QString("%1 %2").arg(tr("Search"), headerText)); - - /* Setup tree */ - ui.treeWidget_IdList->sortByColumn(RSID_COL_NICKNAME, Qt::AscendingOrder); - - mIdQueue = new TokenQueue(rsIdentity->getTokenService(), this); - - mStateHelper->setActive(IDDIALOG_IDDETAILS, false); - mStateHelper->setActive(IDDIALOG_REPLIST, false); - - // Hiding RepList until that part is finished. - //ui.treeWidget_RepList->setVisible(false); - ui.toolButton_Reputation->setVisible(false); -#endif + QByteArray geometryExt = Settings->valueFromGroup("PeopleDialog", "SplitterExtState", QByteArray()).toByteArray(); + if (geometryExt.isEmpty() == false) { + splitterExternal->restoreState(geometryExt); + } + QByteArray geometryInt = Settings->valueFromGroup("PeopleDialog", "SplitterIntState", QByteArray()).toByteArray(); + if (geometryInt.isEmpty() == false) { + splitterInternal->restoreState(geometryInt); + } } -void PeopleDialog::~PeopleDialog() +/** Destructor. */ +PeopleDialog::~PeopleDialog() { - delete(mIdentityQueue); - delete(mCirclesQueue); + delete mIdentityQueue; + delete mCirclesQueue; + + Settings->setValueToGroup("PeopleDialog", "SplitterExtState", splitterExternal->saveState()); + Settings->setValueToGroup("PeopleDialog", "SplitterIntState", splitterInternal->saveState()); } void PeopleDialog::updateDisplay(bool complete) { Q_UNUSED(complete); + reloadAll(); +} + +void PeopleDialog::reloadAll() +{ /* Update identity list */ requestIdList(); requestCirclesList(); @@ -213,43 +135,64 @@ void PeopleDialog::updateDisplay(bool complete) std::list friend_pgpIds; std::list all_pgpIds; std::list::iterator it; + std::set friend_set; rsPeers->getGPGAcceptedList(friend_pgpIds); - rsPeers->getGPGAllList(all_pgpIds); + //rsPeers->getGPGAllList(all_pgpIds); + for(it = friend_pgpIds.begin(); it != friend_pgpIds.end(); ++it) { - friend_set.insert(*it); - }//for(it = friend_pgpIds.begin(); it != friend_pgpIds.end(); ++it) - for(it = all_pgpIds.begin(); it != all_pgpIds.end(); ++it) { - if (friend_set.find(*it) != friend_set.end()) continue;// already added as a friend. - friend_set.insert(*it); - }//for(it = all_pgpIds.begin(); it != all_pgpIds.end(); ++it) + RsPeerDetails details; + if(rsPeers->getGPGDetails(*it, details)){ + std::map::iterator itFound; + if((itFound=_pgp_identity_widgets.find(*it)) == _pgp_identity_widgets.end()) { + IdentityWidget *new_item = new IdentityWidget(); + new_item->updateData(details) ; + _pgp_identity_widgets[*it] = new_item ; + + QObject::connect(new_item, SIGNAL(addButtonClicked()), this, SLOT(iw_AddButtonClickedInt())); + QObject::connect(new_item, SIGNAL(flowLayoutItemDropped(QList,bool&)), this, SLOT(fl_flowLayoutItemDroppedInt(QList,bool&))); + _flowLayoutInt->addWidget(new_item); + } else {//if((itFound=_pgp_identity_widgets.find(gdItem.mPgpId)) == _pgp_identity_widgets.end()) + IdentityWidget *idWidget = itFound->second; + + idWidget->updateData(details) ; + }//else ((itFound=_pgp_identity_widgets.find(gdItem.mPgpId)) == _pgp_identity_widgets.end()) + + friend_set.insert(*it); + }//if(rsPeers->getGPGDetails(*it, details)) + }//for(it = friend_pgpIds.begin(); it != friend_pgpIds.end(); ++it) + + for(it = all_pgpIds.begin(); it != all_pgpIds.end(); it++) { + if(friend_set.end() != friend_set.find(*it)) { + // already added as a friend. + continue; + }//if(friend_set.end() != friend_set.find(*it)) - for(std::set::iterator it = friend_set.begin() - ; it != friend_set.end() - ;++it){ RsPeerDetails details; if (rsPeers->getGPGDetails(*it, details)) { std::map::iterator itFound; if((itFound=_pgp_identity_widgets.find(*it)) == _pgp_identity_widgets.end()) { - std::cerr << "Loading pgp identity ID = " << it->toStdString() << std::endl; - - IdentityWidget *new_item = new IdentityWidget(details) ; + IdentityWidget *new_item = new IdentityWidget(); + new_item->updateData(details) ; _pgp_identity_widgets[*it] = new_item ; - QObject::connect(new_item, SIGNAL(flowLayoutItemDropped(QList,bool&)), this, SLOT(fl_flowLayoutItemDropped(QList,bool&))); - _flowLayout->addWidget(new_item); - }//if((itFound=_pgp_identity_widgets.find(*it)) == _pgp_identity_widgets.end()) - }//if (rsPeers->getGPGDetails(*it, details)) - }//for(std::set::iterator it = friend_set.begin() + QObject::connect(new_item, SIGNAL(addButtonClicked()), this, SLOT(iw_AddButtonClickedInt())); + QObject::connect(new_item, SIGNAL(flowLayoutItemDropped(QList,bool&)), this, SLOT(fl_flowLayoutItemDroppedInt(QList,bool&))); + _flowLayoutInt->addWidget(new_item); + } else {//if((itFound=_pgp_identity_widgets.find(gdItem.mPgpId)) == _pgp_identity_widgets.end()) + IdentityWidget *idWidget = itFound->second; + idWidget->updateData(details) ; + }//else ((itFound=_pgp_identity_widgets.find(gdItem.mPgpId)) == _pgp_identity_widgets.end()) + }//if(rsPeers->getGPGDetails(*it, details)) + }//for(it = all_pgpIds.begin(); it != all_pgpIds.end(); it++) } void PeopleDialog::insertIdList(uint32_t token) { std::cerr << "**** In insertIdList() ****" << std::endl; - mStateHelper->setLoading(PD_IDLIST, false); std::vector gdataVector; std::vector::iterator gdIt; @@ -258,72 +201,67 @@ void PeopleDialog::insertIdList(uint32_t token) std::cerr << "PeopleDialog::insertIdList() Error getting GroupData"; std::cerr << std::endl; - mStateHelper->setLoading(PD_IDDETAILS, false); - mStateHelper->setLoading(PD_CIRCLES, false); - - mStateHelper->setActive(PD_IDLIST, false); - mStateHelper->setActive(PD_IDDETAILS, false); - mStateHelper->setActive(PD_CIRCLES, false); - - mStateHelper->clear(PD_IDLIST); - mStateHelper->clear(PD_IDDETAILS); - mStateHelper->clear(PD_CIRCLES); - return; }//if (!rsIdentity->getGroupData(token, gdataVector)) - mStateHelper->setActive(PD_IDLIST, true); - //RsPgpId ownPgpId = rsPeers->getGPGOwnId(); /* Insert items */ int i=0 ; for (gdIt = gdataVector.begin(); gdIt != gdataVector.end(); ++gdIt){ RsGxsIdGroup gdItem = (*gdIt); + bool bGotDetail = false; + + RsPeerDetails details; + if (gdItem.mPgpKnown) { + bGotDetail = rsPeers->getGPGDetails(gdItem.mPgpId, details); + }//if (gdItem.mPgpKnown) std::map::iterator itFound; if((itFound=_gxs_identity_widgets.find(RsGxsId(gdItem.mMeta.mGroupId))) == _gxs_identity_widgets.end()) { - std::cerr << "Loading data vector identity ID = " << gdItem.mMeta.mGroupId << ", i="<< i << std::endl; + std::cerr << "Loading data vector identity GXS ID = " << gdItem.mMeta.mGroupId << ", i="<< i << std::endl; - IdentityWidget *new_item = new IdentityWidget(gdItem) ; + IdentityWidget *new_item = new IdentityWidget(); + if (bGotDetail) { + new_item->updateData(gdItem, details); + } else {//if (bGotDetail) + new_item->updateData(gdItem); + }//else (bGotDetail) _gxs_identity_widgets[RsGxsId(gdItem.mMeta.mGroupId)] = new_item ; - QObject::connect(new_item, SIGNAL(flowLayoutItemDropped(QList,bool&)), this, SLOT(fl_flowLayoutItemDropped(QList,bool&))); - _flowLayout->addWidget(new_item); + QObject::connect(new_item, SIGNAL(addButtonClicked()), this, SLOT(iw_AddButtonClickedExt())); + QObject::connect(new_item, SIGNAL(flowLayoutItemDropped(QList,bool&)), this, SLOT(fl_flowLayoutItemDroppedExt(QList,bool&))); + _flowLayoutExt->addWidget(new_item); ++i ; - } else {//if((itFound=_identity_widgets.find(gdItem.mMeta.mGroupId)) == _identity_widgets.end()) + } else {//if((itFound=_gxs_identity_widgets.find(RsGxsId(gdItem.mMeta.mGroupId))) == _gxs_identity_widgets.end()) - std::cerr << "Updating data vector identity ID = " << gdItem.mMeta.mGroupId << std::endl; - //TODO + std::cerr << "Updating data vector identity GXS ID = " << gdItem.mMeta.mGroupId << std::endl; IdentityWidget *idWidget = itFound->second; - idWidget->setName("TODO updated"); - //RsGxsIdGroup idGroup = gdIt; - //idWidget->update(idGroup); - }//else (_identity_widgets.find((*vit).mMeta.mGroupId) == _identity_widgets.end()) + if (bGotDetail) { + idWidget->updateData(gdItem, details) ; + } else {//if (bGotDetail) + idWidget->updateData(gdItem) ; + }//else (bGotDetail) + + }//else ((itFound=_gxs_identity_widgets.find(RsGxsId(gdItem.mMeta.mGroupId))) == _gxs_identity_widgets.end())) }//for (gdIt = gdataVector.begin(); gdIt != gdataVector.end(); ++gdIt) } void PeopleDialog::insertCircles(uint32_t token) { - std::cerr << "PeopleDialog::insertCircles(token==" << token << ")" << std::endl; - mStateHelper->setLoading(PD_CIRCLES, false); + std::cerr << "PeopleDialog::insertExtCircles(token==" << token << ")" << std::endl; std::list gSummaryList; std::list::iterator gsIt; if (!rsGxsCircles->getGroupSummary(token,gSummaryList)) { - std::cerr << "PeopleDialog::insertCircles() Error getting GroupSummary"; + std::cerr << "PeopleDialog::insertExtCircles() Error getting GroupSummary"; std::cerr << std::endl; - mStateHelper->setActive(PD_CIRCLES, false); - return; }//if (!rsGxsCircles->getGroupSummary(token,gSummaryList)) - mStateHelper->setActive(PD_CIRCLES, true); - - /* add the top level item */ for(gsIt = gSummaryList.begin(); gsIt != gSummaryList.end(); gsIt++) { RsGroupMetaData gsItem = (*gsIt); @@ -333,38 +271,71 @@ void PeopleDialog::insertCircles(uint32_t token) continue ; }//if(!rsGxsCircles->getCircleDetails(RsGxsCircleId(git->mGroupId), details)) + if (!details.mIsExternal){ std::map::iterator itFound; - if((itFound=_circles_widgets.find(gsItem.mGroupId)) == _circles_widgets.end()) { - std::cerr << "PeopleDialog::insertCircles() add new GroupId: " << gsItem.mGroupId; + if((itFound=_int_circles_widgets.find(gsItem.mGroupId)) == _int_circles_widgets.end()) { + std::cerr << "PeopleDialog::insertExtCircles() add new Internal GroupId: " << gsItem.mGroupId; std::cerr << " GroupName: " << gsItem.mGroupName; std::cerr << std::endl; CircleWidget *gitem = new CircleWidget() ; - QObject::connect(gitem, SIGNAL(flowLayoutItemDropped(QList,bool&)), this, SLOT(fl_flowLayoutItemDropped(QList,bool&))); + QObject::connect(gitem, SIGNAL(flowLayoutItemDropped(QList,bool&)), this, SLOT(fl_flowLayoutItemDroppedInt(QList,bool&))); QObject::connect(gitem, SIGNAL(askForGXSIdentityWidget(RsGxsId)), this, SLOT(cw_askForGXSIdentityWidget(RsGxsId))); - QObject::connect(gitem, SIGNAL(askForPGPIdentityWidget(RsGxsId)), this, SLOT(cw_askForPGPIdentityWidget(RsPgpId))); + QObject::connect(gitem, SIGNAL(askForPGPIdentityWidget(RsPgpId)), this, SLOT(cw_askForPGPIdentityWidget(RsPgpId))); + QObject::connect(gitem, SIGNAL(imageUpdated()), this, SLOT(cw_imageUpdatedInt())); gitem->updateData( gsItem, details ); - _circles_widgets[gsItem.mGroupId] = gitem ; + _int_circles_widgets[gsItem.mGroupId] = gitem ; + _flowLayoutInt->addWidget(gitem); - _flowLayout->addWidget(gitem); + QPixmap pixmap = gitem->getImage(); + pictureFlowWidgetInternal->addSlide( pixmap ); + _intListCir << gitem; + } else {//if((itFound=_int_circles_widgets.find(gsItem.mGroupId)) == _int_circles_widgets.end()) + std::cerr << "PeopleDialog::insertExtCircles() Update GroupId: " << gsItem.mGroupId; + std::cerr << " GroupName: " << gsItem.mGroupName; + std::cerr << std::endl; + + CircleWidget *cirWidget = itFound->second; + cirWidget->updateData( gsItem, details ); + + //int index = _intListCir.indexOf(cirWidget); + //QPixmap pixmap = cirWidget->getImage(); + //pictureFlowWidgetInternal->setSlide(index, pixmap); + }//if((item=_int_circles_widgets.find(gsItem.mGroupId)) == _int_circles_widgets.end()) + } else {//if (!details.mIsExternal) + std::map::iterator itFound; + if((itFound=_ext_circles_widgets.find(gsItem.mGroupId)) == _ext_circles_widgets.end()) { + std::cerr << "PeopleDialog::insertExtCircles() add new GroupId: " << gsItem.mGroupId; + std::cerr << " GroupName: " << gsItem.mGroupName; + std::cerr << std::endl; + + CircleWidget *gitem = new CircleWidget() ; + QObject::connect(gitem, SIGNAL(flowLayoutItemDropped(QList,bool&)), this, SLOT(fl_flowLayoutItemDroppedExt(QList,bool&))); + QObject::connect(gitem, SIGNAL(askForGXSIdentityWidget(RsGxsId)), this, SLOT(cw_askForGXSIdentityWidget(RsGxsId))); + QObject::connect(gitem, SIGNAL(askForPGPIdentityWidget(RsPgpId)), this, SLOT(cw_askForPGPIdentityWidget(RsPgpId))); + QObject::connect(gitem, SIGNAL(imageUpdated()), this, SLOT(cw_imageUpdatedExt())); + gitem->updateData( gsItem, details ); + _ext_circles_widgets[gsItem.mGroupId] = gitem ; + + _flowLayoutExt->addWidget(gitem); QPixmap pixmap = gitem->getImage(); - pictureFlowWidget->addSlide( pixmap ); - _listCir << gitem; + pictureFlowWidgetExternal->addSlide( pixmap ); + _extListCir << gitem; } else {//if((itFound=_circles_widgets.find(gsItem.mGroupId)) == _circles_widgets.end()) - std::cerr << "PeopleDialog::insertCircles() Update GroupId: " << gsItem.mGroupId; + std::cerr << "PeopleDialog::insertExtCircles() Update GroupId: " << gsItem.mGroupId; std::cerr << " GroupName: " << gsItem.mGroupName; std::cerr << std::endl; - //TODO CircleWidget *cirWidget = itFound->second; - cirWidget->setName("TODO updated"); - //cirWidget->update(gsItem, details); - int index = _listCir.indexOf(cirWidget); - QPixmap pixmap = cirWidget->getImage(); - pictureFlowWidget->setSlide(index, pixmap); + cirWidget->updateData( gsItem, details ); + + //int index = _extListCir.indexOf(cirWidget); + //QPixmap pixmap = cirWidget->getImage(); + //pictureFlowWidgetExternal->setSlide(index, pixmap); }//if((item=_circles_items.find(gsItem.mGroupId)) == _circles_items.end()) + }//else (!details.mIsExternal) }//for(gsIt = gSummaryList.begin(); gsIt != gSummaryList.end(); gsIt++) } @@ -374,10 +345,6 @@ void PeopleDialog::requestIdList() if (!mIdentityQueue) return; - mStateHelper->setLoading(PD_IDLIST, true); - //mStateHelper->setLoading(PD_IDDETAILS, true); - //mStateHelper->setLoading(PD_REPLIST, true); - mIdentityQueue->cancelActiveRequestTokens(PD_IDLIST); RsTokReqOptions opts; @@ -394,10 +361,6 @@ void PeopleDialog::requestCirclesList() if (!mCirclesQueue) return; - mStateHelper->setLoading(PD_CIRCLES, true); - //mStateHelper->setLoading(PD_IDDETAILS, true); - //mStateHelper->setLoading(PD_REPLIST, true); - mCirclesQueue->cancelActiveRequestTokens(PD_CIRCLES); RsTokReqOptions opts; @@ -435,6 +398,112 @@ void PeopleDialog::loadRequest(const TokenQueue * /*queue*/, const TokenRequest }//switch(req.mUserType) } +void PeopleDialog::iw_AddButtonClickedExt() +{ + IdentityWidget *dest= + qobject_cast(QObject::sender()); + if (dest) { + QMenu contextMnu( this ); + + std::map::iterator itCurs; + for( itCurs =_ext_circles_widgets.begin(); + itCurs != _ext_circles_widgets.end(); + ++itCurs) { + CircleWidget *curs = itCurs->second; + QIcon icon = QIcon(curs->getImage()); + QString name = curs->getName(); + + QAction *action = contextMnu.addAction(icon, name, this, SLOT(addToCircleExt())); + action->setData(QString::fromStdString(curs->groupInfo().mGroupId.toStdString()) + + ";" + QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString())); + }//for( itCurs =_ext_circles_widgets.begin(); + + contextMnu.exec(QCursor::pos()); + }//if (dest) +} + +void PeopleDialog::iw_AddButtonClickedInt() +{ + IdentityWidget *dest= + qobject_cast(QObject::sender()); + if (dest) { + QMenu contextMnu( this ); + + std::map::iterator itCurs; + for( itCurs =_int_circles_widgets.begin(); + itCurs != _int_circles_widgets.end(); + ++itCurs) { + CircleWidget *curs = itCurs->second; + QIcon icon = QIcon(curs->getImage()); + QString name = curs->getName(); + + QAction *action = contextMnu.addAction(icon, name, this, SLOT(addToCircleInt())); + action->setData(QString::fromStdString(curs->groupInfo().mGroupId.toStdString()) + + ";" + QString::fromStdString(dest->details().gpg_id.toStdString())); + }//for( itCurs =_int_circles_widgets.begin(); + + contextMnu.exec(QCursor::pos()); + }//if (dest) +} + +void PeopleDialog::addToCircleExt() +{ + QAction *action = + qobject_cast(QObject::sender()); + if (action) { + QString data = action->data().toString(); + QStringList idList = data.split(";"); + + RsGxsGroupId groupId = RsGxsGroupId(idList.at(0).toStdString()); + std::map::iterator itCirFound; + if((itCirFound=_ext_circles_widgets.find(groupId)) != _ext_circles_widgets.end()) { + CircleWidget *circle = itCirFound->second; + CreateCircleDialog dlg; + dlg.addCircle(circle->circleDetails()); + + RsGxsId gxs_id = RsGxsId(idList.at(1).toStdString()); + + std::map::iterator itIdFound; + if((itIdFound=_gxs_identity_widgets.find(gxs_id)) != _gxs_identity_widgets.end()) { + IdentityWidget *idWidget = itIdFound->second; + dlg.addMember(idWidget->groupInfo()); + }//if((itFound=_gxs_identity_widgets.find(gxs_id)) != _gxs_identity_widgets.end()) + + dlg.editExistingId(circle->groupInfo().mGroupId, false); + dlg.exec(); + }//if((itFound=_ext_circles_widgets.find(groupId)) != _ext_circles_widgets.end()) + }//if (action) +} + +void PeopleDialog::addToCircleInt() +{ + QAction *action = + qobject_cast(QObject::sender()); + if (action) { + QString data = action->data().toString(); + QStringList idList = data.split(";"); + + RsGxsGroupId groupId = RsGxsGroupId(idList.at(0).toStdString()); + std::map::iterator itCirFound; + if((itCirFound=_int_circles_widgets.find(groupId)) != _int_circles_widgets.end()) { + CircleWidget *circle = itCirFound->second; + CreateCircleDialog dlg; + dlg.addCircle(circle->circleDetails()); + + RsPgpId pgp_id = RsPgpId(idList.at(1).toStdString()); + + std::map::iterator itIdFound; + if((itIdFound=_pgp_identity_widgets.find(pgp_id)) != _pgp_identity_widgets.end()) { + IdentityWidget *idWidget = itIdFound->second; + dlg.addMember(idWidget->keyId(), idWidget->idtype(), idWidget->nickname()); + }//if((itFound=_pgp_identity_widgets.find(pgp_id)) != _pgp_identity_widgets.end()) + + dlg.editExistingId(circle->groupInfo().mGroupId, false); + dlg.exec(); + }//if((itFound=_ext_circles_widgets.find(groupId)) != _ext_circles_widgets.end()) + }//if (action) +} + void PeopleDialog::cw_askForGXSIdentityWidget(RsGxsId gxs_id) { CircleWidget *dest = @@ -463,12 +532,34 @@ void PeopleDialog::cw_askForPGPIdentityWidget(RsPgpId pgp_id) }//if (dest) } -void PeopleDialog::fl_flowLayoutItemDropped(QListflListItem, bool &bAccept) +void PeopleDialog::cw_imageUpdatedInt() +{ + CircleWidget *cirWidget = + qobject_cast(QObject::sender()); + if (cirWidget){ + int index = _intListCir.indexOf(cirWidget); + QPixmap pixmap = cirWidget->getImage(); + pictureFlowWidgetInternal->setSlide(index, pixmap); + }//if (cirWidget) +} + +void PeopleDialog::cw_imageUpdatedExt() +{ + CircleWidget *cirWidget = + qobject_cast(QObject::sender()); + if (cirWidget){ + int index = _extListCir.indexOf(cirWidget); + QPixmap pixmap = cirWidget->getImage(); + pictureFlowWidgetExternal->setSlide(index, pixmap); + }//if (cirWidget) +} + +void PeopleDialog::fl_flowLayoutItemDroppedExt(QListflListItem, bool &bAccept) { bAccept=false; bool bCreateNewCircle=false; - bool bIsExternal=false;//External if one at least is unknow or external - bool bDestCirIsLocal=false; + QApplication::restoreOverrideCursor(); + FlowLayoutItem *dest = qobject_cast(QObject::sender()); if (dest) { @@ -476,24 +567,19 @@ void PeopleDialog::fl_flowLayoutItemDropped(QListflListItem, b CircleWidget* cirDest = qobject_cast(dest); if (cirDest) { - bDestCirIsLocal = (cirDest->groupInfo().mCircleType == GXS_CIRCLE_TYPE_LOCAL); - bIsExternal |= ! bDestCirIsLocal; dlg.addCircle(cirDest->circleDetails()); + } else {//if (cirDest) bCreateNewCircle=true; - }//else (cirDest) - IdentityWidget* idDest = qobject_cast(dest); if (idDest) { - if (idDest->isGXS()){ - bIsExternal |= ! idDest->groupInfo().mPgpKnown; + if (idDest->haveGXSId()){ dlg.addMember(idDest->groupInfo()); - } else {//if (idDest->isGXS()) - ///TODO: How to get RSGxsIdGrop from pgp??? - //dlg.addMember(idDest->details().id); - }//else (idDest->isGXS()) + }//if (idDest->haveGXSId()) }//if (idDest) + }//else (cirDest) + typedef QList::Iterator itList; for (itList listCurs = flListItem.begin() @@ -504,25 +590,84 @@ void PeopleDialog::fl_flowLayoutItemDropped(QListflListItem, b //Create new circle if circle dropped in circle or ident if (cirDropped) { bCreateNewCircle = true; - bIsExternal |= (cirDropped->groupInfo().mCircleType != GXS_CIRCLE_TYPE_LOCAL); dlg.addCircle(cirDropped->circleDetails()); } else {//if (cirDropped) IdentityWidget* idDropped = qobject_cast(flCurs); if (idDropped){ - bIsExternal |= ! idDropped->groupInfo().mPgpKnown; + if (idDropped->haveGXSId()){ dlg.addMember(idDropped->groupInfo()); + }//if (idDropped->haveGXSId()) + }//if (idDropped) + }//else (cirDropped) + + }//for (itList listCurs = flListItem.begin() + + if (bCreateNewCircle){ + dlg.editNewId(true); + } else {//if (bCreateNewCircle) + dlg.editExistingId(cirDest->groupInfo().mGroupId, false); + }//else (bCreateNewCircle) + + dlg.exec(); + + bAccept=true; + }//if (dest) +} + +void PeopleDialog::fl_flowLayoutItemDroppedInt(QListflListItem, bool &bAccept) +{ + bAccept=false; + bool bCreateNewCircle=false; + QApplication::restoreOverrideCursor(); + + FlowLayoutItem *dest = + qobject_cast(QObject::sender()); + if (dest) { + CreateCircleDialog dlg; + + CircleWidget* cirDest = qobject_cast(dest); + if (cirDest) { + dlg.addCircle(cirDest->circleDetails()); + + } else {//if (cirDest) + bCreateNewCircle=true; + IdentityWidget* idDest = qobject_cast(dest); + if (idDest) { + if (idDest->havePGPDetail()){ + dlg.addMember(idDest->keyId(), idDest->idtype(), idDest->nickname()); + + }//if (idDest->havePGPDetail()) + }//if (idDest) + }//else (cirDest) + + + typedef QList::Iterator itList; + for (itList listCurs = flListItem.begin() + ; listCurs != flListItem.end() + ; ++listCurs) { + FlowLayoutItem *flCurs = *listCurs; + CircleWidget* cirDropped = qobject_cast(flCurs); + //Create new circle if circle dropped in circle or ident + if (cirDropped) { + bCreateNewCircle = true; + dlg.addCircle(cirDropped->circleDetails()); + + } else {//if (cirDropped) + IdentityWidget* idDropped = qobject_cast(flCurs); + if (idDropped){ + dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname()); + }//if (idDropped) }//else (cirDropped) }//for (itList listCurs = flListItem.begin() - bCreateNewCircle |= (bIsExternal && bDestCirIsLocal); if (bCreateNewCircle){ - dlg.editNewId(bIsExternal); + dlg.editNewId(false); } else {//if (bCreateNewCircle) - dlg.editExistingId(cirDest->groupInfo().mGroupId); + dlg.editExistingId(cirDest->groupInfo().mGroupId, false); }//else (bCreateNewCircle) dlg.exec(); @@ -584,20 +729,17 @@ void PeopleDialog::pf_dragMoveEventOccurs(QDragMoveEvent *event) }//if (layout) } -void PeopleDialog::pf_dropEventOccurs(QDropEvent *event) +void PeopleDialog::pf_dropEventOccursExt(QDropEvent *event) { bool bCreateNewCircle=false; - bool bIsExternal=false;//External if one at least is unknow or external - bool bDestCirIsLocal=false; bool atLeastOne = false; + QApplication::restoreOverrideCursor(); - int index = pictureFlowWidget->centerIndex(); - CircleWidget* cirDest = _listCir[index]; + int index = pictureFlowWidgetExternal->centerIndex(); + CircleWidget* cirDest = _extListCir[index]; if (cirDest) { CreateCircleDialog dlg; - bDestCirIsLocal = (cirDest->groupInfo().mCircleType == GXS_CIRCLE_TYPE_LOCAL); - bIsExternal |= ! bDestCirIsLocal; dlg.addCircle(cirDest->circleDetails()); {//Test if source is only one FlowLayoutItem @@ -608,29 +750,21 @@ void PeopleDialog::pf_dropEventOccurs(QDropEvent *event) //Create new circle if circle dropped in circle or ident if (cirDropped) { bCreateNewCircle = true; - bIsExternal |= (cirDropped->groupInfo().mCircleType != GXS_CIRCLE_TYPE_LOCAL); dlg.addCircle(cirDropped->circleDetails()); atLeastOne = true; } else {//if (cirDropped) IdentityWidget* idDropped = qobject_cast(flCurs); if (idDropped){ - if (idDropped->isGXS()){ - bIsExternal |= ! idDropped->groupInfo().mPgpKnown; + if (idDropped->haveGXSId()){ dlg.addMember(idDropped->groupInfo()); atLeastOne = true; - } else {//if (idDropped->isGXS()) - ///TODO: How to get RSGxsIdGrop from pgp??? - //dlg.addMember(idDropped->details().id); - //atLeastOne = true; - - }//else (idDropped->isGXS()) - + }//if (idDropped->haveGXSId()) }//if (idDropped) }//else (cirDropped) }//if (flCurs) - }//End Test if source is only one IdentityWidget + }//End Test if source is only one FlowLayoutItem QWidget *wid = qobject_cast(event->source());//QT5 return QObject @@ -651,16 +785,16 @@ void PeopleDialog::pf_dropEventOccurs(QDropEvent *event) //Create new circle if circle dropped in circle or ident if (cirDropped) { bCreateNewCircle = true; - bIsExternal |= (cirDropped->groupInfo().mCircleType != GXS_CIRCLE_TYPE_LOCAL); dlg.addCircle(cirDropped->circleDetails()); atLeastOne = true; } else {//if (cirDropped) IdentityWidget* idDropped = qobject_cast(flCurs); if (idDropped){ - bIsExternal |= ! idDropped->groupInfo().mPgpKnown; + if (idDropped->haveGXSId()){ dlg.addMember(idDropped->groupInfo()); atLeastOne = true; + }//if (idDropped->haveGXSId()) }//if (idDropped) }//else (cirDropped) @@ -671,11 +805,10 @@ void PeopleDialog::pf_dropEventOccurs(QDropEvent *event) }//if (layout) if (atLeastOne) { - bCreateNewCircle |= (bIsExternal && bDestCirIsLocal); if (bCreateNewCircle){ - dlg.editNewId(bIsExternal); + dlg.editNewId(true); } else {//if (bCreateNewCircle) - dlg.editExistingId(cirDest->groupInfo().mGroupId); + dlg.editExistingId(cirDest->groupInfo().mGroupId, false); }//else (bCreateNewCircle) dlg.exec(); @@ -686,458 +819,114 @@ void PeopleDialog::pf_dropEventOccurs(QDropEvent *event) }//if (cirDest) } -void PeopleDialog::populatePictureFlow() -{ +void PeopleDialog::pf_dropEventOccursInt(QDropEvent *event) + { + bool bCreateNewCircle=false; + bool atLeastOne = false; + QApplication::restoreOverrideCursor(); + + int index = pictureFlowWidgetInternal->centerIndex(); + CircleWidget* cirDest = _intListCir[index]; + if (cirDest) { + CreateCircleDialog dlg; + + dlg.addCircle(cirDest->circleDetails()); + + {//Test if source is only one FlowLayoutItem + FlowLayoutItem *flCurs = + qobject_cast(event->source()); + if (flCurs) { + CircleWidget* cirDropped = qobject_cast(flCurs); + //Create new circle if circle dropped in circle or ident + if (cirDropped) { + bCreateNewCircle = true; + dlg.addCircle(cirDropped->circleDetails()); + atLeastOne = true; + + } else {//if (cirDropped) + IdentityWidget* idDropped = qobject_cast(flCurs); + if (idDropped){ + if (idDropped->havePGPDetail()){ + dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname()); + atLeastOne = true; + }//if (idDropped->havePGPDetail()) + }//if (idDropped) + }//else (cirDropped) + + }//if (flCurs) + }//End Test if source is only one FlowLayoutItem + + QWidget *wid = + qobject_cast(event->source());//QT5 return QObject + FlowLayout *layout; + if (wid) layout = + qobject_cast(wid->layout()); + if (layout) { + + QList list = layout->selectionList(); + int count = list.count(); + for (int curs = 0; curs < count; ++curs){ + QLayoutItem *layoutItem = list.at(curs); + if (layoutItem){ + FlowLayoutItem *flCurs = + qobject_cast(layoutItem->widget()); + if (flCurs){ + CircleWidget* cirDropped = qobject_cast(flCurs); + //Create new circle if circle dropped in circle or ident + if (cirDropped) { + bCreateNewCircle = true; + dlg.addCircle(cirDropped->circleDetails()); + atLeastOne = true; + + } else {//if (cirDropped) + IdentityWidget* idDropped = qobject_cast(flCurs); + if (idDropped){ + if (idDropped->havePGPDetail()){ + dlg.addMember(idDropped->keyId(), idDropped->idtype(), idDropped->nickname()); + atLeastOne = true; + }//if (idDropped->havePGPDetail()) + + }//if (idDropped) + }//else (cirDropped) + + }//if (flCurs) + }//if (layoutItem) + }//for (int curs = 0; curs < count; ++curs) + }//if (layout) + + if (atLeastOne) { + if (bCreateNewCircle){ + dlg.editNewId(false); + } else {//if (bCreateNewCircle) + dlg.editExistingId(cirDest->groupInfo().mGroupId, false); + }//else (bCreateNewCircle) + + dlg.exec(); + + event->setDropAction(Qt::CopyAction); + event->accept(); + }//if (atLeastOne) + }//if (cirDest) +} + +void PeopleDialog::populatePictureFlowExt() + { std::map::iterator it; - for (it=_circles_widgets.begin(); it!=_circles_widgets.end(); ++it) { + for (it=_ext_circles_widgets.begin(); it!=_ext_circles_widgets.end(); ++it) { CircleWidget *item = it->second; QPixmap pixmap = item->getImage(); - pictureFlowWidget->addSlide( pixmap ); - }//for (it=_circles_items.begin(); it!=_circles_items.end(); ++it) - pictureFlowWidget->setSlideSizeRatio(4/4.0); + pictureFlowWidgetExternal->addSlide( pixmap ); + }//for (it=_ext_circles_widgets.begin(); it!=_ext_circles_widgets.end(); ++it) + pictureFlowWidgetExternal->setSlideSizeRatio(4/4.0); + } + +void PeopleDialog::populatePictureFlowInt() + { + std::map::iterator it; + for (it=_int_circles_widgets.begin(); it!=_int_circles_widgets.end(); ++it) { + CircleWidget *item = it->second; + QPixmap pixmap = item->getImage(); + pictureFlowWidgetInternal->addSlide( pixmap ); + }//for (it=_int_circles_widgets.begin(); it!=_int_circles_widgets.end(); ++it) + pictureFlowWidgetInternal->setSlideSizeRatio(4/4.0); } - - - - - - - -#if 0 -void IdDialog::todo() -{ - QMessageBox::information(this, "Todo", - "Open points:
    " - "
  • Delete ID" - "
  • Reputation" - "
  • Load/save settings" - "
"); -} - -void IdDialog::filterComboBoxChanged() -{ - requestIdList(); -} - -void IdDialog::filterChanged(const QString& /*text*/) -{ - filterIds(); -} - -void IdDialog::updateSelection() -{ - QTreeWidgetItem *item = ui.treeWidget_IdList->currentItem(); - RsGxsGroupId id; - - if (item) - { - id = RsGxsGroupId(item->text(RSID_COL_KEYID).toStdString()); - } - - requestIdDetails(id); -} - -bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item, const RsPgpId &ownPgpId, int accept) -{ - bool isOwnId = (data.mPgpKnown && (data.mPgpId == ownPgpId)) || (data.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN); - - /* do filtering */ - bool ok = false; - if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID) - { - if (isOwnId && (accept & RSID_FILTER_YOURSELF)) - { - ok = true; - } - else - { - if (data.mPgpKnown) - { - if (accept & RSID_FILTER_FRIENDS) - { - ok = true; - } - } - else - { - if (accept & RSID_FILTER_OTHERS) - { - ok = true; - } - } - } - } - else - { - if (accept & RSID_FILTER_PSEUDONYMS) - { - ok = true; - } - - if (isOwnId && (accept & RSID_FILTER_YOURSELF)) - { - ok = true; - } - } - - if (!ok) - { - return false; - } - - if (!item) - { - item = new QTreeWidgetItem(); - } - item->setText(RSID_COL_NICKNAME, QString::fromUtf8(data.mMeta.mGroupName.c_str())); - item->setText(RSID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId.toStdString())); - - if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID) - { - if (data.mPgpKnown) - { - RsPeerDetails details; - rsPeers->getGPGDetails(data.mPgpId, details); - item->setText(RSID_COL_IDTYPE, QString::fromUtf8(details.name.c_str())); - } - else - { - item->setText(RSID_COL_IDTYPE, tr("PGP Linked Id")); - } - } - else - { - item->setText(RSID_COL_IDTYPE, tr("Anon Id")); - } - - return true; -} - -void IdDialog::requestIdDetails(RsGxsGroupId &id) -{ - mIdQueue->cancelActiveRequestTokens(IDDIALOG_IDDETAILS); - - if (id.isNull()) - { - mStateHelper->setActive(IDDIALOG_IDDETAILS, false); - mStateHelper->setActive(IDDIALOG_REPLIST, false); - mStateHelper->setLoading(IDDIALOG_IDDETAILS, false); - mStateHelper->setLoading(IDDIALOG_REPLIST, false); - mStateHelper->clear(IDDIALOG_IDDETAILS); - mStateHelper->clear(IDDIALOG_REPLIST); - - return; - } - - mStateHelper->setLoading(IDDIALOG_IDDETAILS, true); - mStateHelper->setLoading(IDDIALOG_REPLIST, true); - - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; - - uint32_t token; - std::list groupIds; - groupIds.push_back(id); - - mIdQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, IDDIALOG_IDDETAILS); -} - -void IdDialog::insertIdDetails(uint32_t token) -{ - mStateHelper->setLoading(IDDIALOG_IDDETAILS, false); - - /* get details from libretroshare */ - RsGxsIdGroup data; - std::vector datavector; - if (!rsIdentity->getGroupData(token, datavector)) - { - mStateHelper->setActive(IDDIALOG_IDDETAILS, false); - mStateHelper->setActive(IDDIALOG_REPLIST, false); - mStateHelper->setLoading(IDDIALOG_REPLIST, false); - mStateHelper->clear(IDDIALOG_IDDETAILS); - mStateHelper->clear(IDDIALOG_REPLIST); - - ui.lineEdit_KeyId->setText("ERROR GETTING KEY!"); - - return; - } - - if (datavector.size() != 1) - { - std::cerr << "IdDialog::insertIdDetails() Invalid datavector size"; - - mStateHelper->setActive(IDDIALOG_IDDETAILS, false); - mStateHelper->setActive(IDDIALOG_REPLIST, false); - mStateHelper->setLoading(IDDIALOG_REPLIST, false); - mStateHelper->clear(IDDIALOG_IDDETAILS); - mStateHelper->clear(IDDIALOG_REPLIST); - - ui.lineEdit_KeyId->setText("INVALID DV SIZE"); - - return; - } - - mStateHelper->setActive(IDDIALOG_IDDETAILS, true); - - data = datavector[0]; - - /* get GPG Details from rsPeers */ - RsPgpId ownPgpId = rsPeers->getGPGOwnId(); - - ui.lineEdit_Nickname->setText(QString::fromUtf8(data.mMeta.mGroupName.c_str())); - ui.lineEdit_KeyId->setText(QString::fromStdString(data.mMeta.mGroupId.toStdString())); - ui.lineEdit_GpgHash->setText(QString::fromStdString(data.mPgpIdHash.toStdString())); - ui.lineEdit_GpgId->setText(QString::fromStdString(data.mPgpId.toStdString())); - - if (data.mPgpKnown) - { - RsPeerDetails details; - rsPeers->getGPGDetails(data.mPgpId, details); - ui.lineEdit_GpgName->setText(QString::fromUtf8(details.name.c_str())); - } - else - { - if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID) - { - ui.lineEdit_GpgName->setText(tr("Unknown real name")); - } - else - { - ui.lineEdit_GpgName->setText(tr("Anonymous Id")); - } - } - - bool isOwnId = (data.mPgpKnown && (data.mPgpId == ownPgpId)) || (data.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN); - - if (isOwnId) - { - ui.radioButton_IdYourself->setChecked(true); - } - else if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID) - { - if (data.mPgpKnown) - { - if (rsPeers->isGPGAccepted(data.mPgpId)) - { - ui.radioButton_IdFriend->setChecked(true); - } - else - { - ui.radioButton_IdFOF->setChecked(true); - } - } - else - { - ui.radioButton_IdOther->setChecked(true); - } - } - else - { - ui.radioButton_IdPseudo->setChecked(true); - } - - if (isOwnId) - { - mStateHelper->setWidgetEnabled(ui.toolButton_Reputation, false); - // No Delete Ids yet! - mStateHelper->setWidgetEnabled(ui.toolButton_Delete, /*true*/ false); - mStateHelper->setWidgetEnabled(ui.toolButton_EditId, true); - } - else - { - // No Reputation yet! - mStateHelper->setWidgetEnabled(ui.toolButton_Reputation, /*true*/ false); - mStateHelper->setWidgetEnabled(ui.toolButton_Delete, false); - mStateHelper->setWidgetEnabled(ui.toolButton_EditId, false); - } - - /* now fill in the reputation information */ - ui.line_RatingOverall->setText("Overall Rating TODO"); - ui.line_RatingOwn->setText("Own Rating TODO"); - - if (data.mPgpKnown) - { - ui.line_RatingImplicit->setText("+50 Known PGP"); - } - else if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID) - { - ui.line_RatingImplicit->setText("+10 UnKnown PGP"); - } - else - { - ui.line_RatingImplicit->setText("+5 Anon Id"); - } - - { - QString rating = QString::number(data.mReputation.mOverallScore); - ui.line_RatingOverall->setText(rating); - } - - { - QString rating = QString::number(data.mReputation.mIdScore); - ui.line_RatingImplicit->setText(rating); - } - - { - QString rating = QString::number(data.mReputation.mOwnOpinion); - ui.line_RatingOwn->setText(rating); - } - - { - QString rating = QString::number(data.mReputation.mPeerOpinion); - ui.line_RatingPeers->setText(rating); - } - - /* request network ratings */ - // Removing this for the moment. - // requestRepList(data.mMeta.mGroupId); -} - -void IdDialog::modifyReputation() -{ - std::cerr << "IdDialog::modifyReputation()"; - std::cerr << std::endl; - - RsGxsId id(ui.lineEdit_KeyId->text().toStdString()); - - int mod = 0; - if (ui.repMod_Accept->isChecked()) - { - mod += 100; - } - else if (ui.repMod_Positive->isChecked()) - { - mod += 10; - } - else if (ui.repMod_Negative->isChecked()) - { - mod += -10; - } - else if (ui.repMod_Ban->isChecked()) - { - mod += -100; - } - else if (ui.repMod_Custom->isChecked()) - { - mod += ui.repMod_spinBox->value(); - } - else - { - // invalid - return; - } - - std::cerr << "IdDialog::modifyReputation() ID: " << id << " Mod: " << mod; - std::cerr << std::endl; - - uint32_t token; - if (!rsIdentity->submitOpinion(token, id, false, mod)) - { - std::cerr << "IdDialog::modifyReputation() Error submitting Opinion"; - std::cerr << std::endl; - - } - - std::cerr << "IdDialog::modifyReputation() queuingRequest(), token: " << token; - std::cerr << std::endl; - - // trigger refresh when finished. - // basic / anstype are not needed. - mIdQueue->queueRequest(token, 0, 0, IDDIALOG_REFRESH); - - return; -} - -void IdDialog::addIdentity() -{ - IdEditDialog dlg(this); - dlg.setupNewId(false); - dlg.exec(); -} - -void IdDialog::editIdentity() -{ - QTreeWidgetItem *item = ui.treeWidget_IdList->currentItem(); - if (!item) - { - std::cerr << "IdDialog::editIdentity() Invalid item"; - std::cerr << std::endl; - return; - } - - std::string keyId = item->text(RSID_COL_KEYID).toStdString(); - - IdEditDialog dlg(this); - dlg.setupExistingId(keyId); - dlg.exec(); -} - -void IdDialog::filterIds() -{ - int filterColumn = ui.filterLineEdit->currentFilter(); - QString text = ui.filterLineEdit->text(); - - ui.treeWidget_IdList->filterItems(filterColumn, text); -} - -void IdDialog::requestRepList(const RsGxsGroupId &aboutId) -{ - mStateHelper->setLoading(IDDIALOG_REPLIST, true); - - mIdQueue->cancelActiveRequestTokens(IDDIALOG_REPLIST); - - std::list groupIds; - groupIds.push_back(aboutId); - - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; - - uint32_t token; - mIdQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, IDDIALOG_REPLIST); -} - -void IdDialog::insertRepList(uint32_t token) -{ - mStateHelper->setLoading(IDDIALOG_REPLIST, false); -#if 0 - - std::vector opinions; - std::vector::iterator vit; - if (!rsIdentity->getMsgData(token, opinions)) - { - std::cerr << "IdDialog::insertRepList() Error getting Opinions"; - std::cerr << std::endl; - - mStateHelper->setActive(IDDIALOG_REPLIST, false); - mStateHelper->clear(IDDIALOG_REPLIST); - - return; - } - - for(vit = opinions.begin(); vit != opinions.end(); vit++) - { - RsGxsIdOpinion &op = (*vit); - GxsIdTreeWidgetItem *item = new GxsIdTreeWidgetItem(); - - /* insert 4 columns */ - - /* friend name */ - item->setId(op.mMeta.mAuthorId, RSIDREP_COL_NAME); - - /* score */ - item->setText(RSIDREP_COL_OPINION, QString::number(op.getOpinion())); - - /* comment */ - item->setText(RSIDREP_COL_COMMENT, QString::fromUtf8(op.mComment.c_str())); - - /* local reputation */ - item->setText(RSIDREP_COL_REPUTATION, QString::number(op.getReputation())); - - ui.treeWidget_RepList->addTopLevelItem(item); - } -#endif - mStateHelper->setActive(IDDIALOG_REPLIST, true); -} - - -#endif diff --git a/retroshare-gui/src/gui/People/PeopleDialog.h b/retroshare-gui/src/gui/People/PeopleDialog.h index 8e40250c0..2436a63b0 100644 --- a/retroshare-gui/src/gui/People/PeopleDialog.h +++ b/retroshare-gui/src/gui/People/PeopleDialog.h @@ -36,10 +36,6 @@ #define IMAGE_IDENTITY ":/images/identity/identities_32.png" -class UIStateHelper; -//class IdentityItem ; -//class CircleItem ; - class PeopleDialog : public RsGxsUpdateBroadcastPage, public Ui::PeopleDialog, public TokenResponse { Q_OBJECT @@ -57,8 +53,6 @@ class PeopleDialog : public RsGxsUpdateBroadcastPage, public Ui::PeopleDialog, p virtual QString pageName() const { return tr("People") ; } //MainPage virtual QString helpText() const { return ""; } //MainPage - // Derives from RsGxsUpdateBroadcastPage -// virtual void updateDisplay(bool) ; void loadRequest(const TokenQueue * /*queue*/, const TokenRequest &req) ; void requestIdList() ; @@ -68,30 +62,44 @@ class PeopleDialog : public RsGxsUpdateBroadcastPage, public Ui::PeopleDialog, p void insertCircles(uint32_t token) ; protected: + // Derives from RsGxsUpdateBroadcastPage virtual void updateDisplay(bool complete); + //End RsGxsUpdateBroadcastPage private slots: + void iw_AddButtonClickedExt(); + void iw_AddButtonClickedInt(); + void addToCircleExt(); + void addToCircleInt(); void cw_askForGXSIdentityWidget(RsGxsId gxs_id); void cw_askForPGPIdentityWidget(RsPgpId pgp_id); - void fl_flowLayoutItemDropped(QList flListItem, bool &bAccept); + void cw_imageUpdatedExt(); + void cw_imageUpdatedInt(); + void fl_flowLayoutItemDroppedExt(QList flListItem, bool &bAccept); + void fl_flowLayoutItemDroppedInt(QList flListItem, bool &bAccept); void pf_centerIndexChanged(int index); void pf_mouseMoveOverSlideEvent(QMouseEvent* event, int slideIndex); void pf_dragEnterEventOccurs(QDragEnterEvent *event); void pf_dragMoveEventOccurs(QDragMoveEvent *event); - void pf_dropEventOccurs(QDropEvent *event); + void pf_dropEventOccursExt(QDropEvent *event); + void pf_dropEventOccursInt(QDropEvent *event); private: - void populatePictureFlow(); + void reloadAll(); + void populatePictureFlowExt(); + void populatePictureFlowInt(); TokenQueue *mIdentityQueue; TokenQueue *mCirclesQueue; - UIStateHelper *mStateHelper; - FlowLayout *_flowLayout; - std::map _pgp_identity_widgets ; + FlowLayout *_flowLayoutExt; std::map _gxs_identity_widgets ; - std::map _circles_widgets ; - //QList listId; - QList _listCir; + std::map _ext_circles_widgets ; + QList _extListCir; + + FlowLayout *_flowLayoutInt; + std::map _pgp_identity_widgets ; + std::map _int_circles_widgets ; + QList _intListCir; }; diff --git a/retroshare-gui/src/gui/People/PeopleDialog.ui b/retroshare-gui/src/gui/People/PeopleDialog.ui index 491917641..d2f1b5447 100644 --- a/retroshare-gui/src/gui/People/PeopleDialog.ui +++ b/retroshare-gui/src/gui/People/PeopleDialog.ui @@ -1,183 +1,265 @@ - - - PeopleDialog - - - - 0 - 0 - 727 - 524 - - - - - 0 - 0 - - - - - - - - - - - 11 - - - - People you may know on RetroShare - - - - - - - QFrame::Box - - - QFrame::Sunken - - - - 2 - - - - - - 0 - 0 - - - - - 24 - 24 - - - - - - - :/images/identity/identities_32.png - - - true - - - - - - - - 10 - 75 - true - - - - <html><head/><body><p>People</p></body></html> - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Qt::Vertical - - - - - 0 - 250 - - - - true - - - - - 0 - 0 - 707 - 248 - - - - - - - - - - - - 0 - 0 - - - - - 11 - - - - Drag people to your Circles - - - Qt::AlignCenter - - - - - - - true - - - - - - - - - - - - PictureFlow - QWidget -
gui/common/PictureFlow.h
- 1 -
- - FlowLayoutWidget - QWidget -
gui/common/FlowLayout.h
- 1 -
-
- - - - -
+ + + PeopleDialog + + + + 0 + 0 + 727 + 524 + + + + + 0 + 0 + + + + + + + + + + QFrame::Box + + + QFrame::Sunken + + + + 2 + + + + + + 0 + 0 + + + + + 24 + 24 + + + + + + + :/images/identity/identities_32.png + + + true + + + + + + + + 10 + 75 + true + + + + <html><head/><body><p>People</p></body></html> + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 0 + + + + + 0 + 0 + + + + External + + + + + + Qt::Vertical + + + + + 0 + 250 + + + + true + + + + + 0 + 0 + 685 + 248 + + + + + + + + + + + + 0 + 0 + + + + + 11 + + + + Drag your circles or people to each other. + + + Qt::AlignCenter + + + + + + + true + + + + + + + + + + + + + 0 + 0 + + + + Internal + + + + + + Qt::Vertical + + + + + 0 + 250 + + + + true + + + + + 0 + 0 + 685 + 248 + + + + + + + + + + + + 0 + 0 + + + + + 11 + + + + Drag your circles or people to each other. + + + Qt::AlignCenter + + + + + + + true + + + + + + + + + + + + + + + + PictureFlow + QWidget +
gui/common/PictureFlow.h
+ 1 +
+ + FlowLayoutWidget + QWidget +
gui/common/FlowLayout.h
+ 1 +
+
+ + + + +
diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp index 055d94598..fa331ecb3 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp @@ -97,7 +97,7 @@ PhotoShare::PhotoShare(QWidget *parent) requestAlbumData(); } -void PhotoShare::~PhotoShare() +PhotoShare::~PhotoShare() { delete(mPhotoQueue); } diff --git a/retroshare-gui/src/gui/common/FlowLayout.h b/retroshare-gui/src/gui/common/FlowLayout.h index 7e6d5237e..69f20a4f2 100644 --- a/retroshare-gui/src/gui/common/FlowLayout.h +++ b/retroshare-gui/src/gui/common/FlowLayout.h @@ -122,6 +122,10 @@ signals: ///Signales when the widget is dropped. void flowLayoutItemDropped(QList listItem, bool &bAccept); + /// \brief updated + ///Signales when the image (getImage) is updated. + void imageUpdated(); + protected: void keyPressEvent(QKeyEvent *event){event->ignore();} void keyReleaseEvent(QKeyEvent *event){event->ignore();}