mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add an option to Preferences->Look and Feel->Cover Browser to show the cover browser full screen. Fixes #829855 ([Enhancements] in cover browser)
This commit is contained in:
parent
ec32d0f3f1
commit
2c33b9b409
@ -98,6 +98,7 @@ gprefs.defaults['book_display_fields'] = [
|
||||
]
|
||||
gprefs.defaults['default_author_link'] = 'http://en.wikipedia.org/w/index.php?search={author}'
|
||||
gprefs.defaults['preserve_date_on_ctl'] = True
|
||||
gprefs.defaults['cb_fullscreen'] = False
|
||||
|
||||
# }}}
|
||||
|
||||
|
@ -9,8 +9,8 @@ Module to implement the Cover Flow feature
|
||||
|
||||
import sys, os, time
|
||||
|
||||
from PyQt4.Qt import (QImage, QSizePolicy, QTimer, QDialog, Qt, QSize,
|
||||
QStackedLayout, QLabel, QByteArray, pyqtSignal)
|
||||
from PyQt4.Qt import (QImage, QSizePolicy, QTimer, QDialog, Qt, QSize, QAction,
|
||||
QStackedLayout, QLabel, QByteArray, pyqtSignal, QKeySequence)
|
||||
|
||||
from calibre import plugins
|
||||
from calibre.gui2 import config, available_height, available_width, gprefs
|
||||
@ -150,12 +150,39 @@ class CBDialog(QDialog):
|
||||
if not self.restoreGeometry(geom):
|
||||
h, w = available_height()-60, int(available_width()/1.5)
|
||||
self.resize(w, h)
|
||||
self.action_fs_toggle = a = QAction(self)
|
||||
self.addAction(a)
|
||||
a.setShortcuts([QKeySequence('F11', QKeySequence.PortableText),
|
||||
QKeySequence('Ctrl+Shift+F', QKeySequence.PortableText)])
|
||||
a.triggered.connect(self.toggle_fullscreen)
|
||||
self.action_esc_fs = a = QAction(self)
|
||||
a.triggered.connect(self.show_normal)
|
||||
self.addAction(a)
|
||||
a.setShortcuts([QKeySequence('Esc', QKeySequence.PortableText)])
|
||||
|
||||
self.pre_fs_geom = None
|
||||
|
||||
def closeEvent(self, *args):
|
||||
geom = bytearray(self.saveGeometry())
|
||||
gprefs['cover_browser_dialog_geometry'] = geom
|
||||
if not self.isFullScreen():
|
||||
geom = bytearray(self.saveGeometry())
|
||||
gprefs['cover_browser_dialog_geometry'] = geom
|
||||
self.closed.emit()
|
||||
|
||||
def show_normal(self):
|
||||
self.showNormal()
|
||||
if self.pre_fs_geom is not None:
|
||||
self.restoreGeometry(self.pre_fs_geom)
|
||||
self.pre_fs_geom = None
|
||||
|
||||
def toggle_fullscreen(self, *args):
|
||||
if self.isFullScreen():
|
||||
self.show_normal()
|
||||
else:
|
||||
self.pre_fs_geom = bytearray(self.saveGeometry())
|
||||
self.showFullScreen()
|
||||
|
||||
|
||||
|
||||
class CoverFlowMixin(object):
|
||||
|
||||
def __init__(self):
|
||||
@ -228,7 +255,7 @@ class CoverFlowMixin(object):
|
||||
d.addAction(self.cb_splitter.action_toggle)
|
||||
self.cover_flow.setVisible(True)
|
||||
self.cover_flow.setFocus(Qt.OtherFocusReason)
|
||||
d.show()
|
||||
d.showFullScreen() if gprefs['cb_fullscreen'] else d.show()
|
||||
self.cb_splitter.button.set_state_to_hide()
|
||||
d.closed.connect(self.cover_browser_closed)
|
||||
self.cb_dialog = d
|
||||
|
@ -6,7 +6,7 @@ __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from PyQt4.Qt import (QApplication, QFont, QFontInfo, QFontDialog,
|
||||
QAbstractListModel, Qt, QIcon)
|
||||
QAbstractListModel, Qt, QIcon, QKeySequence)
|
||||
|
||||
from calibre.gui2.preferences import ConfigWidgetBase, test_widget, CommaSeparatedList
|
||||
from calibre.gui2.preferences.look_feel_ui import Ui_Form
|
||||
@ -129,6 +129,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
r('disable_tray_notification', config)
|
||||
r('use_roman_numerals_for_series_number', config)
|
||||
r('separate_cover_flow', config, restart_required=True)
|
||||
r('cb_fullscreen', gprefs)
|
||||
|
||||
choices = [(_('Off'), 'off'), (_('Small'), 'small'),
|
||||
(_('Medium'), 'medium'), (_('Large'), 'large')]
|
||||
@ -170,6 +171,11 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
self.tabWidget.addTab(self.edit_rules,
|
||||
QIcon(I('format-fill-color.png')), _('Column coloring'))
|
||||
self.tabWidget.setCurrentIndex(0)
|
||||
keys = [QKeySequence('F11', QKeySequence.PortableText), QKeySequence(
|
||||
'Ctrl+Shift+F', QKeySequence.PortableText)]
|
||||
keys = [unicode(x.toString(QKeySequence.NativeText)) for x in keys]
|
||||
self.fs_help_msg.setText(unicode(self.fs_help_msg.text())%(
|
||||
_(' or ').join(keys)))
|
||||
|
||||
def initialize(self):
|
||||
ConfigWidgetBase.initialize(self)
|
||||
|
@ -417,7 +417,7 @@ then the tags will be displayed each on their own line.</string>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="opt_cover_flow_queue_length"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -430,6 +430,26 @@ then the tags will be displayed each on their own line.</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="opt_cb_fullscreen">
|
||||
<property name="text">
|
||||
<string>When showing cover browser in separate window, show it &fullscreen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="fs_help_msg">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">margin-left: 1.5em</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>You can press the %s keys to toggle full screen mode.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
Loading…
x
Reference in New Issue
Block a user