Changeset View
Changeset View
Standalone View
Standalone View
ui/pageview.cpp
Show First 20 Lines • Show All 235 Lines • ▼ Show 20 Line(s) | 198 | #endif | |||
---|---|---|---|---|---|
236 | KToggleAction * aZoomAutoFit; | 236 | KToggleAction * aZoomAutoFit; | ||
237 | KActionMenu * aViewMode; | 237 | KActionMenu * aViewMode; | ||
238 | KToggleAction * aViewContinuous; | 238 | KToggleAction * aViewContinuous; | ||
239 | QAction * aPrevAction; | 239 | QAction * aPrevAction; | ||
240 | QAction * aToggleForms; | 240 | QAction * aToggleForms; | ||
241 | QAction * aSpeakDoc; | 241 | QAction * aSpeakDoc; | ||
242 | QAction * aSpeakPage; | 242 | QAction * aSpeakPage; | ||
243 | QAction * aSpeakStop; | 243 | QAction * aSpeakStop; | ||
244 | QAction * aSpeakPauseResume; | ||||
244 | KActionCollection * actionCollection; | 245 | KActionCollection * actionCollection; | ||
245 | QActionGroup * mouseModeActionGroup; | 246 | QActionGroup * mouseModeActionGroup; | ||
246 | QAction * aFitWindowToPage; | 247 | QAction * aFitWindowToPage; | ||
247 | 248 | | |||
248 | int setting_viewCols; | 249 | int setting_viewCols; | ||
249 | bool rtl_Mode; | 250 | bool rtl_Mode; | ||
250 | // Keep track of whether tablet pen is currently pressed down | 251 | // Keep track of whether tablet pen is currently pressed down | ||
251 | bool penDown; | 252 | bool penDown; | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
295 | #ifdef HAVE_SPEECH | 296 | #ifdef HAVE_SPEECH | ||
296 | OkularTTS* PageViewPrivate::tts() | 297 | OkularTTS* PageViewPrivate::tts() | ||
297 | { | 298 | { | ||
298 | if ( !m_tts ) | 299 | if ( !m_tts ) | ||
299 | { | 300 | { | ||
300 | m_tts = new OkularTTS( q ); | 301 | m_tts = new OkularTTS( q ); | ||
301 | if ( aSpeakStop ) | 302 | if ( aSpeakStop ) | ||
302 | { | 303 | { | ||
303 | QObject::connect( m_tts, &OkularTTS::isSpeaking, | 304 | QObject::connect( m_tts, &OkularTTS::canPauseOrResume, | ||
304 | aSpeakStop, &QAction::setEnabled ); | 305 | aSpeakStop, &QAction::setEnabled ); | ||
305 | } | 306 | } | ||
307 | | ||||
308 | if ( aSpeakPauseResume ) | ||||
309 | { | ||||
310 | QObject::connect( m_tts, &OkularTTS::canPauseOrResume, | ||||
311 | aSpeakPauseResume, &QAction::setEnabled ); | ||||
312 | } | ||||
306 | } | 313 | } | ||
307 | 314 | | |||
308 | return m_tts; | 315 | return m_tts; | ||
309 | } | 316 | } | ||
310 | #endif | 317 | #endif | ||
311 | 318 | | |||
312 | 319 | | |||
313 | /* PageView. What's in this file? -> quick overview. | 320 | /* PageView. What's in this file? -> quick overview. | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 366 | #endif | |||
374 | d->aZoomAutoFit = nullptr; | 381 | d->aZoomAutoFit = nullptr; | ||
375 | d->aViewMode = nullptr; | 382 | d->aViewMode = nullptr; | ||
376 | d->aViewContinuous = nullptr; | 383 | d->aViewContinuous = nullptr; | ||
377 | d->aPrevAction = nullptr; | 384 | d->aPrevAction = nullptr; | ||
378 | d->aToggleForms = nullptr; | 385 | d->aToggleForms = nullptr; | ||
379 | d->aSpeakDoc = nullptr; | 386 | d->aSpeakDoc = nullptr; | ||
380 | d->aSpeakPage = nullptr; | 387 | d->aSpeakPage = nullptr; | ||
381 | d->aSpeakStop = nullptr; | 388 | d->aSpeakStop = nullptr; | ||
389 | d->aSpeakPauseResume = nullptr; | ||||
382 | d->actionCollection = nullptr; | 390 | d->actionCollection = nullptr; | ||
383 | d->aPageSizes=nullptr; | 391 | d->aPageSizes=nullptr; | ||
384 | d->setting_viewCols = Okular::Settings::viewColumns(); | 392 | d->setting_viewCols = Okular::Settings::viewColumns(); | ||
385 | d->rtl_Mode = Okular::Settings::rtlReadingDirection(); | 393 | d->rtl_Mode = Okular::Settings::rtlReadingDirection(); | ||
386 | d->mouseModeActionGroup = nullptr; | 394 | d->mouseModeActionGroup = nullptr; | ||
387 | d->penDown = false; | 395 | d->penDown = false; | ||
388 | d->aMouseMagnifier = nullptr; | 396 | d->aMouseMagnifier = nullptr; | ||
389 | d->aFitWindowToPage = nullptr; | 397 | d->aFitWindowToPage = nullptr; | ||
▲ Show 20 Lines • Show All 310 Lines • ▼ Show 20 Line(s) | 701 | #ifdef HAVE_SPEECH | |||
700 | ac->addAction( QStringLiteral("speak_current_page"), d->aSpeakPage ); | 708 | ac->addAction( QStringLiteral("speak_current_page"), d->aSpeakPage ); | ||
701 | d->aSpeakPage->setEnabled( false ); | 709 | d->aSpeakPage->setEnabled( false ); | ||
702 | connect( d->aSpeakPage, &QAction::triggered, this, &PageView::slotSpeakCurrentPage ); | 710 | connect( d->aSpeakPage, &QAction::triggered, this, &PageView::slotSpeakCurrentPage ); | ||
703 | 711 | | |||
704 | d->aSpeakStop = new QAction( QIcon::fromTheme( QStringLiteral("media-playback-stop") ), i18n( "Stop Speaking" ), this ); | 712 | d->aSpeakStop = new QAction( QIcon::fromTheme( QStringLiteral("media-playback-stop") ), i18n( "Stop Speaking" ), this ); | ||
705 | ac->addAction( QStringLiteral("speak_stop_all"), d->aSpeakStop ); | 713 | ac->addAction( QStringLiteral("speak_stop_all"), d->aSpeakStop ); | ||
706 | d->aSpeakStop->setEnabled( false ); | 714 | d->aSpeakStop->setEnabled( false ); | ||
707 | connect( d->aSpeakStop, &QAction::triggered, this, &PageView::slotStopSpeaks ); | 715 | connect( d->aSpeakStop, &QAction::triggered, this, &PageView::slotStopSpeaks ); | ||
716 | | ||||
717 | d->aSpeakPauseResume = new QAction( QIcon::fromTheme( QStringLiteral("media-playback-pause") ), i18n( "Pause/Resume Speaking" ), this ); | ||||
718 | ac->addAction( QStringLiteral("speak_pause_resume"), d->aSpeakPauseResume ); | ||||
719 | d->aSpeakPauseResume->setEnabled( false ); | ||||
720 | connect( d->aSpeakPauseResume, &QAction::triggered, this, &PageView::slotPauseResumeSpeech ); | ||||
708 | #else | 721 | #else | ||
709 | d->aSpeakDoc = 0; | 722 | d->aSpeakDoc = 0; | ||
710 | d->aSpeakPage = 0; | 723 | d->aSpeakPage = 0; | ||
711 | d->aSpeakStop = 0; | 724 | d->aSpeakStop = 0; | ||
725 | d->aSpeakPauseResume = 0; | ||||
712 | #endif | 726 | #endif | ||
713 | 727 | | |||
714 | // Other actions | 728 | // Other actions | ||
715 | QAction * su = new QAction(i18n("Scroll Up"), this); | 729 | QAction * su = new QAction(i18n("Scroll Up"), this); | ||
716 | ac->addAction(QStringLiteral("view_scroll_up"), su ); | 730 | ac->addAction(QStringLiteral("view_scroll_up"), su ); | ||
717 | connect( su, &QAction::triggered, this, &PageView::slotAutoScrollUp ); | 731 | connect( su, &QAction::triggered, this, &PageView::slotAutoScrollUp ); | ||
718 | ac->setDefaultShortcut(su, QKeySequence(Qt::SHIFT + Qt::Key_Up)); | 732 | ac->setDefaultShortcut(su, QKeySequence(Qt::SHIFT + Qt::Key_Up)); | ||
719 | addAction(su); | 733 | addAction(su); | ||
▲ Show 20 Lines • Show All 1885 Lines • ▼ Show 20 Line(s) | 2617 | #if 0 | |||
2605 | { | 2619 | { | ||
2606 | // a link can move us to another page or even to another document, there's no point in trying to | 2620 | // a link can move us to another page or even to another document, there's no point in trying to | ||
2607 | // process the click on the image once we have processes the click on the link | 2621 | // process the click on the image once we have processes the click on the link | ||
2608 | rect = pageItem->page()->objectRect( Okular::ObjectRect::Image, nX, nY, pageItem->width(), pageItem->height() ); | 2622 | rect = pageItem->page()->objectRect( Okular::ObjectRect::Image, nX, nY, pageItem->width(), pageItem->height() ); | ||
2609 | if ( rect ) | 2623 | if ( rect ) | ||
2610 | { | 2624 | { | ||
2611 | // handle click over a image | 2625 | // handle click over a image | ||
2612 | } | 2626 | } | ||
2613 | /* Enrico and me have decided this is not worth the trouble it generates | 2627 | /* Enrico and me have decided this is not worth the trouble it generates | ||
sander: Please avoid this whitespace change. | |||||
2614 | else | 2628 | else | ||
2615 | { | 2629 | { | ||
2616 | // if not on a rect, the click selects the page | 2630 | // if not on a rect, the click selects the page | ||
2617 | // if ( pageItem->pageNumber() != (int)d->document->currentPage() ) | 2631 | // if ( pageItem->pageNumber() != (int)d->document->currentPage() ) | ||
2618 | d->document->setViewportPage( pageItem->pageNumber(), this ); | 2632 | d->document->setViewportPage( pageItem->pageNumber(), this ); | ||
2619 | }*/ | 2633 | }*/ | ||
2620 | } | 2634 | } | ||
2621 | #endif | 2635 | #endif | ||
▲ Show 20 Lines • Show All 2865 Lines • ▼ Show 20 Line(s) | |||||
5487 | 5501 | | |||
5488 | void PageView::slotStopSpeaks() | 5502 | void PageView::slotStopSpeaks() | ||
5489 | { | 5503 | { | ||
5490 | if ( !d->m_tts ) | 5504 | if ( !d->m_tts ) | ||
5491 | return; | 5505 | return; | ||
5492 | 5506 | | |||
5493 | d->m_tts->stopAllSpeechs(); | 5507 | d->m_tts->stopAllSpeechs(); | ||
5494 | } | 5508 | } | ||
5509 | | ||||
5510 | void PageView::slotPauseResumeSpeech() | ||||
5511 | { | ||||
5512 | if ( !d->m_tts ) | ||||
5513 | return; | ||||
5514 | | ||||
5515 | d->m_tts->pauseResumeSpeech(); | ||||
5516 | } | ||||
5517 | | ||||
5495 | #endif | 5518 | #endif | ||
5496 | 5519 | | |||
5497 | void PageView::slotAction( Okular::Action *action ) | 5520 | void PageView::slotAction( Okular::Action *action ) | ||
5498 | { | 5521 | { | ||
5499 | d->document->processAction( action ); | 5522 | d->document->processAction( action ); | ||
5500 | } | 5523 | } | ||
5501 | 5524 | | |||
5502 | void PageView::externalKeyPressEvent( QKeyEvent *e ) | 5525 | void PageView::externalKeyPressEvent( QKeyEvent *e ) | ||
▲ Show 20 Lines • Show All 161 Lines • Show Last 20 Lines |
Please avoid this whitespace change.