diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/plugins/texteffect | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/plugins/texteffect')
-rw-r--r-- | kopete/plugins/texteffect/Makefile.am | 20 | ||||
-rw-r--r-- | kopete/plugins/texteffect/icons/Makefile.am | 3 | ||||
-rw-r--r-- | kopete/plugins/texteffect/icons/cr32-app-texteffect.png | bin | 0 -> 1621 bytes | |||
-rw-r--r-- | kopete/plugins/texteffect/kopete_texteffect.desktop | 131 | ||||
-rw-r--r-- | kopete/plugins/texteffect/kopete_texteffect_config.desktop | 126 | ||||
-rw-r--r-- | kopete/plugins/texteffect/texteffectconfig.cpp | 140 | ||||
-rw-r--r-- | kopete/plugins/texteffect/texteffectconfig.h | 62 | ||||
-rw-r--r-- | kopete/plugins/texteffect/texteffectplugin.cpp | 198 | ||||
-rw-r--r-- | kopete/plugins/texteffect/texteffectplugin.h | 71 | ||||
-rw-r--r-- | kopete/plugins/texteffect/texteffectpreferences.cpp | 232 | ||||
-rw-r--r-- | kopete/plugins/texteffect/texteffectpreferences.h | 58 | ||||
-rw-r--r-- | kopete/plugins/texteffect/texteffectprefs.ui | 231 |
12 files changed, 1272 insertions, 0 deletions
diff --git a/kopete/plugins/texteffect/Makefile.am b/kopete/plugins/texteffect/Makefile.am new file mode 100644 index 00000000..0d657dc5 --- /dev/null +++ b/kopete/plugins/texteffect/Makefile.am @@ -0,0 +1,20 @@ +METASOURCES = AUTO + +SUBDIRS = icons +INCLUDES = $(KOPETE_INCLUDES) $(all_includes) + +kde_module_LTLIBRARIES = kopete_texteffect.la kcm_kopete_texteffect.la + +kopete_texteffect_la_SOURCES = texteffectplugin.cpp texteffectconfig.cpp +kopete_texteffect_la_LDFLAGS = -module -no-undefined $(KDE_PLUGIN) $(all_libraries) +kopete_texteffect_la_LIBADD = ../../libkopete/libkopete.la + +kcm_kopete_texteffect_la_SOURCES = texteffectconfig.cpp texteffectprefs.ui texteffectpreferences.cpp +kcm_kopete_texteffect_la_LDFLAGS = -module -no-undefined $(KDE_PLUGIN) $(all_libraries) +kcm_kopete_texteffect_la_LIBADD = ../../libkopete/libkopete.la $(LIB_KUTILS) + +service_DATA = kopete_texteffect.desktop +servicedir = $(kde_servicesdir) + +kcm_DATA = kopete_texteffect_config.desktop +kcmdir = $(kde_servicesdir)/kconfiguredialog diff --git a/kopete/plugins/texteffect/icons/Makefile.am b/kopete/plugins/texteffect/icons/Makefile.am new file mode 100644 index 00000000..224eb420 --- /dev/null +++ b/kopete/plugins/texteffect/icons/Makefile.am @@ -0,0 +1,3 @@ +kopeteicondir = $(kde_datadir)/kopete/icons +kopeteicon_ICON = AUTO + diff --git a/kopete/plugins/texteffect/icons/cr32-app-texteffect.png b/kopete/plugins/texteffect/icons/cr32-app-texteffect.png Binary files differnew file mode 100644 index 00000000..9f44eb65 --- /dev/null +++ b/kopete/plugins/texteffect/icons/cr32-app-texteffect.png diff --git a/kopete/plugins/texteffect/kopete_texteffect.desktop b/kopete/plugins/texteffect/kopete_texteffect.desktop new file mode 100644 index 00000000..f929b2f2 --- /dev/null +++ b/kopete/plugins/texteffect/kopete_texteffect.desktop @@ -0,0 +1,131 @@ +[Desktop Entry] +Type=Service +X-Kopete-Version=1000900 +Icon=texteffect +ServiceTypes=Kopete/Plugin +X-KDE-Library=kopete_texteffect +X-KDE-PluginInfo-Author=Olivier Goffart +X-KDE-PluginInfo-Name=kopete_texteffect +X-KDE-PluginInfo-Version=0.8.0 +X-KDE-PluginInfo-Website=http://kopete.kde.org +X-KDE-PluginInfo-Category=Plugins +X-KDE-PluginInfo-Depends= +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-EnabledByDefault=false +Name=Text Effect +Name[ar]=التأثير النصي +Name[be]=Тэкставы эфект +Name[bg]=Текстови ефекти +Name[bn]=টেক্সট প্রভাব +Name[bs]=Tekst efekti +Name[ca]=Efecte de text +Name[cs]=Textový efekt +Name[cy]=Effaith Testun +Name[da]=Teksteffekt +Name[de]=Texteffekte +Name[el]=Εφέ κειμένου +Name[eo]=Tekst-efektoj +Name[es]=Efecto de texto +Name[et]=Tekstiefektid +Name[eu]=Testuaren efektua +Name[fa]=جلوۀ متن +Name[fi]=Tekstitehoste +Name[fr]=Effets de texte +Name[ga]=Maisíocht Téacs +Name[gl]=Efecto de texto +Name[he]=אפקטים של טקסט +Name[hi]=पाठ प्रभाव +Name[hr]=Tekstualni efekti +Name[hu]=Szövegeffektus +Name[is]=Breyta letri +Name[it]=Effetto di testo +Name[ja]=テキスト効果 +Name[ka]=ტექსტის ეფექტები +Name[kk]=Мәтінді безендіру +Name[km]=បែបផែនអត្ថបទ +Name[lt]=Teksto efektai +Name[mk]=Ефекти за текст +Name[nb]=Teksteffekt +Name[nds]=Texteffekt +Name[ne]=पाठ प्रभाव +Name[nl]=Teksteffect +Name[nn]=Teksteffekt +Name[pa]=ਪਾਠ ਪਰਭਾਵ +Name[pl]=Efekty tekstowe +Name[pt]=Efeito de Texto +Name[pt_BR]=Efeito de texto +Name[ro]=Efect text +Name[ru]=Текстовые эффекты +Name[se]=Teakstaeffeakta +Name[sk]=Textový efekt +Name[sl]=Besedilni učinki +Name[sr]=Текстуални ефекти +Name[sr@Latn]=Tekstualni efekti +Name[sv]=Texteffekter +Name[ta]=செயல் +Name[tg]=Натиҷаҳои Матн +Name[tr]=Metin Efekti +Name[uk]=Текстові ефекти +Name[uz]=Matn effekti +Name[uz@cyrillic]=Матн эффекти +Name[zh_CN]=文字特效 +Name[zh_HK]=文字效果 +Name[zh_TW]=文字效果 +Comment=Add nice effects to your messages +Comment[ar]=تضيف مؤثرات لطيفة لرسائلك +Comment[be]=Дадаць файныя эфекты да вашых паведамленняў +Comment[bg]=Добавяне на текстови ефекти към съобщенията +Comment[bn]=আপনার বার্তাতে সুন্দর প্রভাব যোগ করে +Comment[bs]=Dodaj efekte porukama +Comment[ca]=Afegeix bonics efectes als vostres missatges +Comment[cs]=Přidává efekty ke zprávám +Comment[cy]=Ychwanegu effeithiau del i'ch negeseuon +Comment[da]=Tilføj rare effekter til dine beskeder +Comment[de]=Verschönern Sie eigene Nachrichten durch nette Effekte +Comment[el]=Προσθέτει όμορφα εφέ στα μηνύματά σας +Comment[eo]=Ornami viajn mesaĝojn per belaj efektoj +Comment[es]=Añade efectos agradables a sus mensajes +Comment[et]=Lisab sõnumitele vahvaid efekte +Comment[eu]=Gehitu efektu atseginak zure mezuei +Comment[fa]=افزودن جلوههای زیبا به پیامهایتان +Comment[fi]=Lisää tehosteita viesteihisi +Comment[fr]=Ajouter des effets sympathiques à vos messages +Comment[ga]=Cuir maisíochtaí deasa le do theachtaireachtaí +Comment[gl]=Engadir efectos agradables ás túas mensaxes +Comment[he]=הוסף אפקטים נחמדים להודעותך +Comment[hi]=आपके संदेशों में सुंदर प्रभाव जोड़े +Comment[hu]=Effektusok hozzáadása az üzenetekhez +Comment[is]=Gera skeytin þín flottari +Comment[it]=Aggiungi effetti carini ai tuoi messaggi +Comment[ja]=メッセージに効果を付加 +Comment[ka]=თქვენს შეტყობინებებს ამატებს სასიამოვნო ეფექტებს +Comment[kk]=Хабарыңызды безендіру тәсілдері +Comment[km]=បន្ថែមបែបផែនស្រស់ស្អាតទៅសាររបស់អ្នក +Comment[lt]=Papuoškite žinutes gražiais teksto efektais +Comment[mk]=Додадете фини ефекти на вашите пораки +Comment[nb]=Legg til effekter på meldingene dine +Comment[nds]=Dien Narichten smucke Effekten tofögen +Comment[ne]=तपाईँको सन्देशमा उत्तम प्रभाव थप्नुहोस् +Comment[nl]=Voegt leuke effecten to aan uw berichten +Comment[nn]=Legg til effektar på meldingane +Comment[pl]=Dodaje ładne efekty do Twoich wiadomości +Comment[pt]=Adicionar efeitos engraçados às suas mensagens +Comment[pt_BR]=Adiciona um efeito às suas mensagens +Comment[ro]=Adaucă efecte drăguţe la mesajele dumneavoastră +Comment[ru]=Добавить эффекты к вашим сообщениям +Comment[se]=Lasit fiinna effeavttaid du dieđáhusaide +Comment[sk]=Pridá pekné efekty k vašim správam +Comment[sl]=Doda lepe učinke vašim sporočilom +Comment[sr]=Додаје лепе ефекте вашим порукама +Comment[sr@Latn]=Dodaje lepe efekte vašim porukama +Comment[sv]=Lägg till trevliga effekter i dina meddelanden +Comment[ta]=இனிய விளைவுகளை உங்களுக்கு சேர்க்கும் +Comment[tg]=Натиҷаҳои хубро ба пайёмҳои шумо ҳамроҳ мекунад +Comment[tr]=Mesajlarınıza hoş efektler ekleyin +Comment[uk]=Додати ефекти до ваших повідомлень +Comment[uz]=Xabarlarga chiroyli effektlarni qoʻshish +Comment[uz@cyrillic]=Хабарларга чиройли эффектларни қўшиш +Comment[zh_CN]=在您的消息中添加文字特效 +Comment[zh_HK]=為您的訊息增加有趣的效果 +Comment[zh_TW]=在您的訊息中加入一些效果 diff --git a/kopete/plugins/texteffect/kopete_texteffect_config.desktop b/kopete/plugins/texteffect/kopete_texteffect_config.desktop new file mode 100644 index 00000000..06678e51 --- /dev/null +++ b/kopete/plugins/texteffect/kopete_texteffect_config.desktop @@ -0,0 +1,126 @@ +[Desktop Entry] +Icon=texteffect +Type=Service +ServiceTypes=KCModule + +X-KDE-ModuleType=Library +X-KDE-Library=kopete_texteffect +X-KDE-FactoryName=TextEffectConfigFactory +X-KDE-ParentApp=kopete_texteffect +X-KDE-ParentComponents=kopete_texteffect + +Name=Text Effect +Name[ar]=التأثير النصي +Name[be]=Тэкставы эфект +Name[bg]=Текстови ефекти +Name[bn]=টেক্সট প্রভাব +Name[bs]=Tekst efekti +Name[ca]=Efecte de text +Name[cs]=Textový efekt +Name[cy]=Effaith Testun +Name[da]=Teksteffekt +Name[de]=Texteffekte +Name[el]=Εφέ κειμένου +Name[eo]=Tekst-efektoj +Name[es]=Efecto de texto +Name[et]=Tekstiefektid +Name[eu]=Testuaren efektua +Name[fa]=جلوۀ متن +Name[fi]=Tekstitehoste +Name[fr]=Effets de texte +Name[ga]=Maisíocht Téacs +Name[gl]=Efecto de texto +Name[he]=אפקטים של טקסט +Name[hi]=पाठ प्रभाव +Name[hr]=Tekstualni efekti +Name[hu]=Szövegeffektus +Name[is]=Breyta letri +Name[it]=Effetto di testo +Name[ja]=テキスト効果 +Name[ka]=ტექსტის ეფექტები +Name[kk]=Мәтінді безендіру +Name[km]=បែបផែនអត្ថបទ +Name[lt]=Teksto efektai +Name[mk]=Ефекти за текст +Name[nb]=Teksteffekt +Name[nds]=Texteffekt +Name[ne]=पाठ प्रभाव +Name[nl]=Teksteffect +Name[nn]=Teksteffekt +Name[pa]=ਪਾਠ ਪਰਭਾਵ +Name[pl]=Efekty tekstowe +Name[pt]=Efeito de Texto +Name[pt_BR]=Efeito de texto +Name[ro]=Efect text +Name[ru]=Текстовые эффекты +Name[se]=Teakstaeffeakta +Name[sk]=Textový efekt +Name[sl]=Besedilni učinki +Name[sr]=Текстуални ефекти +Name[sr@Latn]=Tekstualni efekti +Name[sv]=Texteffekter +Name[ta]=செயல் +Name[tg]=Натиҷаҳои Матн +Name[tr]=Metin Efekti +Name[uk]=Текстові ефекти +Name[uz]=Matn effekti +Name[uz@cyrillic]=Матн эффекти +Name[zh_CN]=文字特效 +Name[zh_HK]=文字效果 +Name[zh_TW]=文字效果 +Comment=Adds special effects to your text +Comment[ar]=يضيف مؤثرات خاصة لنصوصك +Comment[be]=Дадае адмысловыя эфекты да вашага тэксту +Comment[bg]=Добавяне на текстови ефекти към съобщенията +Comment[bn]=আপনার টেক্সটে বিশেষ প্রভাব যোগ করে +Comment[bs]=Dodaje specijalne efekte vašim porukama +Comment[ca]=Afegeix bonics efectes al vostre text +Comment[cs]=Přidává speciální efekty do vašeho textu +Comment[cy]=Ychwanegu effeithiau arbennig i'ch testun +Comment[da]=Tilføj specielle effekter til din tekst +Comment[de]=Verschönern Sie eigene Nachrichten durch nette Effekte +Comment[el]=Προσθέτει ειδικά εφέ στο κείμενό σας +Comment[es]=Añade efectos especiales a su texto +Comment[et]=Lisab tekstile eriefekte +Comment[eu]=Gehitu efektu bereziak zure testuar +Comment[fa]=جلوههای ویژه را به متن شما اضافه میکند +Comment[fi]=Lisää erikoisefektejä tekstiisi +Comment[fr]=Ajoute des effets spéciaux à vos messages +Comment[ga]=Cuir maisíochtaí speisialta le do théacs +Comment[gl]=Engadir efectos especiáis ó teu texto +Comment[he]=הוסף אפקטים מיוחדים להודעותך +Comment[hi]=आपके संदेशों में विशिष्ट प्रभाव जोड़े +Comment[hr]=Dodaje specijalne efekte vašem tekstu +Comment[hu]=Speciális effektusok hozzáadása az üzenetek szövegéhez +Comment[is]=Bæta skreytingum í textann +Comment[it]=Aggiunti effetti speciali al tuo testo +Comment[ja]=テキストに特別な効果を付加 +Comment[ka]=თქვენს ტექსტს ამატებს ეფექტებს +Comment[kk]=Мәтініңізді арнаулы безендіру тәсілдері +Comment[km]=បន្ថែមបែបផែនពិសេសៗទៅអត្ថបទរបស់អ្នក +Comment[lt]=Pridėkite į tekstą specialiųjų efektų +Comment[mk]=Додава спцијални ефекти на вашиот текст +Comment[nb]=Legg til spesielle effekter på teksten +Comment[nds]=Föögt Dien Text smucke Effekten to +Comment[ne]=तपाईँको पाठमा विशेष प्रभाव थप्दछ +Comment[nl]=Voegt speciale effecten aan uw teksten toe +Comment[nn]=Legg til spesielle effektar på teksten +Comment[pl]=Dodaje specjalne efekty do Twojego tekstu +Comment[pt]=Adiciona efeitos especiais ao seu texto +Comment[pt_BR]=Adiciona efeitos especiais em seu texto +Comment[ro]=Adaugă efecte speciale la textele dumneavoastră +Comment[ru]=Добавляет эффекты к вашим сообщениям +Comment[se]=Lasiha erenoamaš effeavttaid du tekstii +Comment[sk]=Pridá špeciálne efekty k vášmu textu +Comment[sl]=Doda posebne učinke vašemu besedilu +Comment[sr]=Додаје специјалне ефекте вашем тексту +Comment[sr@Latn]=Dodaje specijalne efekte vašem tekstu +Comment[sv]=Lägger till specialeffekter till din text +Comment[ta]=உங்கள் உரையில் சிறப்பு விளைவிகளை சேர்க்கும் +Comment[tg]=Натиҷаҳои махсусро ба матни шумо ҳамроҳ мекунад +Comment[tr]=Metinlerinize özel efektler ekleyin +Comment[uk]=Додає ефекти до ваших повідомлень +Comment[zh_CN]=在您的文字中添加特殊效果 +Comment[zh_HK]=為您的訊息增加特別的效果 +Comment[zh_TW]=在您的文字中加入一些特效 + diff --git a/kopete/plugins/texteffect/texteffectconfig.cpp b/kopete/plugins/texteffect/texteffectconfig.cpp new file mode 100644 index 00000000..9ecca3f0 --- /dev/null +++ b/kopete/plugins/texteffect/texteffectconfig.cpp @@ -0,0 +1,140 @@ +/* + texteffectconfig.cpp + + Copyright (c) 2003 by Olivier Goffart <ogoffart @ kde.org> + Copyright (c) 2003 by Matt Rogers <[email protected]> + + Kopete (c) 2002-2003 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 option) any later version. * + * * + ************************************************************************* +*/ + +#include <qstring.h> + +#include <kglobal.h> +#include <kconfig.h> + +#include "texteffectconfig.h" + +TextEffectConfig::TextEffectConfig() +{ + load(); +} + +void TextEffectConfig::load() +{ + KConfig *config = KGlobal::config(); + config->setGroup("TextEffect Plugin"); + + mColors = config->readListEntry("Colors"); + if(mColors.isEmpty()) + { + mColors= defaultColorList(); + } + mColorRandom = config->readBoolEntry("Color Random Order", false); + mColorLines = config->readBoolEntry("Color change every lines", true); + mColorWords = config->readBoolEntry("Color change every words", false); + mColorChar = config->readBoolEntry("Color change every char", false); + + mLamer = config->readBoolEntry("L4m3r", false); + mWaves = config->readBoolEntry("WaVeS", false); +} + +QStringList TextEffectConfig::defaultColorList() +{ + return QStringList::split( ",", "#00BBDD,#0088DD,#0000DD,#8800DD,#DD00DD,#DD0088,#DD0000,#DD8800,#DDBB00,#88BB00,#00BB00" ); +} + +void TextEffectConfig::save() +{ + KConfig *config = KGlobal::config(); + config->setGroup("TextEffect Plugin"); + + config->writeEntry("Colors", mColors ); + config->writeEntry("Color Random Order", mColorRandom); + config->writeEntry("Color change every lines", mColorLines); + config->writeEntry("Color change every words", mColorWords); + config->writeEntry("Color change every char", mColorChar); + + config->writeEntry("L4m3r", mLamer); + config->writeEntry("WaVeS", mWaves); + + config->sync(); +} + +QStringList TextEffectConfig::colors() const +{ + return mColors; +} + +bool TextEffectConfig::colorRandom() const +{ + return mColorRandom; +} + +bool TextEffectConfig::colorWords() const +{ + return mColorWords; +} + +bool TextEffectConfig::colorLines() const +{ + return mColorLines; +} + +bool TextEffectConfig::colorChar() const +{ + return mColorChar; +} + +bool TextEffectConfig::lamer() const +{ + return mLamer; +} + +bool TextEffectConfig::waves() const +{ + return mWaves; +} + +void TextEffectConfig::setColors(const QStringList &newColors) +{ + mColors = newColors; +} + +void TextEffectConfig::setColorWords(bool newWords) +{ + mColorWords = newWords; +} + +void TextEffectConfig::setColorLines(bool newLines) +{ + mColorLines = newLines; +} + +void TextEffectConfig::setColorRandom(bool newRandom) +{ + mColorRandom = newRandom; +} + +void TextEffectConfig::setColorChar(bool newChar) +{ + mColorChar = newChar; +} + +void TextEffectConfig::setLamer(bool newLamers) +{ + mLamer = newLamers; +} + +void TextEffectConfig::setWaves(bool newWaves) +{ + mWaves = newWaves; +} diff --git a/kopete/plugins/texteffect/texteffectconfig.h b/kopete/plugins/texteffect/texteffectconfig.h new file mode 100644 index 00000000..80b19151 --- /dev/null +++ b/kopete/plugins/texteffect/texteffectconfig.h @@ -0,0 +1,62 @@ +/* + texteffectconfig.h + + Copyright (c) 2003 by Olivier Goffart <ogoffart @ kde.org> + Copyright (c) 2003 by Matt Rogers <[email protected]> + + Kopete (c) 2002-2003 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 option) any later version. * + * * + ************************************************************************* +*/ + +#ifndef TEXTEFFECTCONFIG_H +#define TEXTEFFECTCONFIG_H + +class QStringList; + +class TextEffectConfig +{ +public: + TextEffectConfig(); + + void load(); + void save(); + + //accessor functions + QStringList colors() const; + bool colorLines() const; + bool colorWords() const; + bool colorChar() const; + bool colorRandom() const; + bool lamer() const; + bool waves() const; + + void setColors(const QStringList &newColors = QStringList()); + void setColorLines(bool newLines); + void setColorChar(bool newChar); + void setColorWords(bool newWords); + void setColorRandom(bool newRandom); + void setLamer(bool newLamer); + void setWaves(bool newWaves); + QStringList defaultColorList(); + + +private: + QStringList mColors; + bool mColorLines; + bool mColorWords; + bool mColorChar; + bool mColorRandom; + bool mLamer; + bool mWaves; + +}; + +#endif diff --git a/kopete/plugins/texteffect/texteffectplugin.cpp b/kopete/plugins/texteffect/texteffectplugin.cpp new file mode 100644 index 00000000..5374b2ca --- /dev/null +++ b/kopete/plugins/texteffect/texteffectplugin.cpp @@ -0,0 +1,198 @@ +/*************************************************************************** + texteffectplugin.cpp - description + ------------------- + begin : jeu nov 14 2002 + copyright : (C) 2002 by Olivier Goffart + email : ogoffart @ kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 option) any later version. * + * * + ***************************************************************************/ + +#include <stdlib.h> + +#include <kdebug.h> +#include <kgenericfactory.h> + +#include "kopetechatsessionmanager.h" + +#include "texteffectplugin.h" +#include "texteffectconfig.h" + +typedef KGenericFactory<TextEffectPlugin> TextEffectPluginFactory; +K_EXPORT_COMPONENT_FACTORY( kopete_texteffect, TextEffectPluginFactory( "kopete_texteffect" ) ) + +TextEffectPlugin::TextEffectPlugin( QObject *parent, const char *name, const QStringList &/*args*/ ) +: Kopete::Plugin( TextEffectPluginFactory::instance(), parent, name ) +{ + if( !pluginStatic_ ) + pluginStatic_=this; + + m_config = new TextEffectConfig; + + connect ( this , SIGNAL( settingsChanged() ) , this , SLOT( slotSettingsChanged() ) ); + + connect( Kopete::ChatSessionManager::self(), + SIGNAL( aboutToSend( Kopete::Message & ) ), + SLOT( slotOutgoingMessage( Kopete::Message & ) ) ); + + last_color=0; +} + +TextEffectPlugin::~TextEffectPlugin() +{ + delete m_config; + pluginStatic_ = 0L; +} + +TextEffectPlugin* TextEffectPlugin::plugin() +{ + return pluginStatic_ ; +} + +TextEffectPlugin* TextEffectPlugin::pluginStatic_ = 0L; + + +void TextEffectPlugin::slotOutgoingMessage( Kopete::Message& msg ) +{ + if(msg.direction() != Kopete::Message::Outbound) + return; + + QStringList colors=m_config->colors(); + + if(m_config->colorChar() || m_config->colorWords() || m_config->lamer() || m_config->waves() ) + { + QString original=msg.plainBody(); + QString resultat; + + unsigned int c=0; + bool wavein=false; + + for(unsigned int f=0;f<original.length();f++) + { + QChar x=original[f]; + if(f==0 || m_config->colorChar() || (m_config->colorWords() && x==' ' )) + { + if(f!=0) + resultat+="</font>"; + resultat+="<font color=\""; + resultat+=colors[c]; + if(m_config->colorRandom()) + c=rand()%colors.count(); + else + { + c++; + if(c >= colors.count()) + c=0; + } + resultat+="\">"; + } + switch (x.latin1()) + { + case '>': + resultat+=">"; + break; + case '<': + resultat+="<"; + break; + case '&': + resultat+="&"; + break; + case '\n': + resultat+="<br>"; + case 'a': + case 'A': + if(m_config->lamer()) + { + resultat+="4"; + break; + } //else, go to the default, all other case have this check + case 'e': + case 'E': + if(m_config->lamer()) + { + resultat+="3"; + break; + }//else, go to the default, all other case have this check + case 'i': + case 'I': + if(m_config->lamer()) + { + resultat+="1"; + break; + }//else, go to the default, all other case have this check + case 'l': + case 'L': + if(m_config->lamer()) + { + resultat+="|"; + break; + }//else, go to the default, all other case have this check + case 't': + case 'T': + if(m_config->lamer()) + { + resultat+="7"; + break; + }//else, go to the default, all other case have this check + case 's': + case 'S': + if(m_config->lamer()) + { + resultat+="5"; + break; + }//else, go to the default, all other case have this check + case 'o': + case 'O': + if(m_config->lamer()) + { + resultat+="0"; + break; + }//else, go to the default, all other case have this check + default: + if(m_config->waves()) + { + resultat+= wavein ? x.lower() : x.upper(); + wavein=!wavein; + } + else + resultat+=x; + break; + } + } + if( m_config->colorChar() || m_config->colorWords() ) + resultat+="</font>"; + msg.setBody(resultat,Kopete::Message::RichText); + } + + if(m_config->colorLines()) + { + if(m_config->colorRandom()) + { + last_color=rand()%colors.count(); + } + else + { + last_color++; + if(last_color >= colors.count()) + last_color=0; + } + + msg.setFg(QColor (colors[last_color])); + } +} + +void TextEffectPlugin::slotSettingsChanged() +{ + m_config->load(); +} + + +#include "texteffectplugin.moc" + diff --git a/kopete/plugins/texteffect/texteffectplugin.h b/kopete/plugins/texteffect/texteffectplugin.h new file mode 100644 index 00000000..db34fdcb --- /dev/null +++ b/kopete/plugins/texteffect/texteffectplugin.h @@ -0,0 +1,71 @@ +/*************************************************************************** + texteffectplugin.h - description + ------------------- + begin : jeu nov 14 2002 + copyright : (C) 2002 by Olivier Goffart + email : ogoffart @ kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 option) any later version. * + * * + ***************************************************************************/ + +#ifndef TextEffectPLUGIN_H +#define TextEffectPLUGIN_H + +#include <qobject.h> +#include <qmap.h> +#include <qstring.h> + +#include "kopetemessage.h" +#include "kopeteplugin.h" + + +class QStringList; +class QString; + +namespace Kopete { class Message; } +namespace Kopete { class MetaContact; } +namespace Kopete { class ChatSession; } +class TextEffectConfig; + +/** + * @author Olivier Goffart + */ + +class TextEffectPlugin : public Kopete::Plugin +{ + Q_OBJECT + +public: + static TextEffectPlugin *plugin(); + + TextEffectPlugin( QObject *parent, const char *name, const QStringList &args ); + ~TextEffectPlugin(); + +public slots: + void slotOutgoingMessage( Kopete::Message& msg ); + void slotSettingsChanged(); + +private: + static TextEffectPlugin* pluginStatic_; + unsigned int last_color; + TextEffectConfig *m_config; +}; + +#endif + +/* + * Local variables: + * c-indentation-style: k&r + * c-basic-offset: 8 + * indent-tabs-mode: t + * End: + */ +// vim: set noet ts=4 sts=4 sw=4: + diff --git a/kopete/plugins/texteffect/texteffectpreferences.cpp b/kopete/plugins/texteffect/texteffectpreferences.cpp new file mode 100644 index 00000000..c9f0c03b --- /dev/null +++ b/kopete/plugins/texteffect/texteffectpreferences.cpp @@ -0,0 +1,232 @@ +/*************************************************************************** + texteffectpreferences.cpp - description + ------------------- + begin : jeu nov 14 2002 + copyright : (C) 2002 by Olivier Goffart + email : ogoffart @ kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 option) any later version. * + * * + ***************************************************************************/ + +#include <qstring.h> +#include <qlayout.h> +#include <qcheckbox.h> +#include <qpushbutton.h> + +#include <klocale.h> +#include <kcolordialog.h> +#include <kgenericfactory.h> +#include <kautoconfig.h> +#include <kdebug.h> + +#include <kdeversion.h> + +#include "texteffectprefs.h" +#include "texteffectpreferences.h" +#include "texteffectconfig.h" + +typedef KGenericFactory<TextEffectPreferences> TextEffectPreferencesFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_kopete_texteffect, TextEffectPreferencesFactory( "kcm_kopete_texteffect" ) ) + +TextEffectPreferences::TextEffectPreferences(QWidget *parent, + const char* /*name*/, + const QStringList &args) + : KCModule(TextEffectPreferencesFactory::instance(), parent, args) +{ + ( new QVBoxLayout( this ) )->setAutoAdd( true ); + + kdDebug( 14310 ) << "Creating preferences dialog" << endl; + + preferencesDialog = new TextEffectPrefs(this); + + kdDebug( 14310 ) << "Creating config object" << endl; + + config = new TextEffectConfig; + + kdDebug( 14310 ) << "Setting up connections" << endl; + + connect(preferencesDialog->mColorsAdd , SIGNAL(pressed()) , + this , SLOT(slotAddPressed())); + + connect(preferencesDialog->mColorsRemove , SIGNAL(pressed()) , + this , SLOT(slotRemovePressed())); + + connect(preferencesDialog->mColorsUp , SIGNAL(pressed()) , + this , SLOT(slotUpPressed())); + + connect(preferencesDialog->mColorsDown , SIGNAL(pressed()) , + this , SLOT(slotDownPressed())); + + // Connect up all the check boxes + connect( preferencesDialog->m_lamer, SIGNAL( clicked() ), + this, SLOT( slotSettingChanged() ) ); + connect( preferencesDialog->m_casewaves, SIGNAL( clicked() ), + this, SLOT( slotSettingChanged() ) ); + + connect( preferencesDialog->m_colorRandom, SIGNAL( clicked() ), + this, SLOT( slotSettingChanged() ) ); + connect( preferencesDialog->m_fg, SIGNAL( clicked() ), + this, SLOT( slotSettingChanged() ) ); + connect( preferencesDialog->m_char, SIGNAL( clicked() ), + this, SLOT( slotSettingChanged() ) ); + connect( preferencesDialog->m_words, SIGNAL( clicked() ), + this, SLOT( slotSettingChanged() ) ); + + //setMainWidget( preferencesDialog, "Text Effect Plugin" ); + + load(); + +} + +TextEffectPreferences::~TextEffectPreferences() +{ + delete preferencesDialog; + delete config; +} + + +void TextEffectPreferences::load() +{ + kdDebug( 14310 ) << k_funcinfo << "ENTER" << endl; + + config->load(); + + preferencesDialog->mColorsListBox->insertStringList(config->colors()); + preferencesDialog->m_fg->setChecked(config->colorLines()); + preferencesDialog->m_words->setChecked(config->colorWords()); + preferencesDialog->m_char->setChecked(config->colorChar()); + preferencesDialog->m_lamer->setChecked(config->lamer()); + preferencesDialog->m_casewaves->setChecked(config->waves()); + + + // Call parent's save method + KCModule::load(); + + // Indicate that we have not changed ^_^ + emit changed( false ); + + kdDebug( 14310 ) << k_funcinfo << "EXIT" << endl; + +} + +void TextEffectPreferences::save() +{ + kdDebug() << k_funcinfo << "ENTER" << endl; + // Save the settings + config->setColors(colors()); + config->setColorRandom(preferencesDialog->m_colorRandom->isChecked()); + config->setColorLines(preferencesDialog->m_fg->isChecked()); + config->setColorWords(preferencesDialog->m_words->isChecked()); + config->setColorChar(preferencesDialog->m_char->isChecked()); + + config->setLamer(preferencesDialog->m_lamer->isChecked()); + config->setWaves(preferencesDialog->m_casewaves->isChecked()); + + config->save(); + + // Notify the plugin that the settings have changed + //TextEffectPlugin::plugin()->slotSettingsChanged(); + + // Call parent's save method + KCModule::save(); + + // Indicate that we have not changed ^_^ + emit changed( false ); + kdDebug() << k_funcinfo << "EXIT" << endl; +} + +QStringList TextEffectPreferences::colors() +{ + QStringList ret; + for(unsigned int f=0; f<preferencesDialog->mColorsListBox->count() ; f++) + { + ret.append(preferencesDialog->mColorsListBox->text(f)); + } + return ret; +} + +void TextEffectPreferences::slotAddPressed() +{ + QColor myColor; + if( KColorDialog::getColor( myColor ) == KColorDialog::Accepted ) + { + preferencesDialog->mColorsListBox->insertItem(myColor.name()); + } + + // Indicate that something has changed + slotSettingChanged(); + +} +void TextEffectPreferences::slotRemovePressed() +{ + delete preferencesDialog->mColorsListBox->selectedItem(); + // Indicate that something has changed + slotSettingChanged(); +} + + +void TextEffectPreferences::slotUpPressed() +{ + int p=preferencesDialog->mColorsListBox->currentItem(); + if(p <= 0 ) + return; + QListBoxItem *i=preferencesDialog->mColorsListBox->selectedItem(); + if(!i) + return; + preferencesDialog->mColorsListBox->setSelected(i,false); + preferencesDialog->mColorsListBox->takeItem(i); + preferencesDialog->mColorsListBox->insertItem(i , p-1 ); + preferencesDialog->mColorsListBox->setSelected(i,true); + + // Indicate that something has changed + slotSettingChanged(); + +} +void TextEffectPreferences::slotDownPressed() +{ + int p=preferencesDialog->mColorsListBox->currentItem(); + if(p < 0 ) + return; + QListBoxItem *i=preferencesDialog->mColorsListBox->selectedItem(); + if(!i) + return; + preferencesDialog->mColorsListBox->setSelected(i,false); + preferencesDialog->mColorsListBox->takeItem(i); + preferencesDialog->mColorsListBox->insertItem(i , p+1 ); + preferencesDialog->mColorsListBox->setSelected(i,true); + + // Indicate that something has changed + slotSettingChanged(); +} + + + +void TextEffectPreferences::slotSettingChanged() +{ + kdDebug() << k_funcinfo << "Called" + << endl; + // Indicate that our settings have changed + emit changed( true ); +} + +void TextEffectPreferences::defaults() +{ + preferencesDialog->mColorsListBox->clear(); + preferencesDialog->mColorsListBox->insertStringList(config->defaultColorList()); + preferencesDialog->m_fg->setChecked(false); + preferencesDialog->m_words->setChecked(false); + preferencesDialog->m_char->setChecked(false); + preferencesDialog->m_lamer->setChecked(false); + preferencesDialog->m_casewaves->setChecked(false); + preferencesDialog->m_colorRandom->setChecked( false ); + emit changed( true ); +} + +#include "texteffectpreferences.moc" diff --git a/kopete/plugins/texteffect/texteffectpreferences.h b/kopete/plugins/texteffect/texteffectpreferences.h new file mode 100644 index 00000000..21dc7bff --- /dev/null +++ b/kopete/plugins/texteffect/texteffectpreferences.h @@ -0,0 +1,58 @@ +/*************************************************************************** + texteffectpreferences.h - description + ------------------- + begin : jeu nov 14 2002 + copyright : (C) 2002 by Olivier Goffart + email : ogoffart @ kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 option) any later version. * + * * + ***************************************************************************/ + +#ifndef TextEffectPREFERENCES_H +#define TextEffectPREFERENCES_H + +#include <kcmodule.h> + +class TextEffectPrefs; +class TextEffectConfig; +class QStringList; + +/** + *@author Olivier Goffart + */ + +class TextEffectPreferences : public KCModule { + Q_OBJECT +public: + + TextEffectPreferences(QWidget *parent = 0, const char* name = 0, const QStringList &args = QStringList()); + ~TextEffectPreferences(); + + // Overloaded from parent + virtual void save(); + virtual void load(); + virtual void defaults(); + +private: + QStringList colors(); + TextEffectPrefs *preferencesDialog; + TextEffectConfig *config; + +private slots: // Public slots + void slotAddPressed(); + void slotRemovePressed(); + void slotUpPressed(); + void slotDownPressed(); + void slotSettingChanged(); + +}; + +#endif + diff --git a/kopete/plugins/texteffect/texteffectprefs.ui b/kopete/plugins/texteffect/texteffectprefs.ui new file mode 100644 index 00000000..95ff801c --- /dev/null +++ b/kopete/plugins/texteffect/texteffectprefs.ui @@ -0,0 +1,231 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>TextEffectPrefs</class> +<author>Olivier Goffart</author> +<widget class="QWidget"> + <property name="name"> + <cstring>TextEffectPrefs</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>630</width> + <height>529</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>5</number> + </property> + <property name="spacing"> + <number>0</number> + </property> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>TabWidget3</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Colors</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>groupBox1</cstring> + </property> + <property name="title"> + <string>Colors</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListBox" row="0" column="0" rowspan="5" colspan="1"> + <property name="name"> + <cstring>mColorsListBox</cstring> + </property> + </widget> + <widget class="QPushButton" row="0" column="1"> + <property name="name"> + <cstring>mColorsAdd</cstring> + </property> + <property name="text"> + <string>&Add...</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="1"> + <property name="name"> + <cstring>mColorsRemove</cstring> + </property> + <property name="text"> + <string>&Remove</string> + </property> + </widget> + <widget class="QPushButton" row="2" column="1"> + <property name="name"> + <cstring>mColorsUp</cstring> + </property> + <property name="text"> + <string>Move &Up</string> + </property> + </widget> + <widget class="QPushButton" row="3" column="1"> + <property name="name"> + <cstring>mColorsDown</cstring> + </property> + <property name="text"> + <string>Move &Down</string> + </property> + </widget> + <spacer row="4" column="1"> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>81</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>m_colorRandom</cstring> + </property> + <property name="text"> + <string>Random order</string> + </property> + </widget> + <widget class="Line" row="2" column="0"> + <property name="name"> + <cstring>Line1</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0"> + <property name="name"> + <cstring>m_fg</cstring> + </property> + <property name="text"> + <string>Change global text foreground color</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0"> + <property name="name"> + <cstring>m_char</cstring> + </property> + <property name="text"> + <string>Change color every letter</string> + </property> + </widget> + <widget class="QCheckBox" row="5" column="0"> + <property name="name"> + <cstring>m_words</cstring> + </property> + <property name="text"> + <string>Change color every word</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Effects</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_lamer</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>L4m3r t4lk</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_casewaves</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>CasE wAVes</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer5_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>279</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>TabWidget3</tabstop> +</tabstops> +<includes> + <include location="global" impldecl="in implementation">knuminput.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistbox.h</includehint> +</includehints> +</UI> |