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

@ -57,6 +57,10 @@ ChatDialog::ChatDialog(QWidget *parent)
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 ) ),
// 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

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

View File

@ -5,14 +5,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>455</width>
<height>303</height>
<width>432</width>
<height>329</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -507,35 +505,61 @@
<iconset/>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>1</number>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="spacing" >
<number>1</number>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item row="0" column="0" >
<widget class="QSplitter" name="splitter_2" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</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" >
<property name="leftMargin" >
<number>0</number>
</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>0</number>
</property>
<property name="verticalSpacing" >
<number>0</number>
</property>
<item row="0" column="0" >
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>0</number>
</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>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="1" >
@ -553,10 +577,22 @@
</item>
<item row="0" column="0" >
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>0</number>
</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>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="0" >
@ -590,9 +626,7 @@
<item row="1" column="0" >
<widget class="QTextBrowser" name="msgText" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>3</vsizetype>
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -609,18 +643,42 @@
</widget>
<widget class="QWidget" name="layoutWidget" >
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>0</number>
</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>0</number>
</property>
<property name="verticalSpacing" >
<number>0</number>
</property>
<item row="0" column="0" >
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>0</number>
</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>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="1" >
@ -641,18 +699,28 @@
</item>
<item row="0" column="0" >
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>0</number>
</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>
</property>
<property name="verticalSpacing" >
<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>
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -686,9 +754,7 @@
<item row="1" column="0" >
<widget class="QTreeWidget" name="msgSendList" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>13</hsizetype>
<vsizetype>13</vsizetype>
<sizepolicy vsizetype="Ignored" hsizetype="Ignored" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -705,25 +771,52 @@
<property name="sortingEnabled" >
<bool>true</bool>
</property>
<column>
<property name="text" >
<string>1</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget" >
</item>
<item row="1" column="0" >
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>0</number>
</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>
<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" >
@ -760,7 +853,7 @@
<iconset resource="images.qrc" >:/images/edit-underline.png</iconset>
</property>
<property name="checkable" >
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
@ -785,7 +878,7 @@
<iconset resource="images.qrc" >:/images/edit-italic.png</iconset>
</property>
<property name="checkable" >
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
@ -810,7 +903,7 @@
<iconset resource="images.qrc" >:/images/edit-bold.png</iconset>
</property>
<property name="checkable" >
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
@ -838,9 +931,7 @@
<item>
<widget class="QLineEdit" name="lineEdit" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>3</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -848,7 +939,7 @@
<property name="minimumSize" >
<size>
<width>0</width>
<height>40</height>
<height>0</height>
</size>
</property>
<property name="font" >
@ -859,8 +950,6 @@
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>