diff options
| author | 2008-08-18 15:41:08 +0000 | |
|---|---|---|
| committer | 2008-08-18 15:41:08 +0000 | |
| commit | befc91c05aba46217ec0f8d1c3ca9aa91e79eae4 (patch) | |
| tree | 760f3777674c652cbf3da204f82aad4cfbb5c2fd | |
| parent | updated italian translation (diff) | |
| download | KVIrc-befc91c05aba46217ec0f8d1c3ca9aa91e79eae4.tar.gz KVIrc-befc91c05aba46217ec0f8d1c3ca9aa91e79eae4.tar.bz2 KVIrc-befc91c05aba46217ec0f8d1c3ca9aa91e79eae4.zip | |
Rewrote highlighting of nicks/words, fixing reported bug with non-word characters in nick.
Disabled usage of QtDbus for building w/KDE
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2262 17fca916-40b9-46aa-a4ea-0a15b648b75c
| -rw-r--r-- | src/kvirc/kernel/kvi_main.cpp | 4 | ||||
| -rw-r--r-- | src/kvirc/ui/kvi_console.cpp | 36 |
2 files changed, 21 insertions, 19 deletions
diff --git a/src/kvirc/kernel/kvi_main.cpp b/src/kvirc/kernel/kvi_main.cpp index 2a8917b42..4a01277f1 100644 --- a/src/kvirc/kernel/kvi_main.cpp +++ b/src/kvirc/kernel/kvi_main.cpp @@ -33,8 +33,10 @@ #include "kvi_msgbox.h" #include "kvi_buildinfo.h" #ifdef COMPILE_DBUS_SUPPORT +#ifndef COMPILE_KDE_SUPPORT // 'cause kde adds an interface itself #include "kvi_dbusadaptor.h" #endif +#endif #ifndef COMPILE_NO_IPC extern bool kvi_sendIpcMessage(const char * message); // kvi_ipc.cpp #endif @@ -321,9 +323,11 @@ int main(int argc,char ** argv) // Need to have the X socket open before IPC startup KviApp * theApp = new KviApp(argc,argv); #ifdef COMPILE_DBUS_SUPPORT +#ifndef COMPILE_KDE_SUPPORT new KviDbusAdaptor(theApp); QDBusConnection::sessionBus().registerObject("/MainApplication", theApp); #endif +#endif KviStr szRemoteCommand = a.szExecCommand; if(a.szExecRemoteCommand.hasData()) { diff --git a/src/kvirc/ui/kvi_console.cpp b/src/kvirc/ui/kvi_console.cpp index a2a2ea597..2fcc078d0 100644 --- a/src/kvirc/ui/kvi_console.cpp +++ b/src/kvirc/ui/kvi_console.cpp @@ -85,6 +85,8 @@ #include <QStringList> #include <QCloseEvent> #include <QTextDocument> +#include <QRegExp> +#include <QDebug> // FIXME: Qt4 #include <QMimeData> //#include <q3mimefactory.h> @@ -596,25 +598,16 @@ int KviConsole::applyHighlighting(KviWindow *wnd,int type,const QString &nick,co QString szPattern=KVI_OPTION_STRING(KviOption_stringWordSplitters); QString szSource; QString szStripMsg=KviMircCntrl::stripControlBytes(szMsg); - QChar* aux=(QChar*)(szStripMsg.utf16()); - if(aux) - { - while(aux->unicode()) - { - if( KVI_OPTION_STRING(KviOption_stringWordSplitters).indexOf(*aux,Qt::CaseInsensitive) > -1 ) - szSource.append(' '); - else - szSource.append(*aux); - aux++; - } - } else { - szSource=szStripMsg; - } - szSource.append(' '); - szSource.prepend(' '); + QRegExp rgxHlite; if(KVI_OPTION_BOOL(KviOption_boolAlwaysHighlightNick) && connection()) { - if(szSource.indexOf(QString(" %1 ").arg(connection()->userInfo()->nickName()),0,Qt::CaseInsensitive) > -1) + rgxHlite.setPattern( + QString("(?:[%1]|\\b)%2(?:[%1]|\\b)").arg( + QRegExp::escape(szPattern), QRegExp::escape(connection()->userInfo()->nickName()) + ) + ); + rgxHlite.setCaseSensitivity(Qt::CaseInsensitive); + if(szStripMsg.contains(rgxHlite)) return triggerOnHighlight(wnd,type,nick,user,host,szMsg,connection()->userInfo()->nickName()); } @@ -625,8 +618,13 @@ int KviConsole::applyHighlighting(KviWindow *wnd,int type,const QString &nick,co { if((*it).isEmpty()) continue; - // FIXME : This is SLOOOOOOOOW (QString -> ascii translation!!) !!!! - if(szSource.indexOf(QString(" %1 ").arg(*it),0,Qt::CaseInsensitive) > -1) + rgxHlite.setPattern( + QString("(?:[%1]|\\b)%2(?:[%1]|\\b)").arg( + QRegExp::escape(szPattern), QRegExp::escape(*it) + ) + ); + rgxHlite.setCaseSensitivity(Qt::CaseInsensitive); + if(szStripMsg.contains(rgxHlite)) { return triggerOnHighlight(wnd,type,nick,user,host,szMsg,*it); } |
