merge of branch v0.6-idclean 7180

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7187 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2014-03-17 20:56:06 +00:00
parent 7815efb16f
commit 0f29d28b1b
397 changed files with 6503 additions and 5702 deletions

View file

@ -36,7 +36,7 @@
#include <retroshare/rsnotify.h>
#include <retroshare/rspeers.h>
static std::map<std::string, ChatDialog*> chatDialogs;
static std::map<RsPeerId, ChatDialog*> chatDialogs;
ChatDialog::ChatDialog(QWidget *parent, Qt::WindowFlags flags) :
QWidget(parent, flags)
@ -46,7 +46,7 @@ ChatDialog::ChatDialog(QWidget *parent, Qt::WindowFlags flags) :
ChatDialog::~ChatDialog()
{
std::map<std::string, ChatDialog *>::iterator it;
std::map<RsPeerId, ChatDialog *>::iterator it;
if (chatDialogs.end() != (it = chatDialogs.find(getPeerId()))) {
chatDialogs.erase(it);
}
@ -61,7 +61,7 @@ void ChatDialog::closeEvent(QCloseEvent *event)
emit dialogClose(this);
}
void ChatDialog::init(const std::string &peerId, const QString &title)
void ChatDialog::init(const RsPeerId &peerId, const QString &title)
{
this->peerId = peerId;
@ -74,9 +74,9 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
}
}
/*static*/ ChatDialog *ChatDialog::getExistingChat(const std::string &peerId)
/*static*/ ChatDialog *ChatDialog::getExistingChat(const RsPeerId &peerId)
{
std::map<std::string, ChatDialog*>::iterator it;
std::map<RsPeerId, ChatDialog*>::iterator it;
if (chatDialogs.end() != (it = chatDialogs.find(peerId))) {
/* exists already */
return it->second;
@ -85,7 +85,7 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
return NULL;
}
/*static*/ ChatDialog *ChatDialog::getChat(const std::string &peerId, uint chatflags)
/*static*/ ChatDialog *ChatDialog::getChat(const RsPeerId &peerId, uint chatflags)
{
/* see if it already exists */
ChatDialog *cd = getExistingChat(peerId);
@ -98,7 +98,7 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
}
uint32_t distant_peer_status ;
std::string distant_chat_pgp_id ;
RsPgpId distant_chat_pgp_id ;
if(rsMsgs->getDistantChatStatus(peerId,distant_peer_status,distant_chat_pgp_id))
chatflags = RS_CHAT_OPEN | RS_CHAT_FOCUS; // use own flags
@ -119,7 +119,7 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
cd = new PopupDistantChatDialog();
chatDialogs[peerId] = cd;
std::string peer_name = rsPeers->getGPGName(distant_chat_pgp_id) ;
cd->init(peerId, tr("Talking to ")+QString::fromStdString(peer_name)+" (PGP id="+QString::fromStdString(distant_chat_pgp_id)+")") ;
cd->init(peerId, tr("Talking to ")+QString::fromStdString(peer_name)+" (PGP id="+QString::fromStdString(distant_chat_pgp_id.toStdString())+")") ;
} else {
RsPeerDetails sslDetails;
@ -150,7 +150,7 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
/* ChatDialog destuctor removes the entry from the map */
std::list<ChatDialog*> list;
std::map<std::string, ChatDialog*>::iterator it;
std::map<RsPeerId, ChatDialog*>::iterator it;
for (it = chatDialogs.begin(); it != chatDialogs.end(); it++) {
if (it->second) {
list.push_back(it->second);
@ -171,11 +171,11 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
// play sound when recv a message
soundManager->play(SOUND_NEW_CHAT_MESSAGE);
std::list<std::string> ids;
std::list<RsPeerId> ids;
if (rsMsgs->getPrivateChatQueueIds(true, ids)) {
uint chatflags = Settings->getChatFlags();
std::list<std::string>::iterator id;
std::list<RsPeerId>::iterator id;
for (id = ids.begin(); id != ids.end(); id++) {
ChatDialog *cd = getChat(*id, chatflags);
@ -187,7 +187,7 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
}
/* now notify all open priavate chat windows */
std::map<std::string, ChatDialog *>::iterator it;
std::map<RsPeerId, ChatDialog *>::iterator it;
for (it = chatDialogs.begin (); it != chatDialogs.end(); it++) {
if (it->second) {
it->second->onChatChanged(list, type);
@ -195,7 +195,7 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
}
}
/*static*/ void ChatDialog::closeChat(const std::string& peerId)
/*static*/ void ChatDialog::closeChat(const RsPeerId &peerId)
{
ChatDialog *chatDialog = getExistingChat(peerId);
@ -204,13 +204,13 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
}
}
/*static*/ void ChatDialog::chatFriend(const std::string &peerId, const bool forceFocus)
/*static*/ void ChatDialog::chatFriend(const RsPeerId &peerId, const bool forceFocus)
{
if (peerId.empty()){
if (peerId.isNull()){
return;
}
std::string distant_chat_pgp_id ;
RsPgpId distant_chat_pgp_id ;
uint32_t distant_peer_status ;
if(rsMsgs->getDistantChatStatus(peerId,distant_peer_status,distant_chat_pgp_id))
@ -229,10 +229,10 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
return;
if (detail.isOnlyGPGdetail) {
std::list<std::string> onlineIds;
std::list<RsPeerId> onlineIds;
//let's get the ssl child details
std::list<std::string> sslIds;
std::list<RsPeerId> sslIds;
rsPeers->getAssociatedSSLIds(detail.gpg_id, sslIds);
if (sslIds.size() == 1) {
@ -242,7 +242,7 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
}
// more than one ssl ids available, check for online
for (std::list<std::string>::iterator it = sslIds.begin(); it != sslIds.end(); ++it) {
for (std::list<RsPeerId>::iterator it = sslIds.begin(); it != sslIds.end(); ++it) {
if (rsPeers->isOnline(*it)) {
onlineIds.push_back(*it);
}
@ -298,7 +298,7 @@ bool ChatDialog::hasNewMessages()
return false;
}
QString ChatDialog::getPeerName(const std::string& id) const
QString ChatDialog::getPeerName(const RsPeerId& id) const
{
return QString::fromUtf8( rsPeers->getPeerName(id).c_str() ) ;
}
@ -307,7 +307,7 @@ void ChatDialog::setPeerStatus(uint32_t status)
{
ChatWidget *cw = getChatWidget();
if (cw)
cw->updateStatus(QString::fromStdString(getPeerId()), status);
cw->updateStatus(QString::fromStdString(getPeerId().toStdString()), status);
}
int ChatDialog::getPeerStatus()
{
@ -369,7 +369,7 @@ void ChatDialog::chatNewMessage(ChatWidget*)
void ChatDialog::insertChatMsgs()
{
std::string peerId = getPeerId();
RsPeerId peerId = getPeerId();
std::list<ChatInfo> newchat;
if (!rsMsgs->getPrivateChatQueue(true, peerId, newchat)) {

View file

@ -34,11 +34,11 @@ class ChatDialog : public QWidget
Q_OBJECT
public:
static ChatDialog *getExistingChat(const std::string &peerId);
static ChatDialog *getChat(const std::string &peerId, uint chatflags);
static ChatDialog *getExistingChat(const RsPeerId &peerId);
static ChatDialog *getChat(const RsPeerId &peerId, uint chatflags);
static void cleanupChat();
static void chatFriend(const std::string &peerId, bool forceFocus = true);
static void closeChat(const std::string &peerId);
static void chatFriend(const RsPeerId &peerId, bool forceFocus = true);
static void closeChat(const RsPeerId &peerId);
static void chatChanged(int list, int type);
virtual void showDialog(uint /*chatflags*/) {}
@ -50,7 +50,7 @@ public:
void addToParent(QWidget *newParent);
void removeFromParent(QWidget *oldParent);
std::string getPeerId() { return peerId; }
RsPeerId getPeerId() { return peerId; }
QString getTitle();
bool hasNewMessages();
bool isTyping();
@ -80,14 +80,14 @@ protected:
void closeEvent(QCloseEvent *event);
virtual bool canClose() { return true; }
virtual QString getPeerName(const std::string& sslid) const ; // can be overloaded for chat dialogs that have specific peers
virtual QString getPeerName(const RsPeerId &sslid) const ; // can be overloaded for chat dialogs that have specific peers
virtual void init(const std::string &peerId, const QString &title);
virtual void init(const RsPeerId &peerId, const QString &title);
virtual void onChatChanged(int /*list*/, int /*type*/) {}
virtual void addIncomingChatMsg(const ChatInfo& info) = 0;
std::string peerId;
RsPeerId peerId;
};
#endif // CHATDIALOG_H

View file

@ -111,7 +111,7 @@ void ChatLobbyDialog::inviteFriends()
{
std::cerr << "Inviting friends" << std::endl;
std::list<std::string> ids = FriendSelectionDialog::selectFriends(NULL,tr("Invite friends"),tr("Select friends to invite:")) ;
std::list<RsPeerId> ids = FriendSelectionDialog::selectFriends_SSL(NULL,tr("Invite friends"),tr("Select friends to invite:")) ;
std::cerr << "Inviting these friends:" << std::endl;
@ -119,7 +119,7 @@ void ChatLobbyDialog::inviteFriends()
if (!rsMsgs->isLobbyId(getPeerId(), lobby_id))
return ;
for(std::list<std::string>::const_iterator it(ids.begin());it!=ids.end();++it)
for(std::list<RsPeerId>::const_iterator it(ids.begin());it!=ids.end();++it)
{
std::cerr << " " << *it << std::endl;
@ -158,14 +158,14 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
contextMnu.exec(QCursor::pos());
}
void ChatLobbyDialog::init(const std::string &peerId, const QString &title)
void ChatLobbyDialog::init(const RsPeerId &peerId, const QString &title)
{
std::list<ChatLobbyInfo> lobbies;
rsMsgs->getChatLobbyList(lobbies);
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
std::string vpid;
RsPeerId vpid;
if (rsMsgs->getVirtualPeerId(lobbyIt->lobby_id, vpid)) {
if (vpid == peerId) {
QString msg = tr("Welcome to lobby %1").arg(RsHtml::plainText(lobbyIt->lobby_name));
@ -288,7 +288,7 @@ void ChatLobbyDialog::addIncomingChatMsg(const ChatInfo& info)
QDateTime recvTime = QDateTime::fromTime_t(info.recvTime);
QString message = QString::fromUtf8(info.msg.c_str());
QString name = QString::fromUtf8(info.peer_nickname.c_str());
QString rsid = QString::fromUtf8(info.rsid.c_str());
QString rsid = QString::fromUtf8(info.rsid.toStdString().c_str());
//std::cerr << "message from rsid " << info.rsid.c_str() << std::endl;

View file

@ -67,7 +67,7 @@ protected:
void processSettings(bool load);
virtual void init(const std::string &peerId, const QString &title);
virtual void init(const RsPeerId &peerId, const QString &title);
virtual bool canClose();
virtual void addIncomingChatMsg(const ChatInfo& info);

View file

@ -101,7 +101,7 @@ unsigned int ChatUserNotify::getNewCount()
void ChatUserNotify::iconClicked()
{
ChatDialog *chatDialog = NULL;
std::list<std::string> ids;
std::list<RsPeerId> ids;
if (rsMsgs->getPrivateChatQueueIds(true, ids) && ids.size()) {
chatDialog = ChatDialog::getChat(ids.front(), RS_CHAT_OPEN | RS_CHAT_FOCUS);
}

View file

@ -172,14 +172,14 @@ void ChatWidget::addChatBarWidget(QWidget *w)
ui->pluginButtonFrame->layout()->addWidget(w) ;
}
void ChatWidget::init(const std::string &peerId, const QString &title)
void ChatWidget::init(const RsPeerId &peerId, const QString &title)
{
this->peerId = peerId;
this->title = title;
ui->titleLabel->setText(RsHtml::plainText(title));
std::string ownId = rsPeers->getOwnId();
RsPeerId ownId = rsPeers->getOwnId();
setName(QString::fromUtf8(rsPeers->getPeerName(ownId).c_str()));
ChatLobbyId lid;
@ -187,8 +187,8 @@ void ChatWidget::init(const std::string &peerId, const QString &title)
mChatType = CHATTYPE_LOBBY;
} else {
uint32_t status;
std::string pgp_id;
if (rsMsgs->getDistantChatStatus(peerId, status, pgp_id)) {
RsPgpId pgp_id;
if (rsMsgs->getDistantChatStatus(peerId, status, pgp_id)) {
mChatType = CHATTYPE_DISTANT;
} else {
mChatType = CHATTYPE_PRIVATE;
@ -206,15 +206,15 @@ void ChatWidget::init(const std::string &peerId, const QString &title)
break;
}
currentColor.setNamedColor(PeerSettings->getPrivateChatColor(peerId));
currentFont.fromString(PeerSettings->getPrivateChatFont(peerId));
currentColor.setNamedColor(PeerSettings->getPrivateChatColor(peerId));
currentFont.fromString(PeerSettings->getPrivateChatFont(peerId));
colorChanged();
fontChanged();
setColorAndFont();
// load style
PeerSettings->getStyle(peerId, "ChatWidget", style);
PeerSettings->getStyle(peerId, "ChatWidget", style);
/* Add plugin functions */
int pluginCount = rsPlugins->nbPlugins();
@ -244,11 +244,11 @@ void ChatWidget::init(const std::string &peerId, const QString &title)
StatusInfo peerStatusInfo;
// No check of return value. Non existing status info is handled as offline.
rsStatus->getStatus(peerId, peerStatusInfo);
updateStatus(QString::fromStdString(peerId), peerStatusInfo.status);
updateStatus(QString::fromStdString(peerId.toStdString()), peerStatusInfo.status);
// initialize first custom state string
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(peerId).c_str());
updatePeersCustomStateString(QString::fromStdString(peerId), customStateString);
updatePeersCustomStateString(QString::fromStdString(peerId.toStdString()), customStateString);
}
@ -384,7 +384,7 @@ void ChatWidget::completeNickname(bool reverse)
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
std::string vpid;
RsPeerId vpid;
if (rsMsgs->getVirtualPeerId(lobbyIt->lobby_id, vpid)) {
if (vpid == peerId) {
lobby = &*lobbyIt;
@ -490,7 +490,7 @@ QAbstractItemModel *ChatWidget::modelFromPeers()
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
std::string vpid;
RsPeerId vpid;
if (rsMsgs->getVirtualPeerId(lobbyIt->lobby_id, vpid)) {
if (vpid == peerId) {
lobby = &*lobbyIt;
@ -878,9 +878,9 @@ void ChatWidget::fileHashingFinished(QList<HashedFile> hashedFiles)
RetroShareLink link;
if(mDefaultExtraFileFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash));
link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash.toStdString()));
else
link.createExtraFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash),QString::fromStdString(rsPeers->getOwnId()));
link.createExtraFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash.toStdString()),QString::fromStdString(rsPeers->getOwnId().toStdString()));
if (hashedFile.flag & HashedFile::Picture) {
message += QString("<img src=\"file:///%1\" width=\"100\" height=\"100\">").arg(hashedFile.filepath);
@ -947,15 +947,15 @@ void ChatWidget::updateStatus(const QString &peer_id, int status)
}
/* set font size for status */
if (peer_id.toStdString() == peerId) {
if (RsPeerId(peer_id.toStdString()) == peerId) {
// the peers status has changed
QString peerName ;
uint32_t stts ;
std::string pgp_id ;
RsPgpId pgp_id ;
if(rsMsgs->getDistantChatStatus(peerId,stts,pgp_id))
peerName = QString::fromUtf8(rsPeers->getPeerName(pgp_id).c_str());
peerName = QString::fromUtf8(rsPeers->getGPGName(pgp_id).c_str());
else
peerName = QString::fromUtf8(rsPeers->getPeerName(peerId).c_str());
@ -1025,10 +1025,9 @@ void ChatWidget::updateTitle()
void ChatWidget::updatePeersCustomStateString(const QString& peer_id, const QString& status_string)
{
std::string stdPeerId = peer_id.toStdString();
QString status_text;
if (stdPeerId == peerId) {
if (RsPeerId(peer_id.toStdString()) == peerId) {
// the peers status string has changed
if (status_string.isEmpty()) {
ui->statusMessageLabel->hide();

View file

@ -68,7 +68,7 @@ public:
explicit ChatWidget(QWidget *parent = 0);
~ChatWidget();
void init(const std::string &peerId, const QString &title);
void init(const RsPeerId &peerId, const QString &title);
ChatType chatType() { return mChatType; }
bool hasNewMessages() { return newMessages; }
@ -84,7 +84,7 @@ public:
void addToolsAction(QAction *action);
std::string getPeerId() { return peerId; }
RsPeerId getPeerId() { return peerId; }
QString getTitle() { return title; }
int getPeerStatus() { return peerStatus; }
void setName(const QString &name);
@ -158,7 +158,7 @@ private:
void completeNickname(bool reverse);
QAbstractItemModel *modelFromPeers();
std::string peerId;
RsPeerId peerId;
QString title;
QString name;
QString completionWord;

View file

@ -27,11 +27,12 @@
#include <retroshare/rsmsgs.h>
#include <retroshare/rspeers.h>
#include <retroshare/rstypes.h>
#include "gui/common/PeerDefs.h"
#include "ChatDialog.h"
CreateLobbyDialog::CreateLobbyDialog(const std::list<std::string>& peer_list, int privacyLevel, QWidget *parent) :
CreateLobbyDialog::CreateLobbyDialog(const std::list<RsPeerId>& peer_list, int privacyLevel, QWidget *parent) :
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
{
ui = new Ui::CreateLobbyDialog() ;
@ -60,7 +61,7 @@ CreateLobbyDialog::CreateLobbyDialog(const std::list<std::string>& peer_list, in
ui->keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
ui->keyShareList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
ui->keyShareList->start();
ui->keyShareList->setSelectedSslIds(peer_list, false);
ui->keyShareList->setSelectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(peer_list, false);
if (privacyLevel) {
ui->security_CB->setCurrentIndex((privacyLevel == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) ? 0 : 1);
@ -98,8 +99,8 @@ void CreateLobbyDialog::checkTextFields()
void CreateLobbyDialog::createLobby()
{
std::list<std::string> shareList;
ui->keyShareList->selectedSslIds(shareList, false);
std::list<RsPeerId> shareList;
ui->keyShareList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(shareList, false);
// if (shareList.empty()) {
// QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend"), QMessageBox::Ok, QMessageBox::Ok);
@ -123,7 +124,7 @@ void CreateLobbyDialog::createLobby()
rsMsgs->setNickNameForChatLobby(id,ui->nickName_LE->text().toUtf8().constData()) ;
// open chat window !!
std::string vpid ;
RsPeerId vpid ;
if(rsMsgs->getVirtualPeerId(id,vpid))
ChatDialog::chatFriend(vpid) ;

View file

@ -4,6 +4,7 @@
#include <QDialog>
#include "ui_CreateLobbyDialog.h"
#include <retroshare/rstypes.h>
class CreateLobbyDialog : public QDialog {
Q_OBJECT
@ -12,7 +13,7 @@ public:
/*
*@param chanId The channel id to send request for
*/
CreateLobbyDialog(const std::list<std::string>& friends_list, int privacyLevel = 0, QWidget *parent = 0);
CreateLobbyDialog(const std::list<RsPeerId>& friends_list, int privacyLevel = 0, QWidget *parent = 0);
~CreateLobbyDialog();
protected:

View file

@ -51,15 +51,15 @@ PopupChatDialog::PopupChatDialog(QWidget *parent, Qt::WindowFlags flags)
connect(NotifyQt::getInstance(), SIGNAL(chatStatusChanged(const QString&, const QString&, bool)), this, SLOT(chatStatusChanged(const QString&, const QString&, bool)));
}
void PopupChatDialog::init(const std::string &peerId, const QString &title)
void PopupChatDialog::init(const RsPeerId &peerId, const QString &title)
{
ChatDialog::init(peerId, title);
/* Hide or show the avatar frames */
showAvatarFrame(PeerSettings->getShowAvatarFrame(peerId));
showAvatarFrame(PeerSettings->getShowAvatarFrame(peerId));
ui.avatarWidget->setFrameType(AvatarWidget::STATUS_FRAME);
ui.avatarWidget->setId(peerId, false);
ui.avatarWidget->setId(peerId);
ui.ownAvatarWidget->setFrameType(AvatarWidget::STATUS_FRAME);
ui.ownAvatarWidget->setOwnId();
@ -121,8 +121,8 @@ void PopupChatDialog::showDialog(uint chatflags)
//
void PopupChatDialog::chatStatusChanged(const QString &peerId, const QString& statusString, bool isPrivateChat)
{
if (isPrivateChat && this->peerId == peerId.toStdString()) {
ui.chatWidget->updateStatusString(getPeerName(peerId.toStdString()) + " %1", statusString);
if (isPrivateChat && this->peerId == RsPeerId(peerId.toStdString())) {
ui.chatWidget->updateStatusString(getPeerName(RsPeerId(peerId.toStdString())) + " %1", statusString);
}
}
@ -219,7 +219,7 @@ void PopupChatDialog::showAvatarFrame(bool show)
ui.avatarFrameButton->setIcon(QIcon(":images/show_toolbox_frame.png"));
}
PeerSettings->setShowAvatarFrame(getPeerId(), show);
PeerSettings->setShowAvatarFrame(getPeerId(), show);
}
void PopupChatDialog::clearOfflineMessages()

View file

@ -45,7 +45,7 @@ protected:
/** Default destructor */
virtual ~PopupChatDialog();
virtual void init(const std::string &peerId, const QString &title);
virtual void init(const RsPeerId &peerId, const QString &title);
virtual void showDialog(uint chatflags);
virtual ChatWidget *getChatWidget();
virtual bool hasPeerStatus() { return true; }

View file

@ -125,9 +125,9 @@ void PopupChatWindow::saveSettings()
Settings->setValueToGroup("ChatWindow", "OnTop", ui.actionSetOnTop->isChecked());
} else {
if (!peerId.empty()) {
PeerSettings->saveWidgetInformation(peerId, this);
PeerSettings->setPrivateChatOnTop(peerId, ui.actionSetOnTop->isChecked());
if (!peerId.isNull()) {
PeerSettings->saveWidgetInformation(peerId, this);
PeerSettings->setPrivateChatOnTop(peerId, ui.actionSetOnTop->isChecked());
}
}
}
@ -141,7 +141,7 @@ void PopupChatWindow::showEvent(QShowEvent */*event*/)
Settings->loadWidgetInformation(this);
} else {
this->move(qrand()%100, qrand()%100); //avoid to stack multiple popup chat windows on the same position
PeerSettings->loadWidgetInformation(peerId, this);
PeerSettings->loadWidgetInformation(peerId, this);
}
}
}
@ -189,7 +189,7 @@ void PopupChatWindow::addDialog(ChatDialog *dialog)
calculateStyle(dialog);
/* signal toggled is called */
ui.actionSetOnTop->setChecked(PeerSettings->getPrivateChatOnTop(peerId));
ui.actionSetOnTop->setChecked(PeerSettings->getPrivateChatOnTop(peerId));
QObject::connect(dialog, SIGNAL(dialogClose(ChatDialog*)), this, SLOT(dialogClose(ChatDialog*)));
}
@ -217,7 +217,7 @@ void PopupChatWindow::removeDialog(ChatDialog *dialog)
dialog->removeFromParent(this);
ui.horizontalLayout->removeWidget(dialog);
chatDialog = NULL;
peerId.erase();
peerId.clear();
deleteLater();
}
}

View file

@ -25,6 +25,7 @@
#include <QTimer>
#include "ui_PopupChatWindow.h"
#include <retroshare/rstypes.h>
class ChatDialog;
@ -68,7 +69,7 @@ private slots:
private:
bool tabbedWindow;
bool firstShow;
std::string peerId;
RsPeerId peerId;
ChatDialog *chatDialog;
QIcon mBlinkIcon;
QIcon *mEmptyIcon;

View file

@ -24,6 +24,7 @@
#include <QMessageBox>
#include <retroshare/rsstatus.h>
#include <retroshare/rspeers.h>
#include "RsAutoUpdatePage.h"
#include "PopupDistantChatDialog.h"
@ -54,10 +55,10 @@ PopupDistantChatDialog::PopupDistantChatDialog(QWidget *parent, Qt::WindowFlags
updateDisplay() ;
}
void PopupDistantChatDialog::init(const std::string& hash,const QString & title)
void PopupDistantChatDialog::init(const DistantChatPeerId& pid,const QString & title)
{
_hash = hash ;
PopupChatDialog::init(hash,title) ;
_pid = pid ;
PopupChatDialog::init(pid,title) ;
}
void PopupDistantChatDialog::updateDisplay()
@ -73,8 +74,8 @@ void PopupDistantChatDialog::updateDisplay()
//
uint32_t status= RS_DISTANT_CHAT_STATUS_UNKNOWN;
std::string pgp_id ;
rsMsgs->getDistantChatStatus(_hash,status,pgp_id) ;
RsPgpId pgp_id ;
rsMsgs->getDistantChatStatus(_pid,status,pgp_id) ;
switch(status)
{
@ -112,18 +113,18 @@ void PopupDistantChatDialog::updateDisplay()
void PopupDistantChatDialog::closeEvent(QCloseEvent *e)
{
//std::cerr << "Closing window => closing distant chat for hash " << _hash << std::endl;
//std::cerr << "Closing window => closing distant chat for hash " << _pid << std::endl;
uint32_t status= RS_DISTANT_CHAT_STATUS_UNKNOWN;
std::string pgp_id ;
rsMsgs->getDistantChatStatus(_hash,status,pgp_id) ;
RsPgpId pgp_id ;
rsMsgs->getDistantChatStatus(_pid,status,pgp_id) ;
if(status != RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED)
{
QString msg = tr("Closing this window will end the conversation, notify the peer and remove the encrypted tunnel.") ;
if(QMessageBox::Ok == QMessageBox::critical(NULL,tr("Kill the tunnel?"),msg, QMessageBox::Ok | QMessageBox::Cancel))
rsMsgs->closeDistantChatConnexion(_hash) ;
rsMsgs->closeDistantChatConnexion(_pid) ;
else
{
e->ignore() ;
@ -136,13 +137,13 @@ void PopupDistantChatDialog::closeEvent(QCloseEvent *e)
PopupChatDialog::closeEvent(e) ;
}
QString PopupDistantChatDialog::getPeerName(const std::string& id) const
QString PopupDistantChatDialog::getPeerName(const DistantChatPeerId &id) const
{
uint32_t status ;
std::string pgp_id ;
RsPgpId pgp_id ;
if(rsMsgs->getDistantChatStatus(_hash,status,pgp_id))
return ChatDialog::getPeerName(pgp_id) ;
if(rsMsgs->getDistantChatStatus(id,status,pgp_id))
return QString::fromStdString(rsPeers->getGPGName(pgp_id)) ;
else
return ChatDialog::getPeerName(id) ;
}

View file

@ -39,18 +39,17 @@ class PopupDistantChatDialog: public PopupChatDialog
/** Default destructor */
virtual ~PopupDistantChatDialog();
virtual void init(const std::string& _hash, const QString &title);
virtual void init(const DistantChatPeerId &pid, const QString &title);
virtual void closeEvent(QCloseEvent *e) ;
virtual QString getPeerName(const std::string& id) const ;
virtual QString getPeerName(const DistantChatPeerId& id) const ;
protected slots:
void updateDisplay() ; // overloads RsAutoUpdatePage
private:
QTimer *_update_timer ;
std::string _hash ;
std::string _virtual_peer_id ;
DistantChatPeerId _pid ;
QLabel *_status_label ;
};