Commit f65c9225 authored by Pino Toscano's avatar Pino Toscano

Add an action to stop all the text speechs.

svn path=/trunk/KDE/kdegraphics/okular/; revision=782505
parent 32baca86
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
<Separator/> <Separator/>
<Action name="speak_document"/> <Action name="speak_document"/>
<Action name="speak_current_page"/> <Action name="speak_current_page"/>
<Action name="speak_stop_all"/>
</Menu> </Menu>
<Menu name="settings"><text>&amp;Settings</text> <Menu name="settings"><text>&amp;Settings</text>
<Action name="show_leftpanel" group="show_merge"/> <Action name="show_leftpanel" group="show_merge"/>
......
...@@ -150,6 +150,7 @@ public: ...@@ -150,6 +150,7 @@ public:
KToggleAction * aViewContinuous; KToggleAction * aViewContinuous;
QAction * aPrevAction; QAction * aPrevAction;
KAction * aToggleForms; KAction * aToggleForms;
KAction * aSpeakStop;
KActionCollection * actionCollection; KActionCollection * actionCollection;
int setting_viewMode; int setting_viewMode;
...@@ -179,6 +180,11 @@ OkularTTS* PageViewPrivate::tts() ...@@ -179,6 +180,11 @@ OkularTTS* PageViewPrivate::tts()
if ( !m_tts ) if ( !m_tts )
{ {
m_tts = new OkularTTS( messageWindow, q ); m_tts = new OkularTTS( messageWindow, q );
if ( aSpeakStop )
{
QObject::connect( m_tts, SIGNAL( hasSpeechs( bool ) ),
aSpeakStop, SLOT( setEnabled( bool ) ) );
}
} }
return m_tts; return m_tts;
...@@ -320,6 +326,7 @@ PageView::PageView( QWidget *parent, Okular::Document *document ) ...@@ -320,6 +326,7 @@ PageView::PageView( QWidget *parent, Okular::Document *document )
d->aViewContinuous = 0; d->aViewContinuous = 0;
d->aPrevAction = 0; d->aPrevAction = 0;
d->aToggleForms = 0; d->aToggleForms = 0;
d->aSpeakStop = 0;
d->actionCollection = 0; d->actionCollection = 0;
d->aPageSizes=0; d->aPageSizes=0;
d->setting_viewMode = Okular::Settings::viewMode(); d->setting_viewMode = Okular::Settings::viewMode();
...@@ -506,6 +513,11 @@ void PageView::setupActions( KActionCollection * ac ) ...@@ -506,6 +513,11 @@ void PageView::setupActions( KActionCollection * ac )
speakPage->setEnabled( hasTTS ); speakPage->setEnabled( hasTTS );
connect( speakPage, SIGNAL( triggered() ), SLOT( slotSpeakCurrentPage() ) ); connect( speakPage, SIGNAL( triggered() ), SLOT( slotSpeakCurrentPage() ) );
d->aSpeakStop = new KAction( KIcon( "media-playback-stop" ), i18n( "Stop Speaking" ), this );
ac->addAction( "speak_stop_all", d->aSpeakStop );
d->aSpeakStop->setEnabled( false );
connect( d->aSpeakStop, SIGNAL( triggered() ), SLOT( slotStopSpeaks() ) );
// Other actions // Other actions
KAction * su = new KAction(i18n("Scroll Up"), this); KAction * su = new KAction(i18n("Scroll Up"), this);
ac->addAction("view_scroll_up", su ); ac->addAction("view_scroll_up", su );
...@@ -3164,6 +3176,14 @@ void PageView::slotSpeakCurrentPage() ...@@ -3164,6 +3176,14 @@ void PageView::slotSpeakCurrentPage()
d->tts()->say( text ); d->tts()->say( text );
} }
void PageView::slotStopSpeaks()
{
if ( !d->m_tts )
return;
d->m_tts->stopAllSpeechs();
}
//END private SLOTS //END private SLOTS
#include "pageview.moc" #include "pageview.moc"
...@@ -198,6 +198,7 @@ Q_OBJECT ...@@ -198,6 +198,7 @@ Q_OBJECT
void slotFormWidgetChanged( FormWidgetIface *w ); void slotFormWidgetChanged( FormWidgetIface *w );
void slotSpeakDocument(); void slotSpeakDocument();
void slotSpeakCurrentPage(); void slotSpeakCurrentPage();
void slotStopSpeaks();
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment