Added smiley support for messages.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3774 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-11-10 13:35:38 +00:00
parent a27855450f
commit ae4f43d9e8
4 changed files with 73 additions and 36 deletions

View file

@ -50,6 +50,7 @@
#include "gui/RetroShareLink.h"
#include "gui/settings/rsharesettings.h"
#include "gui/feeds/AttachFileItem.h"
#include "gui/common/Emoticons.h"
#include "textformat.h"
#include "util/misc.h"
@ -131,6 +132,7 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
connect(ui.italicbtn, SIGNAL(clicked()), this, SLOT(textItalic()));
connect(ui.colorbtn, SIGNAL(clicked()), this, SLOT(textColor()));
connect(ui.imagebtn, SIGNAL(clicked()), this, SLOT(addImage()));
connect(ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidget()));
//connect(ui.linkbtn, SIGNAL(clicked()), this, SLOT(insertLink()));
connect(ui.actionContactsView, SIGNAL(triggered()), this, SLOT(toggleContacts()));
connect(ui.actionSaveas, SIGNAL(triggered()), this, SLOT(saveasDraft()));
@ -1777,6 +1779,16 @@ void MessageComposer::textAlign(QAction *a)
ui.msgText->setAlignment(Qt::AlignJustify);
}
void MessageComposer::smileyWidget()
{
Emoticons::showSmileyWidget(this, ui.emoticonButton, SLOT(addSmileys()), false);
}
void MessageComposer::addSmileys()
{
ui.msgText->textCursor().insertText(qobject_cast<QPushButton*>(sender())->toolTip().split("|").first());
}
void MessageComposer::currentCharFormatChanged(const QTextCharFormat &format)
{
fontChanged(format.font());