mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
fixed up Chat Dialogs Formating features, cleaned up Formating codes and removed not needed experiments with formating.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@426 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6a6299046c
commit
9001ee6d24
@ -52,6 +52,8 @@ 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);
|
||||||
|
|
||||||
|
setWindowIcon(QIcon(QString(":/images/rstray3.png")));
|
||||||
|
|
||||||
//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.Sendbtn, SIGNAL(clicked()), this, SLOT(sendMsg()));
|
||||||
connect(ui.actionSend, SIGNAL( triggered (bool)), this, SLOT( sendMsg( ) ) );
|
connect(ui.actionSend, SIGNAL( triggered (bool)), this, SLOT( sendMsg( ) ) );
|
||||||
@ -60,12 +62,12 @@ ChatDialog::ChatDialog(QWidget *parent)
|
|||||||
connect( ui.msgSendList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgSendListCostumPopupMenu( QPoint ) ) );
|
connect( ui.msgSendList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgSendListCostumPopupMenu( QPoint ) ) );
|
||||||
|
|
||||||
#ifdef CHAT_IMPROVEMENTS
|
#ifdef CHAT_IMPROVEMENTS
|
||||||
|
connect(ui.textboldChatButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||||
|
connect(ui.textunderlineChatButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||||
|
connect(ui.textitalicChatButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||||
|
connect(ui.fontsButton, SIGNAL(clicked()), this, SLOT(getFont()));
|
||||||
connect(ui.colorChatButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
connect(ui.colorChatButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
||||||
connect(ui.textboldChatButton, SIGNAL(clicked()), this, SLOT(insertBold()));
|
|
||||||
connect(ui.textunderlineChatButton, SIGNAL(clicked()), this, SLOT(insertUnderline()));
|
|
||||||
connect(ui.textitalicChatButton, SIGNAL(clicked()), this, SLOT(insertItalic()));
|
|
||||||
#endif
|
#endif
|
||||||
connect(ui.fontsButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
|
||||||
|
|
||||||
ui.fontsButton->setIcon(QIcon(QString(":/images/fonts.png")));
|
ui.fontsButton->setIcon(QIcon(QString(":/images/fonts.png")));
|
||||||
|
|
||||||
@ -85,6 +87,8 @@ ChatDialog::ChatDialog(QWidget *parent)
|
|||||||
pxm.fill(textColor);
|
pxm.fill(textColor);
|
||||||
ui.colorChatButton->setIcon(pxm);
|
ui.colorChatButton->setIcon(pxm);
|
||||||
|
|
||||||
|
QFont font = QFont("Comic Sans MS", 10);
|
||||||
|
|
||||||
|
|
||||||
/* Hide platform specific features */
|
/* Hide platform specific features */
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
@ -136,10 +140,6 @@ void ChatDialog::insertChat()
|
|||||||
QTextEdit *msgWidget = ui.msgText;
|
QTextEdit *msgWidget = ui.msgText;
|
||||||
std::list<ChatInfo>::iterator it;
|
std::list<ChatInfo>::iterator it;
|
||||||
|
|
||||||
//QString color = ci.messageColor.name();
|
|
||||||
//QString nickColor;
|
|
||||||
//QString font = ci.messageFont.family();
|
|
||||||
//QString fontSize = QString::number(ci.messageFont.pointSize());
|
|
||||||
|
|
||||||
/* add in lines at the bottom */
|
/* add in lines at the bottom */
|
||||||
for(it = newchat.begin(); it != newchat.end(); it++)
|
for(it = newchat.begin(); it != newchat.end(); it++)
|
||||||
@ -183,20 +183,12 @@ void ChatDialog::sendMsg()
|
|||||||
{
|
{
|
||||||
QTextEdit *lineWidget = ui.lineEdit;
|
QTextEdit *lineWidget = ui.lineEdit;
|
||||||
|
|
||||||
QFont font = QFont("Comic Sans MS", 10);
|
|
||||||
font.setBold(ui.textboldChatButton->isChecked());
|
|
||||||
font.setUnderline(ui.textunderlineChatButton->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.msg = lineWidget->toHtml().toStdWString();
|
||||||
ci.chatflags = RS_CHAT_PUBLIC;
|
ci.chatflags = RS_CHAT_PUBLIC;
|
||||||
//ci.messageFont = font;
|
|
||||||
//ci.messageColor = textColor;
|
|
||||||
|
|
||||||
rsMsgs -> ChatSend(ci);
|
rsMsgs -> ChatSend(ci);
|
||||||
//lineWidget -> setText(QString(""));
|
|
||||||
ui.lineEdit->clear();
|
ui.lineEdit->clear();
|
||||||
|
|
||||||
/* redraw send list */
|
/* redraw send list */
|
||||||
@ -289,18 +281,6 @@ void ChatDialog::toggleSendItem( QTreeWidgetItem *item, int col )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatDialog::setColor()
|
|
||||||
{
|
|
||||||
textColor = QColorDialog::getColor(Qt::black, this);
|
|
||||||
QPixmap pxm(24,24);
|
|
||||||
pxm.fill(textColor);
|
|
||||||
ui.lineEdit->setText(QString(tr("<a style=\"color:")) + (textColor.name()));
|
|
||||||
this->insertAutour(tr("\">"), tr("</style>"));
|
|
||||||
this->ui.lineEdit->setFocus();
|
|
||||||
ui.colorChatButton->setIcon(pxm);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ChatDialog::privchat()
|
void ChatDialog::privchat()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -340,50 +320,15 @@ void ChatDialog::clearOldChats()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatDialog::insertBold()
|
void ChatDialog::setColor()
|
||||||
{
|
{
|
||||||
|
textColor = QColorDialog::getColor(Qt::black, this);
|
||||||
this->insertAutour(tr("<b>"), tr("</b>"));
|
QPixmap pxm(24,24);
|
||||||
this->ui.lineEdit->setFocus();
|
pxm.fill(textColor);
|
||||||
|
ui.colorChatButton->setIcon(pxm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatDialog::getFont()
|
||||||
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->textCursor();
|
|
||||||
QString stringToInsert = leftTruc ;
|
|
||||||
stringToInsert.append(rightTruc);
|
|
||||||
ui.lineEdit->insertPlainText(stringToInsert);
|
|
||||||
//ui.lineEdit->setCursorPosition(p0 + leftTruc.size());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChatDialog::setFont()
|
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
QFont font = QFontDialog::getFont(&ok, QFont(ui.lineEdit->toHtml()), this);
|
QFont font = QFontDialog::getFont(&ok, QFont(ui.lineEdit->toHtml()), this);
|
||||||
@ -391,3 +336,19 @@ void ChatDialog::setFont()
|
|||||||
ui.lineEdit->setFont(font);
|
ui.lineEdit->setFont(font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatDialog::setFont()
|
||||||
|
{
|
||||||
|
|
||||||
|
QFont font = QFont("Comic Sans MS", 10);
|
||||||
|
|
||||||
|
font.setBold(ui.textboldChatButton->isChecked());
|
||||||
|
font.setUnderline(ui.textunderlineChatButton->isChecked());
|
||||||
|
font.setItalic(ui.textitalicChatButton->isChecked());
|
||||||
|
ui.lineEdit->setFont(font);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,13 +58,9 @@ 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);
|
|
||||||
|
|
||||||
void setFont();
|
void setFont();
|
||||||
|
void getFont();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -831,6 +831,9 @@
|
|||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Underline</string>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -838,7 +841,7 @@
|
|||||||
<iconset resource="images.qrc" >:/images/edit-underline.png</iconset>
|
<iconset resource="images.qrc" >:/images/edit-underline.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable" >
|
<property name="checkable" >
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -856,6 +859,9 @@
|
|||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Italic</string>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -863,7 +869,7 @@
|
|||||||
<iconset resource="images.qrc" >:/images/edit-italic.png</iconset>
|
<iconset resource="images.qrc" >:/images/edit-italic.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable" >
|
<property name="checkable" >
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -881,6 +887,9 @@
|
|||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Bold</string>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -888,7 +897,7 @@
|
|||||||
<iconset resource="images.qrc" >:/images/edit-bold.png</iconset>
|
<iconset resource="images.qrc" >:/images/edit-bold.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable" >
|
<property name="checkable" >
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -906,6 +915,9 @@
|
|||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Text Color</string>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -925,6 +937,9 @@
|
|||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Font</string>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
@ -53,21 +53,15 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
|
|||||||
showAvatarFrame(true);
|
showAvatarFrame(true);
|
||||||
connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool)));
|
connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool)));
|
||||||
|
|
||||||
connect(ui.lineEdit, SIGNAL(returnPressed( ) ), this, SLOT(sendChat( ) ));
|
//connect(ui.chattextEdit, SIGNAL(returnPressed( ) ), this, SLOT(sendChat( ) ));
|
||||||
|
|
||||||
connect(ui.sendButton, SIGNAL(clicked( ) ), this, SLOT(sendChat( ) ));
|
connect(ui.sendButton, SIGNAL(clicked( ) ), this, SLOT(sendChat( ) ));
|
||||||
|
|
||||||
|
connect(ui.textboldButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||||
|
connect(ui.textunderlineButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||||
|
connect(ui.textitalicButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||||
|
connect(ui.fontButton, SIGNAL(clicked()), this, SLOT(getFont()));
|
||||||
connect(ui.colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
connect(ui.colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
||||||
//connect(ui.fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
|
||||||
|
|
||||||
connect(ui.textboldButton, SIGNAL(clicked()), this, SLOT(insertBold()));
|
|
||||||
connect(ui.textunderlineButton, SIGNAL(clicked()), this, SLOT(insertUnderline()));
|
|
||||||
connect(ui.textitalicButton, SIGNAL(clicked()), this, SLOT(insertItalic()));
|
|
||||||
|
|
||||||
connect(ui.actionBold, SIGNAL(triggered()), this, SLOT(insertBold()));
|
|
||||||
connect(ui.actionItalic, SIGNAL(triggered()), this, SLOT(insertItalic()));
|
|
||||||
connect(ui.actionUnderline, SIGNAL(triggered()), this, SLOT(insertUnderline()));
|
|
||||||
connect(ui.actionStrike, SIGNAL(triggered()), this, SLOT(insertStrike()));
|
|
||||||
|
|
||||||
// Create the status bar
|
// Create the status bar
|
||||||
std::ostringstream statusstr;
|
std::ostringstream statusstr;
|
||||||
@ -82,24 +76,28 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
|
|||||||
//ui.avatarlabel->setPixmap(QPixmap(":/images/retrosharelogo1.png"));
|
//ui.avatarlabel->setPixmap(QPixmap(":/images/retrosharelogo1.png"));
|
||||||
|
|
||||||
setWindowIcon(QIcon(QString(":/images/rstray3.png")));
|
setWindowIcon(QIcon(QString(":/images/rstray3.png")));
|
||||||
|
|
||||||
ui.textboldButton->setIcon(QIcon(QString(":/images/edit-bold.png")));
|
ui.textboldButton->setIcon(QIcon(QString(":/images/edit-bold.png")));
|
||||||
ui.textunderlineButton->setIcon(QIcon(QString(":/images/edit-underline.png")));
|
ui.textunderlineButton->setIcon(QIcon(QString(":/images/edit-underline.png")));
|
||||||
ui.textitalicButton->setIcon(QIcon(QString(":/images/edit-italic.png")));
|
ui.textitalicButton->setIcon(QIcon(QString(":/images/edit-italic.png")));
|
||||||
ui.fontButton->setIcon(QIcon(QString(":/images/fonts.png")));
|
ui.fontButton->setIcon(QIcon(QString(":/images/fonts.png")));
|
||||||
|
|
||||||
ui.actionBold->setIcon(QIcon(":/images/edit-bold.png"));
|
ui.textboldButton->setCheckable(true);
|
||||||
ui.actionUnderline->setIcon(QIcon(":/images/edit-underline.png"));
|
ui.textunderlineButton->setCheckable(true);
|
||||||
ui.actionItalic->setIcon(QIcon(":/images/edit-italic.png"));
|
ui.textitalicButton->setCheckable(true);
|
||||||
//ui.actionStrike->setIcon(QIcon(":/exit.png"));
|
|
||||||
|
|
||||||
QMenu * fontmenu = new QMenu();
|
/*QMenu * fontmenu = new QMenu();
|
||||||
fontmenu->addAction(ui.actionBold);
|
fontmenu->addAction(ui.actionBold);
|
||||||
fontmenu->addAction(ui.actionUnderline);
|
fontmenu->addAction(ui.actionUnderline);
|
||||||
fontmenu->addAction(ui.actionItalic);
|
fontmenu->addAction(ui.actionItalic);
|
||||||
fontmenu->addAction(ui.actionStrike);
|
fontmenu->addAction(ui.actionStrike);
|
||||||
ui.fontButton->setMenu(fontmenu);
|
ui.fontButton->setMenu(fontmenu);*/
|
||||||
|
|
||||||
|
QPixmap pxm(24,24);
|
||||||
|
pxm.fill(Qt::black);
|
||||||
|
ui.colorButton->setIcon(pxm);
|
||||||
|
|
||||||
|
QFont font = QFont("Comic Sans MS", 10);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,40 +129,6 @@ void PopupChatDialog::closeEvent (QCloseEvent * event)
|
|||||||
event->ignore();
|
event->ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::setColor()
|
|
||||||
{
|
|
||||||
QColor col = QColorDialog::getColor(Qt::green, this);
|
|
||||||
if (col.isValid()) {
|
|
||||||
|
|
||||||
ui.colorButton->setPalette(QPalette(col));
|
|
||||||
ui.lineEdit->setText(QString(tr("<a style=\"color:")) + (col.name()));
|
|
||||||
this->insertAutour(tr("\">"), tr("</style>"));
|
|
||||||
this->ui.lineEdit->setFocus();
|
|
||||||
QTextCharFormat fmt;
|
|
||||||
fmt.setForeground(col);
|
|
||||||
colorChanged(col);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PopupChatDialog::setFont()
|
|
||||||
{
|
|
||||||
bool ok;
|
|
||||||
QFont font = QFontDialog::getFont(&ok, QFont(ui.lineEdit->text()), this);
|
|
||||||
if (ok) {
|
|
||||||
//ui.lineEdit->setText(font.key());
|
|
||||||
ui.lineEdit->setFont(font);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PopupChatDialog::colorChanged(const QColor &c)
|
|
||||||
{
|
|
||||||
QPixmap pix(16, 16);
|
|
||||||
pix.fill(c);
|
|
||||||
ui.colorButton->setIcon(pix);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PopupChatDialog::updateChat()
|
void PopupChatDialog::updateChat()
|
||||||
{
|
{
|
||||||
/* get chat off queue */
|
/* get chat off queue */
|
||||||
@ -211,7 +175,7 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci)
|
|||||||
//QString pre = tr("Peer:" );
|
//QString pre = tr("Peer:" );
|
||||||
QString name = QString::fromStdString(ci->name);
|
QString name = QString::fromStdString(ci->name);
|
||||||
QString line = "<span style=\"color:#1D84C9\"><strong>" + timestamp +
|
QString line = "<span style=\"color:#1D84C9\"><strong>" + timestamp +
|
||||||
" " + name + "</strong></span> \n<br>";
|
" " + name + "</strong></span>";
|
||||||
|
|
||||||
extraTxt += line;
|
extraTxt += line;
|
||||||
|
|
||||||
@ -231,7 +195,7 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci)
|
|||||||
|
|
||||||
void PopupChatDialog::sendChat()
|
void PopupChatDialog::sendChat()
|
||||||
{
|
{
|
||||||
QLineEdit *lineWidget = ui.lineEdit;
|
QTextEdit *chatWidget = ui.chattextEdit;
|
||||||
|
|
||||||
ChatInfo ci;
|
ChatInfo ci;
|
||||||
|
|
||||||
@ -245,7 +209,7 @@ void PopupChatDialog::sendChat()
|
|||||||
rsiface->unlockData(); /* Unlock Interface */
|
rsiface->unlockData(); /* Unlock Interface */
|
||||||
}
|
}
|
||||||
|
|
||||||
ci.msg = lineWidget->text().toStdWString();
|
ci.msg = chatWidget->toHtml().toStdWString();
|
||||||
ci.chatflags = RS_CHAT_PRIVATE;
|
ci.chatflags = RS_CHAT_PRIVATE;
|
||||||
|
|
||||||
addChatMsg(&ci);
|
addChatMsg(&ci);
|
||||||
@ -255,7 +219,7 @@ void PopupChatDialog::sendChat()
|
|||||||
ci.name = dialogName;
|
ci.name = dialogName;
|
||||||
|
|
||||||
rsMsgs -> ChatSend(ci);
|
rsMsgs -> ChatSend(ci);
|
||||||
lineWidget -> setText(QString(""));
|
chatWidget ->clear();
|
||||||
|
|
||||||
/* redraw send list */
|
/* redraw send list */
|
||||||
}
|
}
|
||||||
@ -278,47 +242,52 @@ void PopupChatDialog::showAvatarFrame(bool show)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::insertBold()
|
void PopupChatDialog::setColor()
|
||||||
{
|
{
|
||||||
|
QColor col = QColorDialog::getColor(Qt::black, this);
|
||||||
|
if (col.isValid()) {
|
||||||
|
|
||||||
this->insertAutour(tr("<b>"), tr("</b>"));
|
ui.colorButton->setPalette(QPalette(col));
|
||||||
this->ui.lineEdit->setFocus();
|
ui.chattextEdit->setTextColor(QColor(col));
|
||||||
|
QTextCharFormat fmt;
|
||||||
|
fmt.setForeground(col);
|
||||||
|
mergeFormatOnWordOrSelection(fmt);
|
||||||
|
colorChanged(col);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::insertItalic()
|
void PopupChatDialog::colorChanged(const QColor &c)
|
||||||
{
|
{
|
||||||
|
QPixmap pix(16, 16);
|
||||||
this->insertAutour(tr("<i>"), tr("</i>"));
|
pix.fill(c);
|
||||||
this->ui.lineEdit->setFocus();
|
ui.colorButton->setIcon(pix);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::insertUnderline()
|
void PopupChatDialog::mergeFormatOnWordOrSelection(const QTextCharFormat &format)
|
||||||
{
|
{
|
||||||
|
QTextCursor cursor = ui.chattextEdit->textCursor();
|
||||||
this->insertAutour(tr("<u>"), tr("</u>"));
|
if (!cursor.hasSelection())
|
||||||
this->ui.lineEdit->setFocus();
|
cursor.select(QTextCursor::WordUnderCursor);
|
||||||
|
cursor.mergeCharFormat(format);
|
||||||
|
ui.chattextEdit->mergeCurrentCharFormat(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::insertStrike()
|
void PopupChatDialog::getFont()
|
||||||
{
|
{
|
||||||
|
bool ok;
|
||||||
this->insertAutour(tr("<s>"), tr("</s>"));
|
QFont font = QFontDialog::getFont(&ok, QFont(ui.chattextEdit->toHtml()), this);
|
||||||
this->ui.lineEdit->setFocus();
|
if (ok) {
|
||||||
|
ui.chattextEdit->setFont(font);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::insertAutour(QString leftTruc,QString rightTruc)
|
void PopupChatDialog::setFont()
|
||||||
{
|
{
|
||||||
int p0 = ui.lineEdit->cursorPosition();
|
QFont font = QFont("Comic Sans MS", 10);
|
||||||
QString stringToInsert = leftTruc ;
|
font.setBold(ui.textboldButton->isChecked());
|
||||||
stringToInsert.append(rightTruc);
|
font.setUnderline(ui.textunderlineButton->isChecked());
|
||||||
ui.lineEdit->insert(stringToInsert);
|
font.setItalic(ui.textitalicButton->isChecked());
|
||||||
ui.lineEdit->setCursorPosition(p0 + leftTruc.size());
|
ui.chattextEdit->setFont(font);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,17 +50,10 @@ public:
|
|||||||
void updateChat();
|
void updateChat();
|
||||||
void addChatMsg(ChatInfo *ci);
|
void addChatMsg(ChatInfo *ci);
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/** Overloaded QWidget.show */
|
/** Overloaded QWidget.show */
|
||||||
void show();
|
void show();
|
||||||
|
|
||||||
void insertBold();
|
|
||||||
void insertItalic();
|
|
||||||
void insertUnderline();
|
|
||||||
void insertStrike();
|
|
||||||
void insertAutour(QString leftTruc,QString rightTruc);
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent (QCloseEvent * event);
|
void closeEvent (QCloseEvent * event);
|
||||||
@ -70,6 +63,7 @@ private slots:
|
|||||||
void showAvatarFrame(bool show);
|
void showAvatarFrame(bool show);
|
||||||
|
|
||||||
void setColor();
|
void setColor();
|
||||||
|
void getFont();
|
||||||
void setFont();
|
void setFont();
|
||||||
|
|
||||||
void sendChat();
|
void sendChat();
|
||||||
@ -77,7 +71,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
|
||||||
void colorChanged(const QColor &c);
|
void colorChanged(const QColor &c);
|
||||||
|
|
||||||
QAction *actionTextBold;
|
QAction *actionTextBold;
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>565</width>
|
<width>560</width>
|
||||||
<height>349</height>
|
<height>410</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
@ -14,40 +14,19 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget" >
|
<widget class="QWidget" name="centralwidget" >
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout" >
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
<property name="rightMargin" >
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</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" >
|
<item row="0" column="0" >
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout" >
|
||||||
<property name="leftMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="QTextBrowser" name="textBrowser" >
|
<widget class="QTextBrowser" name="textBrowser" >
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize" >
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
@ -64,12 +43,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0" >
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout" >
|
||||||
<property name="horizontalSpacing" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="verticalSpacing" >
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="QWidget" native="1" name="widget" >
|
<widget class="QWidget" native="1" name="widget" >
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize" >
|
||||||
@ -82,6 +55,21 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</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>
|
||||||
|
<property name="horizontalSpacing" >
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
@ -109,6 +97,9 @@
|
|||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Bold</string>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -134,6 +125,9 @@
|
|||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Underline</string>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -159,6 +153,9 @@
|
|||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Italic</string>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -184,6 +181,9 @@
|
|||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Italic</string>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -209,6 +209,9 @@
|
|||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Text Color</string>
|
||||||
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -218,9 +221,31 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0" >
|
||||||
|
<widget class="QTextEdit" name="chattextEdit" >
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy vsizetype="Maximum" hsizetype="Expanding" >
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" >
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout" >
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="QLineEdit" name="lineEdit" />
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>351</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1" >
|
||||||
<widget class="QPushButton" name="sendButton" >
|
<widget class="QPushButton" name="sendButton" >
|
||||||
@ -233,8 +258,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1" >
|
||||||
<widget class="QFrame" name="avatarframe" >
|
<widget class="QFrame" name="avatarframe" >
|
||||||
<property name="frameShape" >
|
<property name="frameShape" >
|
||||||
@ -244,6 +267,18 @@
|
|||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout" >
|
||||||
|
<property name="leftMargin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin" >
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="QLabel" name="avatarlabel" >
|
<widget class="QLabel" name="avatarlabel" >
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize" >
|
||||||
@ -279,8 +314,8 @@ border-image: url(:/images/mystatus_bg.png);
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" >
|
||||||
<size>
|
<size>
|
||||||
<width>71</width>
|
<width>61</width>
|
||||||
<height>138</height>
|
<height>141</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
@ -313,6 +348,19 @@ border-image: url(:/images/mystatus_bg.png);
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0" >
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>61</width>
|
||||||
|
<height>41</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user