mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kate: create KSpeech instance on demand
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
a5fa8348e3
commit
c8d5cf3c10
2 changed files with 20 additions and 13 deletions
|
@ -51,7 +51,8 @@ Kate::PluginView *KateKttsdPlugin::createView (Kate::MainWindow *mainWindow)
|
|||
|
||||
KateKttsdPluginView::KateKttsdPluginView( Kate::MainWindow *mw )
|
||||
: Kate::PluginView (mw),
|
||||
Kate::XMLGUIClient(KateKttsdFactory::componentData())
|
||||
Kate::XMLGUIClient(KateKttsdFactory::componentData()),
|
||||
m_kspeech(nullptr)
|
||||
{
|
||||
KGlobal::locale()->insertCatalog("kttsd");
|
||||
KAction *a = actionCollection()->addAction("tools_kttsd");
|
||||
|
@ -90,8 +91,11 @@ void KateKttsdPluginView::slotReadOut()
|
|||
return;
|
||||
}
|
||||
|
||||
KSpeech kspeech(this);
|
||||
kspeech.setSpeechID(QString::fromLatin1("kate"));
|
||||
kspeech.say(text);
|
||||
if (!m_kspeech) {
|
||||
m_kspeech = new KSpeech(this);
|
||||
m_kspeech->setSpeechID(QString::fromLatin1("kate"));
|
||||
}
|
||||
|
||||
m_kspeech->say(text);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,29 +23,32 @@
|
|||
#include <ktexteditor/plugin.h>
|
||||
#include <ktexteditor/view.h>
|
||||
#include <kate/plugin.h>
|
||||
#include <kspeech.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
class KateKttsdPlugin : public Kate::Plugin
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit KateKttsdPlugin( QObject* parent = 0, const QList<QVariant>& = QList<QVariant>() );
|
||||
virtual ~KateKttsdPlugin() {};
|
||||
|
||||
public:
|
||||
explicit KateKttsdPlugin( QObject* parent = 0, const QList<QVariant>& = QList<QVariant>() );
|
||||
virtual ~KateKttsdPlugin() {};
|
||||
Kate::PluginView *createView(Kate::MainWindow *mainWindow);
|
||||
Kate::PluginView *createView(Kate::MainWindow *mainWindow);
|
||||
};
|
||||
|
||||
class KateKttsdPluginView : public Kate::PluginView, public Kate::XMLGUIClient
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit KateKttsdPluginView(Kate::MainWindow *mw );
|
||||
public:
|
||||
explicit KateKttsdPluginView(Kate::MainWindow *mw );
|
||||
~KateKttsdPluginView();
|
||||
|
||||
public slots:
|
||||
void slotReadOut();
|
||||
public slots:
|
||||
void slotReadOut();
|
||||
|
||||
private:
|
||||
KSpeech *m_kspeech;
|
||||
};
|
||||
|
||||
#endif // _KATEKTTSD_H_
|
||||
|
|
Loading…
Add table
Reference in a new issue