fixed Group Chats Chat Dialog with little changes for a basic formating

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@405 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-03-23 12:58:28 +00:00
parent 9652da42b4
commit 06cb4cf01f
3 changed files with 449 additions and 310 deletions

View File

@ -56,6 +56,10 @@ ChatDialog::ChatDialog(QWidget *parent)
connect(ui.colorChatButton, SIGNAL(clicked()), this, SLOT(setColor())); connect(ui.colorChatButton, SIGNAL(clicked()), this, SLOT(setColor()));
connect( ui.msgSendList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgSendListCostumPopupMenu( QPoint ) ) ); connect( ui.msgSendList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgSendListCostumPopupMenu( QPoint ) ) );
connect(ui.textboldChatButton, SIGNAL(clicked()), this, SLOT(insertBold()));
connect(ui.textunderlineChatButton, SIGNAL(clicked()), this, SLOT(insertUnderline()));
connect(ui.textitalicChatButton, SIGNAL(clicked()), this, SLOT(insertItalic()));
// connect(ui.msgSendList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ), // connect(ui.msgSendList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ),
// this, SLOT(toggleSendItem( QTreeWidgetItem *, int ) )); // this, SLOT(toggleSendItem( QTreeWidgetItem *, int ) ));
@ -317,4 +321,44 @@ void ChatDialog::clearOldChats()
} }
void ChatDialog::insertBold()
{
this->insertAutour(tr("<b>"), tr("</b>"));
this->ui.lineEdit->setFocus();
}
void ChatDialog::insertItalic()
{
this->insertAutour(tr("<i>"), tr("</i>"));
this->ui.lineEdit->setFocus();
}
void ChatDialog::insertUnderline()
{
this->insertAutour(tr("<u>"), tr("</u>"));
this->ui.lineEdit->setFocus();
}
void ChatDialog::insertStrike()
{
this->insertAutour(tr("<s>"), tr("</s>"));
this->ui.lineEdit->setFocus();
}
void ChatDialog::insertAutour(QString leftTruc,QString rightTruc)
{
int p0 = ui.lineEdit->cursorPosition();
QString stringToInsert = leftTruc ;
stringToInsert.append(rightTruc);
ui.lineEdit->insert(stringToInsert);
ui.lineEdit->setCursorPosition(p0 + leftTruc.size());
}

View File

@ -58,6 +58,12 @@ void toggleSendItem( QTreeWidgetItem *item, int col );
void sendMsg(); void sendMsg();
void privchat(); void privchat();
void insertBold();
void insertItalic();
void insertUnderline();
void insertStrike();
void insertAutour(QString leftTruc,QString rightTruc);
private: private:

View File

