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'))
|
help=_('Save the current position in the document, when quitting'))
|
||||||
c.add_opt('wheel_flips_pages', default=False,
|
c.add_opt('wheel_flips_pages', default=False,
|
||||||
help=_('Have the mouse wheel turn pages'))
|
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,
|
c.add_opt('line_scrolling_stops_on_pagebreaks', default=False,
|
||||||
help=_('Prevent the up and down arrow keys from scrolling past '
|
help=_('Prevent the up and down arrow keys from scrolling past '
|
||||||
'page breaks'))
|
'page breaks'))
|
||||||
@ -280,6 +282,7 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
|||||||
self.opt_remember_window_size.setChecked(opts.remember_window_size)
|
self.opt_remember_window_size.setChecked(opts.remember_window_size)
|
||||||
self.opt_remember_current_page.setChecked(opts.remember_current_page)
|
self.opt_remember_current_page.setChecked(opts.remember_current_page)
|
||||||
self.opt_wheel_flips_pages.setChecked(opts.wheel_flips_pages)
|
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)
|
self.opt_page_flip_duration.setValue(opts.page_flip_duration)
|
||||||
fms = opts.font_magnification_step
|
fms = opts.font_magnification_step
|
||||||
if fms < 0.01 or fms > 1:
|
if fms < 0.01 or fms > 1:
|
||||||
@ -381,6 +384,7 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
|||||||
c.set('hyphenate', self.hyphenate.isChecked())
|
c.set('hyphenate', self.hyphenate.isChecked())
|
||||||
c.set('remember_current_page', self.opt_remember_current_page.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('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('page_flip_duration', self.opt_page_flip_duration.value())
|
||||||
c.set('font_magnification_step',
|
c.set('font_magnification_step',
|
||||||
float(self.opt_font_mag_step.value())/100.)
|
float(self.opt_font_mag_step.value())/100.)
|
||||||
|
@ -60,15 +60,15 @@ QToolBox::tab:hover {
|
|||||||
}</string>
|
}</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>371</width>
|
<width>799</width>
|
||||||
<height>236</height>
|
<height>378</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
@ -370,8 +370,8 @@ QToolBox::tab:hover {
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>799</width>
|
<width>381</width>
|
||||||
<height>378</height>
|
<height>193</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
@ -551,8 +551,8 @@ QToolBox::tab:hover {
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>384</width>
|
<width>799</width>
|
||||||
<height>115</height>
|
<height>378</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
@ -594,27 +594,34 @@ QToolBox::tab:hover {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="2">
|
<item row="2" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="opt_wheel_flips_pages">
|
<widget class="QCheckBox" name="opt_wheel_flips_pages">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Mouse &wheel flips pages</string>
|
<string>Mouse &wheel flips pages</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<widget class="QCheckBox" name="opt_line_scrolling_stops_on_pagebreaks">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Line &scrolling stops at page breaks</string>
|
<string>Line &scrolling stops at page breaks</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="4" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="opt_fit_images">
|
<widget class="QCheckBox" name="opt_fit_images">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Resize images larger than the viewer window (needs restart)</string>
|
<string>&Resize images larger than the viewer window (needs restart)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_4">
|
<widget class="QWidget" name="page_4">
|
||||||
|
@ -157,6 +157,7 @@ class Document(QWebPage): # {{{
|
|||||||
self.enable_page_flip = self.page_flip_duration > 0.1
|
self.enable_page_flip = self.page_flip_duration > 0.1
|
||||||
self.font_magnification_step = opts.font_magnification_step
|
self.font_magnification_step = opts.font_magnification_step
|
||||||
self.wheel_flips_pages = opts.wheel_flips_pages
|
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
|
self.line_scrolling_stops_on_pagebreaks = opts.line_scrolling_stops_on_pagebreaks
|
||||||
screen_width = QApplication.desktop().screenGeometry().width()
|
screen_width = QApplication.desktop().screenGeometry().width()
|
||||||
# Leave some space for the scrollbar and some border
|
# Leave some space for the scrollbar and some border
|
||||||
|
@ -322,9 +322,10 @@ class GestureHandler(QObject):
|
|||||||
mf = view.document.mainFrame()
|
mf = view.document.mainFrame()
|
||||||
r = mf.hitTestContent(self.current_position(tp))
|
r = mf.hitTestContent(self.current_position(tp))
|
||||||
if r.linkElement().isNull():
|
if r.linkElement().isNull():
|
||||||
threshold = view.width() / 3.0
|
if view.document.tap_flips_pages:
|
||||||
attr = 'previous' if self.current_position(tp).x() <= threshold else 'next'
|
threshold = view.width() / 3.0
|
||||||
getattr(view, '%s_page'%attr)()
|
attr = 'previous' if self.current_position(tp).x() <= threshold else 'next'
|
||||||
|
getattr(view, '%s_page'%attr)()
|
||||||
else:
|
else:
|
||||||
for etype in (QEvent.MouseButtonPress, QEvent.MouseButtonRelease):
|
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)
|
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