From c398ea4ef193086f470bd367c13c230c8ef278e9 Mon Sep 17 00:00:00 2001 From: defnax Date: Wed, 2 Sep 2009 22:42:31 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/gui/PeersDialog.cpp | 68 +- retroshare-gui/src/gui/PeersDialog.h | 7 + retroshare-gui/src/gui/PeersDialog.ui | 1261 +++++++++++++----------- retroshare-gui/src/gui/ShareManager.ui | 89 +- 4 files changed, 827 insertions(+), 598 deletions(-) diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index 3557ff22e..50d1bef2b 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -91,6 +91,8 @@ PeersDialog::PeersDialog(QWidget *parent) connect( ui.peertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peertreeWidgetCostumPopupMenu( QPoint ) ) ); connect( ui.peertreeWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend())); + connect( ui.avatartoolButton, SIGNAL(clicked()), SLOT(getAvatar())); + /* hide the Tree +/- */ ui.peertreeWidget -> setRootIsDecorated( false ); @@ -171,7 +173,9 @@ PeersDialog::PeersDialog(QWidget *parent) timer->connect(timer, SIGNAL(timeout()), this, SLOT(insertChat())); timer->start(500); /* half a second */ - ui.peertreeWidget->sortItems( 1, Qt::AscendingOrder ); + ui.peertreeWidget->sortItems( 1, Qt::AscendingOrder ); + + updateAvatar(); /* Hide platform specific features */ @@ -219,6 +223,8 @@ void PeersDialog::peertreeWidgetCostumPopupMenu( QPoint point ) contextMnu.addAction( exportfriendAct); contextMnu.addAction( removefriendAct); contextMnu.exec( mevent->globalPos() ); + + updateAvatar(); } @@ -253,6 +259,17 @@ void PeersDialog::insertPeers() peerWidget->clear(); peerWidget->setColumnCount(3); + // add self nick and Avatar to Friends. + RsPeerDetails pd ; + + if (rsPeers->getPeerDetails(rsPeers->getOwnId(),pd)) + { + QString titleStr("%1"); + ui.nicklabel->setText(titleStr.arg(QString::fromStdString(pd.name) + tr(" (me)"))) ; + + } + QList items; for(it = peers.begin(); it != peers.end(); it++) @@ -1185,3 +1202,52 @@ void PeersDialog::viewprofile() profileview -> setPeerId(id); 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(); +} \ No newline at end of file diff --git a/retroshare-gui/src/gui/PeersDialog.h b/retroshare-gui/src/gui/PeersDialog.h index 38610cd74..a7ee4fbd4 100644 --- a/retroshare-gui/src/gui/PeersDialog.h +++ b/retroshare-gui/src/gui/PeersDialog.h @@ -52,6 +52,8 @@ public: void loadEmoticonsgroupchat(); // void setChatDialog(ChatDialog *cd); + QPixmap picture; + public slots: void insertPeers(); @@ -104,6 +106,11 @@ private slots: void getFont(); void underline(); + void changeAvatarClicked(); + void updateAvatar(); + void getAvatar(); + + signals: void friendsUpdated() ; void notifyGroupChat(const QString&,const QString&) ; diff --git a/retroshare-gui/src/gui/PeersDialog.ui b/retroshare-gui/src/gui/PeersDialog.ui index 8fef6d7d3..4835750d0 100644 --- a/retroshare-gui/src/gui/PeersDialog.ui +++ b/retroshare-gui/src/gui/PeersDialog.ui @@ -1,164 +1,165 @@ - + + PeersDialog - - + + 0 0 - 721 - 516 + 778 + 517 - + - - - + + + 0 0 0 - - - + + + 208 208 208 - - - + + + 255 255 255 - - - + + + 247 247 247 - - - + + + 104 104 104 - - - + + + 139 139 139 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 240 240 240 - - - + + + 0 0 0 - - - + + + 0 0 128 - - - + + + 255 255 255 - - - + + + 0 0 255 - - - + + + 255 0 255 - - - + + + 231 231 231 @@ -167,153 +168,153 @@ - - - + + + 0 0 0 - - - + + + 208 208 208 - - - + + + 255 255 255 - - - + + + 247 247 247 - - - + + + 104 104 104 - - - + + + 139 139 139 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 240 240 240 - - - + + + 0 0 0 - - - + + + 192 192 192 - - - + + + 0 0 0 - - - + + + 0 0 255 - - - + + + 255 0 255 - - - + + + 231 231 231 @@ -322,153 +323,153 @@ - - - + + + 104 104 104 - - - + + + 208 208 208 - - - + + + 255 255 255 - - - + + + 247 247 247 - - - + + + 104 104 104 - - - + + + 139 139 139 - - - + + + 104 104 104 - - - + + + 255 255 255 - - - + + + 104 104 104 - - - + + + 240 240 240 - - - + + + 240 240 240 - - - + + + 0 0 0 - - - + + + 0 0 128 - - - + + + 255 255 255 - - - + + + 0 0 255 - - - + + + 255 0 255 - - - + + + 231 231 231 @@ -478,437 +479,583 @@ - + Qt::NoContextMenu - - - - - 0 + + + + + Qt::Horizontal - - - - - - + + + + 0 + + + + + 0 - - :/images/user/friends24.png - - - - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> + + + + + + + :/images/user/friends24.png + + + + + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; font-weight:600;">Friends</span></p></body></html> - - +</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; font-weight:600;">Friends</span></p></body></html> + + + + - - - - - - Qt::Horizontal - - - - 201 - 20 - - - - - - - - - 250 - 0 - - - - - 1677215 - 16777215 - - - - Qt::CustomContextMenu - - - false - - - false - - - - 24 - 24 - - - - true - - - true - - - - # - - - - - Status - - - - - Person - - - - - - - - - - 0 - - - 0 - - - - + - + Qt::Horizontal - + - 181 + 168 20 - - - - - - + + + + + 0 + 0 + + + + + 250 + 0 + + + + + 16777215 + 16777215 + + + + Qt::CustomContextMenu + + + false + + + false + + + + 24 + 24 + + + + true + + + true + + + + # + + + + + Status + + + + + Person + + + + + + + + + + + + + 0 + 0 + + + + + 0 + 70 + + + + + 16777215 + 70 + + + + background-image: url(:/images/connect/connectFriendBanner.png) + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 1 + + + + + + 61 + 61 + + + + + 61 + 61 + + + + border-image: url(:/images/mystatus_bg.png); + + + + + + + 50 + 50 + + + + true + + + + + + + + + + 0 + 32 + + + + + 16777215 + 42 + + + + + + + + + <!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"> +p, li { white-space: pre-wrap; } +</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-size:14pt; color:#00aa00;">nickname (me)</span></p></body></html> + + + + + + + Qt::Vertical + + + + 98 + 18 + + + + + + + + + + Qt::Horizontal + + + + 221 + 76 + + + + + + + + + + + 0 + + + + + + + Qt::Horizontal + + + + 181 + 20 + + + + + + + + + + + + + :/images/user/agt_forum24.png + + + + + + + + 10 + 75 + true + + + + Live Group Chat: + + + + + + + + + + + + 0 + 0 + - - :/images/user/agt_forum24.png + + Qt::DefaultContextMenu + + + false + + + true - - - - - 10 - 75 - true - + + + + + + + + + + Qt::Horizontal + + + + 321 + 20 + + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + Italic + + + + + + + :/images/edit-italic.png:/images/edit-italic.png + + + true + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + Underline + + + + + + + :/images/edit-underline.png:/images/edit-underline.png + + + true + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + Bold + + + + + + + :/images/edit-bold.png:/images/edit-bold.png + + + true + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + Text Color + + + + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + Font + + + + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + + + + :/images/emoticons/kopete/kopete020.png:/images/emoticons/kopete/kopete020.png + + + + 24 + 24 + + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + + + + + + + + + + 0 + 0 + - - Live Group Chat: + + + 16777215 + 100 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + + + + + + + + Qt::Horizontal + + + + 321 + 20 + + + + + + + + Send - - - - - - 0 - 0 - - - - Qt::DefaultContextMenu - - - false - - - true - - - - - - - - - - - - - Qt::Horizontal - - - - 321 - 20 - - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - Italic - - - - - - :/images/edit-italic.png - - - true - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - Underline - - - - - - :/images/edit-underline.png - - - true - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - Bold - - - - - - :/images/edit-bold.png - - - true - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - Text Color - - - - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - Font - - - - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - - - :/images/emoticons/kopete/kopete020.png - - - - 24 - 24 - - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 100 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - - - - - Qt::Horizontal - - - - 321 - 20 - - - - - - - - Send - - - - + + - - + + Clear Chat History - + diff --git a/retroshare-gui/src/gui/ShareManager.ui b/retroshare-gui/src/gui/ShareManager.ui index b173f6f37..8976e0f65 100644 --- a/retroshare-gui/src/gui/ShareManager.ui +++ b/retroshare-gui/src/gui/ShareManager.ui @@ -17,53 +17,62 @@ :/images/rstray3.png:/images/rstray3.png - + - - - 0 + + + background-image: url(:/images/connect/connectFriendBanner.png) + - - - - - 48 - 48 - - - - - 48 - 48 - - - - background-image: url(:/images/connect/connectFriendBanner.png)v - - - - - - :/images/fileshare48.png - - - - - - - background-image: url(:/images/connect/connectFriendBanner.png) - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 48 + 48 + + + + + 48 + 48 + + + + + + + + + + :/images/fileshare48.png + + + + + + + + + + <!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"> p, li { white-space: pre-wrap; } </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:10pt;"> Add a new Folder to Share with your Friends or remove a Shared Folder.</span></p></body></html> - - - - + + + + +