aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Fabio Bas2010-01-04 21:39:18 +0000
committerGravatar Fabio Bas2010-01-04 21:39:18 +0000
commitea1084670270a8877f1e4baa69d1adf16aec5714 (patch)
tree8febc161ed96186ab4ae6055f279c92d818714f2 /src
parentfix for #678 (diff)
downloadKVIrc-ea1084670270a8877f1e4baa69d1adf16aec5714.tar.gz
KVIrc-ea1084670270a8877f1e4baa69d1adf16aec5714.tar.bz2
KVIrc-ea1084670270a8877f1e4baa69d1adf16aec5714.zip
merged topicbar and notifier html's converters, welcome kvi_htmlgenerator
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3792 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
-rw-r--r--src/kvirc/CMakeLists.txt1
-rw-r--r--src/kvirc/kernel/kvi_htmlgenerator.cpp284
-rw-r--r--src/kvirc/kernel/kvi_htmlgenerator.h49
-rw-r--r--src/kvirc/ui/kvi_topicw.cpp139
-rw-r--r--src/modules/notifier/notifiermessage.cpp256
-rw-r--r--src/modules/notifier/notifiermessage.h6
6 files changed, 340 insertions, 395 deletions
diff --git a/src/kvirc/CMakeLists.txt b/src/kvirc/CMakeLists.txt
index 934a8eac7..6477bb907 100644
--- a/src/kvirc/CMakeLists.txt
+++ b/src/kvirc/CMakeLists.txt
@@ -278,6 +278,7 @@ SET(kvirc_SRCS
kernel/kvi_customtoolbardescriptor.cpp
kernel/kvi_customtoolbarmanager.cpp
kernel/kvi_filetransfer.cpp
+ kernel/kvi_htmlgenerator.cpp
kernel/kvi_iconmanager.cpp
kernel/kvi_internalcmd.cpp
kernel/kvi_ipc.cpp
diff --git a/src/kvirc/kernel/kvi_htmlgenerator.cpp b/src/kvirc/kernel/kvi_htmlgenerator.cpp
new file mode 100644
index 000000000..b07d949ef
--- /dev/null
+++ b/src/kvirc/kernel/kvi_htmlgenerator.cpp
@@ -0,0 +1,284 @@
+//=============================================================================
+//
+// File : kvi_htmlgenerator.cpp
+// Creation date : Mon 04 Jan 2010 22:09:18 by Fabio Bas
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2010 Fabio Bas < ctrlaltca at gmail dot com >
+//
+// This program is FREE software. You can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=============================================================================
+
+#include "kvi_htmlgenerator.h"
+
+#include "kvi_iconmanager.h"
+#include "kvi_mirccntrl.h"
+#include "kvi_options.h"
+#include "kvi_texticonmanager.h"
+
+#define KVI_LABEL_DEF_BACK 100
+#define KVI_LABEL_DEF_FORE 101
+
+namespace KviHtmlGenerator
+{
+
+ QString convertToHtml(const QString &szText)
+ {
+ QString szResult;
+ bool bCurBold = false;
+ bool bCurUnderline = false;
+ bool bIgnoreIcons = false;
+ bool bShowIcons = KVI_OPTION_BOOL(KviOption_boolDrawEmoticons);
+
+ unsigned char uCurFore = KVI_LABEL_DEF_FORE; //default fore
+ unsigned char uCurBack = KVI_LABEL_DEF_BACK; //default back
+
+ unsigned int uIdx = 0;
+
+ while(uIdx < (unsigned int)szText.length())
+ {
+ unsigned short c = szText[(int)uIdx].unicode();
+ unsigned int uStart = uIdx;
+
+ while(
+ (c != KVI_TEXT_COLOR) &&
+ (c != KVI_TEXT_BOLD) &&
+ (c != KVI_TEXT_UNDERLINE) &&
+ (c != KVI_TEXT_REVERSE) &&
+ (c != KVI_TEXT_RESET) &&
+ (c != KVI_TEXT_ICON) &&
+ ((c != ':') || bIgnoreIcons) &&
+ ((c != ';') || bIgnoreIcons) &&
+ ((c != '=') || bIgnoreIcons)
+ )
+ {
+ uIdx++;
+ bIgnoreIcons=FALSE;
+ if(uIdx >= (unsigned int)szText.length())break;
+ else c = szText[(int)uIdx].unicode();
+ }
+
+ bIgnoreIcons=FALSE;
+ int iLen = uIdx - uStart;
+
+ if(iLen > 0)
+ {
+ bool bOpened = FALSE;
+
+ if(uCurFore != KVI_LABEL_DEF_FORE)
+ {
+ szResult.append("<span style=\"color:");
+ szResult.append(KVI_OPTION_MIRCCOLOR(uCurFore).name());
+ bOpened = TRUE;
+ }
+
+ if(uCurBack != KVI_LABEL_DEF_BACK)
+ {
+ if(!bOpened)
+ {
+ szResult.append("<span style=\"background-color:");
+ bOpened = TRUE;
+ } else {
+ szResult.append(";background-color:");
+ }
+ szResult.append(KVI_OPTION_MIRCCOLOR(uCurBack).name());
+ }
+
+ if(bCurUnderline)
+ {
+ if(!bOpened)
+ {
+ szResult.append("<span style=\"text-decoration:underline");
+ bOpened = TRUE;
+ } else {
+ szResult.append(";text-decoration:underline");
+ }
+ }
+
+ if(bCurBold)
+ {
+ if(!bOpened)
+ {
+ szResult.append("<span style=\"font-weight:bold");
+ bOpened = TRUE;
+ } else {
+ szResult.append(";font-weight:bold");
+ }
+ }
+
+ if(bOpened) szResult.append(";\">");
+
+ szResult.append(szText.mid(uStart,iLen));
+
+ if( bOpened )
+ szResult.append("</span>");
+ }
+
+ switch(c)
+ {
+ case KVI_TEXT_BOLD: bCurBold = !bCurBold; ++uIdx; break;
+ case KVI_TEXT_UNDERLINE: bCurUnderline = !bCurUnderline; ++uIdx; break;
+ case KVI_TEXT_REVERSE:
+ {
+ char auxBack = uCurBack;
+ uCurBack = uCurFore;
+ uCurFore = auxBack;
+ }
+ ++uIdx;
+ break;
+ case KVI_TEXT_RESET:
+ uCurFore = KVI_LABEL_DEF_FORE;
+ uCurBack = KVI_LABEL_DEF_BACK;
+ bCurBold = false;
+ bCurUnderline = false;
+ ++uIdx;
+ break;
+ case KVI_TEXT_COLOR:
+ {
+ ++uIdx;
+ unsigned char fore;
+ unsigned char back;
+ uIdx = getUnicodeColorBytes(szText,uIdx,&fore,&back);
+ if(fore != KVI_NOCHANGE)
+ {
+ uCurFore = fore;
+ if(back != KVI_NOCHANGE)uCurBack = back;
+ } else {
+ // only a CTRL+K
+ uCurBack = KVI_LABEL_DEF_BACK;
+ uCurFore = KVI_LABEL_DEF_FORE;
+ }
+ }
+ break;
+ case ':':
+ case ';':
+ case '=':
+ {
+ //potential emoticon, got eyes
+ if(bShowIcons)
+ {
+ ++uIdx;
+ QString szLookup;
+ szLookup.append(QChar(c));
+ unsigned short uIsEmoticon=0;
+ unsigned int uIcoStart = uIdx;
+
+ if(uIdx < (unsigned int)szText.length())
+ {
+ //look up for a nose
+ if(szText[(int)uIdx] == '-')
+ {
+ szLookup.append('-');
+ uIdx++;
+ }
+ }
+
+ if(uIdx < (unsigned int)szText.length())
+ {
+ //look up for a mouth
+ unsigned short m = szText[(int)uIdx].unicode();
+ switch(m)
+ {
+ case ')':
+ case '(':
+ case '/':
+ case 'D':
+ case 'P':
+ case 'S':
+ case 'O':
+ case '*':
+ case '|':
+ szLookup+=QChar(m);
+ uIsEmoticon++;
+ uIdx++;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if(uIdx < (unsigned int)szText.length())
+ {
+ //look up for a space
+ if(szText[(int)uIdx]== ' ')
+ {
+ uIsEmoticon++;
+ }
+ } else {
+ //got a smile at the end of the szText
+ uIsEmoticon++;
+ }
+
+ if(uIsEmoticon>1)
+ {
+ KviTextIcon * pIcon = g_pTextIconManager->lookupTextIcon(szLookup);
+ // do we have that emoticon-icon association ?
+ if(pIcon)
+ {
+ szResult.append("<img src=\"");
+ szResult.append(g_pIconManager->getSmallIconResourceName(pIcon->id()));
+ if(uCurBack != KVI_LABEL_DEF_BACK)
+ {
+ szResult.append("\" style=\"background-color:");
+ szResult.append(KVI_OPTION_MIRCCOLOR(uCurBack).name());
+ }
+ szResult.append("\">");
+ } else {
+ bIgnoreIcons=TRUE;
+ uIdx = uIcoStart-1;
+ }
+ } else {
+ bIgnoreIcons=TRUE;
+ uIdx = uIcoStart-1;
+ }
+ } else {
+ bIgnoreIcons=TRUE;
+ }
+ }
+ break;
+ case KVI_TEXT_ICON:
+ {
+ ++uIdx;
+ if(bShowIcons)
+ {
+ unsigned int uIcoStart = uIdx;
+ while((uIdx < (unsigned int)szText.length()) && (szText[(int)uIdx].unicode() > 32))uIdx++;
+
+ QString szLookup = szText.mid(uIcoStart,uIdx - uIcoStart);
+
+ KviTextIcon * pIcon = g_pTextIconManager->lookupTextIcon(szLookup);
+ if(pIcon)
+ {
+ szResult.append("<img src=\"");
+ szResult.append(g_pIconManager->getSmallIconResourceName(pIcon->id()));
+ if(uCurBack != KVI_LABEL_DEF_BACK)
+ {
+ szResult.append("\" style=\"background-color:");
+ szResult.append(KVI_OPTION_MIRCCOLOR(uCurBack).name());
+ }
+ szResult.append("\">");
+ } else {
+ uIdx = uIcoStart;
+ }
+ }
+ }
+ break;
+ }
+ }
+ //qDebug("%s",szResult.toUtf8().data());
+ return szResult;
+ }
+} \ No newline at end of file
diff --git a/src/kvirc/kernel/kvi_htmlgenerator.h b/src/kvirc/kernel/kvi_htmlgenerator.h
new file mode 100644
index 000000000..193ee28fb
--- /dev/null
+++ b/src/kvirc/kernel/kvi_htmlgenerator.h
@@ -0,0 +1,49 @@
+#ifndef _KVI_HTMLGENERATOR_H_
+#define _KVI_HTMLGENERATOR_H_
+//=============================================================================
+//
+// File : kvi_htmlgenerator.h
+// Creation date : Mon 04 Jan 2010 22:09:18 by Fabio Bas
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2010 Fabio Bas < ctrlaltca at gmail dot com >
+//
+// This program is FREE software. You can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=============================================================================
+
+/**
+* \file kvi_htmlgenerator.h
+* \author Fabio Bas
+* \brief Irc => Html format converter; this should better live in kdelibs, but uses kvirc options
+*/
+
+#include "kvi_settings.h"
+
+/**
+* \namespace KviHtmlGenerator
+* \brief A namespace to handle file utilities functions
+*/
+namespace KviHtmlGenerator
+{
+ /**
+ * \brief Converts a raw irc message to its html equivalent text
+ * \param szText const reference to a message text
+ * \return QString
+ */
+ extern KVIRC_API QString convertToHtml(const QString &szText);
+};
+
+#endif //_KVI_HTMLGENERATOR_H_ \ No newline at end of file
diff --git a/src/kvirc/ui/kvi_topicw.cpp b/src/kvirc/ui/kvi_topicw.cpp
index bc743756e..7b29152bd 100644
--- a/src/kvirc/ui/kvi_topicw.cpp
+++ b/src/kvirc/ui/kvi_topicw.cpp
@@ -40,6 +40,7 @@
#include "kvi_ircconnection.h"
#include "kvi_ircconnectionserverinfo.h"
#include "kvi_ircconnectionuserinfo.h"
+#include "kvi_htmlgenerator.h"
#include "kvi_mirccntrl.h"
#include "kvi_tal_tooltip.h"
#include "kvi_tal_popupmenu.h"
@@ -54,6 +55,8 @@
extern KviColorWindow * g_pColorWindow;
+#define KVI_LABEL_DEF_BACK 100
+#define KVI_LABEL_DEF_FORE 101
#ifdef COMPILE_PSEUDO_TRANSPARENCY
extern QPixmap * g_pShadedChildGlobalDesktopBackground;
@@ -160,140 +163,6 @@ void KviTopicWidget::applyOptions()
resizeEvent(0);
}
-#define KVI_LABEL_DEF_BACK 100
-#define KVI_LABEL_DEF_FORE 101
-
-QString convertToHtml(const QString &text)
-{
- QString result;
- bool curBold = false;
- bool curUnderline = false;
- unsigned char curFore = KVI_LABEL_DEF_FORE; //default fore
- unsigned char curBack = KVI_LABEL_DEF_BACK; //default back
-
- unsigned int idx = 0;
-
- while(idx < (unsigned int)text.length())
- {
- unsigned short c = text[(int)idx].unicode();
-
- unsigned int start = idx;
-
- while(
- (c != KVI_TEXT_COLOR) &&
- (c != KVI_TEXT_BOLD) &&
- (c != KVI_TEXT_UNDERLINE) &&
- (c != KVI_TEXT_REVERSE) &&
- (c != KVI_TEXT_RESET) &&
- (c != KVI_TEXT_ICON)
- )
- {
- idx++;
- if(idx >= (unsigned int)text.length())break;
- else c = text[(int)idx].unicode();
- }
-
- int len = idx - start;
-
- if(len > 0)
- {
- bool bOpened = FALSE;
- QString szText = text.mid(start,len);
-
- if(curBold) result.append("<b>");
- if(curUnderline) result.append("<u>");
-
- if(curFore != KVI_LABEL_DEF_FORE)
- {
- result.append("<font color=\"");
- result.append(KVI_OPTION_MIRCCOLOR(curFore).name());
- result.append('"');
- bOpened = TRUE;
- }
-
-/* if(curBack != KVI_LABEL_DEF_BACK)
- {
- if(!bOpened)
- result.append("<font bgcolor=");
- else
- result.append(" bgcolor=");
- result.append(KVI_OPTION_MIRCCOLOR(curBack).name());
- }*/
-
- if(bOpened) result.append(">");
-
- result.append(text.mid(start,len));
-
- if( (curFore != KVI_LABEL_DEF_FORE) /*|| (curBack != KVI_LABEL_DEF_BACK)*/ )
- result.append("</font>");
-
- if(curUnderline) result.append("</u>");
- if(curBold) result.append("</b>");
-
- }
-
- switch(c)
- {
- case KVI_TEXT_BOLD: curBold = !curBold; ++idx; break;
- case KVI_TEXT_UNDERLINE: curUnderline = !curUnderline; ++idx; break;
- case KVI_TEXT_REVERSE:
- {
- char auxBack = curBack;
- curBack = curFore;
- curFore = auxBack;
- }
- ++idx;
- break;
- case KVI_TEXT_RESET:
- curFore = KVI_LABEL_DEF_FORE;
- curBack = KVI_LABEL_DEF_BACK;
- curBold = false;
- curUnderline = false;
- ++idx;
- break;
- case KVI_TEXT_COLOR:
- {
- ++idx;
- unsigned char fore;
- unsigned char back;
- idx = getUnicodeColorBytes(text,idx,&fore,&back);
- if(fore != KVI_NOCHANGE)
- {
- curFore = fore;
- if(back != KVI_NOCHANGE)curBack = back;
- } else {
- // only a CTRL+K
- curBack = KVI_LABEL_DEF_BACK;
- curFore = KVI_LABEL_DEF_FORE;
- }
- }
- break;
- case KVI_TEXT_ICON:
- {
- ++idx;
-
- unsigned int icoStart = idx;
- while((idx < (unsigned int)text.length()) && (text[(int)idx].unicode() > 32))idx++;
-
- KviStr lookupString = text.mid(icoStart,idx - icoStart);
-
- KviTextIcon * icon = g_pTextIconManager->lookupTextIcon(lookupString.ptr());
- if(icon)
- {
- //TODO: icons
-/* QPixmap * pigzmap = icon->pixmap();
- p->drawPixmap(curX,(baseline + 2) - pigzmap->height(),*(pigzmap));
- curX += pigzmap->width();*/
- } else {
- idx = icoStart;
- }
- }
- break;
- }
- }
- return result;
-}
-
void KviTopicWidget::paintColoredText(QPainter *p, QString text,const QPalette& cg,const QRect & rect)
{
QFontMetrics fm(p->fontMetrics());
@@ -527,7 +396,7 @@ void KviTopicWidget::updateToolTip()
tmp.replace('&',"&amp;");
tmp.replace('<',"&lt;");
tmp.replace('>',"&gt;");
- tmp = convertToHtml(tmp);
+ tmp = KviHtmlGenerator::convertToHtml(tmp);
txt += tmp;
txt += "</center></td></tr>";
diff --git a/src/modules/notifier/notifiermessage.cpp b/src/modules/notifier/notifiermessage.cpp
index cde4130c7..04d862ac2 100644
--- a/src/modules/notifier/notifiermessage.cpp
+++ b/src/modules/notifier/notifiermessage.cpp
@@ -26,10 +26,8 @@
#include "notifiermessage.h"
#include "notifiersettings.h"
-#include "kvi_iconmanager.h"
-#include "kvi_mirccntrl.h"
+#include "kvi_htmlgenerator.h"
#include "kvi_options.h"
-#include "kvi_texticonmanager.h"
#include <QRect>
#include <QResizeEvent>
@@ -53,7 +51,7 @@ KviNotifierMessage::KviNotifierMessage(QPixmap * pPixmap, const QString &szText)
m_pLabel1 = new QLabel();
m_pLabel1->setTextFormat(Qt::RichText);
- m_pLabel1->setText(KviNotifierMessage::convertToHtml(m_szText));
+ m_pLabel1->setText(KviHtmlGenerator::convertToHtml(m_szText));
m_pLabel1->setWordWrap(true);
m_pHBox = new QHBoxLayout(this);
@@ -78,254 +76,4 @@ KviNotifierMessage::~KviNotifierMessage()
m_pHBox->deleteLater();
}
-//TODO merge this code with kvi_topicw.cpp's one
-#define KVI_LABEL_DEF_BACK 100
-#define KVI_LABEL_DEF_FORE 101
-
-QString KviNotifierMessage::convertToHtml(const QString &szText)
-{
- QString szResult;
- bool bCurBold = false;
- bool bCurUnderline = false;
- bool bIgnoreIcons = false;
- bool bShowIcons = KVI_OPTION_BOOL(KviOption_boolDrawEmoticons);
-
- unsigned char uCurFore = KVI_LABEL_DEF_FORE; //default fore
- unsigned char uCurBack = KVI_LABEL_DEF_BACK; //default back
-
- unsigned int uIdx = 0;
-
- while(uIdx < (unsigned int)szText.length())
- {
- unsigned short c = szText[(int)uIdx].unicode();
- unsigned int uStart = uIdx;
-
- while(
- (c != KVI_TEXT_COLOR) &&
- (c != KVI_TEXT_BOLD) &&
- (c != KVI_TEXT_UNDERLINE) &&
- (c != KVI_TEXT_REVERSE) &&
- (c != KVI_TEXT_RESET) &&
- (c != KVI_TEXT_ICON) &&
- ((c != ':') || bIgnoreIcons) &&
- ((c != ';') || bIgnoreIcons) &&
- ((c != '=') || bIgnoreIcons)
- )
- {
- uIdx++;
- bIgnoreIcons=FALSE;
- if(uIdx >= (unsigned int)szText.length())break;
- else c = szText[(int)uIdx].unicode();
- }
-
- bIgnoreIcons=FALSE;
- int iLen = uIdx - uStart;
-
- if(iLen > 0)
- {
- bool bOpened = FALSE;
-
- if(uCurFore != KVI_LABEL_DEF_FORE)
- {
- szResult.append("<span style=\"color:");
- szResult.append(KVI_OPTION_MIRCCOLOR(uCurFore).name());
- bOpened = TRUE;
- }
-
- if(uCurBack != KVI_LABEL_DEF_BACK)
- {
- if(!bOpened)
- {
- szResult.append("<span style=\"background-color:");
- bOpened = TRUE;
- } else {
- szResult.append(";background-color:");
- }
- szResult.append(KVI_OPTION_MIRCCOLOR(uCurBack).name());
- }
-
- if(bCurUnderline)
- {
- if(!bOpened)
- {
- szResult.append("<span style=\"text-decoration:underline");
- bOpened = TRUE;
- } else {
- szResult.append(";text-decoration:underline");
- }
- }
-
- if(bCurBold)
- {
- if(!bOpened)
- {
- szResult.append("<span style=\"font-weight:bold");
- bOpened = TRUE;
- } else {
- szResult.append(";font-weight:bold");
- }
- }
-
- if(bOpened) szResult.append(";\">");
-
- szResult.append(szText.mid(uStart,iLen));
-
- if( bOpened )
- szResult.append("</span>");
- }
-
- switch(c)
- {
- case KVI_TEXT_BOLD: bCurBold = !bCurBold; ++uIdx; break;
- case KVI_TEXT_UNDERLINE: bCurUnderline = !bCurUnderline; ++uIdx; break;
- case KVI_TEXT_REVERSE:
- {
- char auxBack = uCurBack;
- uCurBack = uCurFore;
- uCurFore = auxBack;
- }
- ++uIdx;
- break;
- case KVI_TEXT_RESET:
- uCurFore = KVI_LABEL_DEF_FORE;
- uCurBack = KVI_LABEL_DEF_BACK;
- bCurBold = false;
- bCurUnderline = false;
- ++uIdx;
- break;
- case KVI_TEXT_COLOR:
- {
- ++uIdx;
- unsigned char fore;
- unsigned char back;
- uIdx = getUnicodeColorBytes(szText,uIdx,&fore,&back);
- if(fore != KVI_NOCHANGE)
- {
- uCurFore = fore;
- if(back != KVI_NOCHANGE)uCurBack = back;
- } else {
- // only a CTRL+K
- uCurBack = KVI_LABEL_DEF_BACK;
- uCurFore = KVI_LABEL_DEF_FORE;
- }
- }
- break;
- case ':':
- case ';':
- case '=':
- {
- //potential emoticon, got eyes
- if(bShowIcons)
- {
- ++uIdx;
- QString szLookup;
- szLookup.append(QChar(c));
- unsigned short uIsEmoticon=0;
- unsigned int uIcoStart = uIdx;
-
- if(uIdx < (unsigned int)szText.length())
- {
- //look up for a nose
- if(szText[(int)uIdx] == '-')
- {
- szLookup.append('-');
- uIdx++;
- }
- }
-
- if(uIdx < (unsigned int)szText.length())
- {
- //look up for a mouth
- unsigned short m = szText[(int)uIdx].unicode();
- switch(m)
- {
- case ')':
- case '(':
- case '/':
- case 'D':
- case 'P':
- case 'S':
- case 'O':
- case '*':
- case '|':
- szLookup+=QChar(m);
- uIsEmoticon++;
- uIdx++;
- break;
- default:
- break;
- }
- }
-
- if(uIdx < (unsigned int)szText.length())
- {
- //look up for a space
- if(szText[(int)uIdx]== ' ')
- {
- uIsEmoticon++;
- }
- } else {
- //got a smile at the end of the szText
- uIsEmoticon++;
- }
-
- if(uIsEmoticon>1)
- {
- KviTextIcon * pIcon = g_pTextIconManager->lookupTextIcon(szLookup);
- // do we have that emoticon-icon association ?
- if(pIcon)
- {
- szResult.append("<img src=\"");
- szResult.append(g_pIconManager->getSmallIconResourceName(pIcon->id()));
- if(uCurBack != KVI_LABEL_DEF_BACK)
- {
- szResult.append("\" style=\"background-color:");
- szResult.append(KVI_OPTION_MIRCCOLOR(uCurBack).name());
- }
- szResult.append("\">");
- } else {
- bIgnoreIcons=TRUE;
- uIdx = uIcoStart-1;
- }
- } else {
- bIgnoreIcons=TRUE;
- uIdx = uIcoStart-1;
- }
- } else {
- bIgnoreIcons=TRUE;
- }
- }
- break;
- case KVI_TEXT_ICON:
- {
- ++uIdx;
- if(bShowIcons)
- {
- unsigned int uIcoStart = uIdx;
- while((uIdx < (unsigned int)szText.length()) && (szText[(int)uIdx].unicode() > 32))uIdx++;
-
- QString szLookup = szText.mid(uIcoStart,uIdx - uIcoStart);
-
- KviTextIcon * pIcon = g_pTextIconManager->lookupTextIcon(szLookup);
- if(pIcon)
- {
- szResult.append("<img src=\"");
- szResult.append(g_pIconManager->getSmallIconResourceName(pIcon->id()));
- if(uCurBack != KVI_LABEL_DEF_BACK)
- {
- szResult.append("\" style=\"background-color:");
- szResult.append(KVI_OPTION_MIRCCOLOR(uCurBack).name());
- }
- szResult.append("\">");
- } else {
- uIdx = uIcoStart;
- }
- }
- }
- break;
- }
- }
- //qDebug("%s",szResult.toUtf8().data());
- return szResult;
-}
diff --git a/src/modules/notifier/notifiermessage.h b/src/modules/notifier/notifiermessage.h
index 15a9d9763..d5cdc3d4b 100644
--- a/src/modules/notifier/notifiermessage.h
+++ b/src/modules/notifier/notifiermessage.h
@@ -68,12 +68,6 @@ private:
QLabel * m_pLabel1;
public:
/**
- * \brief Converts a raw irc message to its html equivalent text
- * \param szText const reference to a message text
- * \return QString
- */
- static QString convertToHtml(const QString &szText);
- /**
* \brief Returns the original irc message
* \return QString
*/