mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
a27855450f
commit
ae4f43d9e8
@ -40,6 +40,7 @@
|
||||
#include "common/TagDefs.h"
|
||||
#include "common/PeerDefs.h"
|
||||
#include "common/RSItemDelegate.h"
|
||||
#include "common/Emoticons.h"
|
||||
|
||||
#include <retroshare/rsinit.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
@ -1664,27 +1665,27 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
|
||||
/* iterate through the sources */
|
||||
std::list<std::string>::const_iterator pit;
|
||||
|
||||
QString msgTxt;
|
||||
QString text;
|
||||
QString name;
|
||||
QString rsid;
|
||||
for(pit = msgInfo.msgto.begin(); pit != msgInfo.msgto.end(); pit++)
|
||||
{
|
||||
rsid = PeerDefs::rsidFromId(*pit, &name);
|
||||
msgTxt += "<a style='color: black;'href='" + rsid + "'> " + name + "</a>" + " ";
|
||||
text += "<a style='color: black;'href='" + rsid + "'> " + name + "</a>" + " ";
|
||||
}
|
||||
ui.toText->setText(msgTxt);
|
||||
ui.toText->setText(text);
|
||||
|
||||
if (msgInfo.msgcc.size() > 0) {
|
||||
ui.cclabel->setVisible(true);
|
||||
ui.ccText->setVisible(true);
|
||||
|
||||
msgTxt.clear();
|
||||
text.clear();
|
||||
for(pit = msgInfo.msgcc.begin(); pit != msgInfo.msgcc.end(); pit++)
|
||||
{
|
||||
rsid = PeerDefs::rsidFromId(*pit, &name);
|
||||
msgTxt += "<a style='color: black;'href='" + rsid + "'> " + name + "</a>" + " ";
|
||||
text += "<a style='color: black;'href='" + rsid + "'> " + name + "</a>" + " ";
|
||||
}
|
||||
ui.ccText->setText(msgTxt);
|
||||
ui.ccText->setText(text);
|
||||
} else {
|
||||
ui.cclabel->setVisible(false);
|
||||
ui.ccText->setVisible(false);
|
||||
@ -1695,13 +1696,13 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
|
||||
ui.bcclabel->setVisible(true);
|
||||
ui.bccText->setVisible(true);
|
||||
|
||||
msgTxt.clear();
|
||||
text.clear();
|
||||
for(pit = msgInfo.msgbcc.begin(); pit != msgInfo.msgbcc.end(); pit++)
|
||||
{
|
||||
rsid = PeerDefs::rsidFromId(*pit, &name);
|
||||
msgTxt += "<a style='color: black;'href='" + rsid + "'> " + name + "</a>" + " ";
|
||||
text += "<a style='color: black;'href='" + rsid + "'> " + name + "</a>" + " ";
|
||||
}
|
||||
ui.bccText->setText(msgTxt);
|
||||
ui.bccText->setText(text);
|
||||
} else {
|
||||
ui.bcclabel->setVisible(false);
|
||||
ui.bccText->setVisible(false);
|
||||
@ -1723,13 +1724,16 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
|
||||
sSrcId = msgInfo.srcId;
|
||||
}
|
||||
rsid = PeerDefs::rsidFromId(sSrcId, &name);
|
||||
msgTxt += "<a style='color: black;'href='" + rsid + "'> " + name + "</a>" + " ";
|
||||
text += "<a style='color: black;'href='" + rsid + "'> " + name + "</a>" + " ";
|
||||
|
||||
ui.fromText->setText("<a style='color: blue;' href='" + rsid + "'> " + name +"</a>");
|
||||
ui.fromText->setToolTip(rsid);
|
||||
|
||||
ui.subjectText->setText(QString::fromStdWString(msgInfo.title));
|
||||
ui.msgText->setHtml(QString::fromStdWString(msgInfo.msg));
|
||||
|
||||
text = QString::fromStdWString(msgInfo.msg);
|
||||
Emoticons::formatText(text);
|
||||
ui.msgText->setHtml(text);
|
||||
|
||||
{
|
||||
std::ostringstream out;
|
||||
|
@ -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());
|
||||
|
@ -107,6 +107,8 @@ private slots:
|
||||
void textStyle(int styleIndex);
|
||||
void textColor();
|
||||
void textAlign(QAction *a);
|
||||
void smileyWidget();
|
||||
void addSmileys();
|
||||
|
||||
void currentCharFormatChanged(const QTextCharFormat &format);
|
||||
void cursorPositionChanged();
|
||||
|
@ -17,7 +17,7 @@
|
||||
<string>Compose</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/folder-draft.png</normaloff>:/images/folder-draft.png</iconset>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
@ -364,7 +364,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<item row="0" column="4">
|
||||
<widget class="QToolButton" name="sizeincreaseButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@ -379,7 +379,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/textedit/format_font_size_more.png</normaloff>:/images/textedit/format_font_size_more.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -393,7 +393,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<item row="0" column="5">
|
||||
<widget class="QToolButton" name="sizedecreaseButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@ -408,7 +408,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/textedit/format_font_size_less.png</normaloff>:/images/textedit/format_font_size_less.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -422,7 +422,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<item row="0" column="6">
|
||||
<widget class="QToolButton" name="boldbtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -443,7 +443,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/textedit/textbold.png</normaloff>:/images/textedit/textbold.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -460,7 +460,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<item row="0" column="7">
|
||||
<widget class="QToolButton" name="underlinebtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -481,7 +481,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/textedit/textunder.png</normaloff>:/images/textedit/textunder.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -498,7 +498,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<item row="0" column="8">
|
||||
<widget class="QToolButton" name="italicbtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -519,7 +519,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/textedit/textitalic.png</normaloff>:/images/textedit/textitalic.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -536,7 +536,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<item row="0" column="10">
|
||||
<widget class="QToolButton" name="colorbtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -561,7 +561,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="10">
|
||||
<item row="0" column="11">
|
||||
<widget class="QToolButton" name="textalignmentbtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -595,7 +595,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="11">
|
||||
<item row="0" column="12">
|
||||
<widget class="QToolButton" name="imagebtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -616,7 +616,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -630,7 +630,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<item row="0" column="9">
|
||||
<widget class="QToolButton" name="codeButton">
|
||||
<property name="toolTip">
|
||||
<string>Sets text font to code style</string>
|
||||
@ -639,7 +639,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/textedit/hi22-action-format-text-code.png</normaloff>:/images/textedit/hi22-action-format-text-code.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -653,7 +653,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="14">
|
||||
<item row="0" column="16">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -666,6 +666,23 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QToolButton" name="emoticonButton">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/emoticons/kopete/kopete020.png</normaloff>:/images/emoticons/kopete/kopete020.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@ -861,7 +878,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</widget>
|
||||
<action name="actionSend">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/send24.png</normaloff>:/images/send24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -873,7 +890,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</action>
|
||||
<action name="actionReply">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/replymail24.png</normaloff>:/images/replymail24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -882,7 +899,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</action>
|
||||
<action name="actionContactsView">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/contacts24.png</normaloff>:/images/contacts24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -894,7 +911,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</action>
|
||||
<action name="actionSaveas">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/save24.png</normaloff>:/images/save24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -906,7 +923,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
</action>
|
||||
<action name="actionAttach">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/attach.png</normaloff>:/images/attach.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -921,7 +938,7 @@ border: 1px solid #CCCCCC;}</string>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/quote_24.png</normaloff>:/images/quote_24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -937,6 +954,8 @@ border: 1px solid #CCCCCC;}</string>
|
||||
<tabstop>msgText</tabstop>
|
||||
<tabstop>msgFileList</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user