mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Add an option to prevent tapping on the page from turning pages.
This commit is contained in:
parent
09c29e476a
commit
53cb56200d
@ -51,6 +51,8 @@ def config(defaults=None):
|
||||
help=_('Save the current position in the document, when quitting'))
|
||||
c.add_opt('wheel_flips_pages', default=False,
|
||||
help=_('Have the mouse wheel turn pages'))
|
||||
c.add_opt('tap_flips_pages', default=True,
|
||||
help=_('Tapping on the screen turns pages'))
|
||||
c.add_opt('line_scrolling_stops_on_pagebreaks', default=False,
|
||||
help=_('Prevent the up and down arrow keys from scrolling past '
|
||||
'page breaks'))
|
||||
@ -280,6 +282,7 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
||||
self.opt_remember_window_size.setChecked(opts.remember_window_size)
|
||||
self.opt_remember_current_page.setChecked(opts.remember_current_page)
|
||||
self.opt_wheel_flips_pages.setChecked(opts.wheel_flips_pages)
|
||||
self.opt_tap_flips_pages.setChecked(opts.tap_flips_pages)
|
||||
self.opt_page_flip_duration.setValue(opts.page_flip_duration)
|
||||
fms = opts.font_magnification_step
|
||||
if fms < 0.01 or fms > 1:
|
||||
@ -381,6 +384,7 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
||||
c.set('hyphenate', self.hyphenate.isChecked())
|
||||
c.set('remember_current_page', self.opt_remember_current_page.isChecked())
|
||||
c.set('wheel_flips_pages', self.opt_wheel_flips_pages.isChecked())
|
||||
c.set('tap_flips_pages', self.opt_tap_flips_pages.isChecked())
|
||||
c.set('page_flip_duration', self.opt_page_flip_duration.value())
|
||||
c.set('font_magnification_step',
|
||||
float(self.opt_font_mag_step.value())/100.)
|
||||
|
@ -60,15 +60,15 @@ QToolBox::tab:hover {
|
||||
}</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>371</width>
|
||||
<height>236</height>
|
||||
<width>799</width>
|
||||
<height>378</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -370,8 +370,8 @@ QToolBox::tab:hover {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>799</width>
|
||||
<height>378</height>
|
||||
<width>381</width>
|
||||
<height>193</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -551,8 +551,8 @@ QToolBox::tab:hover {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>384</width>
|
||||
<height>115</height>
|
||||
<width>799</width>
|
||||
<height>378</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -594,27 +594,34 @@ QToolBox::tab:hover {
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="opt_wheel_flips_pages">
|
||||
<property name="text">
|
||||
<string>Mouse &wheel flips pages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="opt_line_scrolling_stops_on_pagebreaks">
|
||||
<property name="text">
|
||||
<string>Line &scrolling stops at page breaks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="opt_fit_images">
|
||||
<property name="text">
|
||||
<string>&Resize images larger than the viewer window (needs restart)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="opt_tap_flips_pages">
|
||||
<property name="text">
|
||||
<string>&Tapping on the page flips pages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_4">
|
||||
|
@ -157,6 +157,7 @@ class Document(QWebPage): # {{{
|
||||
self.enable_page_flip = self.page_flip_duration > 0.1
|
||||
self.font_magnification_step = opts.font_magnification_step
|
||||
self.wheel_flips_pages = opts.wheel_flips_pages
|
||||
self.tap_flips_pages = opts.tap_flips_pages
|
||||
self.line_scrolling_stops_on_pagebreaks = opts.line_scrolling_stops_on_pagebreaks
|
||||
screen_width = QApplication.desktop().screenGeometry().width()
|
||||
# Leave some space for the scrollbar and some border
|
||||
|
@ -322,9 +322,10 @@ class GestureHandler(QObject):
|
||||
mf = view.document.mainFrame()
|
||||
r = mf.hitTestContent(self.current_position(tp))
|
||||
if r.linkElement().isNull():
|
||||
threshold = view.width() / 3.0
|
||||
attr = 'previous' if self.current_position(tp).x() <= threshold else 'next'
|
||||
getattr(view, '%s_page'%attr)()
|
||||
if view.document.tap_flips_pages:
|
||||
threshold = view.width() / 3.0
|
||||
attr = 'previous' if self.current_position(tp).x() <= threshold else 'next'
|
||||
getattr(view, '%s_page'%attr)()
|
||||
else:
|
||||
for etype in (QEvent.MouseButtonPress, QEvent.MouseButtonRelease):
|
||||
ev = QMouseEvent(etype, self.current_position(tp), tp.current_screen_position.toPoint(), Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
|
||||
|
Loading…
x
Reference in New Issue
Block a user