incorporated defnax changes

This commit is contained in:
csoler 2015-09-08 22:40:35 -04:00
parent 734a308aa3
commit 0769dabb2e
5 changed files with 1767 additions and 1645 deletions

View File

@ -85,14 +85,22 @@ void IdentityWidget::updateData(const RsGxsIdGroup &gxs_group_info)
ui->labelKeyId->setVisible(false);
/// (TODO) Get real ident icon
QImage image = GxsIdDetails::makeDefaultIcon(RsGxsId(_group_info.mMeta.mGroupId));
QImage image;
if(_group_info.mImage.mSize > 0 && image.loadFromData(_group_info.mImage.mData, _group_info.mImage.mSize, "PNG"))
image = image;
else
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)
@ -120,14 +128,16 @@ void IdentityWidget::updateData(const RsPeerDetails &pgp_details)
ui->labelKeyId->setToolTip(tr("PGP id:").append(" "+_keyId));
QPixmap avatar;
AvatarDefs::getAvatarFromGpgId(_details.gpg_id, avatar);
if (_avatar != avatar.toImage())
{
/*AvatarDefs::getAvatarFromGpgId(_details.gpg_id, 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)
@ -197,3 +207,4 @@ void IdentityWidget::pbAdd_clicked()
{
emit addButtonClicked();
}

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>102</width>
<height>158</height>
<height>170</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -131,7 +131,6 @@
</item>
</layout>
</widget>
<resources/>
<customwidgets>
<customwidget>
<class>ElidedLabel</class>
@ -140,5 +139,8 @@
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -26,11 +26,15 @@
#include "gui/Circles/CreateCircleDialog.h"
#include "gui/common/FlowLayout.h"
#include "gui/settings/rsharesettings.h"
#include "gui/msgs/MessageComposer.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/Identity/IdDetailsDialog.h"
#include "retroshare/rspeers.h"
#include "retroshare/rsidentity.h"
#include "retroshare/rsgxscircles.h"
#include "retroshare/rsgxsflags.h"
#include "retroshare/rsmsgs.h"
#include <iostream>
#include <QMenu>
@ -56,6 +60,9 @@ PeopleDialog::PeopleDialog(QWidget *parent)
mIdentityQueue = new TokenQueue(rsIdentity->getTokenService(), this);
mCirclesQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
tabWidget->removeTab(1);
//need erase QtCreator Layout first(for Win)
delete idExternal->layout();
delete idInternal->layout();
@ -418,6 +425,45 @@ void PeopleDialog::iw_AddButtonClickedExt()
+ ";" + QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString()));
}//for( itCurs =_ext_circles_widgets.begin();
std::list<RsGxsId> own_identities ;
rsIdentity->getOwnIds(own_identities) ;
if(own_identities.size() <= 1)
{
QAction *action = contextMnu.addAction(QIcon(":/images/chat_24.png"), tr("Chat with this person"), this, SLOT(chatIdentity()));
if(own_identities.empty())
action->setEnabled(false) ;
else
action->setData(QString::fromStdString((own_identities.front()).toStdString()) + ";" + QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString())) ;
}
else
{
QMenu *mnu = contextMnu.addMenu(QIcon(":/images/chat_24.png"),tr("Chat with this person as...")) ;
for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it)
{
RsIdentityDetails idd ;
rsIdentity->getIdDetails(*it,idd) ;
QPixmap pixmap ;
if(idd.mAvatar.mSize == 0 || !pixmap.loadFromData(idd.mAvatar.mData, idd.mAvatar.mSize, "PNG"))
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(*it)) ;
QAction *action = mnu->addAction(QIcon(pixmap), QString("%1 (%2)").arg(QString::fromUtf8(idd.mNickname.c_str()), QString::fromStdString((*it).toStdString())), this, SLOT(chatIdentity()));
action->setData(QString::fromStdString((*it).toStdString()) + ";" + QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString())) ;
}
}
QAction *actionsendmsg = contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message to this person"), this, SLOT(sendMessage()));
actionsendmsg->setData( QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString()));
contextMnu.addSeparator();
QAction *actionDetails = contextMnu.addAction(QIcon(":/images/info16.png"), tr("Person details"), this, SLOT(personDetails()));
actionDetails->setData( QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString()));
contextMnu.exec(QCursor::pos());
}//if (dest)
}
@ -504,6 +550,71 @@ void PeopleDialog::addToCircleInt()
}//if (action)
}
void PeopleDialog::chatIdentity()
{
QAction *action =
qobject_cast<QAction *>(QObject::sender());
if (action) {
QString data = action->data().toString();
QStringList idList = data.split(";");
RsGxsId from_gxs_id = RsGxsId(idList.at(0).toStdString());
RsGxsId gxs_id = RsGxsId(idList.at(1).toStdString());
uint32_t error_code ;
if(!rsMsgs->initiateDistantChatConnexion(RsGxsId(gxs_id), from_gxs_id, error_code))
QMessageBox::information(NULL, tr("Distant chat cannot work"), QString("%1 %2: %3").arg(tr("Distant chat refused with this person.")).arg(tr("Error code")).arg(error_code)) ;
}
}
void PeopleDialog::sendMessage()
{
QAction *action =
qobject_cast<QAction *>(QObject::sender());
if (action) {
QString data = action->data().toString();
MessageComposer *nMsgDialog = MessageComposer::newMsg();
if (nMsgDialog == NULL) {
return;
}
RsGxsId gxs_id = RsGxsId(data.toStdString());;
nMsgDialog->addRecipient(MessageComposer::TO, RsGxsId(gxs_id));
nMsgDialog->show();
nMsgDialog->activateWindow();
/* window will destroy itself! */
}
}
void PeopleDialog::personDetails()
{
QAction *action =
qobject_cast<QAction *>(QObject::sender());
if (action) {
QString data = action->data().toString();
RsGxsId gxs_id = RsGxsId(data.toStdString());
if (RsGxsGroupId(gxs_id).isNull()) {
return;
}
IdDetailsDialog *dialog = new IdDetailsDialog(RsGxsGroupId(gxs_id));
dialog->show();
/* Dialog will destroy itself */
}
}
void PeopleDialog::cw_askForGXSIdentityWidget(RsGxsId gxs_id)
{
CircleWidget *dest =

View File

@ -84,6 +84,10 @@ private slots:
void pf_dropEventOccursExt(QDropEvent *event);
void pf_dropEventOccursInt(QDropEvent *event);
void chatIdentity();
void sendMessage();
void personDetails();
private:
void reloadAll();
void populatePictureFlowExt();

View File

@ -20,16 +20,7 @@
<string/>
</property>
<layout class="QGridLayout" name="titleBarLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
@ -94,8 +85,11 @@
</item>
<item row="1" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tabExternal">
<property name="sizePolicy">
@ -105,7 +99,7 @@
</sizepolicy>
</property>
<attribute name="title">
<string>External</string>
<string>People</string>
</attribute>
<layout class="QVBoxLayout">
<item>
@ -128,7 +122,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>685</width>
<width>701</width>
<height>248</height>
</rect>
</property>
@ -197,7 +191,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>685</width>
<width>701</width>
<height>248</height>
</rect>
</property>