@ -5,14 +5,12 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>455</width> <width>432</width>
<height>303</height> <height>329</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -507,361 +505,452 @@
<iconset/> <iconset/>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="margin" > <property name="leftMargin" >
<number>1</number> <number>0</number>
</property> </property>
<property name="spacing" > <property name="topMargin" >
<number>1</number> <number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property> </property>
<item row="0" column="0" > <item row="0" column="0" >
<widget class="QSplitter" name="splitter_2" > <widget class="QSplitter" name="splitter" >
<property name="orientation" > <property name="orientation" >
<enum>Qt::Vertical</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<widget class="QSplitter" name="splitter" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="layoutWidget" >
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
<item row="0" column="0" >
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>181</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" >
<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" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/chat.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="label_12" >
<property name="font" >
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Live Group Chat:</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0" >
<widget class="QTextBrowser" name="msgText" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>3</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="undoRedoEnabled" >
<bool>false</bool>
</property>
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget" >
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
<item row="0" column="0" >
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>41</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" >
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QLabel" name="label_14" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<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>Users:</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/peers_16x16.png</pixmap>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0" >
<widget class="QTreeWidget" name="msgSendList" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>13</hsizetype>
<vsizetype>13</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="sortingEnabled" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget" > <widget class="QWidget" name="layoutWidget" >
<layout class="QVBoxLayout" > <layout class="QGridLayout" >
<property name="margin" > <property name="leftMargin" >
<number>0</number> <number>0</number>
</property> </property>
<property name="spacing" > <property name="topMargin" >
<number>6</number> <number>0</number>
</property> </property>
<item> <property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>0</number>
</property>
<property name="verticalSpacing" >
<number>0</number>
</property>
<item row="0" column="0" >
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="margin" > <property name="leftMargin" >
<number>0</number> <number>0</number>
</property> </property>
<property name="spacing" > <property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number> <number>6</number>
</property> </property>
<item row="0" column="0" > <property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" >
<size> <size>
<width>321</width> <width>181</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="3" > <item row="0" column="0" >
<widget class="QPushButton" name="textitalicChatButton" > <layout class="QGridLayout" >
<property name="minimumSize" > <property name="leftMargin" >
<size> <number>0</number>
<width>24</width>
<height>24</height>
</size>
</property> </property>
<property name="maximumSize" > <property name="topMargin" >
<size> <number>0</number>
<width>24</width>
<height>24</height>
</size>
</property> </property>
<property name="text" > <property name="rightMargin" >
<string/> <number>0</number>
</property> </property>
<property name="icon" > <property name="bottomMargin" >
<iconset resource="images.qrc" >:/images/edit-underline.png</iconset> <number>0</number>
</property> </property>
<property name="checkable" > <property name="horizontalSpacing" >
<bool>true</bool> <number>6</number>
</property> </property>
</widget> <property name="verticalSpacing" >
</item> <number>6</number>
<item row="0" column="2" >
<widget class="QPushButton" name="textunderlineChatButton" >
<property name="minimumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property> </property>
<property name="maximumSize" > <item row="0" column="0" >
<size> <widget class="QLabel" name="label" >
<width>24</width> <property name="text" >
<height>24</height> <string/>
</size> </property>
</property> <property name="pixmap" >
<property name="text" > <pixmap resource="images.qrc" >:/images/chat.png</pixmap>
<string/> </property>
</property> </widget>
<property name="icon" > </item>
<iconset resource="images.qrc" >:/images/edit-italic.png</iconset> <item row="0" column="1" >
</property> <widget class="QLabel" name="label_12" >
<property name="checkable" > <property name="font" >
<bool>true</bool> <font>
</property> <pointsize>10</pointsize>
</widget> <weight>75</weight>
</item> <bold>true</bold>
<item row="0" column="1" > </font>
<widget class="QPushButton" name="textboldChatButton" > </property>
<property name="minimumSize" > <property name="text" >
<size> <string>Live Group Chat:</string>
<width>24</width> </property>
<height>24</height> </widget>
</size> </item>
</property> </layout>
<property name="maximumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/edit-bold.png</iconset>
</property>
<property name="checkable" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="4" >
<widget class="QPushButton" name="colorChatButton" >
<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="text" >
<string/>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item row="1" column="0" >
<widget class="QLineEdit" name="lineEdit" > <widget class="QTextBrowser" name="msgText" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
<hsizetype>7</hsizetype> <horstretch>0</horstretch>
<vsizetype>3</vsizetype> <verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="undoRedoEnabled" >
<bool>false</bool>
</property>
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget" >
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>0</number>
</property>
<property name="verticalSpacing" >
<number>0</number>
</property>
<item row="0" column="0" >
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>41</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" >
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QLabel" name="label_14" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<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>Users:</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/peers_16x16.png</pixmap>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0" >
<widget class="QTreeWidget" name="msgSendList" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Ignored" hsizetype="Ignored" >
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize" > <property name="minimumSize" >
<size> <size>
<width>0</width> <width>20</width>
<height>40</height> <height>0</height>
</size> </size>
</property> </property>
<property name="font" > <property name="contextMenuPolicy" >
<font> <enum>Qt::CustomContextMenu</enum>
<pointsize>9</pointsize>
</font>
</property> </property>
<property name="sortingEnabled" >
<bool>true</bool>
</property>
<column>
<property name="text" >
<string>1</string>
</property>
</column>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="1" column="0" >
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>321</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3" >
<widget class="QPushButton" name="textitalicChatButton" >
<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="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/edit-underline.png</iconset>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="textunderlineChatButton" >
<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="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/edit-italic.png</iconset>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="textboldChatButton" >
<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="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/edit-bold.png</iconset>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="4" >
<widget class="QPushButton" name="colorChatButton" >
<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="text" >
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLineEdit" name="lineEdit" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font" >
<font>
<pointsize>9</pointsize>
</font>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>