diff options
Diffstat (limited to 'kttsd/app-plugins')
-rw-r--r-- | kttsd/app-plugins/Makefile.am | 1 | ||||
-rw-r--r-- | kttsd/app-plugins/kate/Makefile.am | 19 | ||||
-rw-r--r-- | kttsd/app-plugins/kate/katekttsd.cpp | 120 | ||||
-rw-r--r-- | kttsd/app-plugins/kate/katekttsd.h | 57 | ||||
-rw-r--r-- | kttsd/app-plugins/kate/ktexteditor_kttsd.desktop | 104 | ||||
-rw-r--r-- | kttsd/app-plugins/kate/ktexteditor_kttsdui.rc | 11 |
6 files changed, 312 insertions, 0 deletions
diff --git a/kttsd/app-plugins/Makefile.am b/kttsd/app-plugins/Makefile.am new file mode 100644 index 0000000..22a2493 --- /dev/null +++ b/kttsd/app-plugins/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = kate diff --git a/kttsd/app-plugins/kate/Makefile.am b/kttsd/app-plugins/kate/Makefile.am new file mode 100644 index 0000000..3508e52 --- /dev/null +++ b/kttsd/app-plugins/kate/Makefile.am @@ -0,0 +1,19 @@ +# Allow build from within kdebase or kdeaccessibility. +INCLUDES = \ + -I$(top_srcdir)/kate/interfaces \ + -I$(kde_includes)/kate \ + $(all_includes) + +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = ktexteditor_kttsd.la + +ktexteditor_kttsd_la_SOURCES = katekttsd.cpp +ktexteditor_kttsd_la_LIBADD = -lktexteditor +ktexteditor_kttsd_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +kttsddatadir = $(kde_datadir)/ktexteditor_kttsd +kttsddata_DATA = ktexteditor_kttsdui.rc + +kde_services_DATA = ktexteditor_kttsd.desktop diff --git a/kttsd/app-plugins/kate/katekttsd.cpp b/kttsd/app-plugins/kate/katekttsd.cpp new file mode 100644 index 0000000..a2e64e6 --- /dev/null +++ b/kttsd/app-plugins/kate/katekttsd.cpp @@ -0,0 +1,120 @@ +/*************************************************************************** + A KTextEditor (Kate Part) plugin for speaking text. + + Copyright: + (C) 2003-2004 by Olaf Schmidt <ojschmidt@kde.org> + (C) 2005 by Gary Cramblitt <garycramblitt@comcast.net> + + Original Author: Olaf Schmidt <ojschmidt@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. * + * * + ***************************************************************************/ + +// Qt includes. +#include <qmessagebox.h> +#include <dcopclient.h> +#include <qtimer.h> + +// KDE includes. +#include <ktexteditor/editinterface.h> +#include <ktexteditor/selectioninterface.h> + +#include <kaction.h> +#include <klocale.h> +#include <kstandarddirs.h> +#include <kapplication.h> +#include <kgenericfactory.h> + +// KateKttsdPlugin includes. +#include "katekttsd.h" +#include "katekttsd.moc" + +K_EXPORT_COMPONENT_FACTORY( ktexteditor_kttsd, KGenericFactory<KateKttsdPlugin>( "ktexteditor_kttsd" ) ) + +KateKttsdPlugin::KateKttsdPlugin( QObject *parent, const char* name, const QStringList& ) + : KTextEditor::Plugin ( (KTextEditor::Document*) parent, name ) +{ +} + +KateKttsdPlugin::~KateKttsdPlugin() +{ +} + + +void KateKttsdPlugin::addView(KTextEditor::View *view) +{ + KateKttsdPluginView *nview = new KateKttsdPluginView (view, "KTTSD Plugin"); + m_views.append (nview); +} + +void KateKttsdPlugin::removeView(KTextEditor::View *view) +{ + for (uint z=0; z < m_views.count(); ++z) + if (m_views.at(z)->parentClient() == view) + { + KateKttsdPluginView *nview = m_views.at(z); + m_views.remove (nview); + delete nview; + } + KGlobal::locale()->removeCatalogue("kttsd"); +} + + +KateKttsdPluginView::KateKttsdPluginView( KTextEditor::View *view, const char *name ) + : QObject( view, name ), + KXMLGUIClient( view ) +{ + view->insertChildClient( this ); + setInstance( KGenericFactory<KateKttsdPlugin>::instance() ); + KGlobal::locale()->insertCatalogue("kttsd"); + (void) new KAction( i18n("Speak Text"), "kttsd", 0, this, SLOT(slotReadOut()), actionCollection(), "tools_kttsd" ); + setXMLFile( "ktexteditor_kttsdui.rc" ); +} + +void KateKttsdPluginView::slotReadOut() +{ + KTextEditor::View *v = (KTextEditor::View*)parent(); + KTextEditor::SelectionInterface *si = KTextEditor::selectionInterface( v->document() ); + QString text; + + if ( si->hasSelection() ) + text = si->selection(); + else { + KTextEditor::EditInterface *ei = KTextEditor::editInterface( v->document() ); + text = ei->text(); + } + + DCOPClient *client = kapp->dcopClient(); + // If KTTSD not running, start it. + if (!client->isApplicationRegistered("kttsd")) + { + QString error; + if (kapp->startServiceByDesktopName("kttsd", QStringList(), &error)) + QMessageBox::warning(0, i18n( "Starting KTTSD Failed"), error ); + } + QByteArray data; + QByteArray data2; + QCString replyType; + QByteArray replyData; + QDataStream arg(data, IO_WriteOnly); + arg << text << ""; + if ( !client->call("kttsd", "KSpeech", "setText(QString,QString)", + data, replyType, replyData, true) ) + QMessageBox::warning( 0, i18n( "DCOP Call Failed" ), + i18n( "The DCOP call setText failed." )); + QDataStream arg2(data2, IO_WriteOnly); + + arg2 << 0; + if ( !client->call("kttsd", "KSpeech", "startText(uint)", + data2, replyType, replyData, true) ) + QMessageBox::warning( 0, i18n( "DCOP Call Failed" ), + i18n( "The DCOP call startText failed." )); +} + diff --git a/kttsd/app-plugins/kate/katekttsd.h b/kttsd/app-plugins/kate/katekttsd.h new file mode 100644 index 0000000..cbab720 --- /dev/null +++ b/kttsd/app-plugins/kate/katekttsd.h @@ -0,0 +1,57 @@ +/*************************************************************************** + A KTextEditor (Kate Part) plugin for speaking text. + + Copyright: + (C) 2003-2004 by Olaf Schmidt <ojschmidt@kde.org> + (C) 2005 by Gary Cramblitt <garycramblitt@comcast.net> + + Original Author: Olaf Schmidt <ojschmidt@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 _KATEKTTSD_H_ +#define _KATEKTTSD_H_ + +#include <ktexteditor/plugin.h> +#include <ktexteditor/view.h> +#include <kxmlguiclient.h> +#include <qobject.h> + +class KateKttsdPlugin : public KTextEditor::Plugin, public KTextEditor::PluginViewInterface +{ + Q_OBJECT + + public: + KateKttsdPlugin( QObject *parent = 0, + const char* name = 0, + const QStringList &args = QStringList() ); + virtual ~KateKttsdPlugin(); + + void addView (KTextEditor::View *view); + void removeView (KTextEditor::View *view); + + private: + QPtrList<class KateKttsdPluginView> m_views; +}; + +class KateKttsdPluginView : public QObject, public KXMLGUIClient +{ + Q_OBJECT + + public: + KateKttsdPluginView( KTextEditor::View *view, const char *name=0 ); + ~KateKttsdPluginView() {}; + + public slots: + void slotReadOut(); +}; + +#endif // _KATEKTTSD_H_ diff --git a/kttsd/app-plugins/kate/ktexteditor_kttsd.desktop b/kttsd/app-plugins/kate/ktexteditor_kttsd.desktop new file mode 100644 index 0000000..aac7e0c --- /dev/null +++ b/kttsd/app-plugins/kate/ktexteditor_kttsd.desktop @@ -0,0 +1,104 @@ +[Desktop Entry] +Name=KTextEditor KTTSD Plugin +Name[bg]=Приставка KTextEditor KTTSD +Name[br]=Lugent KTTSD KTextEditor +Name[bs]=KTextEditor KTTSD dodatak +Name[ca]=Connector pel KTTSD del KTextEditor +Name[cs]=KTextEditor KTTSD modul +Name[de]=KTextEditor-Modul für KTTSD +Name[el]=Πρόσθετο KTextEditor KTTSD +Name[es]=Complemento KTextEditor KTTSD +Name[et]=KTextEditor KTTSD plugin +Name[eu]=KTextEditor-en KTTSD plugina +Name[fa]=وصلۀ KTextEditor KTTSD +Name[fi]=KTextEditor KTTSD -liitännäinen +Name[fr]=Module KTTSD pour KTextEditor +Name[ga]=Breiseán KTTSD KTextEditor +Name[gl]=Plugin de KTTSD para KTextEditor +Name[he]=תוסף KTextEditor עבור KTTSD +Name[hu]=KTextEditor KTTSD-modul +Name[is]=KTextEditor KTTSD íforrit +Name[it]=Plugin di KTTSD per KTextEditor +Name[ja]=KTextEditor KTTSD プラグイン +Name[ka]=KTextEditor KTTSD მოდული +Name[km]= កម្មវិធីជំនួយ KTextEditor KTTSD +Name[lt]=KTextEditor KTTSD priedas +Name[mk]=KTTSD-приклучок за KTextEditor +Name[ms]=Plugin KTextEditor KTTSD +Name[nb]=KTextEditor programtillegg for KTTSD +Name[nds]=KTTSD-Moduul KTextEditor +Name[ne]=केडीई पाठ सम्पादक KTTSD प्लगइन +Name[nl]=KTextEditor KTTSD-plugin +Name[pa]=KTextEditor KTTSD ਪਲੱਗਿੰਨ +Name[pl]=Wtyczka KTTSD dla edytora tekstu +Name[pt]='Plugin' KTextEditor do KTTSD +Name[pt_BR]=Plug-in do KTTSD para o KTextEditor +Name[ru]=Модуль KTextEditor для KTTSD +Name[sk]=KTextEditor KTTSD modul +Name[sl]=Vstavek KTTSD za KTextEditor +Name[sr]=KTTSD као прикључак за KTextEditor +Name[sr@Latn]=KTTSD kao priključak za KTextEditor +Name[sv]=KTTSD-insticksprogram för Ktexteditor +Name[ta]=KTextEditor KTTSD சொருகுப்பொருள் +Name[tg]=Модли KTextEditor барои KTTSD +Name[th]=ปลั๊กอิน KTTSD สำหรับ KTextEditor +Name[tr]=Ktexteditor KTTSD Eklentisi +Name[uk]=Втулок KTextEditor KTTSD +Name[vi]=Trình bổ sung KTTSD cho Trình soạn thảo K +Name[zh_CN]=KTextEditor KTTSD 插件 +Name[zh_TW]=K-文字編輯器的 kttsd 外掛程式 +Comment=Adds a menu entry for speaking the text +Comment[bg]=Добавяне на операция в менюто за изговаряне на текст +Comment[bs]=Dodaje stavku u meniju za čitanje teksta +Comment[ca]=Afegeix una entrada de menú per pronunciar el text +Comment[cs]=Vložení nabídky pro předčítání textu +Comment[da]=Tilføjer et menupunkt for at læse teksten op +Comment[de]=Fügt einen Menüeintrag zum Vorlesen des Textes hinzu +Comment[el]=Προσθέτει μία καταχώρηση στο μενού για τη μετατροπή σε φωνή του κειμένου +Comment[es]=Añadir una entrada al menú para leer el texto +Comment[et]=Lisab menüükirje teksti kõnelemiseks +Comment[eu]=Testuak ahoskatzeko menuko sarrera bat gehitzen du +Comment[fa]=مدخل گزینگان را برای گفتن متن اضافه میکند +Comment[fi]=Lisää valikkovalinnan tekstin puhumiseksi +Comment[fr]=Ajoute une entrée dans le menu pour prononcer le texte +Comment[ga]=Cuir iontráil sa roghchlár chun an téacs a rá +Comment[gl]=Engade unha entrada no menu para falar o texto +Comment[he]=מוסיף כניסה בתפריט להקראת הטקסט +Comment[hu]=Menüpont létrehozása szövegfelolvasáshoz +Comment[is]=Bætir við valmyndarfærslu fyrir tal af textanum +Comment[it]=Aggiunge una voce del menu per pronunciare il testo +Comment[ja]=テキスト読み上げをメニューエントリに追加する +Comment[ka]=ტექსტის წაკითხვას ამატებს მენიუს ჩანაწერს +Comment[km]=បន្ថែមធាតុម៉ឺនុយសម្រាប់ការនិយាយអត្ថបទ +Comment[lt]=Prideda meniu įrašą teksto įkalbėjimui +Comment[mk]=Додава елемент во менито за зборување на текстот +Comment[ms]=Tambah entri menu untuk menjadikan teks bercakap +Comment[nb]=Legger til en menyoppføring for å si teksten høyt +Comment[nds]=Föögt en Menüindrag för dat Textvörlesen to +Comment[ne]=पाठ बोल्नका लागि मेनु प्रविष्टि थप्छ +Comment[nl]=Voegt een menuoptie toe voor het uitspreken van de tekst +Comment[pa]=ਪਾਠ ਬੋਲਣ ਲਈ ਇੱਕ ਮੇਨੂ ਇੰਦਰਾਜ਼ ਜੋੜਦਾ ਹੈ +Comment[pl]=Dodaje wpis w menu do mówienia tekstu +Comment[pt]=Adiciona uma entrada de menu para ler o texto +Comment[pt_BR]=Adiciona uma entrada no menu para falar o texto +Comment[ru]=Добавляет меню синтеза речи +Comment[sk]=Pridá položku menu pre hovorenie textu +Comment[sl]=Dodaj menijski vnos za govorjenje besedila +Comment[sr]=Додаје ставку менија за изговарање текста +Comment[sr@Latn]=Dodaje stavku menija za izgovaranje teksta +Comment[sv]=Lägger till ett menyalternativ för att läsa upp texten +Comment[ta]=உரையை பேசுவதற்கு ஒரு பட்டியல் உள்ளிட்டை சேர்க்கிறது +Comment[tg]=Илова кардани менюи таҳлили овоз +Comment[th]=เพิ่มรายการเมนูสำหรับอ่านข้อความเป็นเสียง +Comment[tr]=Metni okumak için bir menü girdisi oluşturur +Comment[uk]=Додає елемент меню для декламування тексту +Comment[vi]=Thêm danh mục thực đơn cho việc đọc văn bản +Comment[zh_CN]=添加可读出文本的菜单项 +Comment[zh_TW]=新增朗讀文字的目錄 +Type=Service +ServiceTypes=KTextEditor/Plugin +X-KDE-Library=ktexteditor_kttsd +X-Kate-Version=2.2 +MimeType=text/plain +Icon=kttsd +author=Olaf Jan Schmidt, ojschmidt@kde.org diff --git a/kttsd/app-plugins/kate/ktexteditor_kttsdui.rc b/kttsd/app-plugins/kate/ktexteditor_kttsdui.rc new file mode 100644 index 0000000..9dea629 --- /dev/null +++ b/kttsd/app-plugins/kate/ktexteditor_kttsdui.rc @@ -0,0 +1,11 @@ +<!DOCTYPE kpartgui> +<kpartplugin name="ktexteditor_kttsd" library="ktexteditor_kttsd" version="2"> + <MenuBar> + <Menu name="tools"><Text>&Tools</Text> + <Action name="tools_kttsd" /> + </Menu> + </MenuBar> + <ToolBar name="mainToolBar"><text>Main Toolbar</text> + <Action name="tools_kttsd" /> + </ToolBar> +</kpartplugin> |