mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-30 09:56:14 -05:00
added to Friends own Avatar and own nick labels
changed to ShareManager Title Background git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1588 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
070bc5bdd3
commit
c398ea4ef1
@ -91,6 +91,8 @@ PeersDialog::PeersDialog(QWidget *parent)
|
|||||||
connect( ui.peertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peertreeWidgetCostumPopupMenu( QPoint ) ) );
|
connect( ui.peertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peertreeWidgetCostumPopupMenu( QPoint ) ) );
|
||||||
connect( ui.peertreeWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend()));
|
connect( ui.peertreeWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend()));
|
||||||
|
|
||||||
|
connect( ui.avatartoolButton, SIGNAL(clicked()), SLOT(getAvatar()));
|
||||||
|
|
||||||
/* hide the Tree +/- */
|
/* hide the Tree +/- */
|
||||||
ui.peertreeWidget -> setRootIsDecorated( false );
|
ui.peertreeWidget -> setRootIsDecorated( false );
|
||||||
|
|
||||||
@ -171,7 +173,9 @@ PeersDialog::PeersDialog(QWidget *parent)
|
|||||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(insertChat()));
|
timer->connect(timer, SIGNAL(timeout()), this, SLOT(insertChat()));
|
||||||
timer->start(500); /* half a second */
|
timer->start(500); /* half a second */
|
||||||
|
|
||||||
ui.peertreeWidget->sortItems( 1, Qt::AscendingOrder );
|
ui.peertreeWidget->sortItems( 1, Qt::AscendingOrder );
|
||||||
|
|
||||||
|
updateAvatar();
|
||||||
|
|
||||||
|
|
||||||
/* Hide platform specific features */
|
/* Hide platform specific features */
|
||||||
@ -219,6 +223,8 @@ void PeersDialog::peertreeWidgetCostumPopupMenu( QPoint point )
|
|||||||
contextMnu.addAction( exportfriendAct);
|
contextMnu.addAction( exportfriendAct);
|
||||||
contextMnu.addAction( removefriendAct);
|
contextMnu.addAction( removefriendAct);
|
||||||
contextMnu.exec( mevent->globalPos() );
|
contextMnu.exec( mevent->globalPos() );
|
||||||
|
|
||||||
|
updateAvatar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -253,6 +259,17 @@ void PeersDialog::insertPeers()
|
|||||||
peerWidget->clear();
|
peerWidget->clear();
|
||||||
peerWidget->setColumnCount(3);
|
peerWidget->setColumnCount(3);
|
||||||
|
|
||||||
|
// add self nick and Avatar to Friends.
|
||||||
|
RsPeerDetails pd ;
|
||||||
|
|
||||||
|
if (rsPeers->getPeerDetails(rsPeers->getOwnId(),pd))
|
||||||
|
{
|
||||||
|
QString titleStr("<span style=\"font-size:16pt; font-weight:500;"
|
||||||
|
"color:#32cd32;\">%1</span>");
|
||||||
|
ui.nicklabel->setText(titleStr.arg(QString::fromStdString(pd.name) + tr(" (me)"))) ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QList<QTreeWidgetItem *> items;
|
QList<QTreeWidgetItem *> items;
|
||||||
for(it = peers.begin(); it != peers.end(); it++)
|
for(it = peers.begin(); it != peers.end(); it++)
|
||||||
@ -1185,3 +1202,52 @@ void PeersDialog::viewprofile()
|
|||||||
profileview -> setPeerId(id);
|
profileview -> setPeerId(id);
|
||||||
profileview -> show();
|
profileview -> show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PeersDialog::updateAvatar()
|
||||||
|
{
|
||||||
|
unsigned char *data = NULL;
|
||||||
|
int size = 0 ;
|
||||||
|
|
||||||
|
rsMsgs->getOwnAvatarData(data,size);
|
||||||
|
|
||||||
|
std::cerr << "Image size = " << size << std::endl ;
|
||||||
|
|
||||||
|
if(size == 0)
|
||||||
|
std::cerr << "Got no image" << std::endl ;
|
||||||
|
|
||||||
|
// set the image
|
||||||
|
QPixmap pix ;
|
||||||
|
pix.loadFromData(data,size,"JPG") ;
|
||||||
|
ui.avatartoolButton->setIcon(pix); // writes image into ba in JPG format
|
||||||
|
|
||||||
|
delete[] data ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PeersDialog::getAvatar()
|
||||||
|
{
|
||||||
|
QString fileName = QFileDialog::getOpenFileName(this, "Load File", QDir::homePath(), "Pictures (*.png *.xpm *.jpg)");
|
||||||
|
if(!fileName.isEmpty())
|
||||||
|
{
|
||||||
|
picture = QPixmap(fileName).scaled(82,82, Qt::IgnoreAspectRatio);
|
||||||
|
|
||||||
|
std::cerr << "Sending avatar image down the pipe" << std::endl ;
|
||||||
|
|
||||||
|
// send avatar down the pipe for other peers to get it.
|
||||||
|
QByteArray ba;
|
||||||
|
QBuffer buffer(&ba);
|
||||||
|
buffer.open(QIODevice::WriteOnly);
|
||||||
|
picture.save(&buffer, "JPG"); // writes image into ba in JPG format
|
||||||
|
|
||||||
|
std::cerr << "Image size = " << ba.size() << std::endl ;
|
||||||
|
|
||||||
|
rsMsgs->setOwnAvatarData((unsigned char *)(ba.data()),ba.size()) ; // last char 0 included.
|
||||||
|
|
||||||
|
updateAvatar() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PeersDialog::changeAvatarClicked()
|
||||||
|
{
|
||||||
|
|
||||||
|
updateAvatar();
|
||||||
|
}
|
@ -52,6 +52,8 @@ public:
|
|||||||
void loadEmoticonsgroupchat();
|
void loadEmoticonsgroupchat();
|
||||||
// void setChatDialog(ChatDialog *cd);
|
// void setChatDialog(ChatDialog *cd);
|
||||||
|
|
||||||
|
QPixmap picture;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void insertPeers();
|
void insertPeers();
|
||||||
@ -104,6 +106,11 @@ private slots:
|
|||||||
void getFont();
|
void getFont();
|
||||||
void underline();
|
void underline();
|
||||||
|
|
||||||
|
void changeAvatarClicked();
|
||||||
|
void updateAvatar();
|
||||||
|
void getAvatar();
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void friendsUpdated() ;
|
void friendsUpdated() ;
|
||||||
void notifyGroupChat(const QString&,const QString&) ;
|
void notifyGroupChat(const QString&,const QString&) ;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -17,53 +17,62 @@
|
|||||||
<iconset resource="images.qrc">
|
<iconset resource="images.qrc">
|
||||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="0" column="0" colspan="4">
|
<item row="0" column="0" colspan="4">
|
||||||
<layout class="QGridLayout">
|
<widget class="QFrame" name="frame">
|
||||||
<property name="horizontalSpacing">
|
<property name="styleSheet">
|
||||||
<number>0</number>
|
<string notr="true">background-image: url(:/images/connect/connectFriendBanner.png)
|
||||||
|
</string>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<property name="frameShape">
|
||||||
<widget class="QLabel" name="piclabel">
|
<enum>QFrame::StyledPanel</enum>
|
||||||
<property name="minimumSize">
|
</property>
|
||||||
<size>
|
<property name="frameShadow">
|
||||||
<width>48</width>
|
<enum>QFrame::Raised</enum>
|
||||||
<height>48</height>
|
</property>
|
||||||
</size>
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
</property>
|
<item row="0" column="0">
|
||||||
<property name="maximumSize">
|
<widget class="QLabel" name="piclabel">
|
||||||
<size>
|
<property name="minimumSize">
|
||||||
<width>48</width>
|
<size>
|
||||||
<height>48</height>
|
<width>48</width>
|
||||||
</size>
|
<height>48</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="styleSheet">
|
</property>
|
||||||
<string notr="true">background-image: url(:/images/connect/connectFriendBanner.png)v</string>
|
<property name="maximumSize">
|
||||||
</property>
|
<size>
|
||||||
<property name="text">
|
<width>48</width>
|
||||||
<string/>
|
<height>48</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="pixmap">
|
</property>
|
||||||
<pixmap resource="images.qrc">:/images/fileshare48.png</pixmap>
|
<property name="styleSheet">
|
||||||
</property>
|
<string notr="true"/>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<property name="text">
|
||||||
<item row="0" column="1">
|
<string/>
|
||||||
<widget class="QLabel" name="label_2">
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="pixmap">
|
||||||
<string notr="true">background-image: url(:/images/connect/connectFriendBanner.png)</string>
|
<pixmap resource="images.qrc">:/images/fileshare48.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
</widget>
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:16pt; font-weight:600; color:#32cd32;"> Share Manager</span></p>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:16pt; font-weight:600; color:#32cd32;"> Share Manager</span></p>
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:10pt;"> Add a new Folder to Share with your Friends or remove a Shared Folder.</span></p></body></html></string>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:10pt;"> Add a new Folder to Share with your Friends or remove a Shared Folder.</span></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="4">
|
<item row="1" column="0" colspan="4">
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
Loading…
Reference in New Issue
Block a user