mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-15 09:36:23 -04:00
ID cleaning. Saving progress
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-IdCleaning@7117 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
65ccabced7
commit
e865b0b7c3
23 changed files with 89 additions and 86 deletions
|
@ -227,7 +227,7 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
|
||||||
int nb_src = 0 ;
|
int nb_src = 0 ;
|
||||||
int chunk_num = (int)floor(i/float(availability_map_size_X)*(nb_chunks-1)) ;
|
int chunk_num = (int)floor(i/float(availability_map_size_X)*(nb_chunks-1)) ;
|
||||||
|
|
||||||
for(std::map<std::string,CompressedChunkMap>::const_iterator it(info.compressed_peer_availability_maps.begin());it!=info.compressed_peer_availability_maps.end();++it)
|
for(std::map<RsPeerId,CompressedChunkMap>::const_iterator it(info.compressed_peer_availability_maps.begin());it!=info.compressed_peer_availability_maps.end();++it)
|
||||||
nb_src += it->second[chunk_num] ;
|
nb_src += it->second[chunk_num] ;
|
||||||
|
|
||||||
painter->setPen(QColor::fromHsv(200,std::min(255,50*nb_src),200)) ; // the more sources, the more saturated
|
painter->setPen(QColor::fromHsv(200,std::min(255,50*nb_src),200)) ; // the more sources, the more saturated
|
||||||
|
|
|
@ -1034,7 +1034,7 @@ int TransfersDialog::addItem(int row, const FileInfo &fileInfo)
|
||||||
|
|
||||||
QString peerName = getPeerName(transferInfo.peerId);
|
QString peerName = getPeerName(transferInfo.peerId);
|
||||||
//unique combination: fileHash + peerId, variant: hash + peerName (too long)
|
//unique combination: fileHash + peerId, variant: hash + peerName (too long)
|
||||||
QString hashFileAndPeerId = fileHash + QString::fromStdString(transferInfo.peerId);
|
QString hashFileAndPeerId = fileHash + QString::fromStdString(transferInfo.peerId.toStdString());
|
||||||
QString version;
|
QString version;
|
||||||
std::string rsversion;
|
std::string rsversion;
|
||||||
if (rsDisc->getPeerVersion(transferInfo.peerId, rsversion))
|
if (rsDisc->getPeerVersion(transferInfo.peerId, rsversion))
|
||||||
|
@ -1309,7 +1309,7 @@ void TransfersDialog::insertTransfers()
|
||||||
std::list<std::string> upHashes;
|
std::list<std::string> upHashes;
|
||||||
rsFiles->FileUploads(upHashes);
|
rsFiles->FileUploads(upHashes);
|
||||||
|
|
||||||
std::string ownId = rsPeers->getOwnId();
|
RsPeerId ownId = rsPeers->getOwnId();
|
||||||
|
|
||||||
std::set<std::string> used_hashes ;
|
std::set<std::string> used_hashes ;
|
||||||
|
|
||||||
|
@ -1376,9 +1376,9 @@ void TransfersDialog::insertTransfers()
|
||||||
pinfo.progress = (info.size>0)?((pit->transfered % chunk_size)*100.0/info.size):0 ;
|
pinfo.progress = (info.size>0)?((pit->transfered % chunk_size)*100.0/info.size):0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
addUploadItem("", fileName, fileHash, fileSize, pinfo, dlspeed, source,QString::fromStdString(pit->peerId), status, completed, remaining);
|
addUploadItem("", fileName, fileHash, fileSize, pinfo, dlspeed, source,QString::fromStdString(pit->peerId.toStdString()), status, completed, remaining);
|
||||||
|
|
||||||
used_hashes.insert(fileHash.toStdString() + pit->peerId) ;
|
used_hashes.insert(fileHash.toStdString() + pit->peerId.toStdString()) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1402,7 +1402,7 @@ void TransfersDialog::insertTransfers()
|
||||||
ui.uploadsList->setSortingEnabled(true);
|
ui.uploadsList->setSortingEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TransfersDialog::getPeerName(const std::string& id) const
|
QString TransfersDialog::getPeerName(const RsPeerId& id) const
|
||||||
{
|
{
|
||||||
QString res = QString::fromUtf8(rsPeers->getPeerName(id).c_str()) ;
|
QString res = QString::fromUtf8(rsPeers->getPeerName(id).c_str()) ;
|
||||||
|
|
||||||
|
@ -1410,7 +1410,7 @@ QString TransfersDialog::getPeerName(const std::string& id) const
|
||||||
// connect mgr). In such a case their id can suitably hold for a name.
|
// connect mgr). In such a case their id can suitably hold for a name.
|
||||||
//
|
//
|
||||||
if(res == "")
|
if(res == "")
|
||||||
return QString::fromStdString(id) ;
|
return QString::fromStdString(id.toStdString()) ;
|
||||||
else
|
else
|
||||||
return res ;
|
return res ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ signals:
|
||||||
void playFiles(QStringList files);
|
void playFiles(QStringList files);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString getPeerName(const std::string& peer_id) const ;
|
QString getPeerName(const RsPeerId &peer_id) const ;
|
||||||
|
|
||||||
QStandardItemModel *DLListModel;
|
QStandardItemModel *DLListModel;
|
||||||
QStandardItemModel *ULListModel;
|
QStandardItemModel *ULListModel;
|
||||||
|
|
|
@ -83,11 +83,11 @@ void TurtleRouterDialog::updateDisplay()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TurtleRouterDialog::getPeerName(const std::string& peer_id)
|
QString TurtleRouterDialog::getPeerName(const RsPeerId& peer_id)
|
||||||
{
|
{
|
||||||
static std::map<std::string, QString> names ;
|
static std::map<RsPeerId, QString> names ;
|
||||||
|
|
||||||
std::map<std::string,QString>::const_iterator it = names.find(peer_id) ;
|
std::map<RsPeerId,QString>::const_iterator it = names.find(peer_id) ;
|
||||||
|
|
||||||
if( it != names.end())
|
if( it != names.end())
|
||||||
return it->second ;
|
return it->second ;
|
||||||
|
|
|
@ -14,7 +14,7 @@ class TurtleRouterDialog: public RsAutoUpdatePage, public Ui::TurtleRouterDialog
|
||||||
~TurtleRouterDialog();
|
~TurtleRouterDialog();
|
||||||
|
|
||||||
// Cache for peer names.
|
// Cache for peer names.
|
||||||
static QString getPeerName(const std::string& peer_id) ;
|
static QString getPeerName(const RsPeerId &peer_id) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateTunnelRequests( const std::vector<std::vector<std::basic_string<char> > >&,
|
void updateTunnelRequests( const std::vector<std::vector<std::basic_string<char> > >&,
|
||||||
|
|
|
@ -63,9 +63,9 @@ class TRHistogram
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
ox += 10 ;
|
ox += 10 ;
|
||||||
std::map<std::string,std::vector<int> > hits ;
|
std::map<RsPeerId,std::vector<int> > hits ;
|
||||||
std::map<std::string,std::vector<int> > depths ;
|
std::map<RsPeerId,std::vector<int> > depths ;
|
||||||
std::map<std::string,std::vector<int> >::iterator it ;
|
std::map<RsPeerId,std::vector<int> >::iterator it ;
|
||||||
|
|
||||||
int max_hits = 1;
|
int max_hits = 1;
|
||||||
int max_depth = 1;
|
int max_depth = 1;
|
||||||
|
@ -241,11 +241,11 @@ void TurtleRouterStatistics::updateDisplay()
|
||||||
_tst_CW->update();
|
_tst_CW->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TurtleRouterStatistics::getPeerName(const std::string& peer_id)
|
QString TurtleRouterStatistics::getPeerName(const RsPeerId &peer_id)
|
||||||
{
|
{
|
||||||
static std::map<std::string, QString> names ;
|
static std::map<RsPeerId, QString> names ;
|
||||||
|
|
||||||
std::map<std::string,QString>::const_iterator it = names.find(peer_id) ;
|
std::map<RsPeerId,QString>::const_iterator it = names.find(peer_id) ;
|
||||||
|
|
||||||
if( it != names.end())
|
if( it != names.end())
|
||||||
return it->second ;
|
return it->second ;
|
||||||
|
|
|
@ -37,7 +37,7 @@ class TurtleRouterStatistics: public RsAutoUpdatePage, public Ui::TurtleRouterSt
|
||||||
~TurtleRouterStatistics();
|
~TurtleRouterStatistics();
|
||||||
|
|
||||||
// Cache for peer names.
|
// Cache for peer names.
|
||||||
static QString getPeerName(const std::string& peer_id) ;
|
static QString getPeerName(const RsPeerId& peer_id) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -873,7 +873,7 @@ void FriendsDialog::setCurrentFileName(const QString &fileName)
|
||||||
|
|
||||||
void FriendsDialog::on_actionMessageHistory_triggered()
|
void FriendsDialog::on_actionMessageHistory_triggered()
|
||||||
{
|
{
|
||||||
ImHistoryBrowser imBrowser("", ui.lineEdit, this);
|
ImHistoryBrowser imBrowser(RsPeerId(), ui.lineEdit, this);
|
||||||
imBrowser.exec();
|
imBrowser.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1263,10 +1263,10 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string hash ;
|
DistantChatPeerId dpid ;
|
||||||
uint32_t error_code ;
|
uint32_t error_code ;
|
||||||
|
|
||||||
if(!rsMsgs->initiateDistantChatConnexion(link._encrypted_chat_info.toStdString(),link._time_stamp,hash,error_code))
|
if(!rsMsgs->initiateDistantChatConnexion(link._encrypted_chat_info.toStdString(),link._time_stamp,dpid,error_code))
|
||||||
{
|
{
|
||||||
QString error_msg ;
|
QString error_msg ;
|
||||||
switch(error_code)
|
switch(error_code)
|
||||||
|
@ -1283,7 +1283,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||||
if(error_code == RS_DISTANT_CHAT_ERROR_UNKNOWN_KEY)
|
if(error_code == RS_DISTANT_CHAT_ERROR_UNKNOWN_KEY)
|
||||||
QMessageBox::information(NULL,QObject::tr("Chat connection is unauthenticated"),QObject::tr("Signature check failed!\nMake sure you know who you're talking to.")) ;
|
QMessageBox::information(NULL,QObject::tr("Chat connection is unauthenticated"),QObject::tr("Signature check failed!\nMake sure you know who you're talking to.")) ;
|
||||||
|
|
||||||
ChatDialog::chatFriend(hash);
|
ChatDialog::chatFriend(dpid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
|
@ -61,7 +61,7 @@ void ChatDialog::closeEvent(QCloseEvent *event)
|
||||||
emit dialogClose(this);
|
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;
|
this->peerId = peerId;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ 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<std::string, ChatDialog*>::iterator it;
|
||||||
if (chatDialogs.end() != (it = chatDialogs.find(peerId))) {
|
if (chatDialogs.end() != (it = chatDialogs.find(peerId))) {
|
||||||
|
@ -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);
|
ChatDialog *chatDialog = getExistingChat(peerId);
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ 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.empty()){
|
||||||
return;
|
return;
|
||||||
|
@ -298,7 +298,7 @@ bool ChatDialog::hasNewMessages()
|
||||||
|
|
||||||
return false;
|
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() ) ;
|
return QString::fromUtf8( rsPeers->getPeerName(id).c_str() ) ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,11 @@ class ChatDialog : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ChatDialog *getExistingChat(const std::string &peerId);
|
static ChatDialog *getExistingChat(const RsPeerId &peerId);
|
||||||
static ChatDialog *getChat(const std::string &peerId, uint chatflags);
|
static ChatDialog *getChat(const RsPeerId &peerId, uint chatflags);
|
||||||
static void cleanupChat();
|
static void cleanupChat();
|
||||||
static void chatFriend(const std::string &peerId, bool forceFocus = true);
|
static void chatFriend(const RsPeerId &peerId, bool forceFocus = true);
|
||||||
static void closeChat(const std::string &peerId);
|
static void closeChat(const RsPeerId &peerId);
|
||||||
static void chatChanged(int list, int type);
|
static void chatChanged(int list, int type);
|
||||||
|
|
||||||
virtual void showDialog(uint /*chatflags*/) {}
|
virtual void showDialog(uint /*chatflags*/) {}
|
||||||
|
@ -50,7 +50,7 @@ public:
|
||||||
void addToParent(QWidget *newParent);
|
void addToParent(QWidget *newParent);
|
||||||
void removeFromParent(QWidget *oldParent);
|
void removeFromParent(QWidget *oldParent);
|
||||||
|
|
||||||
std::string getPeerId() { return peerId; }
|
RsPeerId getPeerId() { return peerId; }
|
||||||
QString getTitle();
|
QString getTitle();
|
||||||
bool hasNewMessages();
|
bool hasNewMessages();
|
||||||
bool isTyping();
|
bool isTyping();
|
||||||
|
@ -80,14 +80,14 @@ protected:
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
virtual bool canClose() { return true; }
|
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 onChatChanged(int /*list*/, int /*type*/) {}
|
||||||
|
|
||||||
virtual void addIncomingChatMsg(const ChatInfo& info) = 0;
|
virtual void addIncomingChatMsg(const ChatInfo& info) = 0;
|
||||||
|
|
||||||
std::string peerId;
|
RsPeerId peerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHATDIALOG_H
|
#endif // CHATDIALOG_H
|
||||||
|
|
|
@ -179,7 +179,7 @@ void ChatWidget::init(const std::string &peerId, const QString &title)
|
||||||
|
|
||||||
ui->titleLabel->setText(RsHtml::plainText(title));
|
ui->titleLabel->setText(RsHtml::plainText(title));
|
||||||
|
|
||||||
std::string ownId = rsPeers->getOwnId();
|
RsPeerId ownId = rsPeers->getOwnId();
|
||||||
setName(QString::fromUtf8(rsPeers->getPeerName(ownId).c_str()));
|
setName(QString::fromUtf8(rsPeers->getPeerName(ownId).c_str()));
|
||||||
|
|
||||||
ChatLobbyId lid;
|
ChatLobbyId lid;
|
||||||
|
|
|
@ -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)));
|
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);
|
ChatDialog::init(peerId, title);
|
||||||
|
|
||||||
/* Hide or show the avatar frames */
|
/* Hide or show the avatar frames */
|
||||||
showAvatarFrame(PeerSettings->getShowAvatarFrame(peerId));
|
showAvatarFrame(PeerSettings->getShowAvatarFrame(peerId.toStdString()));
|
||||||
|
|
||||||
ui.avatarWidget->setFrameType(AvatarWidget::STATUS_FRAME);
|
ui.avatarWidget->setFrameType(AvatarWidget::STATUS_FRAME);
|
||||||
ui.avatarWidget->setId(peerId, false);
|
ui.avatarWidget->setId(peerId.toStdString(), false);
|
||||||
|
|
||||||
ui.ownAvatarWidget->setFrameType(AvatarWidget::STATUS_FRAME);
|
ui.ownAvatarWidget->setFrameType(AvatarWidget::STATUS_FRAME);
|
||||||
ui.ownAvatarWidget->setOwnId();
|
ui.ownAvatarWidget->setOwnId();
|
||||||
|
@ -121,8 +121,8 @@ void PopupChatDialog::showDialog(uint chatflags)
|
||||||
//
|
//
|
||||||
void PopupChatDialog::chatStatusChanged(const QString &peerId, const QString& statusString, bool isPrivateChat)
|
void PopupChatDialog::chatStatusChanged(const QString &peerId, const QString& statusString, bool isPrivateChat)
|
||||||
{
|
{
|
||||||
if (isPrivateChat && this->peerId == peerId.toStdString()) {
|
if (isPrivateChat && this->peerId == RsPeerId(peerId.toStdString())) {
|
||||||
ui.chatWidget->updateStatusString(getPeerName(peerId.toStdString()) + " %1", statusString);
|
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"));
|
ui.avatarFrameButton->setIcon(QIcon(":images/show_toolbox_frame.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerSettings->setShowAvatarFrame(getPeerId(), show);
|
PeerSettings->setShowAvatarFrame(getPeerId().toStdString(), show);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::clearOfflineMessages()
|
void PopupChatDialog::clearOfflineMessages()
|
||||||
|
|
|
@ -45,7 +45,7 @@ protected:
|
||||||
/** Default destructor */
|
/** Default destructor */
|
||||||
virtual ~PopupChatDialog();
|
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 void showDialog(uint chatflags);
|
||||||
virtual ChatWidget *getChatWidget();
|
virtual ChatWidget *getChatWidget();
|
||||||
virtual bool hasPeerStatus() { return true; }
|
virtual bool hasPeerStatus() { return true; }
|
||||||
|
|
|
@ -125,9 +125,9 @@ void PopupChatWindow::saveSettings()
|
||||||
|
|
||||||
Settings->setValueToGroup("ChatWindow", "OnTop", ui.actionSetOnTop->isChecked());
|
Settings->setValueToGroup("ChatWindow", "OnTop", ui.actionSetOnTop->isChecked());
|
||||||
} else {
|
} else {
|
||||||
if (!peerId.empty()) {
|
if (!peerId.isNull()) {
|
||||||
PeerSettings->saveWidgetInformation(peerId, this);
|
PeerSettings->saveWidgetInformation(peerId.toStdString(), this);
|
||||||
PeerSettings->setPrivateChatOnTop(peerId, ui.actionSetOnTop->isChecked());
|
PeerSettings->setPrivateChatOnTop(peerId.toStdString(), 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, this);
|
PeerSettings->loadWidgetInformation(peerId.toStdString(), 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));
|
ui.actionSetOnTop->setChecked(PeerSettings->getPrivateChatOnTop(peerId.toStdString()));
|
||||||
|
|
||||||
QObject::connect(dialog, SIGNAL(dialogClose(ChatDialog*)), this, SLOT(dialogClose(ChatDialog*)));
|
QObject::connect(dialog, SIGNAL(dialogClose(ChatDialog*)), this, SLOT(dialogClose(ChatDialog*)));
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ void PopupChatWindow::removeDialog(ChatDialog *dialog)
|
||||||
dialog->removeFromParent(this);
|
dialog->removeFromParent(this);
|
||||||
ui.horizontalLayout->removeWidget(dialog);
|
ui.horizontalLayout->removeWidget(dialog);
|
||||||
chatDialog = NULL;
|
chatDialog = NULL;
|
||||||
peerId.erase();
|
peerId.clear();
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "ui_PopupChatWindow.h"
|
#include "ui_PopupChatWindow.h"
|
||||||
|
#include <retroshare/rstypes.h>
|
||||||
|
|
||||||
class ChatDialog;
|
class ChatDialog;
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
bool tabbedWindow;
|
bool tabbedWindow;
|
||||||
bool firstShow;
|
bool firstShow;
|
||||||
std::string peerId;
|
RsPeerId peerId;
|
||||||
ChatDialog *chatDialog;
|
ChatDialog *chatDialog;
|
||||||
QIcon mBlinkIcon;
|
QIcon mBlinkIcon;
|
||||||
QIcon *mEmptyIcon;
|
QIcon *mEmptyIcon;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include <retroshare/rsstatus.h>
|
#include <retroshare/rsstatus.h>
|
||||||
|
#include <retroshare/rspeers.h>
|
||||||
|
|
||||||
#include "RsAutoUpdatePage.h"
|
#include "RsAutoUpdatePage.h"
|
||||||
#include "PopupDistantChatDialog.h"
|
#include "PopupDistantChatDialog.h"
|
||||||
|
@ -54,10 +55,10 @@ PopupDistantChatDialog::PopupDistantChatDialog(QWidget *parent, Qt::WindowFlags
|
||||||
updateDisplay() ;
|
updateDisplay() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupDistantChatDialog::init(const std::string& hash,const QString & title)
|
void PopupDistantChatDialog::init(const DistantChatPeerId& pid,const QString & title)
|
||||||
{
|
{
|
||||||
_hash = hash ;
|
_pid = pid ;
|
||||||
PopupChatDialog::init(hash,title) ;
|
PopupChatDialog::init(pid,title) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupDistantChatDialog::updateDisplay()
|
void PopupDistantChatDialog::updateDisplay()
|
||||||
|
@ -73,8 +74,8 @@ void PopupDistantChatDialog::updateDisplay()
|
||||||
//
|
//
|
||||||
|
|
||||||
uint32_t status= RS_DISTANT_CHAT_STATUS_UNKNOWN;
|
uint32_t status= RS_DISTANT_CHAT_STATUS_UNKNOWN;
|
||||||
std::string pgp_id ;
|
RsPgpId pgp_id ;
|
||||||
rsMsgs->getDistantChatStatus(_hash,status,pgp_id) ;
|
rsMsgs->getDistantChatStatus(_pid,status,pgp_id) ;
|
||||||
|
|
||||||
switch(status)
|
switch(status)
|
||||||
{
|
{
|
||||||
|
@ -112,18 +113,18 @@ void PopupDistantChatDialog::updateDisplay()
|
||||||
|
|
||||||
void PopupDistantChatDialog::closeEvent(QCloseEvent *e)
|
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;
|
uint32_t status= RS_DISTANT_CHAT_STATUS_UNKNOWN;
|
||||||
std::string pgp_id ;
|
RsPgpId pgp_id ;
|
||||||
rsMsgs->getDistantChatStatus(_hash,status,pgp_id) ;
|
rsMsgs->getDistantChatStatus(_pid,status,pgp_id) ;
|
||||||
|
|
||||||
if(status != RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED)
|
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.") ;
|
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))
|
if(QMessageBox::Ok == QMessageBox::critical(NULL,tr("Kill the tunnel?"),msg, QMessageBox::Ok | QMessageBox::Cancel))
|
||||||
rsMsgs->closeDistantChatConnexion(_hash) ;
|
rsMsgs->closeDistantChatConnexion(_pid) ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
e->ignore() ;
|
e->ignore() ;
|
||||||
|
@ -136,13 +137,13 @@ void PopupDistantChatDialog::closeEvent(QCloseEvent *e)
|
||||||
PopupChatDialog::closeEvent(e) ;
|
PopupChatDialog::closeEvent(e) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PopupDistantChatDialog::getPeerName(const std::string& id) const
|
QString PopupDistantChatDialog::getPeerName(const DistantChatPeerId &id) const
|
||||||
{
|
{
|
||||||
uint32_t status ;
|
uint32_t status ;
|
||||||
std::string pgp_id ;
|
RsPgpId pgp_id ;
|
||||||
|
|
||||||
if(rsMsgs->getDistantChatStatus(_hash,status,pgp_id))
|
if(rsMsgs->getDistantChatStatus(id,status,pgp_id))
|
||||||
return ChatDialog::getPeerName(pgp_id) ;
|
return QString::fromStdString(rsPeers->getGPGName(pgp_id)) ;
|
||||||
else
|
else
|
||||||
return ChatDialog::getPeerName(id) ;
|
return ChatDialog::getPeerName(id) ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,18 +39,17 @@ class PopupDistantChatDialog: public PopupChatDialog
|
||||||
/** Default destructor */
|
/** Default destructor */
|
||||||
virtual ~PopupDistantChatDialog();
|
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 void closeEvent(QCloseEvent *e) ;
|
||||||
|
|
||||||
virtual QString getPeerName(const std::string& id) const ;
|
virtual QString getPeerName(const DistantChatPeerId& id) const ;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void updateDisplay() ; // overloads RsAutoUpdatePage
|
void updateDisplay() ; // overloads RsAutoUpdatePage
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTimer *_update_timer ;
|
QTimer *_update_timer ;
|
||||||
std::string _hash ;
|
DistantChatPeerId _pid ;
|
||||||
std::string _virtual_peer_id ;
|
|
||||||
QLabel *_status_label ;
|
QLabel *_status_label ;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
#define ROLE_PLAINTEXT Qt::UserRole + 1
|
#define ROLE_PLAINTEXT Qt::UserRole + 1
|
||||||
#define ROLE_OFFLINE Qt::UserRole + 2
|
#define ROLE_OFFLINE Qt::UserRole + 2
|
||||||
|
|
||||||
ImHistoryBrowserCreateItemsThread::ImHistoryBrowserCreateItemsThread(ImHistoryBrowser *parent, const std::string& peerId)
|
ImHistoryBrowserCreateItemsThread::ImHistoryBrowserCreateItemsThread(ImHistoryBrowser *parent, const RsPeerId& peerId)
|
||||||
: QThread(parent)
|
: QThread(parent)
|
||||||
{
|
{
|
||||||
m_peerId = peerId;
|
m_peerId = peerId;
|
||||||
|
@ -91,7 +91,7 @@ void ImHistoryBrowserCreateItemsThread::run()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Default constructor */
|
/** Default constructor */
|
||||||
ImHistoryBrowser::ImHistoryBrowser(const std::string &peerId, QTextEdit *edit, QWidget *parent)
|
ImHistoryBrowser::ImHistoryBrowser(const RsPeerId &peerId, QTextEdit *edit, QWidget *parent)
|
||||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
||||||
{
|
{
|
||||||
/* Invoke Qt Designer generated QObject setup routine */
|
/* Invoke Qt Designer generated QObject setup routine */
|
||||||
|
@ -101,7 +101,7 @@ ImHistoryBrowser::ImHistoryBrowser(const std::string &peerId, QTextEdit *edit, Q
|
||||||
ui.headerFrame->setHeaderText(tr("Message History"));
|
ui.headerFrame->setHeaderText(tr("Message History"));
|
||||||
|
|
||||||
m_peerId = peerId;
|
m_peerId = peerId;
|
||||||
m_isPrivateChat = !m_peerId.empty();
|
m_isPrivateChat = !m_peerId.isNull();
|
||||||
textEdit = edit;
|
textEdit = edit;
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(historyChanged(uint, int)), this, SLOT(historyChanged(uint, int)));
|
connect(NotifyQt::getInstance(), SIGNAL(historyChanged(uint, int)), this, SLOT(historyChanged(uint, int)));
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ImHistoryBrowser : public QDialog
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default constructor */
|
/** Default constructor */
|
||||||
ImHistoryBrowser(const std::string &peerId, QTextEdit *edit, QWidget *parent = 0);
|
ImHistoryBrowser(const RsPeerId &peerId, QTextEdit *edit, QWidget *parent = 0);
|
||||||
/** Default destructor */
|
/** Default destructor */
|
||||||
virtual ~ImHistoryBrowser();
|
virtual ~ImHistoryBrowser();
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ private:
|
||||||
|
|
||||||
ImHistoryBrowserCreateItemsThread *m_createThread;
|
ImHistoryBrowserCreateItemsThread *m_createThread;
|
||||||
|
|
||||||
std::string m_peerId;
|
RsPeerId m_peerId;
|
||||||
bool m_isPrivateChat;
|
bool m_isPrivateChat;
|
||||||
QTextEdit *textEdit;
|
QTextEdit *textEdit;
|
||||||
bool embedSmileys;
|
bool embedSmileys;
|
||||||
|
@ -95,7 +95,7 @@ class ImHistoryBrowserCreateItemsThread : public QThread
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ImHistoryBrowserCreateItemsThread(ImHistoryBrowser *parent, const std::string& peerId);
|
ImHistoryBrowserCreateItemsThread(ImHistoryBrowser *parent, const RsPeerId &peerId);
|
||||||
~ImHistoryBrowserCreateItemsThread();
|
~ImHistoryBrowserCreateItemsThread();
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
|
|
@ -811,7 +811,7 @@ void NotifyQt::UpdateGUI()
|
||||||
case RS_POPUP_CHAT:
|
case RS_POPUP_CHAT:
|
||||||
if (popupflags & RS_POPUP_CHAT)
|
if (popupflags & RS_POPUP_CHAT)
|
||||||
{
|
{
|
||||||
ChatDialog *chatDialog = ChatDialog::getChat(id, 0);
|
ChatDialog *chatDialog = ChatDialog::getChat(RsPeerId(id), 0);
|
||||||
ChatWidget *chatWidget;
|
ChatWidget *chatWidget;
|
||||||
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) {
|
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) {
|
||||||
// do not show when active
|
// do not show when active
|
||||||
|
@ -838,7 +838,7 @@ void NotifyQt::UpdateGUI()
|
||||||
case RS_POPUP_CHATLOBBY:
|
case RS_POPUP_CHATLOBBY:
|
||||||
if (popupflags & RS_POPUP_CHATLOBBY)
|
if (popupflags & RS_POPUP_CHATLOBBY)
|
||||||
{
|
{
|
||||||
ChatDialog *chatDialog = ChatDialog::getChat(id, 0);
|
ChatDialog *chatDialog = ChatDialog::getChat(RsPeerId(id), 0);
|
||||||
ChatWidget *chatWidget;
|
ChatWidget *chatWidget;
|
||||||
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) {
|
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) {
|
||||||
// do not show when active
|
// do not show when active
|
||||||
|
|
|
@ -96,15 +96,15 @@ void ProfileManager::fillIdentities()
|
||||||
|
|
||||||
QTreeWidgetItem *item;
|
QTreeWidgetItem *item;
|
||||||
|
|
||||||
std::list<std::string> pgpIds;
|
std::list<RsPgpId> pgpIds;
|
||||||
std::list<std::string>::iterator it;
|
std::list<RsPgpId>::iterator it;
|
||||||
|
|
||||||
if (RsAccounts::GetPGPLogins(pgpIds)) {
|
if (RsAccounts::GetPGPLogins(pgpIds)) {
|
||||||
for (it = pgpIds.begin(); it != pgpIds.end(); it++) {
|
for (it = pgpIds.begin(); it != pgpIds.end(); it++) {
|
||||||
std::string name, email;
|
std::string name, email;
|
||||||
RsAccounts::GetPGPLoginDetails(*it, name, email);
|
RsAccounts::GetPGPLoginDetails(*it, name, email);
|
||||||
std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl;
|
std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl;
|
||||||
QString gid = QString::fromStdString(*it);
|
QString gid = QString::fromStdString((*it).toStdString());
|
||||||
|
|
||||||
item = new RSTreeWidgetItem(NULL, 0);
|
item = new RSTreeWidgetItem(NULL, 0);
|
||||||
item -> setText(COLUMN_NAME, QString::fromUtf8(name.c_str()));
|
item -> setText(COLUMN_NAME, QString::fromUtf8(name.c_str()));
|
||||||
|
@ -125,8 +125,8 @@ void ProfileManager::exportIdentity()
|
||||||
if (!item)
|
if (!item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string gpgId = item->text(COLUMN_GID).toStdString();
|
RsPgpId gpgId(item->text(COLUMN_GID).toStdString());
|
||||||
if (gpgId.empty())
|
if (gpgId.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString fname = QFileDialog::getSaveFileName(this, tr("Export Identity"), "", tr("RetroShare Identity files (*.asc)"));
|
QString fname = QFileDialog::getSaveFileName(this, tr("Export Identity"), "", tr("RetroShare Identity files (*.asc)"));
|
||||||
|
@ -151,7 +151,7 @@ void ProfileManager::importIdentity()
|
||||||
if(fname.isNull())
|
if(fname.isNull())
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
std::string gpg_id ;
|
RsPgpId gpg_id ;
|
||||||
std::string err_string ;
|
std::string err_string ;
|
||||||
|
|
||||||
if(!RsAccounts::ImportIdentity(fname.toUtf8().constData(),gpg_id,err_string))
|
if(!RsAccounts::ImportIdentity(fname.toUtf8().constData(),gpg_id,err_string))
|
||||||
|
@ -166,7 +166,9 @@ void ProfileManager::importIdentity()
|
||||||
RsAccounts::GetPGPLoginDetails(gpg_id, name, email);
|
RsAccounts::GetPGPLoginDetails(gpg_id, name, email);
|
||||||
std::cerr << "Adding PGPUser: " << name << " id: " << gpg_id << std::endl;
|
std::cerr << "Adding PGPUser: " << name << " id: " << gpg_id << std::endl;
|
||||||
|
|
||||||
QMessageBox::information(this,tr("New identity imported"),tr("Your identity was imported successfully:")+" \n"+"\nName :"+QString::fromStdString(name)+"\nemail: " + QString::fromStdString(email)+"\nKey ID: "+QString::fromStdString(gpg_id)+"\n\n"+tr("You can use it now to create a new location.")) ;
|
QMessageBox::information(this,tr("New identity imported"),tr("Your identity was imported successfully:")+" \n"+"\nName :"
|
||||||
|
+QString::fromStdString(name)+"\nemail: " + QString::fromStdString(email)+"\nKey ID: "
|
||||||
|
+QString::fromStdString(gpg_id.toStdString())+"\n\n"+tr("You can use it now to create a new location.")) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
fillIdentities();
|
fillIdentities();
|
||||||
|
|
|
@ -56,7 +56,7 @@ void ProfileWidget::showEvent ( QShowEvent * /*event*/ )
|
||||||
ui.name->setText(QString::fromUtf8(detail.name.c_str()));
|
ui.name->setText(QString::fromUtf8(detail.name.c_str()));
|
||||||
ui.country->setText(QString::fromUtf8(detail.location.c_str()));
|
ui.country->setText(QString::fromUtf8(detail.location.c_str()));
|
||||||
|
|
||||||
ui.peerid->setText(QString::fromStdString(detail.id));
|
ui.peerid->setText(QString::fromStdString(detail.id.toStdString()));
|
||||||
|
|
||||||
/* set retroshare version */
|
/* set retroshare version */
|
||||||
std::string version;
|
std::string version;
|
||||||
|
@ -77,7 +77,7 @@ void ProfileWidget::showEvent ( QShowEvent * /*event*/ )
|
||||||
ui.dyndns->setText(QString::fromStdString(detail.dyndns));
|
ui.dyndns->setText(QString::fromStdString(detail.dyndns));
|
||||||
ui.dyndns->setCursorPosition (0);
|
ui.dyndns->setCursorPosition (0);
|
||||||
|
|
||||||
std::list<std::string> ids;
|
std::list<RsPgpId> ids;
|
||||||
ids.clear();
|
ids.clear();
|
||||||
rsPeers->getGPGAcceptedList(ids);
|
rsPeers->getGPGAcceptedList(ids);
|
||||||
int friends = ids.size();
|
int friends = ids.size();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue