mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-15 01:25:56 -04:00
ID cleaning. Savign progress
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-IdCleaning@7118 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e865b0b7c3
commit
fe96317b65
10 changed files with 87 additions and 88 deletions
|
@ -328,7 +328,7 @@ void ChatLobbyWidget::updateDisplay()
|
||||||
|
|
||||||
// now, do a nice display of lobbies
|
// now, do a nice display of lobbies
|
||||||
|
|
||||||
std::string vpid;
|
RsPeerId vpid;
|
||||||
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
|
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
|
||||||
|
|
||||||
// remove not existing public lobbies
|
// remove not existing public lobbies
|
||||||
|
@ -575,7 +575,7 @@ static void subscribeLobby(QTreeWidgetItem *item)
|
||||||
|
|
||||||
ChatLobbyId id = item->data(COLUMN_DATA, ROLE_ID).toULongLong();
|
ChatLobbyId id = item->data(COLUMN_DATA, ROLE_ID).toULongLong();
|
||||||
if (rsMsgs->joinVisibleChatLobby(id)) {
|
if (rsMsgs->joinVisibleChatLobby(id)) {
|
||||||
std::string vpeer_id;
|
RsPeerId vpeer_id;
|
||||||
if (rsMsgs->getVirtualPeerId(id, vpeer_id)) {
|
if (rsMsgs->getVirtualPeerId(id, vpeer_id)) {
|
||||||
ChatDialog::chatFriend(vpeer_id,true) ;
|
ChatDialog::chatFriend(vpeer_id,true) ;
|
||||||
}
|
}
|
||||||
|
@ -739,7 +739,7 @@ void ChatLobbyWidget::unsubscribeChatLobby(ChatLobbyId id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unsubscribe the chat lobby
|
// Unsubscribe the chat lobby
|
||||||
std::string vpeer_id;
|
RsPeerId vpeer_id;
|
||||||
if (rsMsgs->getVirtualPeerId(id, vpeer_id))
|
if (rsMsgs->getVirtualPeerId(id, vpeer_id))
|
||||||
ChatDialog::closeChat(vpeer_id);
|
ChatDialog::closeChat(vpeer_id);
|
||||||
|
|
||||||
|
@ -812,7 +812,7 @@ void ChatLobbyWidget::itemDoubleClicked(QTreeWidgetItem *item, int /*column*/)
|
||||||
|
|
||||||
void ChatLobbyWidget::displayChatLobbyEvent(qulonglong lobby_id, int event_type, const QString& nickname, const QString& str)
|
void ChatLobbyWidget::displayChatLobbyEvent(qulonglong lobby_id, int event_type, const QString& nickname, const QString& str)
|
||||||
{
|
{
|
||||||
std::string vpid;
|
RsPeerId vpid;
|
||||||
if (rsMsgs->getVirtualPeerId(lobby_id, vpid)) {
|
if (rsMsgs->getVirtualPeerId(lobby_id, vpid)) {
|
||||||
if (ChatLobbyDialog *cld = dynamic_cast<ChatLobbyDialog*>(ChatDialog::getExistingChat(vpid))) {
|
if (ChatLobbyDialog *cld = dynamic_cast<ChatLobbyDialog*>(ChatDialog::getExistingChat(vpid))) {
|
||||||
cld->displayLobbyEvent(event_type, nickname, str);
|
cld->displayLobbyEvent(event_type, nickname, str);
|
||||||
|
@ -831,7 +831,7 @@ void ChatLobbyWidget::readChatLobbyInvites()
|
||||||
|
|
||||||
rsMsgs->acceptLobbyInvite((*it).lobby_id);
|
rsMsgs->acceptLobbyInvite((*it).lobby_id);
|
||||||
|
|
||||||
std::string vpid;
|
RsPeerId vpid;
|
||||||
if(rsMsgs->getVirtualPeerId((*it).lobby_id,vpid )) {
|
if(rsMsgs->getVirtualPeerId((*it).lobby_id,vpid )) {
|
||||||
ChatDialog::chatFriend(vpid,true);
|
ChatDialog::chatFriend(vpid,true);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include <retroshare/rsnotify.h>
|
#include <retroshare/rsnotify.h>
|
||||||
#include <retroshare/rspeers.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) :
|
ChatDialog::ChatDialog(QWidget *parent, Qt::WindowFlags flags) :
|
||||||
QWidget(parent, flags)
|
QWidget(parent, flags)
|
||||||
|
@ -46,7 +46,7 @@ ChatDialog::ChatDialog(QWidget *parent, Qt::WindowFlags flags) :
|
||||||
|
|
||||||
ChatDialog::~ChatDialog()
|
ChatDialog::~ChatDialog()
|
||||||
{
|
{
|
||||||
std::map<std::string, ChatDialog *>::iterator it;
|
std::map<RsPeerId, ChatDialog *>::iterator it;
|
||||||
if (chatDialogs.end() != (it = chatDialogs.find(getPeerId()))) {
|
if (chatDialogs.end() != (it = chatDialogs.find(getPeerId()))) {
|
||||||
chatDialogs.erase(it);
|
chatDialogs.erase(it);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ void ChatDialog::init(const RsPeerId &peerId, const QString &title)
|
||||||
|
|
||||||
/*static*/ ChatDialog *ChatDialog::getExistingChat(const RsPeerId &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))) {
|
if (chatDialogs.end() != (it = chatDialogs.find(peerId))) {
|
||||||
/* exists already */
|
/* exists already */
|
||||||
return it->second;
|
return it->second;
|
||||||
|
@ -85,7 +85,7 @@ void ChatDialog::init(const RsPeerId &peerId, const QString &title)
|
||||||
return NULL;
|
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 */
|
/* see if it already exists */
|
||||||
ChatDialog *cd = getExistingChat(peerId);
|
ChatDialog *cd = getExistingChat(peerId);
|
||||||
|
@ -98,7 +98,7 @@ void ChatDialog::init(const RsPeerId &peerId, const QString &title)
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t distant_peer_status ;
|
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))
|
if(rsMsgs->getDistantChatStatus(peerId,distant_peer_status,distant_chat_pgp_id))
|
||||||
chatflags = RS_CHAT_OPEN | RS_CHAT_FOCUS; // use own flags
|
chatflags = RS_CHAT_OPEN | RS_CHAT_FOCUS; // use own flags
|
||||||
|
@ -119,7 +119,7 @@ void ChatDialog::init(const RsPeerId &peerId, const QString &title)
|
||||||
cd = new PopupDistantChatDialog();
|
cd = new PopupDistantChatDialog();
|
||||||
chatDialogs[peerId] = cd;
|
chatDialogs[peerId] = cd;
|
||||||
std::string peer_name = rsPeers->getGPGName(distant_chat_pgp_id) ;
|
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 {
|
} else {
|
||||||
RsPeerDetails sslDetails;
|
RsPeerDetails sslDetails;
|
||||||
|
@ -150,7 +150,7 @@ void ChatDialog::init(const RsPeerId &peerId, const QString &title)
|
||||||
/* ChatDialog destuctor removes the entry from the map */
|
/* ChatDialog destuctor removes the entry from the map */
|
||||||
std::list<ChatDialog*> list;
|
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++) {
|
for (it = chatDialogs.begin(); it != chatDialogs.end(); it++) {
|
||||||
if (it->second) {
|
if (it->second) {
|
||||||
list.push_back(it->second);
|
list.push_back(it->second);
|
||||||
|
@ -171,11 +171,11 @@ void ChatDialog::init(const RsPeerId &peerId, const QString &title)
|
||||||
// play sound when recv a message
|
// play sound when recv a message
|
||||||
soundManager->play(SOUND_NEW_CHAT_MESSAGE);
|
soundManager->play(SOUND_NEW_CHAT_MESSAGE);
|
||||||
|
|
||||||
std::list<std::string> ids;
|
std::list<RsPeerId> ids;
|
||||||
if (rsMsgs->getPrivateChatQueueIds(true, ids)) {
|
if (rsMsgs->getPrivateChatQueueIds(true, ids)) {
|
||||||
uint chatflags = Settings->getChatFlags();
|
uint chatflags = Settings->getChatFlags();
|
||||||
|
|
||||||
std::list<std::string>::iterator id;
|
std::list<RsPeerId>::iterator id;
|
||||||
for (id = ids.begin(); id != ids.end(); id++) {
|
for (id = ids.begin(); id != ids.end(); id++) {
|
||||||
ChatDialog *cd = getChat(*id, chatflags);
|
ChatDialog *cd = getChat(*id, chatflags);
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ void ChatDialog::init(const RsPeerId &peerId, const QString &title)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now notify all open priavate chat windows */
|
/* 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++) {
|
for (it = chatDialogs.begin (); it != chatDialogs.end(); it++) {
|
||||||
if (it->second) {
|
if (it->second) {
|
||||||
it->second->onChatChanged(list, type);
|
it->second->onChatChanged(list, type);
|
||||||
|
@ -206,11 +206,11 @@ void ChatDialog::init(const RsPeerId &peerId, const QString &title)
|
||||||
|
|
||||||
/*static*/ void ChatDialog::chatFriend(const RsPeerId &peerId, const bool forceFocus)
|
/*static*/ void ChatDialog::chatFriend(const RsPeerId &peerId, const bool forceFocus)
|
||||||
{
|
{
|
||||||
if (peerId.empty()){
|
if (peerId.isNull()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string distant_chat_pgp_id ;
|
RsPgpId distant_chat_pgp_id ;
|
||||||
uint32_t distant_peer_status ;
|
uint32_t distant_peer_status ;
|
||||||
|
|
||||||
if(rsMsgs->getDistantChatStatus(peerId,distant_peer_status,distant_chat_pgp_id))
|
if(rsMsgs->getDistantChatStatus(peerId,distant_peer_status,distant_chat_pgp_id))
|
||||||
|
@ -229,10 +229,10 @@ void ChatDialog::init(const RsPeerId &peerId, const QString &title)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (detail.isOnlyGPGdetail) {
|
if (detail.isOnlyGPGdetail) {
|
||||||
std::list<std::string> onlineIds;
|
std::list<RsPeerId> onlineIds;
|
||||||
|
|
||||||
//let's get the ssl child details
|
//let's get the ssl child details
|
||||||
std::list<std::string> sslIds;
|
std::list<RsPeerId> sslIds;
|
||||||
rsPeers->getAssociatedSSLIds(detail.gpg_id, sslIds);
|
rsPeers->getAssociatedSSLIds(detail.gpg_id, sslIds);
|
||||||
|
|
||||||
if (sslIds.size() == 1) {
|
if (sslIds.size() == 1) {
|
||||||
|
@ -242,7 +242,7 @@ void ChatDialog::init(const RsPeerId &peerId, const QString &title)
|
||||||
}
|
}
|
||||||
|
|
||||||
// more than one ssl ids available, check for online
|
// 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)) {
|
if (rsPeers->isOnline(*it)) {
|
||||||
onlineIds.push_back(*it);
|
onlineIds.push_back(*it);
|
||||||
}
|
}
|
||||||
|
@ -307,7 +307,7 @@ void ChatDialog::setPeerStatus(uint32_t status)
|
||||||
{
|
{
|
||||||
ChatWidget *cw = getChatWidget();
|
ChatWidget *cw = getChatWidget();
|
||||||
if (cw)
|
if (cw)
|
||||||
cw->updateStatus(QString::fromStdString(getPeerId()), status);
|
cw->updateStatus(QString::fromStdString(getPeerId().toStdString()), status);
|
||||||
}
|
}
|
||||||
int ChatDialog::getPeerStatus()
|
int ChatDialog::getPeerStatus()
|
||||||
{
|
{
|
||||||
|
@ -369,7 +369,7 @@ void ChatDialog::chatNewMessage(ChatWidget*)
|
||||||
|
|
||||||
void ChatDialog::insertChatMsgs()
|
void ChatDialog::insertChatMsgs()
|
||||||
{
|
{
|
||||||
std::string peerId = getPeerId();
|
RsPeerId peerId = getPeerId();
|
||||||
|
|
||||||
std::list<ChatInfo> newchat;
|
std::list<ChatInfo> newchat;
|
||||||
if (!rsMsgs->getPrivateChatQueue(true, peerId, newchat)) {
|
if (!rsMsgs->getPrivateChatQueue(true, peerId, newchat)) {
|
||||||
|
|
|
@ -111,7 +111,7 @@ void ChatLobbyDialog::inviteFriends()
|
||||||
{
|
{
|
||||||
std::cerr << "Inviting friends" << std::endl;
|
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;
|
std::cerr << "Inviting these friends:" << std::endl;
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ void ChatLobbyDialog::inviteFriends()
|
||||||
if (!rsMsgs->isLobbyId(getPeerId(), lobby_id))
|
if (!rsMsgs->isLobbyId(getPeerId(), lobby_id))
|
||||||
return ;
|
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;
|
std::cerr << " " << *it << std::endl;
|
||||||
|
|
||||||
|
@ -158,14 +158,14 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
|
||||||
contextMnu.exec(QCursor::pos());
|
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;
|
std::list<ChatLobbyInfo> lobbies;
|
||||||
rsMsgs->getChatLobbyList(lobbies);
|
rsMsgs->getChatLobbyList(lobbies);
|
||||||
|
|
||||||
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
|
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
|
||||||
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
|
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
|
||||||
std::string vpid;
|
RsPeerId vpid;
|
||||||
if (rsMsgs->getVirtualPeerId(lobbyIt->lobby_id, vpid)) {
|
if (rsMsgs->getVirtualPeerId(lobbyIt->lobby_id, vpid)) {
|
||||||
if (vpid == peerId) {
|
if (vpid == peerId) {
|
||||||
QString msg = tr("Welcome to lobby %1").arg(RsHtml::plainText(lobbyIt->lobby_name));
|
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);
|
QDateTime recvTime = QDateTime::fromTime_t(info.recvTime);
|
||||||
QString message = QString::fromUtf8(info.msg.c_str());
|
QString message = QString::fromUtf8(info.msg.c_str());
|
||||||
QString name = QString::fromUtf8(info.peer_nickname.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;
|
//std::cerr << "message from rsid " << info.rsid.c_str() << std::endl;
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ protected:
|
||||||
|
|
||||||
void processSettings(bool load);
|
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 bool canClose();
|
||||||
virtual void addIncomingChatMsg(const ChatInfo& info);
|
virtual void addIncomingChatMsg(const ChatInfo& info);
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ void ChatWidget::addChatBarWidget(QWidget *w)
|
||||||
ui->pluginButtonFrame->layout()->addWidget(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->peerId = peerId;
|
||||||
this->title = title;
|
this->title = title;
|
||||||
|
@ -187,8 +187,8 @@ void ChatWidget::init(const std::string &peerId, const QString &title)
|
||||||
mChatType = CHATTYPE_LOBBY;
|
mChatType = CHATTYPE_LOBBY;
|
||||||
} else {
|
} else {
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
std::string pgp_id;
|
RsPgpId pgp_id;
|
||||||
if (rsMsgs->getDistantChatStatus(peerId, status, pgp_id)) {
|
if (rsMsgs->getDistantChatStatus(peerId, status, pgp_id)) {
|
||||||
mChatType = CHATTYPE_DISTANT;
|
mChatType = CHATTYPE_DISTANT;
|
||||||
} else {
|
} else {
|
||||||
mChatType = CHATTYPE_PRIVATE;
|
mChatType = CHATTYPE_PRIVATE;
|
||||||
|
@ -206,15 +206,15 @@ void ChatWidget::init(const std::string &peerId, const QString &title)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentColor.setNamedColor(PeerSettings->getPrivateChatColor(peerId));
|
currentColor.setNamedColor(PeerSettings->getPrivateChatColor(peerId));
|
||||||
currentFont.fromString(PeerSettings->getPrivateChatFont(peerId));
|
currentFont.fromString(PeerSettings->getPrivateChatFont(peerId));
|
||||||
|
|
||||||
colorChanged();
|
colorChanged();
|
||||||
fontChanged();
|
fontChanged();
|
||||||
setColorAndFont();
|
setColorAndFont();
|
||||||
|
|
||||||
// load style
|
// load style
|
||||||
PeerSettings->getStyle(peerId, "ChatWidget", style);
|
PeerSettings->getStyle(peerId, "ChatWidget", style);
|
||||||
|
|
||||||
/* Add plugin functions */
|
/* Add plugin functions */
|
||||||
int pluginCount = rsPlugins->nbPlugins();
|
int pluginCount = rsPlugins->nbPlugins();
|
||||||
|
@ -244,11 +244,11 @@ void ChatWidget::init(const std::string &peerId, const QString &title)
|
||||||
StatusInfo peerStatusInfo;
|
StatusInfo peerStatusInfo;
|
||||||
// No check of return value. Non existing status info is handled as offline.
|
// No check of return value. Non existing status info is handled as offline.
|
||||||
rsStatus->getStatus(peerId, peerStatusInfo);
|
rsStatus->getStatus(peerId, peerStatusInfo);
|
||||||
updateStatus(QString::fromStdString(peerId), peerStatusInfo.status);
|
updateStatus(QString::fromStdString(peerId.toStdString()), peerStatusInfo.status);
|
||||||
|
|
||||||
// initialize first custom state string
|
// initialize first custom state string
|
||||||
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(peerId).c_str());
|
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;
|
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
|
||||||
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
|
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
|
||||||
std::string vpid;
|
RsPeerId vpid;
|
||||||
if (rsMsgs->getVirtualPeerId(lobbyIt->lobby_id, vpid)) {
|
if (rsMsgs->getVirtualPeerId(lobbyIt->lobby_id, vpid)) {
|
||||||
if (vpid == peerId) {
|
if (vpid == peerId) {
|
||||||
lobby = &*lobbyIt;
|
lobby = &*lobbyIt;
|
||||||
|
@ -490,7 +490,7 @@ QAbstractItemModel *ChatWidget::modelFromPeers()
|
||||||
|
|
||||||
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
|
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
|
||||||
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
|
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
|
||||||
std::string vpid;
|
RsPeerId vpid;
|
||||||
if (rsMsgs->getVirtualPeerId(lobbyIt->lobby_id, vpid)) {
|
if (rsMsgs->getVirtualPeerId(lobbyIt->lobby_id, vpid)) {
|
||||||
if (vpid == peerId) {
|
if (vpid == peerId) {
|
||||||
lobby = &*lobbyIt;
|
lobby = &*lobbyIt;
|
||||||
|
@ -880,7 +880,7 @@ void ChatWidget::fileHashingFinished(QList<HashedFile> hashedFiles)
|
||||||
if(mDefaultExtraFileFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
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));
|
||||||
else
|
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),QString::fromStdString(rsPeers->getOwnId().toStdString()));
|
||||||
|
|
||||||
if (hashedFile.flag & HashedFile::Picture) {
|
if (hashedFile.flag & HashedFile::Picture) {
|
||||||
message += QString("<img src=\"file:///%1\" width=\"100\" height=\"100\">").arg(hashedFile.filepath);
|
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 */
|
/* set font size for status */
|
||||||
if (peer_id.toStdString() == peerId) {
|
if (RsPeerId(peer_id.toStdString()) == peerId) {
|
||||||
// the peers status has changed
|
// the peers status has changed
|
||||||
|
|
||||||
QString peerName ;
|
QString peerName ;
|
||||||
uint32_t stts ;
|
uint32_t stts ;
|
||||||
std::string pgp_id ;
|
RsPgpId pgp_id ;
|
||||||
|
|
||||||
if(rsMsgs->getDistantChatStatus(peerId,stts,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
|
else
|
||||||
peerName = QString::fromUtf8(rsPeers->getPeerName(peerId).c_str());
|
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)
|
void ChatWidget::updatePeersCustomStateString(const QString& peer_id, const QString& status_string)
|
||||||
{
|
{
|
||||||
std::string stdPeerId = peer_id.toStdString();
|
|
||||||
QString status_text;
|
QString status_text;
|
||||||
|
|
||||||
if (stdPeerId == peerId) {
|
if (RsPeerId(peer_id.toStdString()) == peerId) {
|
||||||
// the peers status string has changed
|
// the peers status string has changed
|
||||||
if (status_string.isEmpty()) {
|
if (status_string.isEmpty()) {
|
||||||
ui->statusMessageLabel->hide();
|
ui->statusMessageLabel->hide();
|
||||||
|
|
|
@ -68,7 +68,7 @@ public:
|
||||||
explicit ChatWidget(QWidget *parent = 0);
|
explicit ChatWidget(QWidget *parent = 0);
|
||||||
~ChatWidget();
|
~ChatWidget();
|
||||||
|
|
||||||
void init(const std::string &peerId, const QString &title);
|
void init(const RsPeerId &peerId, const QString &title);
|
||||||
ChatType chatType() { return mChatType; }
|
ChatType chatType() { return mChatType; }
|
||||||
|
|
||||||
bool hasNewMessages() { return newMessages; }
|
bool hasNewMessages() { return newMessages; }
|
||||||
|
@ -84,7 +84,7 @@ public:
|
||||||
|
|
||||||
void addToolsAction(QAction *action);
|
void addToolsAction(QAction *action);
|
||||||
|
|
||||||
std::string getPeerId() { return peerId; }
|
RsPeerId getPeerId() { return peerId; }
|
||||||
QString getTitle() { return title; }
|
QString getTitle() { return title; }
|
||||||
int getPeerStatus() { return peerStatus; }
|
int getPeerStatus() { return peerStatus; }
|
||||||
void setName(const QString &name);
|
void setName(const QString &name);
|
||||||
|
@ -158,7 +158,7 @@ private:
|
||||||
void completeNickname(bool reverse);
|
void completeNickname(bool reverse);
|
||||||
QAbstractItemModel *modelFromPeers();
|
QAbstractItemModel *modelFromPeers();
|
||||||
|
|
||||||
std::string peerId;
|
RsPeerId peerId;
|
||||||
QString title;
|
QString title;
|
||||||
QString name;
|
QString name;
|
||||||
QString completionWord;
|
QString completionWord;
|
||||||
|
|
|
@ -56,7 +56,7 @@ void PopupChatDialog::init(const RsPeerId &peerId, const QString &title)
|
||||||
ChatDialog::init(peerId, title);
|
ChatDialog::init(peerId, title);
|
||||||
|
|
||||||
/* Hide or show the avatar frames */
|
/* Hide or show the avatar frames */
|
||||||
showAvatarFrame(PeerSettings->getShowAvatarFrame(peerId.toStdString()));
|
showAvatarFrame(PeerSettings->getShowAvatarFrame(peerId));
|
||||||
|
|
||||||
ui.avatarWidget->setFrameType(AvatarWidget::STATUS_FRAME);
|
ui.avatarWidget->setFrameType(AvatarWidget::STATUS_FRAME);
|
||||||
ui.avatarWidget->setId(peerId.toStdString(), false);
|
ui.avatarWidget->setId(peerId.toStdString(), false);
|
||||||
|
@ -219,7 +219,7 @@ void PopupChatDialog::showAvatarFrame(bool show)
|
||||||
ui.avatarFrameButton->setIcon(QIcon(":images/show_toolbox_frame.png"));
|
ui.avatarFrameButton->setIcon(QIcon(":images/show_toolbox_frame.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerSettings->setShowAvatarFrame(getPeerId().toStdString(), show);
|
PeerSettings->setShowAvatarFrame(getPeerId(), show);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::clearOfflineMessages()
|
void PopupChatDialog::clearOfflineMessages()
|
||||||
|
|
|
@ -126,8 +126,8 @@ void PopupChatWindow::saveSettings()
|
||||||
Settings->setValueToGroup("ChatWindow", "OnTop", ui.actionSetOnTop->isChecked());
|
Settings->setValueToGroup("ChatWindow", "OnTop", ui.actionSetOnTop->isChecked());
|
||||||
} else {
|
} else {
|
||||||
if (!peerId.isNull()) {
|
if (!peerId.isNull()) {
|
||||||
PeerSettings->saveWidgetInformation(peerId.toStdString(), this);
|
PeerSettings->saveWidgetInformation(peerId, this);
|
||||||
PeerSettings->setPrivateChatOnTop(peerId.toStdString(), ui.actionSetOnTop->isChecked());
|
PeerSettings->setPrivateChatOnTop(peerId, ui.actionSetOnTop->isChecked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ void PopupChatWindow::showEvent(QShowEvent */*event*/)
|
||||||
Settings->loadWidgetInformation(this);
|
Settings->loadWidgetInformation(this);
|
||||||
} else {
|
} else {
|
||||||
this->move(qrand()%100, qrand()%100); //avoid to stack multiple popup chat windows on the same position
|
this->move(qrand()%100, qrand()%100); //avoid to stack multiple popup chat windows on the same position
|
||||||
PeerSettings->loadWidgetInformation(peerId.toStdString(), this);
|
PeerSettings->loadWidgetInformation(peerId, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ void PopupChatWindow::addDialog(ChatDialog *dialog)
|
||||||
calculateStyle(dialog);
|
calculateStyle(dialog);
|
||||||
|
|
||||||
/* signal toggled is called */
|
/* signal toggled is called */
|
||||||
ui.actionSetOnTop->setChecked(PeerSettings->getPrivateChatOnTop(peerId.toStdString()));
|
ui.actionSetOnTop->setChecked(PeerSettings->getPrivateChatOnTop(peerId));
|
||||||
|
|
||||||
QObject::connect(dialog, SIGNAL(dialogClose(ChatDialog*)), this, SLOT(dialogClose(ChatDialog*)));
|
QObject::connect(dialog, SIGNAL(dialogClose(ChatDialog*)), this, SLOT(dialogClose(ChatDialog*)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ void RsharePeerSettings::cleanDeadIds()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsharePeerSettings::getSettingsIdOfPeerId(const std::string &peerId, std::string &settingsId)
|
bool RsharePeerSettings::getSettingsIdOfPeerId(const RsPeerId &peerId, std::string &settingsId)
|
||||||
{
|
{
|
||||||
ChatLobbyId lid;
|
ChatLobbyId lid;
|
||||||
if (rsMsgs->isLobbyId(peerId, lid)) {
|
if (rsMsgs->isLobbyId(peerId, lid)) {
|
||||||
|
@ -111,14 +111,14 @@ bool RsharePeerSettings::getSettingsIdOfPeerId(const std::string &peerId, std::s
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsId = details.gpg_id;
|
settingsId = details.gpg_id.toStdString();
|
||||||
m_SslToGpg[peerId] = settingsId;
|
m_SslToGpg[peerId] = settingsId;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get value of peer */
|
/* get value of peer */
|
||||||
QVariant RsharePeerSettings::get(const std::string &peerId, const QString &key, const QVariant &defaultValue)
|
QVariant RsharePeerSettings::get(const RsPeerId &peerId, const QString &key, const QVariant &defaultValue)
|
||||||
{
|
{
|
||||||
QVariant result;
|
QVariant result;
|
||||||
|
|
||||||
|
@ -153,22 +153,22 @@ void RsharePeerSettings::set(const std::string &peerId, const QString &key, cons
|
||||||
endGroup();
|
endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RsharePeerSettings::getPrivateChatColor(const std::string &peerId)
|
QString RsharePeerSettings::getPrivateChatColor(const RsPeerId &peerId)
|
||||||
{
|
{
|
||||||
return get(peerId, "PrivateChatColor", QColor(Qt::black).name()).toString();
|
return get(peerId, "PrivateChatColor", QColor(Qt::black).name()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsharePeerSettings::setPrivateChatColor(const std::string &peerId, const QString &value)
|
void RsharePeerSettings::setPrivateChatColor(const RsPeerId &peerId, const QString &value)
|
||||||
{
|
{
|
||||||
set(peerId, "PrivateChatColor", value);
|
set(peerId, "PrivateChatColor", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RsharePeerSettings::getPrivateChatFont(const std::string &peerId)
|
QString RsharePeerSettings::getPrivateChatFont(const RsPeerId &peerId)
|
||||||
{
|
{
|
||||||
return get(peerId, "PrivateChatFont", Settings->getChatScreenFont()).toString();
|
return get(peerId, "PrivateChatFont", Settings->getChatScreenFont()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsharePeerSettings::setPrivateChatFont(const std::string &peerId, const QString &value)
|
void RsharePeerSettings::setPrivateChatFont(const RsPeerId &peerId, const QString &value)
|
||||||
{
|
{
|
||||||
if (Settings->getChatScreenFont() == value) {
|
if (Settings->getChatScreenFont() == value) {
|
||||||
set(peerId, "PrivateChatFont", QVariant());
|
set(peerId, "PrivateChatFont", QVariant());
|
||||||
|
@ -177,17 +177,17 @@ void RsharePeerSettings::setPrivateChatFont(const std::string &peerId, const QSt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsharePeerSettings::getPrivateChatOnTop(const std::string &peerId)
|
bool RsharePeerSettings::getPrivateChatOnTop(const RsPeerId &peerId)
|
||||||
{
|
{
|
||||||
return get(peerId, "PrivateChatOnTop", false).toBool();
|
return get(peerId, "PrivateChatOnTop", false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsharePeerSettings::setPrivateChatOnTop(const std::string &peerId, bool value)
|
void RsharePeerSettings::setPrivateChatOnTop(const RsPeerId &peerId, bool value)
|
||||||
{
|
{
|
||||||
set(peerId, "PrivateChatOnTop", value);
|
set(peerId, "PrivateChatOnTop", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsharePeerSettings::saveWidgetInformation(const std::string &peerId, QWidget *widget)
|
void RsharePeerSettings::saveWidgetInformation(const RsPeerId &peerId, QWidget *widget)
|
||||||
{
|
{
|
||||||
std::string settingsId;
|
std::string settingsId;
|
||||||
if (getSettingsIdOfPeerId(peerId, settingsId) == false) {
|
if (getSettingsIdOfPeerId(peerId, settingsId) == false) {
|
||||||
|
@ -207,7 +207,7 @@ void RsharePeerSettings::saveWidgetInformation(const std::string &peerId, QWidge
|
||||||
endGroup();
|
endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsharePeerSettings::loadWidgetInformation(const std::string &peerId, QWidget *widget)
|
void RsharePeerSettings::loadWidgetInformation(const RsPeerId &peerId, QWidget *widget)
|
||||||
{
|
{
|
||||||
std::string settingsId;
|
std::string settingsId;
|
||||||
if (getSettingsIdOfPeerId(peerId, settingsId) == false) {
|
if (getSettingsIdOfPeerId(peerId, settingsId) == false) {
|
||||||
|
@ -227,27 +227,27 @@ void RsharePeerSettings::loadWidgetInformation(const std::string &peerId, QWidge
|
||||||
endGroup();
|
endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsharePeerSettings::getShowAvatarFrame(const std::string &peerId)
|
bool RsharePeerSettings::getShowAvatarFrame(const RsPeerId &peerId)
|
||||||
{
|
{
|
||||||
return get(peerId, "ShowAvatarFrame", true).toBool();
|
return get(peerId, "ShowAvatarFrame", true).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsharePeerSettings::setShowAvatarFrame(const std::string &peerId, bool value)
|
void RsharePeerSettings::setShowAvatarFrame(const RsPeerId &peerId, bool value)
|
||||||
{
|
{
|
||||||
return set(peerId, "ShowAvatarFrame", value);
|
return set(peerId, "ShowAvatarFrame", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsharePeerSettings::getShowParticipantsFrame(const std::string &peerId)
|
bool RsharePeerSettings::getShowParticipantsFrame(const RsPeerId &peerId)
|
||||||
{
|
{
|
||||||
return get(peerId, "ShowParticipantsFrame", true).toBool();
|
return get(peerId, "ShowParticipantsFrame", true).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsharePeerSettings::setShowParticipantsFrame(const std::string &peerId, bool value)
|
void RsharePeerSettings::setShowParticipantsFrame(const RsPeerId &peerId, bool value)
|
||||||
{
|
{
|
||||||
return set(peerId, "ShowParticipantsFrame", value);
|
return set(peerId, "ShowParticipantsFrame", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsharePeerSettings::getStyle(const std::string &peerId, const QString &name, RSStyle &style)
|
void RsharePeerSettings::getStyle(const RsPeerId &peerId, const QString &name, RSStyle &style)
|
||||||
{
|
{
|
||||||
std::string settingsId;
|
std::string settingsId;
|
||||||
if (getSettingsIdOfPeerId(peerId, settingsId) == false) {
|
if (getSettingsIdOfPeerId(peerId, settingsId) == false) {
|
||||||
|
@ -266,7 +266,7 @@ void RsharePeerSettings::getStyle(const std::string &peerId, const QString &name
|
||||||
endGroup();
|
endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsharePeerSettings::setStyle(const std::string &peerId, const QString &name, RSStyle &style)
|
void RsharePeerSettings::setStyle(const RsPeerId &peerId, const QString &name, RSStyle &style)
|
||||||
{
|
{
|
||||||
std::string settingsId;
|
std::string settingsId;
|
||||||
if (getSettingsIdOfPeerId(peerId, settingsId) == false) {
|
if (getSettingsIdOfPeerId(peerId, settingsId) == false) {
|
||||||
|
|
|
@ -33,41 +33,41 @@ public:
|
||||||
/* create settings object */
|
/* create settings object */
|
||||||
static void Create ();
|
static void Create ();
|
||||||
|
|
||||||
QString getPrivateChatColor(const std::string &peerId);
|
QString getPrivateChatColor(const RsPeerId &peerId);
|
||||||
void setPrivateChatColor(const std::string &peerId, const QString &value);
|
void setPrivateChatColor(const RsPeerId &peerId, const QString &value);
|
||||||
|
|
||||||
QString getPrivateChatFont(const std::string &peerId);
|
QString getPrivateChatFont(const RsPeerId &peerId);
|
||||||
void setPrivateChatFont(const std::string &peerId, const QString &value);
|
void setPrivateChatFont(const RsPeerId &peerId, const QString &value);
|
||||||
|
|
||||||
bool getPrivateChatOnTop(const std::string &peerId);
|
bool getPrivateChatOnTop(const RsPeerId &peerId);
|
||||||
void setPrivateChatOnTop(const std::string &peerId, bool value);
|
void setPrivateChatOnTop(const RsPeerId &peerId, bool value);
|
||||||
|
|
||||||
void saveWidgetInformation(const std::string &peerId, QWidget *widget);
|
void saveWidgetInformation(const RsPeerId &peerId, QWidget *widget);
|
||||||
void loadWidgetInformation(const std::string &peerId, QWidget *widget);
|
void loadWidgetInformation(const RsPeerId &peerId, QWidget *widget);
|
||||||
|
|
||||||
bool getShowAvatarFrame(const std::string &peerId);
|
bool getShowAvatarFrame(const RsPeerId &peerId);
|
||||||
void setShowAvatarFrame(const std::string &peerId, bool value);
|
void setShowAvatarFrame(const RsPeerId &peerId, bool value);
|
||||||
|
|
||||||
bool getShowParticipantsFrame(const std::string &peerId);
|
bool getShowParticipantsFrame(const RsPeerId &peerId);
|
||||||
void setShowParticipantsFrame(const std::string &peerId, bool value);
|
void setShowParticipantsFrame(const RsPeerId &peerId, bool value);
|
||||||
|
|
||||||
void getStyle(const std::string &peerId, const QString &name, RSStyle &style);
|
void getStyle(const RsPeerId &peerId, const QString &name, RSStyle &style);
|
||||||
void setStyle(const std::string &peerId, const QString &name, RSStyle &style);
|
void setStyle(const RsPeerId &peerId, const QString &name, RSStyle &style);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Default constructor. */
|
/** Default constructor. */
|
||||||
RsharePeerSettings();
|
RsharePeerSettings();
|
||||||
|
|
||||||
bool getSettingsIdOfPeerId(const std::string &peerId, std::string &settingsId);
|
bool getSettingsIdOfPeerId(const RsPeerId &peerId, std::string &settingsId);
|
||||||
void cleanDeadIds();
|
void cleanDeadIds();
|
||||||
|
|
||||||
/* get value of peer */
|
/* get value of peer */
|
||||||
QVariant get(const std::string &peerId, const QString &key, const QVariant &defaultValue = QVariant());
|
QVariant get(const RsPeerId &peerId, const QString &key, const QVariant &defaultValue = QVariant());
|
||||||
/* set value of peer */
|
/* set value of peer */
|
||||||
void set(const std::string &peerId, const QString &key, const QVariant &value);
|
void set(const RsPeerId &peerId, const QString &key, const QVariant &value);
|
||||||
|
|
||||||
/* map for fast access of the gpg id to the ssl id */
|
/* map for fast access of the gpg id to the ssl id */
|
||||||
std::map<std::string, std::string> m_SslToGpg;
|
std::map<RsPeerId, std::string> m_SslToGpg;
|
||||||
};
|
};
|
||||||
|
|
||||||
// the one and only global settings object
|
// the one and only global settings object
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue