Changeset View
Changeset View
Standalone View
Standalone View
ui/presentationwidget.cpp
Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Line(s) | 147 | PresentationWidget::PresentationWidget( QWidget * parent, Okular::Document * doc, DrawingToolActions * drawingToolActions, KActionCollection * collection ) | |||
---|---|---|---|---|---|
148 | : QWidget( nullptr /* must be null, to have an independent widget */, Qt::FramelessWindowHint ), | 148 | : QWidget( nullptr /* must be null, to have an independent widget */, Qt::FramelessWindowHint ), | ||
149 | m_pressedLink( nullptr ), m_handCursor( false ), m_drawingEngine( nullptr ), | 149 | m_pressedLink( nullptr ), m_handCursor( false ), m_drawingEngine( nullptr ), | ||
150 | m_screenInhibitCookie(0), m_sleepInhibitFd(-1), | 150 | m_screenInhibitCookie(0), m_sleepInhibitFd(-1), | ||
151 | m_parentWidget( parent ), | 151 | m_parentWidget( parent ), | ||
152 | m_document( doc ), m_frameIndex( -1 ), m_topBar( nullptr ), m_pagesEdit( nullptr ), m_searchBar( nullptr ), | 152 | m_document( doc ), m_frameIndex( -1 ), m_topBar( nullptr ), m_pagesEdit( nullptr ), m_searchBar( nullptr ), | ||
153 | m_ac( collection ), m_screenSelect( nullptr ), m_isSetup( false ), m_blockNotifications( false ), m_inBlackScreenMode( false ), | 153 | m_ac( collection ), m_screenSelect( nullptr ), m_isSetup( false ), m_blockNotifications( false ), m_inBlackScreenMode( false ), | ||
154 | m_showSummaryView( Okular::Settings::slidesShowSummary() ), | 154 | m_showSummaryView( Okular::Settings::slidesShowSummary() ), | ||
155 | m_advanceSlides( Okular::SettingsCore::slidesAdvance() ), | 155 | m_advanceSlides( Okular::SettingsCore::slidesAdvance() ), | ||
156 | m_goToPreviousPageOnRelease( false ), | ||||
156 | m_goToNextPageOnRelease( false ) | 157 | m_goToNextPageOnRelease( false ) | ||
157 | { | 158 | { | ||
158 | Q_UNUSED( parent ) | 159 | Q_UNUSED( parent ) | ||
159 | setAttribute( Qt::WA_DeleteOnClose ); | 160 | setAttribute( Qt::WA_DeleteOnClose ); | ||
160 | setAttribute( Qt::WA_OpaquePaintEvent ); | 161 | setAttribute( Qt::WA_OpaquePaintEvent ); | ||
161 | setObjectName( QStringLiteral( "presentationWidget" ) ); | 162 | setObjectName( QStringLiteral( "presentationWidget" ) ); | ||
162 | QString caption = doc->metaData( QStringLiteral("DocumentTitle") ).toString(); | 163 | QString caption = doc->metaData( QStringLiteral("DocumentTitle") ).toString(); | ||
163 | if ( caption.trimmed().isEmpty() ) | 164 | if ( caption.trimmed().isEmpty() ) | ||
▲ Show 20 Lines • Show All 538 Lines • ▼ Show 20 Line(s) | 670 | { | |||
702 | // handle clicking on top-right overlay | 703 | // handle clicking on top-right overlay | ||
703 | if ( !( Okular::Settings::slidesCursor() == Okular::Settings::EnumSlidesCursor::Hidden ) && | 704 | if ( !( Okular::Settings::slidesCursor() == Okular::Settings::EnumSlidesCursor::Hidden ) && | ||
704 | m_overlayGeometry.contains( e->pos() ) ) | 705 | m_overlayGeometry.contains( e->pos() ) ) | ||
705 | { | 706 | { | ||
706 | overlayClick( e->pos() ); | 707 | overlayClick( e->pos() ); | ||
707 | return; | 708 | return; | ||
708 | } | 709 | } | ||
709 | 710 | | |||
711 | // Actual mouse press events always lead to the next page page | ||||
712 | if ( e->source() == Qt::MouseEventNotSynthesized ) | ||||
713 | { | ||||
714 | m_goToNextPageOnRelease = true; | ||||
715 | } | ||||
716 | // Touch events may lead to the previous or next page | ||||
aacid: this comment needs updating i guess. | |||||
717 | else if ( Okular::Settings::slidesTapNavigation() != Okular::Settings::EnumSlidesTapNavigation::Disabled ) | ||||
718 | { | ||||
719 | switch ( Okular::Settings::slidesTapNavigation() ) | ||||
720 | { | ||||
721 | case Okular::Settings::EnumSlidesTapNavigation::ForwardBackward: | ||||
722 | { | ||||
723 | if ( e->x() < ( geometry().width()/2 ) ) | ||||
724 | { | ||||
725 | m_goToPreviousPageOnRelease = true; | ||||
726 | } | ||||
727 | else | ||||
728 | { | ||||
729 | m_goToNextPageOnRelease = true; | ||||
730 | } | ||||
731 | break; | ||||
732 | } | ||||
733 | case Okular::Settings::EnumSlidesTapNavigation::Forward: | ||||
734 | { | ||||
710 | m_goToNextPageOnRelease = true; | 735 | m_goToNextPageOnRelease = true; | ||
736 | break; | ||||
737 | } | ||||
738 | case Okular::Settings::EnumSlidesTapNavigation::Disabled: | ||||
739 | { | ||||
740 | // Do Nothing | ||||
741 | } | ||||
742 | } | ||||
743 | } | ||||
711 | } | 744 | } | ||
712 | // pressing the "move forward" mouse button: unlike the left button this | 745 | // pressing the "move forward" mouse button: unlike the left button this | ||
713 | // always means "show next page", so we unconditionally delegate to that | 746 | // always means "show next page", so we unconditionally delegate to that | ||
714 | // action on mouse button press | 747 | // action on mouse button press | ||
715 | else if ( e->button() == Qt::ForwardButton ) { | 748 | else if ( e->button() == Qt::ForwardButton ) { | ||
716 | slotNextPage(); | 749 | slotNextPage(); | ||
717 | } | 750 | } | ||
718 | // pressing right or backward button | 751 | // pressing right or backward button | ||
Show All 13 Lines | 757 | { | |||
732 | if ( m_pressedLink && e->button() == Qt::LeftButton ) | 765 | if ( m_pressedLink && e->button() == Qt::LeftButton ) | ||
733 | { | 766 | { | ||
734 | const Okular::Action * link = getLink( e->x(), e->y() ); | 767 | const Okular::Action * link = getLink( e->x(), e->y() ); | ||
735 | if ( link == m_pressedLink ) | 768 | if ( link == m_pressedLink ) | ||
736 | m_document->processAction( link ); | 769 | m_document->processAction( link ); | ||
737 | m_pressedLink = nullptr; | 770 | m_pressedLink = nullptr; | ||
738 | } | 771 | } | ||
739 | 772 | | |||
773 | if ( m_goToPreviousPageOnRelease ) { | ||||
774 | slotPrevPage(); | ||||
775 | m_goToPreviousPageOnRelease = false; | ||||
776 | } | ||||
777 | | ||||
740 | if ( m_goToNextPageOnRelease ) { | 778 | if ( m_goToNextPageOnRelease ) { | ||
741 | slotNextPage(); | 779 | slotNextPage(); | ||
742 | m_goToNextPageOnRelease = false; | 780 | m_goToNextPageOnRelease = false; | ||
743 | } | 781 | } | ||
744 | } | 782 | } | ||
745 | 783 | | |||
746 | void PresentationWidget::mouseMoveEvent( QMouseEvent * e ) | 784 | void PresentationWidget::mouseMoveEvent( QMouseEvent * e ) | ||
747 | { | 785 | { | ||
▲ Show 20 Lines • Show All 1716 Lines • Show Last 20 Lines |
this comment needs updating i guess.