* Cleaned up more debug output.

* Fixed Popup Chats with new Peer Dialog.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@645 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-07-10 18:52:56 +00:00
parent d36b15d526
commit 67a27744f8
8 changed files with 65 additions and 41 deletions

View file

@ -145,7 +145,7 @@ void ChatDialog::insertChat()
for(it = newchat.begin(); it != newchat.end(); it++) for(it = newchat.begin(); it != newchat.end(); it++)
{ {
std::string msg(it->msg.begin(), it->msg.end()); std::string msg(it->msg.begin(), it->msg.end());
std::cerr << "ChatDialog::insertChat(): " << msg << std::endl; //std::cerr << "ChatDialog::insertChat(): " << msg << std::endl;
/* are they private? */ /* are they private? */
if (it->chatflags & RS_CHAT_PRIVATE) if (it->chatflags & RS_CHAT_PRIVATE)
@ -219,7 +219,7 @@ void ChatDialog::sendMsg()
ci.chatflags = RS_CHAT_PUBLIC; ci.chatflags = RS_CHAT_PUBLIC;
std::string msg(ci.msg.begin(), ci.msg.end()); std::string msg(ci.msg.begin(), ci.msg.end());
std::cerr << "ChatDialog::sendMsg(): " << msg << std::endl; //std::cerr << "ChatDialog::sendMsg(): " << msg << std::endl;
rsMsgs -> ChatSend(ci); rsMsgs -> ChatSend(ci);
ui.lineEdit->clear(); ui.lineEdit->clear();
@ -301,7 +301,7 @@ void ChatDialog::insertSendList()
void ChatDialog::toggleSendItem( QTreeWidgetItem *item, int col ) void ChatDialog::toggleSendItem( QTreeWidgetItem *item, int col )
{ {
std::cerr << "ToggleSendItem()" << std::endl; //std::cerr << "ToggleSendItem()" << std::endl;
/* extract id */ /* extract id */
std::string id = (item -> text(4)).toStdString(); std::string id = (item -> text(4)).toStdString();

View file

@ -198,8 +198,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
// createPageAction(QIcon(IMAGE_STATISTIC), tr("Statistics"), grp)); // createPageAction(QIcon(IMAGE_STATISTIC), tr("Statistics"), grp));
/* also an empty list of chat windows */ /* also an empty list of chat windows */
peersDialog->setChatDialog(chatDialog); messengerWindow->setChatDialog(peersDialog);
messengerWindow->setChatDialog(chatDialog);
/* Create the toolbar */ /* Create the toolbar */
ui.toolBar->addActions(grp->actions()); ui.toolBar->addActions(grp->actions());
@ -691,8 +690,15 @@ void MainWindow::showsmplayer()
void MainWindow::playFiles(QStringList files) void MainWindow::playFiles(QStringList files)
{ {
std::cerr << "MainWindow::playFiles()" << std::endl;
showsmplayer(); showsmplayer();
std::cerr << "MainWindow::playFiles() showsmplayer() done" << std::endl;
mSMPlayer->gui()->openFiles(files); mSMPlayer->gui()->openFiles(files);
std::cerr << "MainWindow::playFiles() done" << std::endl;
} }

View file

@ -31,7 +31,7 @@
#include "chat/PopupChatDialog.h" #include "chat/PopupChatDialog.h"
#include "msgs/ChanMsgDialog.h" #include "msgs/ChanMsgDialog.h"
#include "ChatDialog.h" #include "PeersDialog.h"
#include "connect/ConfCertDialog.h" #include "connect/ConfCertDialog.h"
#include "util/PixmapMerging.h" #include "util/PixmapMerging.h"
#include "LogoBar.h" #include "LogoBar.h"
@ -359,7 +359,7 @@ void MessengerWindow::closeEvent (QCloseEvent * event)
void MessengerWindow::setChatDialog(ChatDialog *cd) void MessengerWindow::setChatDialog(PeersDialog *cd)
{ {
chatDialog = cd; chatDialog = cd;
} }

View file

@ -29,7 +29,7 @@
#include <config/rsharesettings.h> #include <config/rsharesettings.h>
class LogoBar; class LogoBar;
class ChatDialog; class PeersDialog;
class MessengerWindow : public QWidget class MessengerWindow : public QWidget
{ {
@ -41,7 +41,7 @@ public:
/** Default Destructor */ /** Default Destructor */
void insertPeers(); void insertPeers();
void setChatDialog(ChatDialog *cd); void setChatDialog(PeersDialog *cd);
NetworkDialog *networkDialog2; NetworkDialog *networkDialog2;
@ -93,7 +93,7 @@ private:
/* (2) Utility Fns */ /* (2) Utility Fns */
QTreeWidgetItem *getCurrentPeer(bool &isOnline); QTreeWidgetItem *getCurrentPeer(bool &isOnline);
ChatDialog *chatDialog; PeersDialog *chatDialog;
/** Define the popup menus for the Context menu */ /** Define the popup menus for the Context menu */
QMenu* contextMnu; QMenu* contextMnu;

View file

@ -423,26 +423,22 @@ void PeersDialog::chatfriend()
return; return;
} }
/*if (detail.state & RS_PEER_STATE_CONNECTED) if (detail.state & RS_PEER_STATE_CONNECTED)
{*/ {
/* must reference ChatDialog */ getPrivateChat(id, name, true);
if (chatDialog) }
{
chatDialog->getPrivateChat(id, name, true);
}
/*}
else else
{*/ {
/* info dialog */ /* info dialog */
// QMessageBox::StandardButton sb = QMessageBox::question ( NULL, QMessageBox::StandardButton sb = QMessageBox::question ( NULL,
// "Friend Not Online", "Friend Not Online",
//"Your Friend is offline \nDo you want to send them a Message instead", "Your Friend is offline \nDo you want to send them a Message instead",
// (QMessageBox::Yes | QMessageBox::No)); (QMessageBox::Yes | QMessageBox::No));
/*if (sb == QMessageBox::Yes) if (sb == QMessageBox::Yes)
{ {
msgfriend(); msgfriend();
} }
}*/ }
return; return;
} }
@ -643,7 +639,9 @@ void PeersDialog::insertChat()
for(it = newchat.begin(); it != newchat.end(); it++) for(it = newchat.begin(); it != newchat.end(); it++)
{ {
std::string msg(it->msg.begin(), it->msg.end()); std::string msg(it->msg.begin(), it->msg.end());
std::cerr << "ChatDialog::insertChat(): " << msg << std::endl; #ifdef PEERS_DEBUG
std::cerr << "PeersDialog::insertChat(): " << msg << std::endl;
#endif
/* are they private? */ /* are they private? */
if (it->chatflags & RS_CHAT_PRIVATE) if (it->chatflags & RS_CHAT_PRIVATE)
@ -717,7 +715,9 @@ void PeersDialog::sendMsg()
ci.chatflags = RS_CHAT_PUBLIC; ci.chatflags = RS_CHAT_PUBLIC;
std::string msg(ci.msg.begin(), ci.msg.end()); std::string msg(ci.msg.begin(), ci.msg.end());
std::cerr << "ChatDialog::sendMsg(): " << msg << std::endl; #ifdef PEERS_DEBUG
std::cerr << "PeersDialog::sendMsg(): " << msg << std::endl;
#endif
rsMsgs -> ChatSend(ci); rsMsgs -> ChatSend(ci);
ui.lineEdit->clear(); ui.lineEdit->clear();
@ -799,7 +799,9 @@ void PeersDialog::insertSendList()
void PeersDialog::toggleSendItem( QTreeWidgetItem *item, int col ) void PeersDialog::toggleSendItem( QTreeWidgetItem *item, int col )
{ {
#ifdef PEERS_DEBUG
std::cerr << "ToggleSendItem()" << std::endl; std::cerr << "ToggleSendItem()" << std::endl;
#endif
/* extract id */ /* extract id */
std::string id = (item -> text(4)).toStdString(); std::string id = (item -> text(4)).toStdString();

View file

@ -218,6 +218,9 @@ void SharedFilesDialog::playselectedfiles()
} }
playFiles(fullpaths); playFiles(fullpaths);
std::cerr << "SharedFilesDialog::playselectedfiles() Completed";
std::cerr << std::endl;
} }

View file

@ -44,6 +44,9 @@
#include <sstream> #include <sstream>
/*****
* #define CHAT_DEBUG 1
*****/
/** Default constructor */ /** Default constructor */
PopupChatDialog::PopupChatDialog(std::string id, std::string name, PopupChatDialog::PopupChatDialog(std::string id, std::string name,
@ -163,7 +166,9 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci)
RsPeerDetails detail; RsPeerDetails detail;
if (!rsPeers->getPeerDetails(dialogId, detail)) if (!rsPeers->getPeerDetails(dialogId, detail))
{ {
#ifdef CHAT_DEBUG
std::cerr << "WARNING CANNOT GET PEER INFO!!!!" << std::endl; std::cerr << "WARNING CANNOT GET PEER INFO!!!!" << std::endl;
#endif
} }
else if (detail.state & RS_PEER_STATE_CONNECTED) else if (detail.state & RS_PEER_STATE_CONNECTED)
{ {
@ -250,7 +255,9 @@ void PopupChatDialog::sendChat()
ci.msg = chatWidget->toHtml().toStdWString(); ci.msg = chatWidget->toHtml().toStdWString();
ci.chatflags = RS_CHAT_PRIVATE; ci.chatflags = RS_CHAT_PRIVATE;
#ifdef CHAT_DEBUG
std::cout << "PopupChatDialog:sendChat " << styleHtm.toStdString() << std::endl; std::cout << "PopupChatDialog:sendChat " << styleHtm.toStdString() << std::endl;
#endif
addChatMsg(&ci); addChatMsg(&ci);
@ -380,7 +387,9 @@ void PopupChatDialog::addSmiley()
QString PopupChatDialog::loadEmptyStyle() QString PopupChatDialog::loadEmptyStyle()
{ {
#ifdef CHAT_DEBUG
std::cout << "PopupChatDialog:loadEmptyStyle " << styleHtm.toStdString() << std::endl; std::cout << "PopupChatDialog:loadEmptyStyle " << styleHtm.toStdString() << std::endl;
#endif
QString ret; QString ret;
QFile file(styleHtm); QFile file(styleHtm);
//file.open(QIODevice::ReadOnly); //file.open(QIODevice::ReadOnly);
@ -397,14 +406,18 @@ QString PopupChatDialog::loadEmptyStyle()
css.close(); css.close();
} }
else { else {
#ifdef CHAT_DEBUG
std::cerr << "PopupChatDialog:loadEmptyStyle " << "Missing file of default css " << std::endl; std::cerr << "PopupChatDialog:loadEmptyStyle " << "Missing file of default css " << std::endl;
#endif
tmp = ""; tmp = "";
} }
ret.replace("%css-style%", tmp); ret.replace("%css-style%", tmp);
return ret; return ret;
} }
else { else {
#ifdef CHAT_DEBUG
std::cerr << "PopupChatDialog:loadEmptyStyle " << "Missing file of default style " << std::endl; std::cerr << "PopupChatDialog:loadEmptyStyle " << "Missing file of default style " << std::endl;
#endif
ret="%timestamp% %name% \n %message% "; ret="%timestamp% %name% \n %message% ";
return ret; return ret;
} }

View file

@ -577,7 +577,7 @@ void ChanMsgDialog::cancelMessage()
/* First the Msg (People) ones */ /* First the Msg (People) ones */
void ChanMsgDialog::togglePersonItem( QTreeWidgetItem *item, int col ) void ChanMsgDialog::togglePersonItem( QTreeWidgetItem *item, int col )
{ {
std::cerr << "TogglePersonItem()" << std::endl; //std::cerr << "TogglePersonItem()" << std::endl;
/* extract id */ /* extract id */
std::string id = (item -> text(1)).toStdString(); std::string id = (item -> text(1)).toStdString();
@ -594,7 +594,7 @@ void ChanMsgDialog::togglePersonItem( QTreeWidgetItem *item, int col )
/* Second the Channel ones */ /* Second the Channel ones */
void ChanMsgDialog::toggleChannelItem( QTreeWidgetItem *item, int col ) void ChanMsgDialog::toggleChannelItem( QTreeWidgetItem *item, int col )
{ {
std::cerr << "ToggleChannelItem()" << std::endl; //std::cerr << "ToggleChannelItem()" << std::endl;
/* extract id */ /* extract id */
std::string id = (item -> text(2)).toStdString(); std::string id = (item -> text(2)).toStdString();
@ -611,7 +611,7 @@ void ChanMsgDialog::toggleChannelItem( QTreeWidgetItem *item, int col )
/* This is actually for both */ /* This is actually for both */
void ChanMsgDialog::toggleRecommendItem( QTreeWidgetItem *item, int col ) void ChanMsgDialog::toggleRecommendItem( QTreeWidgetItem *item, int col )
{ {
std::cerr << "ToggleRecommendItem()" << std::endl; //std::cerr << "ToggleRecommendItem()" << std::endl;
/* extract name */ /* extract name */
std::string id = (item -> text(0)).toStdString(); std::string id = (item -> text(0)).toStdString();