improve peer chat and message composer

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2078 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-01-18 22:50:14 +00:00
parent cd7467e86d
commit c62daadacd
4 changed files with 386 additions and 364 deletions

View File

@ -269,11 +269,8 @@ void PeersDialog::peertreeWidgetCostumPopupMenu( QPoint point )
contextMnu.addAction( collapseAll); contextMnu.addAction( collapseAll);
contextMnu.addSeparator(); contextMnu.addSeparator();
contextMnu.addAction( widgetAction); contextMnu.addAction( widgetAction);
if (c->type() != 0) { contextMnu.addAction( chatAct);
//this is a SSL key contextMnu.addAction( msgAct);
contextMnu.addAction( chatAct);
contextMnu.addAction( msgAct);
}
contextMnu.addAction( configurefriendAct); contextMnu.addAction( configurefriendAct);
//contextMnu.addAction( profileviewAct); //contextMnu.addAction( profileviewAct);
if (c->type() != 0) { if (c->type() != 0) {
@ -565,28 +562,43 @@ void PeersDialog::chatfriend()
if (!i) if (!i)
return; return;
std::string name = (i -> text(2)).toStdString(); //std::string name = (i -> text(2)).toStdString();
std::string id = (i -> text(3)).toStdString(); std::string id = (i -> text(3)).toStdString();
bool oneLocationConnected = false;
RsPeerDetails detail; RsPeerDetails detail;
if (!rsPeers->getPeerDetails(id, detail)) if (!rsPeers->getPeerDetails(id, detail)) {
{
return; return;
} }
if (detail.state & RS_PEER_STATE_CONNECTED) if (detail.isOnlyGPGdetail) {
{ //let's get the ssl child details, and open all the chat boxes
getPrivateChat(id, name, RS_CHAT_REOPEN); std::list<std::string> sslIds;
rsPeers->getSSLChildListOfGPGId(detail.gpg_id, sslIds);
for (std::list<std::string>::iterator it = sslIds.begin(); it != sslIds.end(); it++) {
RsPeerDetails sslDetails;
if (rsPeers->getPeerDetails(*it, sslDetails)) {
if (sslDetails.state & RS_PEER_STATE_CONNECTED) {
oneLocationConnected = true;
getPrivateChat(*it, sslDetails.name + " - " + sslDetails.location, RS_CHAT_REOPEN);
}
}
}
} else {
if (detail.state & RS_PEER_STATE_CONNECTED) {
oneLocationConnected = true;
getPrivateChat(id, detail.name + " - " + detail.location, RS_CHAT_REOPEN);
}
} }
else
{ if (!oneLocationConnected) {
/* 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();
} }
} }
@ -611,6 +623,12 @@ void PeersDialog::msgfriend()
rsicontrol -> ClearInMsg(); rsicontrol -> ClearInMsg();
rsicontrol -> SetInMsg(id, true); rsicontrol -> SetInMsg(id, true);
std::list<std::string> sslIds;
rsPeers->getSSLChildListOfGPGId(id, sslIds);
for (std::list<std::string>::iterator it = sslIds.begin(); it != sslIds.end(); it++) {
//put all sslChilds in message list
rsicontrol -> SetInMsg(*it, true);
}
/* create a message */ /* create a message */
ChanMsgDialog *nMsgDialog = new ChanMsgDialog(true); ChanMsgDialog *nMsgDialog = new ChanMsgDialog(true);

View File

@ -65,6 +65,8 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
RshareSettings config; RshareSettings config;
config.loadWidgetInformation(this); config.loadWidgetInformation(this);
this->move(qrand()%100, qrand()%100); //avoid to stack multiple popup chat windows on the same position
loadEmoticons(); loadEmoticons();
@ -134,7 +136,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
void PopupChatDialog::resetStatusBar() void PopupChatDialog::resetStatusBar()
{ {
statusBar()->showMessage(tr("Chatting with ") + QString::fromStdString(dialogName) + " (" +QString::fromStdString(dialogId)+ ")") ; statusBar()->showMessage(tr("Chatting with ") + QString::fromStdString(dialogName)) ;
} }
void PopupChatDialog::updateStatusTyping() void PopupChatDialog::updateStatusTyping()

View File

@ -322,7 +322,7 @@ void ChanMsgDialog::insertSendList()
/* add all the labels */ /* add all the labels */
/* (0) Person */ /* (0) Person */
item -> setText(0, QString::fromStdString(detail.name)); item -> setText(0, QString::fromStdString(detail.name) + " - " + QString::fromStdString(detail.location));
/* () Org */ /* () Org */
//item -> setText(1, QString::fromStdString(detail.org)); //item -> setText(1, QString::fromStdString(detail.org));
/* () Location */ /* () Location */

View File

@ -21,360 +21,363 @@
<normaloff>:/images/folder-draft.png</normaloff>:/images/folder-draft.png</iconset> <normaloff>:/images/folder-draft.png</normaloff>:/images/folder-draft.png</iconset>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QGridLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item row="0" column="0"> <item>
<widget class="QDockWidget" name="contactsdockWidget"> <widget class="QSplitter" name="splitter_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>160</width>
<height>524287</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Contacts</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTreeWidget" name="msgSendList">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>160</width>
<height>16777215</height>
</size>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Send To:</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="0" column="1">
<widget class="QSplitter" name="splitter">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<widget class="QWidget" name="layoutWidget"> <widget class="QDockWidget" name="contactsdockWidget">
<layout class="QGridLayout"> <property name="sizePolicy">
<item row="0" column="0"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<layout class="QHBoxLayout"> <horstretch>0</horstretch>
<property name="spacing"> <verstretch>0</verstretch>
<number>6</number> </sizepolicy>
</property> </property>
<property name="margin"> <property name="maximumSize">
<number>0</number> <size>
</property> <width>160</width>
<item> <height>524287</height>
<widget class="QLabel" name="label"> </size>
<property name="font"> </property>
<font> <property name="sizeIncrement">
<pointsize>10</pointsize> <size>
<weight>75</weight> <width>160</width>
<bold>true</bold> <height>0</height>
</font> </size>
</property> </property>
<property name="baseSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Contacts</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTreeWidget" name="msgSendList">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>160</width>
<height>16777215</height>
</size>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text"> <property name="text">
<string>Subject:</string> <string>Send To:</string>
</property> </property>
</widget> </column>
</item> </widget>
<item> </item>
<widget class="QLineEdit" name="titleEdit"/> </layout>
</item> </widget>
</layout>
</item>
<item row="1" column="0">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QComboBox" name="comboStyle"/>
</item>
<item row="0" column="1">
<widget class="QFontComboBox" name="comboFont"/>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboSize">
<property name="toolTip">
<string>Font size</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="boldbtn">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Bold</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="underlinebtn">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Underline</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="italicbtn">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Italic</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QPushButton" name="colorbtn">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Color</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QPushButton" name="textalignmentbtn">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Alignment</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="11">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>24</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="8">
<widget class="QPushButton" name="imagebtn">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Add a Image</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QTextEdit" name="msgText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>4</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="textInteractionFlags">
<set>Qt::TextEditorInteraction</set>
</property>
</widget>
</item>
</layout>
</widget> </widget>
<widget class="QWidget" name="layoutWidget"> <widget class="QSplitter" name="splitter">
<layout class="QGridLayout"> <property name="orientation">
<property name="margin"> <enum>Qt::Vertical</enum>
<number>0</number> </property>
</property> <widget class="QWidget" name="layoutWidget">
<property name="spacing"> <layout class="QGridLayout">
<number>6</number> <item row="0" column="0">
</property> <layout class="QHBoxLayout">
<item row="0" column="0"> <property name="spacing">
<widget class="QLabel" name="label_13"> <number>6</number>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Recommended Files</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QTreeWidget" name="msgFileList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>File Name</string>
</property> </property>
</column> <property name="margin">
<column> <number>0</number>
<property name="text">
<string>Size</string>
</property> </property>
</column> <item>
<column> <widget class="QLabel" name="label">
<property name="text"> <property name="font">
<string>Sources</string> <font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Subject:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="titleEdit"/>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QComboBox" name="comboStyle"/>
</item>
<item row="0" column="1">
<widget class="QFontComboBox" name="comboFont"/>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboSize">
<property name="toolTip">
<string>Font size</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="boldbtn">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Bold</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="underlinebtn">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Underline</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="italicbtn">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Italic</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QPushButton" name="colorbtn">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Color</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QPushButton" name="textalignmentbtn">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Alignment</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="11">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>24</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="8">
<widget class="QPushButton" name="imagebtn">
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Add a Image</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QTextEdit" name="msgText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>4</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property> </property>
</column> <property name="textInteractionFlags">
<column> <set>Qt::TextEditorInteraction</set>
<property name="text">
<string>Hash</string>
</property> </property>
</column> </widget>
</widget> </item>
</item> </layout>
</layout> </widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Recommended Files</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QTreeWidget" name="msgFileList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>File Name</string>
</property>
</column>
<column>
<property name="text">
<string>Size</string>
</property>
</column>
<column>
<property name="text">
<string>Sources</string>
</property>
</column>
<column>
<property name="text">
<string>Hash</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
</widget> </widget>
</item> </item>
@ -386,7 +389,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>770</width> <width>770</width>
<height>21</height> <height>25</height>
</rect> </rect>
</property> </property>
</widget> </widget>
@ -452,7 +455,6 @@
</tabstops> </tabstops>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>