mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Cover browser: Add an option to view the central book by double clicking instead of single clicking (Preferences->Look & feel->Cover browser). Fixes #1937025 [[Enhancement] Single-clicking open book in Cover browser](https://bugs.launchpad.net/calibre/+bug/1937025)
This commit is contained in:
parent
163a4ce54a
commit
0952aed8f6
@ -175,6 +175,7 @@ def create_defs():
|
||||
defs['show_highlight_toggle_button'] = False
|
||||
defs['add_comments_to_email'] = False
|
||||
defs['cb_preserve_aspect_ratio'] = False
|
||||
defs['cb_double_click_to_activate'] = False
|
||||
defs['gpm_template_editor_font_size'] = 10
|
||||
defs['show_emblems'] = False
|
||||
defs['emblem_size'] = 32
|
||||
|
@ -193,6 +193,8 @@ class CoverFlow(pictureflow.PictureFlow):
|
||||
self.setPreserveAspectRatio(gprefs['cb_preserve_aspect_ratio'])
|
||||
if not gprefs['cover_browser_reflections']:
|
||||
self.setShowReflections(False)
|
||||
if gprefs['cb_double_click_to_activate']:
|
||||
self.setActivateOnDoubleClick(True)
|
||||
|
||||
def one_auto_scroll(self):
|
||||
if self.currentSlide() >= self.count() - 1:
|
||||
|
@ -371,6 +371,7 @@ public:
|
||||
int pixelDistanceMoved;
|
||||
int pixelsToMovePerSlide;
|
||||
bool preserveAspectRatio;
|
||||
bool activateOnDoubleClick;
|
||||
QFont subtitleFont;
|
||||
|
||||
void setImages(FlowImages *images);
|
||||
@ -426,6 +427,7 @@ PictureFlowPrivate::PictureFlowPrivate(PictureFlow* w, int queueLength_)
|
||||
fontSize = 10;
|
||||
doReflections = true;
|
||||
preserveAspectRatio = false;
|
||||
activateOnDoubleClick = false;
|
||||
|
||||
centerIndex = 0;
|
||||
queueLength = queueLength_;
|
||||
@ -1246,6 +1248,16 @@ void PictureFlow::setPreserveAspectRatio(bool preserve)
|
||||
clearCaches();
|
||||
}
|
||||
|
||||
bool PictureFlow::activateOnDoubleClick() const
|
||||
{
|
||||
return d->activateOnDoubleClick;
|
||||
}
|
||||
|
||||
void PictureFlow::setActivateOnDoubleClick(bool on)
|
||||
{
|
||||
d->activateOnDoubleClick = on;
|
||||
}
|
||||
|
||||
void PictureFlow::setSubtitleFont(QFont font)
|
||||
{
|
||||
d->subtitleFont = font;
|
||||
@ -1468,7 +1480,7 @@ void PictureFlow::mouseReleaseEvent(QMouseEvent* event)
|
||||
showNext();
|
||||
accepted = true;
|
||||
} else {
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
if (event->button() == Qt::LeftButton && !d->activateOnDoubleClick) {
|
||||
emit itemActivated(d->getTarget());
|
||||
accepted = true;
|
||||
}
|
||||
@ -1480,6 +1492,17 @@ void PictureFlow::mouseReleaseEvent(QMouseEvent* event)
|
||||
}
|
||||
}
|
||||
|
||||
void PictureFlow::mouseDoubleClickEvent(QMouseEvent* event) {
|
||||
if (event->button() == Qt::LeftButton && d->activateOnDoubleClick) {
|
||||
int sideWidth = (d->buffer.width() - slideSize().width()) /2;
|
||||
int x = (int)(event->x() * device_pixel_ratio());
|
||||
if (sideWidth < x && x < sideWidth + slideSize().width() ) {
|
||||
emit itemActivated(d->getTarget());
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PictureFlow::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
@ -94,6 +94,7 @@ Q_OBJECT
|
||||
Q_PROPERTY(QSize slideSize READ slideSize WRITE setSlideSize)
|
||||
Q_PROPERTY(QFont subtitleFont READ subtitleFont WRITE setSubtitleFont)
|
||||
Q_PROPERTY(bool preserveAspectRatio READ preserveAspectRatio WRITE setPreserveAspectRatio)
|
||||
Q_PROPERTY(bool activateOnDoubleClick READ activateOnDoubleClick WRITE setActivateOnDoubleClick)
|
||||
|
||||
public:
|
||||
/*!
|
||||
@ -168,6 +169,9 @@ public:
|
||||
*/
|
||||
int currentSlide() const;
|
||||
|
||||
bool activateOnDoubleClick() const;
|
||||
void setActivateOnDoubleClick(bool on);
|
||||
|
||||
public slots:
|
||||
|
||||
/*!
|
||||
@ -215,6 +219,7 @@ protected:
|
||||
void mouseMoveEvent(QMouseEvent* event);
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void mouseReleaseEvent(QMouseEvent* event);
|
||||
void mouseDoubleClickEvent(QMouseEvent* event);
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
void timerEvent(QTimerEvent* event);
|
||||
|
||||
|
@ -41,6 +41,9 @@ public :
|
||||
|
||||
void setSlideSize(QSize size);
|
||||
|
||||
bool activateOnDoubleClick() const;
|
||||
void setActivateOnDoubleClick(bool on);
|
||||
|
||||
bool preserveAspectRatio() const;
|
||||
|
||||
void setPreserveAspectRatio(bool preserve);
|
||||
|
@ -481,6 +481,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
r('separate_cover_flow', config, restart_required=True)
|
||||
r('cb_fullscreen', gprefs)
|
||||
r('cb_preserve_aspect_ratio', gprefs)
|
||||
r('cb_double_click_to_activate', gprefs)
|
||||
|
||||
choices = [(_('Off'), 'off'), (_('Small'), 'small'),
|
||||
(_('Medium'), 'medium'), (_('Large'), 'large')]
|
||||
@ -806,6 +807,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
gui.library_view.set_row_header_visibility()
|
||||
gui.cover_flow.setShowReflections(gprefs['cover_browser_reflections'])
|
||||
gui.cover_flow.setPreserveAspectRatio(gprefs['cb_preserve_aspect_ratio'])
|
||||
gui.cover_flow.setActivateOnDoubleClick(gprefs['cb_double_click_to_activate'])
|
||||
gui.update_cover_flow_subtitle_font()
|
||||
gui.cover_flow.template_inited = False
|
||||
for view in 'library memory card_a card_b'.split():
|
||||
|
@ -1185,7 +1185,7 @@ using the mouse.</p></string>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>690</width>
|
||||
<height>283</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@ -1277,6 +1277,13 @@ them to all have the same width and height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="opt_cb_double_click_to_activate">
|
||||
<property name="text">
|
||||
<string>&Double click to view the central book, instead of single click</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="quickview_tab">
|
||||
|
Loading…
x
Reference in New Issue
Block a user