From 00bb99ac80741fc50ef8a289719373032f2391eb Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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/kdeaccessibility@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kttsd/filters/stringreplacer/Makefile.am | 34 + kttsd/filters/stringreplacer/abbreviations.xml | 58 ++ kttsd/filters/stringreplacer/chat-de.xml | 616 +++++++++++++++++ kttsd/filters/stringreplacer/chat.xml | 616 +++++++++++++++++ .../stringreplacer/editreplacementwidget.ui | 263 ++++++++ kttsd/filters/stringreplacer/emoticons.xml | 304 +++++++++ .../stringreplacer/festival_unspeakable_chars.xml | 94 +++ kttsd/filters/stringreplacer/kmail.xml | 31 + .../kttsd_stringreplacerplugin.desktop | 92 +++ .../stringreplacer/polish_festival_fixes.xml | 12 + .../polish_festival_unspeakables.xml | 78 +++ kttsd/filters/stringreplacer/qt2plaintext.xml | 359 ++++++++++ .../filters/stringreplacer/stringreplacerconf.cpp | 725 +++++++++++++++++++++ kttsd/filters/stringreplacer/stringreplacerconf.h | 158 +++++ .../stringreplacer/stringreplacerconfwidget.ui | 474 ++++++++++++++ .../stringreplacer/stringreplacerplugin.cpp | 32 + .../filters/stringreplacer/stringreplacerproc.cpp | 231 +++++++ kttsd/filters/stringreplacer/stringreplacerproc.h | 97 +++ 18 files changed, 4274 insertions(+) create mode 100644 kttsd/filters/stringreplacer/Makefile.am create mode 100644 kttsd/filters/stringreplacer/abbreviations.xml create mode 100644 kttsd/filters/stringreplacer/chat-de.xml create mode 100644 kttsd/filters/stringreplacer/chat.xml create mode 100644 kttsd/filters/stringreplacer/editreplacementwidget.ui create mode 100644 kttsd/filters/stringreplacer/emoticons.xml create mode 100644 kttsd/filters/stringreplacer/festival_unspeakable_chars.xml create mode 100644 kttsd/filters/stringreplacer/kmail.xml create mode 100644 kttsd/filters/stringreplacer/kttsd_stringreplacerplugin.desktop create mode 100644 kttsd/filters/stringreplacer/polish_festival_fixes.xml create mode 100644 kttsd/filters/stringreplacer/polish_festival_unspeakables.xml create mode 100644 kttsd/filters/stringreplacer/qt2plaintext.xml create mode 100644 kttsd/filters/stringreplacer/stringreplacerconf.cpp create mode 100644 kttsd/filters/stringreplacer/stringreplacerconf.h create mode 100644 kttsd/filters/stringreplacer/stringreplacerconfwidget.ui create mode 100644 kttsd/filters/stringreplacer/stringreplacerplugin.cpp create mode 100644 kttsd/filters/stringreplacer/stringreplacerproc.cpp create mode 100644 kttsd/filters/stringreplacer/stringreplacerproc.h (limited to 'kttsd/filters/stringreplacer') diff --git a/kttsd/filters/stringreplacer/Makefile.am b/kttsd/filters/stringreplacer/Makefile.am new file mode 100644 index 0000000..b52085c --- /dev/null +++ b/kttsd/filters/stringreplacer/Makefile.am @@ -0,0 +1,34 @@ +INCLUDES = \ + -I$(top_srcdir)/kttsd/libkttsd -I$(top_builddir)/kttsd/libkttsd \ + $(all_includes) + +METASOURCES = AUTO + +kde_module_LTLIBRARIES = libkttsd_stringreplacerplugin.la + +libkttsd_stringreplacerplugin_la_SOURCES = \ + stringreplacerconfwidget.ui \ + editreplacementwidget.ui \ + stringreplacerconf.cpp \ + stringreplacerproc.cpp \ + stringreplacerplugin.cpp +libkttsd_stringreplacerplugin_la_LDFLAGS = $(KDE_PLUGIN) $(all_libraries) +libkttsd_stringreplacerplugin_la_LIBADD = $(top_builddir)/kttsd/libkttsd/libkttsd.la + +services_DATA = kttsd_stringreplacerplugin.desktop +servicesdir = $(kde_servicesdir) + +# Install data files. +stringreplacerdatadir = $(kde_datadir)/kttsd/stringreplacer/ +stringreplacerdata_DATA = \ + abbreviations.xml \ + chat.xml \ + chat-de.xml \ + emoticons.xml \ + polish_festival_fixes.xml \ + polish_festival_unspeakables.xml \ + kmail.xml \ + festival_unspeakable_chars.xml \ + qt2plaintext.xml + +noinst_HEADERS = stringreplacerconfwidget.h editreplacementwidget.h diff --git a/kttsd/filters/stringreplacer/abbreviations.xml b/kttsd/filters/stringreplacer/abbreviations.xml new file mode 100644 index 0000000..d04b7aa --- /dev/null +++ b/kttsd/filters/stringreplacer/abbreviations.xml @@ -0,0 +1,58 @@ + + + Abbreviations + + RegExp + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + diff --git a/kttsd/filters/stringreplacer/chat-de.xml b/kttsd/filters/stringreplacer/chat-de.xml new file mode 100644 index 0000000..801c144 --- /dev/null +++ b/kttsd/filters/stringreplacer/chat-de.xml @@ -0,0 +1,616 @@ + + + Internet Relay Chat and IM (Deutsch) + de + knotify + kopete + kvirc + ksirc + konversation + + RegExp + No + ]]> + + + + RegExp + No + ]+)>]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + ]]> + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + diff --git a/kttsd/filters/stringreplacer/chat.xml b/kttsd/filters/stringreplacer/chat.xml new file mode 100644 index 0000000..2518824 --- /dev/null +++ b/kttsd/filters/stringreplacer/chat.xml @@ -0,0 +1,616 @@ + + + Internet Relay Chat and IM + en + knotify + kopete + kvirc + ksirc + konversation + + RegExp + No + ]]> + + + + RegExp + No + ]+)>]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + ]]> + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + Word + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + diff --git a/kttsd/filters/stringreplacer/editreplacementwidget.ui b/kttsd/filters/stringreplacer/editreplacementwidget.ui new file mode 100644 index 0000000..917cdf8 --- /dev/null +++ b/kttsd/filters/stringreplacer/editreplacementwidget.ui @@ -0,0 +1,263 @@ + +EditReplacementWidget +Gary Cramblitt <garycramblitt@comcast.net> + + + EditReplacementWidget + + + + 0 + 0 + 393 + 148 + + + + + 3 + 5 + 255 + 255 + + + + + 0 + 0 + + + + + unnamed + + + + layout1 + + + + unnamed + + + + typeButtonGroup + + + + 5 + 5 + 0 + 0 + + + + &Type + + + true + + + + unnamed + + + + layout3 + + + + unnamed + + + + wordRadioButton + + + + 1 + 0 + 0 + 0 + + + + &Word + + + true + + + + + regexpRadioButton + + + + 1 + 0 + 0 + 0 + + + + Regular &expression + + + + + + + + + caseCheckBox + + + + 1 + 5 + 0 + 0 + + + + Match &case + + + + + + + layout2 + + + + unnamed + + + + layout6 + + + + unnamed + + + + substLabel + + + + 5 + 5 + 0 + 0 + + + + &Replace with: + + + AlignVCenter|AlignRight + + + matchLineEdit + + + + + matchLabel + + + + 5 + 5 + 0 + 0 + + + + &Match: + + + AlignVCenter|AlignRight + + + matchLineEdit + + + + + + + layout5 + + + + unnamed + + + + substLineEdit + + + + 7 + 0 + 0 + 0 + + + + + + matchButton + + + + 1 + 1 + 0 + 0 + + + + ... + + + + + matchLineEdit + + + + 7 + 0 + 0 + 0 + + + + + + + + + + + + + wordRadioButton + regexpRadioButton + caseCheckBox + matchLineEdit + matchButton + substLineEdit + + + + klineedit.h + kpushbutton.h + klineedit.h + + diff --git a/kttsd/filters/stringreplacer/emoticons.xml b/kttsd/filters/stringreplacer/emoticons.xml new file mode 100644 index 0000000..f522358 --- /dev/null +++ b/kttsd/filters/stringreplacer/emoticons.xml @@ -0,0 +1,304 @@ + + + Emoticons (English) + en + knotify + kopete + ksirc + kvirc + konversation + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + ]]> + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + diff --git a/kttsd/filters/stringreplacer/festival_unspeakable_chars.xml b/kttsd/filters/stringreplacer/festival_unspeakable_chars.xml new file mode 100644 index 0000000..5086d01 --- /dev/null +++ b/kttsd/filters/stringreplacer/festival_unspeakable_chars.xml @@ -0,0 +1,94 @@ + + + Fix Festival Unspeakable Characters + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + ]]> + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + diff --git a/kttsd/filters/stringreplacer/kmail.xml b/kttsd/filters/stringreplacer/kmail.xml new file mode 100644 index 0000000..b0f33d6 --- /dev/null +++ b/kttsd/filters/stringreplacer/kmail.xml @@ -0,0 +1,31 @@ + + + + kmail notify + knotify + kmail + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + + + + + RegExp + No + ]]> + + + diff --git a/kttsd/filters/stringreplacer/kttsd_stringreplacerplugin.desktop b/kttsd/filters/stringreplacer/kttsd_stringreplacerplugin.desktop new file mode 100644 index 0000000..df8214c --- /dev/null +++ b/kttsd/filters/stringreplacer/kttsd_stringreplacerplugin.desktop @@ -0,0 +1,92 @@ +[Desktop Entry] +Name=String Replacer +Name[bg]=Замяна на низове +Name[ca]=Reemplaçador de cadenes +Name[cs]=Nahrazení řetězce +Name[da]=Streng-erstatter +Name[de]=Zeichenkettenersetzer +Name[el]=Αντικαταστάτης συμβολοσειρών +Name[es]=Reemplazador de cadenas +Name[et]=Stringiasendaja +Name[eu]=Kate-ordezkatzailea +Name[fa]=جایگزین‌کنندۀ رشته +Name[fi]=Tekstien korvaaja +Name[fr]=Remplacement de chaînes +Name[ga]=Ionadóir Teaghrán +Name[gl]=Reemprazamento de Cadeas +Name[he]=מחליף מחרוזות +Name[hu]=Sztringcserélő +Name[is]=Strengja útskiptir +Name[it]=Sostitutore di stringhe +Name[ja]=文字列置換 +Name[ka]=სტრიქონის ჩამნაცვლებელი +Name[km]= ឧបករណ៍​ជំនួស​ខ្សែ​អក្សរ +Name[lt]=Eilučių pakeitiklis +Name[mk]=Менувач на низи знаци +Name[ms]=Pengganti Rentetan +Name[nb]=Strengerstatter +Name[nds]=Tekenkeed-Tuscher +Name[ne]=स्ट्रिङ प्रतिस्थापक +Name[nl]=Tekstvervanger +Name[pa]=ਸਤਰ ਤਬਦੀਲ +Name[pl]=Zastępowanie tekstu +Name[pt]=Substituição de Textos +Name[pt_BR]=Substituidor de Strings +Name[ru]=Автозамена +Name[sk]=Náhrada reťazca +Name[sl]=Zamenjevalnik nizov +Name[sr]=Замењивач знаковних низова +Name[sr@Latn]=Zamenjivač znakovnih nizova +Name[sv]=Strängersättning +Name[ta]=சர இடமாற்றி +Name[tg]=Ҷойивазкунии автоматӣ +Name[tr]=Metin Değiştirici +Name[uk]=Заміна рядків +Name[vi]=Trình thay Chuỗi +Name[zh_TW]=字串置換器 +Comment=Generic String Replacement Filter Plugin for KTTS +Comment[bg]=Приставка филтър за замяна на низове за KTTS +Comment[ca]=Connector del filtre reemplaçador genèric de cadenes pel KTTS +Comment[cs]=Modul filtru náhrady řetězce KTTS +Comment[da]=Generisk strengerstatnings-filter-plugin for KTTS +Comment[de]=Ein generisches Modul zur Zeichenkettenersetzung für KTTS +Comment[el]=Γενικό φίλτρο πρόσθετο αντικατάστασης συμβολοσειρών για το KTTS +Comment[es]=Complemento de filtro genérico de sustituición de cadenas para KTTS +Comment[et]=KTTS-i üldine stringiasendusfiltri plugin +Comment[eu]=KTTS-ren kateak ordezkatzeko iragazki-plugin generikoa +Comment[fa]=وصلۀ پالایۀ جایگزینی رشتۀ عمومی برای KTTS +Comment[fi]=Yleinen tekstien korvaussuodatinliitännäinen KTTS-ohjelmaan +Comment[fr]=Module de filtrage de remplacement de chaînes générique pour KTTS +Comment[gl]=Plugin de Filtro Xenérico de Substituición de Cadeas para KTTS +Comment[hu]=Általános sztringcserélő modul a KTTS-hez +Comment[is]=Almennt strengja útskiptinga íforrit fyrir KTTS +Comment[it]=Plugin generico per il filtro di sostituzione di stringhe per KTTS +Comment[ja]=KTTS 用汎用文字列置換フィルタプラグイン +Comment[ka]=ზოგადი სტრიქონის ჩანაცვლების ფილტრის მოდული KTTS-სთვის +Comment[km]=កម្មវិធី​ជំនួយ​តម្រង​ការ​ជំនួស​ខ្សែអក្សរ​ទូទៅ​សម្រាប់ KTTS +Comment[lt]=Bendro pobūdžio eilučių pakeitimo filtro priedas, skirtas KTTS +Comment[mk]=Филтер за KTTS за општа замена на низи знаци +Comment[ms]=Plugin Penapis Penggantian Rentetan Generik bagi KTTS +Comment[nb]=Filter-programtillegg til KTTS for streng-erstatning +Comment[nds]=KTTS-Filtermoduul för dat Utwesseln vun Tekenkeden +Comment[ne]=KTTS का लागि जेनेरीक स्ट्रिङ प्रतिस्थापन फिल्टर प्लगइन +Comment[nl]=Generieke tekst-vervang-filter-plugin voor KTTS +Comment[pl]=Wtyczka zastępowania tekstu dla KTTS +Comment[pt]='Plugin' Genérico de Substituição de Textos para o KTTS +Comment[pt_BR]=Plug-in de Filtro genérico de Substituição de Strings Para o KTTS +Comment[ru]=Фильтр автозамены для KTTS +Comment[sk]=Všeobecný modul filtra náhrady reťazca v KTTS +Comment[sl]=Filtrni vstavek KTTS za generični zamenjevalnik nizov +Comment[sr]=Генерички филтерски прикључак KTTS-а за замену знаковних низова +Comment[sr@Latn]=Generički filterski priključak KTTS-a za zamenu znakovnih nizova +Comment[sv]=Insticksprogram för KTTS med generellt strängersättningsfilter +Comment[ta]=KTTSக்கான அலங்கார சொருகுபொருள் சர இடமாற்றி +Comment[tg]=Филтри худивазкунӣ барои KTTS +Comment[tr]=KTTS için Genel Metin Değiştirme Süzgeci Eklentisi +Comment[uk]=Втулок загального фільтра заміни рядків для KTTS +Comment[vi]=Trình bổ sung Lọc Thay Chuỗi Chung cho KTTS +Comment[zh_TW]=KTTS 使用的字串置換外掛程式 +Type=Service +ServiceTypes=KTTSD/FilterPlugin +X-KDE-Library=libkttsd_stringreplacerplugin +X-KDE-Languages=en,en_US,en_GB,en_CA,es,es_mx,cy,de,fi,cs,pl diff --git a/kttsd/filters/stringreplacer/polish_festival_fixes.xml b/kttsd/filters/stringreplacer/polish_festival_fixes.xml new file mode 100644 index 0000000..a6f2533 --- /dev/null +++ b/kttsd/filters/stringreplacer/polish_festival_fixes.xml @@ -0,0 +1,12 @@ + + + + Filtr polski / Filter for Polish Festival voice + pl + + RegExp + No + + + + diff --git a/kttsd/filters/stringreplacer/polish_festival_unspeakables.xml b/kttsd/filters/stringreplacer/polish_festival_unspeakables.xml new file mode 100644 index 0000000..8fbc18a --- /dev/null +++ b/kttsd/filters/stringreplacer/polish_festival_unspeakables.xml @@ -0,0 +1,78 @@ + + + + Polskie niewymawialne / Polish Festival unspeakables + pl + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + ]]> + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + + + + + Word + No + + + + diff --git a/kttsd/filters/stringreplacer/qt2plaintext.xml b/kttsd/filters/stringreplacer/qt2plaintext.xml new file mode 100644 index 0000000..8a194ec --- /dev/null +++ b/kttsd/filters/stringreplacer/qt2plaintext.xml @@ -0,0 +1,359 @@ + + + Qt Rich Text to Plain Text + knotify + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + + + + + RegExp + No + + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + + RegExp + No + ]]> + + + diff --git a/kttsd/filters/stringreplacer/stringreplacerconf.cpp b/kttsd/filters/stringreplacer/stringreplacerconf.cpp new file mode 100644 index 0000000..9afa2d5 --- /dev/null +++ b/kttsd/filters/stringreplacer/stringreplacerconf.cpp @@ -0,0 +1,725 @@ +/***************************************************** vim:set ts=4 sw=4 sts=4: + Generic String Replacement Filter Configuration class. + ------------------- + Copyright: + (C) 2005 by Gary Cramblitt + ------------------- + Original author: Gary Cramblitt + + 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. + + 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. + ******************************************************************************/ + +// Qt includes. +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// KDE includes. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// KTTS includes. +#include "filterconf.h" + +// StringReplacer includes. +#include "stringreplacerconf.h" +#include "stringreplacerconf.moc" +#include "editreplacementwidget.h" + +/** +* Constructor +*/ +StringReplacerConf::StringReplacerConf( QWidget *parent, const char *name, const QStringList& /*args*/) : + KttsFilterConf(parent, name), + m_editDlg(0), + m_editWidget(0) +{ + // kdDebug() << "StringReplacerConf::StringReplacerConf: Running" << endl; + + // Create configuration widget. + QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), + KDialog::spacingHint(), "StringReplacerConfigWidgetLayout"); + layout->setAlignment (Qt::AlignTop); + m_widget = new StringReplacerConfWidget(this, "StringReplacerConfigWidget"); + layout->addWidget(m_widget); + m_widget->substLView->setSortColumn(-1); + + connect(m_widget->nameLineEdit, SIGNAL(textChanged(const QString&)), + this, SLOT(configChanged())); + connect(m_widget->languageBrowseButton, SIGNAL(clicked()), + this, SLOT(slotLanguageBrowseButton_clicked())); + connect(m_widget->addButton, SIGNAL(clicked()), + this, SLOT(slotAddButton_clicked())); + connect(m_widget->upButton, SIGNAL(clicked()), + this, SLOT(slotUpButton_clicked())); + connect(m_widget->downButton, SIGNAL(clicked()), + this, SLOT(slotDownButton_clicked())); + connect(m_widget->editButton, SIGNAL(clicked()), + this, SLOT(slotEditButton_clicked())); + connect(m_widget->removeButton, SIGNAL(clicked()), + this, SLOT(slotRemoveButton_clicked())); + connect(m_widget->loadButton, SIGNAL(clicked()), + this, SLOT(slotLoadButton_clicked())); + connect(m_widget->saveButton, SIGNAL(clicked()), + this, SLOT(slotSaveButton_clicked())); + connect(m_widget->clearButton, SIGNAL(clicked()), + this, SLOT(slotClearButton_clicked())); + connect(m_widget->substLView, SIGNAL(selectionChanged()), + this, SLOT(enableDisableButtons())); + connect(m_widget->appIdLineEdit, SIGNAL(textChanged(const QString&)), + this, SLOT(configChanged())); + + // Determine if kdeutils Regular Expression Editor is installed. + m_reEditorInstalled = !KTrader::self()->query("KRegExpEditor/KRegExpEditor").isEmpty(); + + // Set up defaults. + defaults(); +} + +/** +* Destructor. +*/ +StringReplacerConf::~StringReplacerConf(){ + // kdDebug() << "StringReplacerConf::~StringReplacerConf: Running" << endl; +} + +/** +* This method is invoked whenever the module should read its +* configuration (most of the times from a config file) and update the +* user interface. This happens when the user clicks the "Reset" button in +* the control center, to undo all of his changes and restore the currently +* valid settings. Note that kttsmgr calls this when the plugin is +* loaded, so it not necessary to call it in your constructor. +* The plugin should read its configuration from the specified group +* in the specified config file. +* @param config Pointer to a KConfig object. +* @param configGroup Call config->setGroup with this argument before +* loading your configuration. +*/ +void StringReplacerConf::load(KConfig* config, const QString& configGroup){ + // kdDebug() << "StringReplacerConf::load: Running" << endl; + // See if this filter previously save its word list. + config->setGroup( configGroup ); + QString wordsFilename = config->readEntry( "WordListFile" ); + if ( !wordsFilename.isEmpty() ) + { + QString errMsg = loadFromFile( wordsFilename, true ); + if ( !errMsg.isEmpty() ) + kdDebug() << "StringReplacerConf::load: " << errMsg << endl; + enableDisableButtons(); + } +} + +// Loads word list and settings from a file. Clearing configuration if clear is True. +QString StringReplacerConf::loadFromFile( const QString& filename, bool clear) +{ + // Open existing word list. + QFile file( filename ); + if ( !file.open( IO_ReadOnly ) ) + { + return i18n("Unable to open file.") + filename; + } + // QDomDocument doc( "http://www.kde.org/share/apps/kttsd/stringreplacer/wordlist.dtd []" ); + QDomDocument doc( "" ); + if ( !doc.setContent( &file ) ) { + file.close(); + return i18n("File not in proper XML format."); + } + // kdDebug() << "StringReplacerConf::load: document successfully parsed." << endl; + file.close(); + + // Clear list view. + if ( clear ) m_widget->substLView->clear(); + + // Name setting. + QDomNodeList nameList = doc.elementsByTagName( "name" ); + QDomNode nameNode = nameList.item( 0 ); + m_widget->nameLineEdit->setText( nameNode.toElement().text() ); + // kdDebug() << "StringReplacerConf::load: name = " << nameNode.toElement().text() << endl; + + // Language Codes setting. List may be single element of comma-separated values, + // or multiple elements. + QString languageCodes; + QDomNodeList languageList = doc.elementsByTagName( "language-code" ); + for ( uint ndx=0; ndx < languageList.count(); ++ndx ) + { + QDomNode languageNode = languageList.item( ndx ); + if (!languageCodes.isEmpty()) languageCodes += ","; + languageCodes += languageNode.toElement().text(); + } + if ( clear ) + m_languageCodeList = QStringList::split(',', languageCodes, false); + else + m_languageCodeList += QStringList::split(',', languageCodes, false); + QString language; + m_languageCodeList.sort(); + // Eliminate dups. + for ( int ndx = m_languageCodeList.count() - 2; ndx >= 0; --ndx ) + { + if ( m_languageCodeList[ndx] == m_languageCodeList[ndx+1] ) + m_languageCodeList.remove(m_languageCodeList.at(ndx+1)); + } + for ( uint ndx=0; ndx < m_languageCodeList.count(); ++ndx ) + { + if (!language.isEmpty()) language += ","; + language += KGlobal::locale()->twoAlphaToLanguageName(m_languageCodeList[ndx]); + } + m_widget->languageLineEdit->setText(language); + + // AppId. Apply this filter only if DCOP appId of application that queued + // the text contains this string. List may be single element of comma-separated values, + // or multiple elements. + QDomNodeList appIdList = doc.elementsByTagName( "appid" ); + QString appIds; + for ( uint ndx=0; ndx < appIdList.count(); ++ndx ) + { + QDomNode appIdNode = appIdList.item( ndx ); + if (!appIds.isEmpty()) appIds += ","; + appIds += appIdNode.toElement().text(); + } + if ( !clear ) appIds = m_widget->appIdLineEdit->text() + appIds; + m_widget->appIdLineEdit->setText( appIds ); + + // Word list. + QListViewItem* item = 0; + if ( !clear ) item = m_widget->substLView->lastChild(); + QDomNodeList wordList = doc.elementsByTagName("word"); + const int wordListCount = wordList.count(); + for (int wordIndex = 0; wordIndex < wordListCount; ++wordIndex) + { + // kdDebug() << "StringReplacerConf::load: start parsing of word " << wordIndex << endl; + QDomNode wordNode = wordList.item(wordIndex); + QDomNodeList propList = wordNode.childNodes(); + QString wordType; + QString matchCase = "No"; // Default for old (v<=3.5.3) config files with no . + QString match; + QString subst; + const int propListCount = propList.count(); + for (int propIndex = 0; propIndex < propListCount; ++propIndex) + { + QDomNode propNode = propList.item(propIndex); + QDomElement prop = propNode.toElement(); + if (prop.tagName() == "type") wordType = prop.text(); + if (prop.tagName() == "case") matchCase = prop.text(); + if (prop.tagName() == "match") match = prop.text(); + if (prop.tagName() == "subst") subst = prop.text(); + } + QString wordTypeStr = + (wordType=="RegExp"?i18n("Abbreviation for 'Regular Expression'", "RegExp"):i18n("Word")); + QString matchCaseStr = + (matchCase=="Yes"?i18n("Yes"):i18n("No")); + if (!item) + item = new KListViewItem(m_widget->substLView, wordTypeStr, matchCaseStr, match, subst); + else + item = new KListViewItem(m_widget->substLView, item, wordTypeStr, matchCaseStr, match, subst); + } + + return QString::null; +} + +/** +* This function gets called when the user wants to save the settings in +* the user interface, updating the config files or wherever the +* configuration is stored. The method is called when the user clicks "Apply" +* or "Ok". The plugin should save its configuration in the specified +* group of the specified config file. +* @param config Pointer to a KConfig object. +* @param configGroup Call config->setGroup with this argument before +* saving your configuration. +*/ +void StringReplacerConf::save(KConfig* config, const QString& configGroup){ + // kdDebug() << "StringReplacerConf::save: Running" << endl; + QString wordsFilename = + KGlobal::dirs()->saveLocation( "data" ,"kttsd/stringreplacer/", true ); + if ( wordsFilename.isEmpty() ) + { + kdDebug() << "StringReplacerConf::save: no save location" << endl; + return; + } + wordsFilename += configGroup; + QString errMsg = saveToFile( wordsFilename ); + if ( errMsg.isEmpty() ) + { + config->setGroup( configGroup ); + config->writeEntry( "WordListFile", realFilePath(wordsFilename) ); + } + else + kdDebug() << "StringReplacerConf::save: " << errMsg << endl; +} + +// Saves word list and settings to a file. +QString StringReplacerConf::saveToFile(const QString& filename) +{ + // kdDebug() << "StringReplacerConf::saveToFile: saving to file " << wordsFilename << endl; + + QFile file( filename ); + if ( !file.open( IO_WriteOnly ) ) + return i18n("Unable to open file ") + filename; + + // QDomDocument doc( "http://www.kde.org/share/apps/kttsd/stringreplacer/wordlist.dtd []" ); + QDomDocument doc( "" ); + + QDomElement root = doc.createElement( "wordlist" ); + doc.appendChild( root ); + + // Name. + QDomElement name = doc.createElement( "name" ); + root.appendChild( name ); + QDomText t = doc.createTextNode( m_widget->nameLineEdit->text() ); + name.appendChild( t ); + + // Language code. + for ( uint ndx=0; ndx < m_languageCodeList.count(); ++ndx ) + { + QDomElement languageCode = doc.createElement( "language-code" ); + root.appendChild( languageCode ); + t = doc.createTextNode( m_languageCodeList[ndx] ); + languageCode.appendChild( t ); + } + + // Application ID + QString appId = m_widget->appIdLineEdit->text().replace(" ", ""); + if ( !appId.isEmpty() ) + { + QStringList appIdList = QStringList::split(",", appId); + for ( uint ndx=0; ndx < appIdList.count(); ++ndx ) + { + QDomElement appIdElem = doc.createElement( "appid" ); + root.appendChild( appIdElem ); + t = doc.createTextNode( appIdList[ndx] ); + appIdElem.appendChild( t ); + } + } + + // Words. + QListView* lView = m_widget->substLView; + QListViewItem* item = lView->firstChild(); + while (item) + { + QDomElement wordTag = doc.createElement( "word" ); + root.appendChild( wordTag ); + QDomElement propTag = doc.createElement( "type" ); + wordTag.appendChild( propTag); + QDomText t = doc.createTextNode( item->text(0)==i18n("Word")?"Word":"RegExp" ); + propTag.appendChild( t ); + + propTag = doc.createElement( "case" ); + wordTag.appendChild( propTag); + t = doc.createTextNode( item->text(1)==i18n("Yes")?"Yes":"No" ); + propTag.appendChild( t ); + + propTag = doc.createElement( "match" ); + wordTag.appendChild( propTag); + t = doc.createCDATASection( item->text(2) ); + propTag.appendChild( t ); + + propTag = doc.createElement( "subst" ); + wordTag.appendChild( propTag); + t = doc.createCDATASection( item->text(3) ); + propTag.appendChild( t ); + + item = item->nextSibling(); + } + + // Write it all out. + QTextStream ts( &file ); + ts.setEncoding( QTextStream::UnicodeUTF8 ); + ts << "\n"; + ts << doc.toString(); + // kdDebug() << "StringReplacerConf::saveToFile: writing out " << doc.toString() << endl; + file.close(); + + return QString::null; +} + +/** +* This function is called to set the settings in the module to sensible +* default values. It gets called when hitting the "Default" button. The +* default values should probably be the same as the ones the application +* uses when started without a config file. Note that defaults should +* be applied to the on-screen widgets; not to the config file. +*/ +void StringReplacerConf::defaults(){ + // kdDebug() << "StringReplacerConf::defaults: Running" << endl; + // Default language is none. + m_languageCodeList.clear(); + m_widget->languageLineEdit->setText( "" ); + // Default name. + m_widget->nameLineEdit->setText( i18n("String Replacer") ); + m_widget->substLView->clear(); + // Default App ID is blank. + m_widget->appIdLineEdit->setText( "" ); + enableDisableButtons(); + // kdDebug() << "StringReplacerConf::defaults: Exiting" << endl; +} + +/** + * Indicates whether the plugin supports multiple instances. Return + * False if only one instance of the plugin can be configured. + * @return True if multiple instances are possible. + */ +bool StringReplacerConf::supportsMultiInstance() { return true; } + +/** + * Returns the name of the plugin. Displayed in Filters tab of KTTSMgr. + * If there can be more than one instance of a filter, it should return + * a unique name for each instance. The name should be translated for + * the user if possible. If the plugin is not correctly configured, + * return an empty string. + * @return Filter instance name. + */ +QString StringReplacerConf::userPlugInName() +{ + if ( m_widget->substLView->childCount() == 0 ) return QString::null; + QString instName = m_widget->nameLineEdit->text(); + if ( instName.isEmpty() ) + { + QString language; + if (m_languageCodeList.count() == 1) + language = KGlobal::locale()->twoAlphaToLanguageName(m_languageCodeList[0]); + if (m_languageCodeList.count() > 1) + language = i18n("Multiple Languages"); + if (!language.isEmpty()) + instName = i18n("String Replacer") + " (" + language + ")"; + } + return instName; +} + +void StringReplacerConf::slotLanguageBrowseButton_clicked() +{ + // Create a QHBox to host KListView. + QHBox* hBox = new QHBox(m_widget, "SelectLanguage_hbox"); + // Create a KListView and fill with all known languages. + KListView* langLView = new KListView(hBox, "SelectLanguage_lview"); + langLView->addColumn(i18n("Language")); + langLView->addColumn(i18n("Code")); + langLView->setSelectionMode(QListView::Extended); + QStringList allLocales = KGlobal::locale()->allLanguagesTwoAlpha(); + QString locale; + QString languageCode; + QString countryCode; + QString charSet; + QString language; + // Blank line so user can select no language. + QListViewItem* item = new KListViewItem(langLView, "", ""); + if (m_languageCodeList.isEmpty()) item->setSelected(true); + const int allLocalesCount = allLocales.count(); + for (int ndx=0; ndx < allLocalesCount; ++ndx) + { + locale = allLocales[ndx]; + KGlobal::locale()->splitLocale(locale, languageCode, countryCode, charSet); + language = KGlobal::locale()->twoAlphaToLanguageName(languageCode); + if (!countryCode.isEmpty()) language += + " (" + KGlobal::locale()->twoAlphaToCountryName(countryCode)+")"; + item = new KListViewItem(langLView, language, locale); + if (m_languageCodeList.contains(locale)) item->setSelected(true); + } + // Sort by language. + langLView->setSorting(0); + langLView->sort(); + // Display the box in a dialog. + KDialogBase* dlg = new KDialogBase( + KDialogBase::Swallow, + i18n("Select Languages"), + KDialogBase::Help|KDialogBase::Ok|KDialogBase::Cancel, + KDialogBase::Cancel, + m_widget, + "SelectLanguage_dlg", + true, + true); + dlg->setMainWidget(hBox); + dlg->setHelp("", "kttsd"); + dlg->setInitialSize(QSize(300, 500), false); + int dlgResult = dlg->exec(); + languageCode = QString::null; + if (dlgResult == QDialog::Accepted) + { + m_languageCodeList.clear(); + QListViewItem* item = langLView->firstChild(); + while (item) + { + if (item->isSelected()) m_languageCodeList += item->text(1); + item = item->nextSibling(); + } + } + delete dlg; + // TODO: Also delete KListView and QHBox? + if (dlgResult != QDialog::Accepted) return; + language = ""; + for ( uint ndx=0; ndx < m_languageCodeList.count(); ++ndx) + { + if (!language.isEmpty()) language += ","; + language += KGlobal::locale()->twoAlphaToLanguageName(m_languageCodeList[ndx]); + } + QString s1 = m_widget->languageLineEdit->text(); + m_widget->languageLineEdit->setText(language); + // Replace language in the user's filter name. + QString s2 = m_widget->nameLineEdit->text(); + if (m_languageCodeList.count() > 1) language = i18n("Multiple Languages"); + if ( !s1.isEmpty() ) + { + s2.replace( s1, language ); + s2.replace( i18n("Multiple Languages"), language ); + } + s2.replace(" ()", ""); + if ( !s2.contains("(") && !language.isEmpty() ) s2 += " (" + language + ")"; + m_widget->nameLineEdit->setText(s2); + configChanged(); +} + +void StringReplacerConf::enableDisableButtons() +{ + bool enableBtn = (m_widget->substLView->selectedItem() != 0); + if (enableBtn) + { + m_widget->upButton->setEnabled( + m_widget->substLView->selectedItem()->itemAbove() != 0); + m_widget->downButton->setEnabled( + m_widget->substLView->selectedItem()->itemBelow() != 0); + } else { + m_widget->upButton->setEnabled(false); + m_widget->downButton->setEnabled(false); + } + m_widget->editButton->setEnabled(enableBtn); + m_widget->removeButton->setEnabled(enableBtn); + m_widget->clearButton->setEnabled(m_widget->substLView->firstChild()); + m_widget->saveButton->setEnabled(m_widget->substLView->firstChild()); +} + +void StringReplacerConf::slotUpButton_clicked() +{ + QListViewItem* item = m_widget->substLView->selectedItem(); + if (!item) return; + QListViewItem* prevItem = item->itemAbove(); + if (!prevItem) return; + prevItem->moveItem(item); + m_widget->substLView->setSelected(item, true); + m_widget->substLView->ensureItemVisible(item); + enableDisableButtons(); + configChanged(); +} + +void StringReplacerConf::slotDownButton_clicked() +{ + QListViewItem* item = m_widget->substLView->selectedItem(); + if (!item) return; + QListViewItem* nextItem = item->itemBelow(); + if (!nextItem) return; + item->moveItem(nextItem); + m_widget->substLView->setSelected(item, true); + m_widget->substLView->ensureItemVisible(item); + enableDisableButtons(); + configChanged(); +} + +void StringReplacerConf::slotAddButton_clicked() +{ + addOrEditSubstitution( true ); +} + +void StringReplacerConf::slotEditButton_clicked() +{ + addOrEditSubstitution( false ); +} + +// Displays the add/edit string replacement dialog. +void StringReplacerConf::addOrEditSubstitution(bool isAdd) +{ + QListViewItem* item = 0; + if (isAdd) + item = m_widget->substLView->lastChild(); + else + { + item = m_widget->substLView->selectedItem(); + if (!item) return; + } + // Create a QHBox to host widget. + QHBox* hBox = new QHBox(m_widget, "AddOrEditSubstitution_hbox" ); + // Create widget. + m_editWidget = new EditReplacementWidget( hBox, "AddOrEditSubstitution_widget" ); + // Set controls if editing existing. + m_editWidget->matchButton->setEnabled( false ); + if (!isAdd) + { + if ( item->text(0) == i18n("Abbreviation for 'Regular Expression'", "RegExp") ) + { + m_editWidget->regexpRadioButton->setChecked( true ); + m_editWidget->matchButton->setEnabled( m_reEditorInstalled ); + } + m_editWidget->caseCheckBox->setChecked( (item->text(1))==i18n("Yes") ); + m_editWidget->matchLineEdit->setText( item->text(2) ); + m_editWidget->substLineEdit->setText( item->text(3) ); + } + // The match box may not be blank. + connect( m_editWidget->matchLineEdit, SIGNAL(textChanged(const QString&)), + this, SLOT(slotMatchLineEdit_textChanged(const QString&)) ); + connect( m_editWidget->regexpRadioButton, SIGNAL(clicked()), + this, SLOT(slotTypeButtonGroup_clicked()) ); + connect( m_editWidget->wordRadioButton, SIGNAL(clicked()), + this, SLOT(slotTypeButtonGroup_clicked()) ); + connect( m_editWidget->matchButton, SIGNAL(clicked()), + this, SLOT(slotMatchButton_clicked()) ); + // Display the box in a dialog. + m_editDlg = new KDialogBase( + KDialogBase::Swallow, + i18n("Edit String Replacement"), + KDialogBase::Help|KDialogBase::Ok|KDialogBase::Cancel, + KDialogBase::Cancel, + m_widget, + "AddOrEditSubstitution_dlg", + true, + true); + // Disable OK button if match field blank. + m_editDlg->setMainWidget( hBox ); + m_editDlg->setHelp( "", "kttsd" ); + m_editDlg->enableButton( KDialogBase::Ok, !m_editWidget->matchLineEdit->text().isEmpty() ); + int dlgResult = m_editDlg->exec(); + QString substType = i18n( "Word" ); + if ( m_editWidget->regexpRadioButton->isChecked() ) + substType = i18n("Abbreviation for 'Regular Expression'", "RegExp"); + QString matchCase = i18n("No"); + if ( m_editWidget->caseCheckBox->isChecked() ) matchCase = i18n("Yes"); + QString match = m_editWidget->matchLineEdit->text(); + QString subst = m_editWidget->substLineEdit->text(); + delete m_editDlg; + m_editDlg = 0; + m_editWidget = 0; + if (dlgResult != QDialog::Accepted) return; + // TODO: Also delete hBox and w? + if ( match.isEmpty() ) return; + if ( isAdd ) + { + if ( item ) + item = new KListViewItem( m_widget->substLView, item, substType, matchCase, match, subst ); + else + item = new KListViewItem( m_widget->substLView, substType, matchCase, match, subst ); + m_widget->substLView->setSelected( item, true ); + } + else + { + item->setText( 0, substType ); + item->setText( 1, matchCase ); + item->setText( 2, match ); + item->setText( 3, subst ); + } + m_widget->substLView->ensureItemVisible( item ); + enableDisableButtons(); + configChanged(); +} + +void StringReplacerConf::slotMatchLineEdit_textChanged(const QString& text) +{ + // Disable OK button if match field blank. + if ( !m_editDlg ) return; + m_editDlg->enableButton( KDialogBase::Ok, !text.isEmpty() ); +} + +void StringReplacerConf::slotRemoveButton_clicked() +{ + QListViewItem* item = m_widget->substLView->selectedItem(); + if (!item) return; + delete item; + enableDisableButtons(); + configChanged(); +} + +void StringReplacerConf::slotTypeButtonGroup_clicked() +{ + // Enable Regular Expression Editor button if editor is installed (requires kdeutils). + if ( !m_editWidget ) return; + m_editWidget->matchButton->setEnabled( m_editWidget->regexpRadioButton->isOn() && m_reEditorInstalled ); +} + +void StringReplacerConf::slotMatchButton_clicked() +{ + // Show Regular Expression Editor dialog if it is installed. + if ( !m_editWidget ) return; + if ( !m_editDlg ) return; + if ( !m_reEditorInstalled ) return; + QDialog *editorDialog = + KParts::ComponentFactory::createInstanceFromQuery( "KRegExpEditor/KRegExpEditor" ); + if ( editorDialog ) + { + // kdeutils was installed, so the dialog was found. Fetch the editor interface. + KRegExpEditorInterface *reEditor = + static_cast(editorDialog->qt_cast( "KRegExpEditorInterface" ) ); + Q_ASSERT( reEditor ); // This should not fail!// now use the editor. + reEditor->setRegExp( m_editWidget->matchLineEdit->text() ); + int dlgResult = editorDialog->exec(); + if ( dlgResult == QDialog::Accepted ) + { + QString re = reEditor->regExp(); + m_editWidget->matchLineEdit->setText( re ); + m_editDlg->enableButton( KDialogBase::Ok, !re.isEmpty() ); + } + delete editorDialog; + } else return; +} + +void StringReplacerConf::slotLoadButton_clicked() +{ + // QString dataDir = KGlobal::dirs()->resourceDirs("data").last() + "/kttsd/stringreplacer/"; + QString dataDir = KGlobal::dirs()->findAllResources("data", "kttsd/stringreplacer/").last(); + QString filename = KFileDialog::getOpenFileName( + dataDir, + "*.xml|String Replacer Word List (*.xml)", + m_widget, + "stringreplacer_loadfile"); + if ( filename.isEmpty() ) return; + QString errMsg = loadFromFile( filename, false ); + enableDisableButtons(); + if ( !errMsg.isEmpty() ) + KMessageBox::sorry( m_widget, errMsg, i18n("Error Opening File") ); + else + configChanged(); +} + +void StringReplacerConf::slotSaveButton_clicked() +{ + QString filename = KFileDialog::getSaveFileName( + KGlobal::dirs()->saveLocation( "data" ,"kttsd/stringreplacer/", false ), + "*.xml|String Replacer Word List (*.xml)", + m_widget, + "stringreplacer_savefile"); + if ( filename.isEmpty() ) return; + QString errMsg = saveToFile( filename ); + enableDisableButtons(); + if ( !errMsg.isEmpty() ) + KMessageBox::sorry( m_widget, errMsg, i18n("Error Opening File") ); +} + +void StringReplacerConf::slotClearButton_clicked() +{ + m_widget->substLView->clear(); + enableDisableButtons(); +} diff --git a/kttsd/filters/stringreplacer/stringreplacerconf.h b/kttsd/filters/stringreplacer/stringreplacerconf.h new file mode 100644 index 0000000..f0312a6 --- /dev/null +++ b/kttsd/filters/stringreplacer/stringreplacerconf.h @@ -0,0 +1,158 @@ +/***************************************************** vim:set ts=4 sw=4 sts=4: + Generic String Replacement Filter Configuration class. + ------------------- + Copyright: + (C) 2005 by Gary Cramblitt + ------------------- + Original author: Gary Cramblitt + + 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. + + 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. + ******************************************************************************/ + +#ifndef _STRINGREPLACERCONF_H_ +#define _STRINGREPLACERCONF_H_ + +// Qt includes. +#include + +// KDE includes. +#include +#include + +// KTTS includes. +#include "filterconf.h" + +// StringReplacer includes. +#include "stringreplacerconfwidget.h" + +class KDialogBase; +class EditReplacementWidget; + +class StringReplacerConf : public KttsFilterConf +{ + Q_OBJECT + + public: + /** + * Constructor + */ + StringReplacerConf( QWidget *parent, const char *name, const QStringList &args = QStringList() ); + + /** + * Destructor + */ + virtual ~StringReplacerConf(); + + enum SubstitutionType { + stWord, // Word + stRegExp // Regular Expression + }; + + /** + * This method is invoked whenever the module should read its + * configuration (most of the times from a config file) and update the + * user interface. This happens when the user clicks the "Reset" button in + * the control center, to undo all of his changes and restore the currently + * valid settings. Note that KTTSMGR calls this when the plugin is + * loaded, so it not necessary to call it in your constructor. + * The plugin should read its configuration from the specified group + * in the specified config file. + * @param config Pointer to a KConfig object. + * @param configGroup Call config->setGroup with this argument before + * loading your configuration. + * + * When a plugin is first added to KTTSMGR, @e load will be called with + * a Null @e configGroup. In this case, the plugin will not have + * any instance-specific parameters to load, but it may still wish + * to load parameters that apply to all instances of the plugin. + */ + virtual void load(KConfig *config, const QString &configGroup); + + /** + * This function gets called when the user wants to save the settings in + * the user interface, updating the config files or wherever the + * configuration is stored. The method is called when the user clicks "Apply" + * or "Ok". The plugin should save its configuration in the specified + * group of the specified config file. + * @param config Pointer to a KConfig object. + * @param configGroup Call config->setGroup with this argument before + * saving your configuration. + */ + virtual void save(KConfig *config, const QString &configGroup); + + /** + * This function is called to set the settings in the module to sensible + * default values. It gets called when hitting the "Default" button. The + * default values should probably be the same as the ones the application + * uses when started without a config file. Note that defaults should + * be applied to the on-screen widgets; not to the config file. + */ + virtual void defaults(); + + /** + * Indicates whether the plugin supports multiple instances. Return + * False if only one instance of the plugin can be configured. + * @return True if multiple instances are possible. + */ + virtual bool supportsMultiInstance(); + + /** + * Returns the name of the plugin. Displayed in Filters tab of KTTSMgr. + * If there can be more than one instance of a filter, it should return + * a unique name for each instance. The name should be translated for + * the user if possible. If the plugin is not correctly configured, + * return an empty string. + * @return Filter instance name. + */ + virtual QString userPlugInName(); + + private slots: + void slotLanguageBrowseButton_clicked(); + void slotAddButton_clicked(); + void slotUpButton_clicked(); + void slotDownButton_clicked(); + void slotEditButton_clicked(); + void slotRemoveButton_clicked(); + void slotMatchLineEdit_textChanged(const QString& text); + void slotTypeButtonGroup_clicked(); + void slotMatchButton_clicked(); + void slotLoadButton_clicked(); + void slotSaveButton_clicked(); + void slotClearButton_clicked(); + + // EnablesDisables buttons depending upon current item in list view. + void enableDisableButtons(); + + private: + // Displays the add/edit string replacement dialog. + void addOrEditSubstitution(bool isAdd); + // Loads word list and settings from a file. Clearing configuration if clear is True. + QString loadFromFile( const QString& filename, bool clear); + // Saves word list and settings to a file. + QString saveToFile( const QString& filename ); + + + // Configuration Widget. + StringReplacerConfWidget* m_widget; + // Edit Dialog and widget. + KDialogBase* m_editDlg; + EditReplacementWidget* m_editWidget; + // True if kdeutils Regular Expression Editor is installed. + bool m_reEditorInstalled; + // Language Codes. + QStringList m_languageCodeList; +}; + +#endif //_STRINGREPLACERCONF_H_ diff --git a/kttsd/filters/stringreplacer/stringreplacerconfwidget.ui b/kttsd/filters/stringreplacer/stringreplacerconfwidget.ui new file mode 100644 index 0000000..e88307f --- /dev/null +++ b/kttsd/filters/stringreplacer/stringreplacerconfwidget.ui @@ -0,0 +1,474 @@ + +StringReplacerConfWidget +Widget for configuring String Replacer Filter for KTTSD. +Gary Cramblitt <garycramblitt@comcast.net> + + + StringReplacerConfWidget + + + + 0 + 0 + 548 + 421 + + + + Configure String Replacer + + + + unnamed + + + + layout3 + + + + unnamed + + + + nameLabel + + + &Name: + + + AlignVCenter|AlignRight + + + nameLineEdit + + + Enter any name you like for this filter. + What's this text + + + + + nameLineEdit + + + Enter any name you like for this filter. + + + + + + + applyGroupBox + + + Apply This &Filter When + + + These settings determines when the filter is applied to text. + + + + unnamed + + + + layout11 + + + + unnamed + + + + languageLabel + + + Lan&guage is: + + + AlignVCenter|AlignRight + + + languageLineEdit + + + This filter is applied to text jobs of the specified language. You may select more than one language by clicking the browse button and Ctrl-clicking on more than one in the list. If blank the filter applies to all text jobs of any language. + What's this text + + + + + appIdLabel + + + Application &ID contains: + + + AlignVCenter|AlignRight + + + appIdLineEdit + + + Enter a DCOP Application ID. This filter will only apply to text jobs queued by that application. You may enter more than one ID separated by commas. If blank, this filter applies to text jobs queued by all applications. Tip: Use kdcop from the command line to get the Application IDs of running applications. Example: "konversation, kvirc,ksirc,kopete" + + + + + + + layout13 + + + + unnamed + + + + layout12 + + + + unnamed + + + + languageLineEdit + + + false + + + This filter is applied to text jobs of the specified language. You may select more than one language by clicking the browse button and Ctrl-clicking on more than one in the list. If blank the filter applies to all text jobs of any language. + + + + + languageBrowseButton + + + ... + + + Click to select one or more languages. This filter will be applied to text jobs of those languages. + + + + + + + appIdLineEdit + + + <qt>Enter a DCOP Application ID. This filter will only apply to text jobs queued by that application. You may enter more than one ID separated by commas. Use <b>knotify</b> to match all messages sent as KDE notifications. If blank, this filter applies to text jobs queued by all applications. Tip: Use kdcop from the command line to get the Application IDs of running applications. Example: "konversation, kvirc,ksirc,kopete"</qt> + + + + + + + + + layout6 + + + + unnamed + + + + loadButton + + + + 1 + 0 + 0 + 0 + + + + Load... + + + + + + Click to load a word list from a file. + What's this text + + + + + saveButton + + + + 1 + 0 + 0 + 0 + + + + &Save... + + + Click to save word list to a file. + What's this text + + + + + clearButton + + + + 1 + 0 + 0 + 0 + + + + C&lear + + + Click to empty the word list. + What's this text + + + + + + + layout24 + + + + unnamed + + + + + Type + + + true + + + true + + + + + Match Case + + + true + + + true + + + + + Match + + + true + + + true + + + + + Replace With + + + true + + + true + + + + substLView + + + true + + + + + layout23 + + + + unnamed + + + + addButton + + + + 1 + 0 + 0 + 0 + + + + &Add... + + + Click to add another word or regular expression to the list. + What's this text + + + + + upButton + + + + 5 + 0 + 0 + 0 + + + + &Up + + + Click to move selected word up in the list. Words higher in the list are applied first. + + + + + downButton + + + + 5 + 0 + 0 + 0 + + + + Do&wn + + + Click to move a word down in the list. Words lower in the list are applied last. + + + + + editButton + + + false + + + + 1 + 0 + 0 + 0 + + + + &Edit... + + + false + + + Click to modify an existing word or regular expression in the list. + + + + + removeButton + + + false + + + + 1 + 0 + 0 + 0 + + + + &Remove + + + false + + + Click to remove a word or regular expression from the list. + + + + + spacer13 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + + + + nameLineEdit + substLView + addButton + upButton + downButton + editButton + removeButton + loadButton + saveButton + clearButton + languageLineEdit + languageBrowseButton + appIdLineEdit + + + + klineedit.h + klineedit.h + kpushbutton.h + klineedit.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + klistview.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + + diff --git a/kttsd/filters/stringreplacer/stringreplacerplugin.cpp b/kttsd/filters/stringreplacer/stringreplacerplugin.cpp new file mode 100644 index 0000000..c3f9678 --- /dev/null +++ b/kttsd/filters/stringreplacer/stringreplacerplugin.cpp @@ -0,0 +1,32 @@ +/***************************************************** vim:set ts=4 sw=4 sts=4: + Generating the factories so String Replacer Filter can be used as plug in. + ------------------- + Copyright: + (C) 2005 by Gary Cramblitt + ------------------- + Original author: Gary Cramblitt + + 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. + + 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 + +#include "stringreplacerconf.h" +#include "stringreplacerproc.h" + +typedef K_TYPELIST_2( StringReplacerProc, StringReplacerConf ) StringReplacerPlugin; +K_EXPORT_COMPONENT_FACTORY( libkttsd_stringreplacerplugin, + KGenericFactory("kttsd_stringreplacer") ) + diff --git a/kttsd/filters/stringreplacer/stringreplacerproc.cpp b/kttsd/filters/stringreplacer/stringreplacerproc.cpp new file mode 100644 index 0000000..1b03810 --- /dev/null +++ b/kttsd/filters/stringreplacer/stringreplacerproc.cpp @@ -0,0 +1,231 @@ +/***************************************************** vim:set ts=4 sw=4 sts=4: + Generic String Replacement Filter Processing class. + ------------------- + Copyright: + (C) 2005 by Gary Cramblitt + ------------------- + Original author: Gary Cramblitt + + 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. + + 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. + ******************************************************************************/ + +// Qt includes. +#include +#include +#include + +// KDE includes. +#include +#include +#include +#include +#include + +// KTTS includes. +#include "filterproc.h" +#include "talkercode.h" + +// StringReplacer includes. +#include "stringreplacerproc.h" +#include "stringreplacerproc.moc" + +/** + * Constructor. + */ +StringReplacerProc::StringReplacerProc( QObject *parent, const char *name, const QStringList& ) : + KttsFilterProc(parent, name) +{ +} + +/** + * Destructor. + */ +/*virtual*/ StringReplacerProc::~StringReplacerProc() +{ + m_matchList.clear(); + m_caseList.clear(); + m_substList.clear(); +} + +/** + * Initialize the filter. + * @param config Settings object. + * @param configGroup Settings Group. + * @return False if filter is not ready to filter. + * + * Note: The parameters are for reading from kttsdrc file. Plugins may wish to maintain + * separate configuration files of their own. + */ +bool StringReplacerProc::init(KConfig* config, const QString& configGroup){ + // kdDebug() << "StringReplacerProc::init: Running" << endl; + QString wordsFilename = + KGlobal::dirs()->saveLocation( "data" ,"kttsd/stringreplacer/", false ); + if ( wordsFilename.isEmpty() ) return false; + wordsFilename += configGroup; + config->setGroup( configGroup ); + wordsFilename = config->readEntry( "WordListFile", wordsFilename ); + + // Open existing word list. + QFile file( wordsFilename ); + if ( !file.open( IO_ReadOnly ) ) + return false; + QDomDocument doc( "" ); + if ( !doc.setContent( &file ) ) { + file.close(); + return false; + } + file.close(); + + // Clear list. + m_matchList.clear(); + m_caseList.clear(); + m_substList.clear(); + + // Name setting. + // QDomNodeList nameList = doc.elementsByTagName( "name" ); + // QDomNode nameNode = nameList.item( 0 ); + // m_widget->nameLineEdit->setText( nameNode.toElement().text() ); + + // Language Codes setting. List may be single element of comma-separated values, + // or multiple elements. + m_languageCodeList.clear(); + QDomNodeList languageList = doc.elementsByTagName( "language-code" ); + for ( uint ndx=0; ndx < languageList.count(); ++ndx ) + { + QDomNode languageNode = languageList.item( ndx ); + m_languageCodeList += QStringList::split(',', languageNode.toElement().text(), false); + } + + // AppId. Apply this filter only if DCOP appId of application that queued + // the text contains this string. List may be single element of comma-separated values, + // or multiple elements. + m_appIdList.clear(); + QDomNodeList appIdList = doc.elementsByTagName( "appid" ); + for ( uint ndx=0; ndx < appIdList.count(); ++ndx ) + { + QDomNode appIdNode = appIdList.item( ndx ); + m_appIdList += QStringList::split(',', appIdNode.toElement().text(), false); + } + + // Word list. + QDomNodeList wordList = doc.elementsByTagName("word"); + const int wordListCount = wordList.count(); + for (int wordIndex = 0; wordIndex < wordListCount; ++wordIndex) + { + QDomNode wordNode = wordList.item(wordIndex); + QDomNodeList propList = wordNode.childNodes(); + QString wordType; + QString matchCase = "No"; // Default for old (v<=3.5.3) config files with no . + QString match; + QString subst; + const int propListCount = propList.count(); + for (int propIndex = 0; propIndex < propListCount; ++propIndex) + { + QDomNode propNode = propList.item(propIndex); + QDomElement prop = propNode.toElement(); + if (prop.tagName() == "type") wordType = prop.text(); + if (prop.tagName() == "case") matchCase = prop.text(); + if (prop.tagName() == "match") match = prop.text(); + if (prop.tagName() == "subst") subst = prop.text(); + } + // Build Regular Expression for each word's match string. + QRegExp rx; + rx.setCaseSensitive(matchCase == "Yes"); + if ( wordType == "Word" ) + { + // TODO: Does \b honor strange non-Latin1 encodings? + rx.setPattern( "\\b" + match + "\\b" ); + } + else + { + rx.setPattern( match ); + } + // Add Regular Expression to list (if valid). + if ( rx.isValid() ) + { + m_matchList.append( rx ); + m_substList.append( subst ); + } + } + return true; +} + +/** + * Convert input, returning output. + * @param inputText Input text. + * @param talkerCode TalkerCode structure for the talker that KTTSD intends to + * use for synthing the text. Useful for extracting hints about + * how to filter the text. For example, languageCode. + * @param appId The DCOP appId of the application that queued the text. + * Also useful for hints about how to do the filtering. + */ +/*virtual*/ QString StringReplacerProc::convert(const QString& inputText, TalkerCode* talkerCode, const QCString& appId) +{ + m_wasModified = false; + // If language doesn't match, return input unmolested. + if ( !m_languageCodeList.isEmpty() ) + { + QString languageCode = talkerCode->languageCode(); + // kdDebug() << "StringReplacerProc::convert: converting " << inputText << + // " if language code " << languageCode << " matches " << m_languageCodeList << endl; + if ( !m_languageCodeList.contains( languageCode ) ) + { + if ( !talkerCode->countryCode().isEmpty() ) + { + languageCode += '_' + talkerCode->countryCode(); + // kdDebug() << "StringReplacerProc::convert: converting " << inputText << + // " if language code " << languageCode << " matches " << m_languageCodeList << endl; + if ( !m_languageCodeList.contains( languageCode ) ) return inputText; + } else return inputText; + } + } + // If appId doesn't match, return input unmolested. + if ( !m_appIdList.isEmpty() ) + { + // kdDebug() << "StringReplacerProc::convert: converting " << inputText << " if appId " + // << appId << " matches " << m_appIdList << endl; + bool found = false; + QString appIdStr = appId; + for ( uint ndx=0; ndx < m_appIdList.count(); ++ndx ) + { + if ( appIdStr.contains(m_appIdList[ndx]) ) + { + found = true; + break; + } + } + if ( !found ) + { + // kdDebug() << "StringReplacerProc::convert: appId not found" << endl; + return inputText; + } + } + QString newText = inputText; + const int listCount = m_matchList.count(); + for ( int index = 0; index < listCount; ++index ) + { + //kdDebug() << "newtext = " << newText << " matching " << m_matchList[index].pattern() << " replacing with " << m_substList[index] << endl; + newText.replace( m_matchList[index], m_substList[index] ); + } + m_wasModified = true; + return newText; +} + +/** + * Did this filter do anything? If the filter returns the input as output + * unmolested, it should return False when this method is called. + */ +/*virtual*/ bool StringReplacerProc::wasModified() { return m_wasModified; } + diff --git a/kttsd/filters/stringreplacer/stringreplacerproc.h b/kttsd/filters/stringreplacer/stringreplacerproc.h new file mode 100644 index 0000000..114ebaf --- /dev/null +++ b/kttsd/filters/stringreplacer/stringreplacerproc.h @@ -0,0 +1,97 @@ +/***************************************************** vim:set ts=4 sw=4 sts=4: + Generic String Replacement Filter Processing class. + This is the interface definition for text filters. + ------------------- + Copyright: + (C) 2005 by Gary Cramblitt + ------------------- + Original author: Gary Cramblitt + + 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. + + 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. + ******************************************************************************/ + +#ifndef _STRINGREPLACERPROC_H_ +#define _STRINGREPLACERPROC_H_ + +// Qt includes. +#include +#include +#include +#include +#include + +// KTTS includes. +#include "filterproc.h" + +class StringReplacerProc : virtual public KttsFilterProc +{ + Q_OBJECT + +public: + /** + * Constructor. + */ + StringReplacerProc( QObject *parent, const char *name, const QStringList &args = QStringList() ); + + /** + * Destructor. + */ + virtual ~StringReplacerProc(); + + /** + * Initialize the filter. + * @param config Settings object. + * @param configGroup Settings Group. + * @return False if filter is not ready to filter. + * + * Note: The parameters are for reading from kttsdrc file. Plugins may wish to maintain + * separate configuration files of their own. + */ + virtual bool init(KConfig *config, const QString &configGroup); + + /** + * Convert input, returning output. + * @param inputText Input text. + * @param talkerCode TalkerCode structure for the talker that KTTSD intends to + * use for synthing the text. Useful for extracting hints about + * how to filter the text. For example, languageCode. + * @param appId The DCOP appId of the application that queued the text. + * Also useful for hints about how to do the filtering. + */ + virtual QString convert(const QString& inputText, TalkerCode* talkerCode, const QCString& appId); + + /** + * Did this filter do anything? If the filter returns the input as output + * unmolested, it should return False when this method is called. + */ + virtual bool wasModified(); + +private: + // Language codes supported by the filter. + QStringList m_languageCodeList; + // If not empty, apply filter only to apps containing one or more of these strings. + QStringList m_appIdList; + + // List of regular expressions to match. + QValueList m_matchList; + // List of match case flag + QValueList m_caseList; + // List of substitutions to replace matches. + QValueList m_substList; + // True if this filter did anything to the text. + bool m_wasModified; +}; + +#endif // _STRINGREPLACERPROC_H_ -- cgit v1.2.1