- Moved HandleRichText from the folder "chat" to "util" and redesigned the source

- Extended RsHtml::formatText to replace the RetroShare links with an image and enabled this for the certificate links in the system messages (friend recommendation and user request)
- Added new ObjectPainter for painting a button on a pixmap


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5160 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-05-12 00:40:53 +00:00
parent 5a3863d216
commit dc2d6c975e
27 changed files with 470 additions and 215 deletions

View file

@ -31,6 +31,7 @@
#include <iostream>
#include "Emoticons.h"
#include "util/HandleRichText.h"
static QHash<QString, QString> Smileys;
@ -118,7 +119,7 @@ void Emoticons::load()
}
// init <img> embedder
RsHtml::defEmbedImg.InitFromAwkwardHash(Smileys);
RsHtml::initEmoticons(Smileys);
}
void Emoticons::showSmileyWidget(QWidget *parent, QWidget *button, const char *slotAddMethod, bool above)
@ -198,13 +199,13 @@ void Emoticons::showSmileyWidget(QWidget *parent, QWidget *button, const char *s
smWidget->show();
}
void Emoticons::formatText(QString &text)
{
QHashIterator<QString, QString> i(Smileys);
while(i.hasNext()) {
i.next();
foreach (QString code, i.key().split("|")) {
text.replace(code, "<img src=\"" + i.value() + "\">");
}
}
}
//void Emoticons::formatText(QString &text)
//{
// QHashIterator<QString, QString> i(Smileys);
// while(i.hasNext()) {
// i.next();
// foreach (QString code, i.key().split("|")) {
// text.replace(code, "<img src=\"" + i.value() + "\">");
// }
// }
//}

View file

@ -19,12 +19,9 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _EMOTICONS_H
#define _EMOTICONS_H
#include "gui/chat/HandleRichText.h"
class QWidget;
class QString;
@ -35,7 +32,7 @@ public:
static void showSmileyWidget(QWidget *parent, QWidget *button, const char *slotAddMethod, bool above);
static void formatText(QString &text);
// static void formatText(QString &text);
};
#endif