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