mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
-Changend QLineEdit with QTextEdit to can write now multiple lines .
-Added a Send Button git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@418 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6b2ca17d28
commit
c3048346f2
@ -30,11 +30,12 @@
|
||||
#include "chat/PopupChatDialog.h"
|
||||
#include <sstream>
|
||||
|
||||
#include <QTextCodec>
|
||||
#include <QTextEdit>
|
||||
#include <QToolBar>
|
||||
#include <QTextCursor>
|
||||
#include <QTextCodec>
|
||||
#include <QTextEdit>
|
||||
#include <QTextCursor>
|
||||
#include <QTextList>
|
||||
#include <QTextStream>
|
||||
#include <QTextDocumentFragment>
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
@ -51,8 +52,10 @@ ChatDialog::ChatDialog(QWidget *parent)
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
connect(ui.lineEdit, SIGNAL(returnPressed( ) ), this, SLOT(sendMsg( ) ));
|
||||
|
||||
//connect(ui.lineEdit, SIGNAL(returnPressed( ) ), this, SLOT(sendMsg( ) ));
|
||||
connect(ui.Sendbtn, SIGNAL(clicked()), this, SLOT(sendMsg()));
|
||||
connect(ui.actionSend, SIGNAL( triggered (bool)), this, SLOT( sendMsg( ) ) );
|
||||
ui.actionSend->setShortcut(Qt::CTRL + Qt::SHIFT);
|
||||
|
||||
connect( ui.msgSendList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgSendListCostumPopupMenu( QPoint ) ) );
|
||||
|
||||
@ -62,7 +65,7 @@ ChatDialog::ChatDialog(QWidget *parent)
|
||||
connect(ui.textunderlineChatButton, SIGNAL(clicked()), this, SLOT(insertUnderline()));
|
||||
connect(ui.textitalicChatButton, SIGNAL(clicked()), this, SLOT(insertItalic()));
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// connect(ui.msgSendList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ),
|
||||
// this, SLOT(toggleSendItem( QTreeWidgetItem *, int ) ));
|
||||
@ -154,7 +157,7 @@ void ChatDialog::insertChat()
|
||||
QString timestamp = "[" + QDateTime::currentDateTime().toString("hh:mm:ss") + "]";
|
||||
QString name = QString::fromStdString(it->name);
|
||||
QString line = "<span style=\"color:#C00000\"><strong>" + timestamp + "</strong></span>" +
|
||||
"<span style=\"color:#2D84C9\"><strong>" + " " + name + "</strong></span> <br>";
|
||||
"<span style=\"color:#2D84C9\"><strong>" + " " + name + "</strong></span>";
|
||||
|
||||
extraTxt += line;
|
||||
|
||||
@ -176,7 +179,7 @@ void ChatDialog::insertChat()
|
||||
|
||||
void ChatDialog::sendMsg()
|
||||
{
|
||||
QLineEdit *lineWidget = ui.lineEdit;
|
||||
QTextEdit *lineWidget = ui.lineEdit;
|
||||
|
||||
QFont font = QFont("Comic Sans MS", 10);
|
||||
font.setBold(ui.textboldChatButton->isChecked());
|
||||
@ -184,18 +187,19 @@ void ChatDialog::sendMsg()
|
||||
font.setItalic(ui.textitalicChatButton->isChecked());
|
||||
|
||||
ChatInfo ci;
|
||||
ci.msg = lineWidget->text().toStdWString();
|
||||
//ci.msg = lineWidget->Text().toStdWString();
|
||||
ci.msg = lineWidget->toHtml().toStdWString();
|
||||
ci.chatflags = RS_CHAT_PUBLIC;
|
||||
//ci.messageFont = font;
|
||||
//ci.messageColor = textColor;
|
||||
|
||||
rsMsgs -> ChatSend(ci);
|
||||
lineWidget -> setText(QString(""));
|
||||
//lineWidget -> setText(QString(""));
|
||||
ui.lineEdit->clear();
|
||||
|
||||
/* redraw send list */
|
||||
insertSendList();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ChatDialog::insertSendList()
|
||||
@ -342,6 +346,7 @@ void ChatDialog::insertBold()
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ChatDialog::insertItalic()
|
||||
{
|
||||
|
||||
@ -368,10 +373,10 @@ void ChatDialog::insertStrike()
|
||||
|
||||
void ChatDialog::insertAutour(QString leftTruc,QString rightTruc)
|
||||
{
|
||||
int p0 = ui.lineEdit->cursorPosition();
|
||||
/*int p0 = */ui.lineEdit->textCursor();
|
||||
QString stringToInsert = leftTruc ;
|
||||
stringToInsert.append(rightTruc);
|
||||
ui.lineEdit->insert(stringToInsert);
|
||||
ui.lineEdit->setCursorPosition(p0 + leftTruc.size());
|
||||
ui.lineEdit->insertPlainText(stringToInsert);
|
||||
//ui.lineEdit->setCursorPosition(p0 + leftTruc.size());
|
||||
|
||||
}
|
||||
|
@ -58,15 +58,14 @@ void toggleSendItem( QTreeWidgetItem *item, int col );
|
||||
void sendMsg();
|
||||
|
||||
void privchat();
|
||||
|
||||
void insertBold();
|
||||
void insertItalic();
|
||||
void insertUnderline();
|
||||
void insertStrike();
|
||||
void insertAutour(QString leftTruc,QString rightTruc);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
QAction *actionTextBold;
|
||||
QAction *actionTextUnderline;
|
||||
|
@ -5,8 +5,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>432</width>
|
||||
<height>329</height>
|
||||
<width>479</width>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
@ -505,20 +505,14 @@
|
||||
<iconset/>
|
||||
</property>
|
||||
<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>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QSplitter" name="splitter" >
|
||||
<property name="baseSize" >
|
||||
<size>
|
||||
<width>2</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -626,7 +620,7 @@
|
||||
<item row="1" column="0" >
|
||||
<widget class="QTextBrowser" name="msgText" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -765,6 +759,12 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
@ -783,23 +783,8 @@
|
||||
</widget>
|
||||
</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" >
|
||||
<item row="0" column="0" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
@ -928,33 +913,68 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit" >
|
||||
<item row="1" column="0" >
|
||||
<widget class="QTextEdit" name="lineEdit" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<sizepolicy vsizetype="Maximum" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
<property name="baseSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<layout class="QGridLayout" >
|
||||
<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="1" >
|
||||
<widget class="QPushButton" name="Sendbtn" >
|
||||
<property name="text" >
|
||||
<string>Send</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="actionSend" >
|
||||
<property name="text" >
|
||||
<string>Send</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>lineEdit</tabstop>
|
||||
<tabstop>textboldChatButton</tabstop>
|
||||
<tabstop>textunderlineChatButton</tabstop>
|
||||
<tabstop>textitalicChatButton</tabstop>
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user