From 9423839eff101b283180ef020225d4bddc4297b8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 27 Feb 2012 15:52:24 +0530 Subject: [PATCH] Show ratings in the book details panel as stars. Also allow the user to change the alignment of the ratings column in the main books list. No longer display the stars in blue. --- imgsrc/calibreSymbols.spd | 152 +++++++++++++++++++ resources/fonts/calibreSymbols.otf | Bin 0 -> 3216 bytes src/calibre/gui2/__init__.py | 17 +++ src/calibre/gui2/book_details.py | 10 +- src/calibre/gui2/cover_flow.py | 7 +- src/calibre/gui2/library/delegates.py | 102 ++++--------- src/calibre/gui2/library/models.py | 4 +- src/calibre/gui2/library/views.py | 4 +- src/calibre/gui2/metadata/single_download.py | 6 +- src/calibre/gui2/pictureflow/pictureflow.cpp | 22 +++ src/calibre/gui2/pictureflow/pictureflow.h | 12 ++ src/calibre/gui2/pictureflow/pictureflow.sip | 4 + src/calibre/library/field_metadata.py | 2 +- 13 files changed, 256 insertions(+), 86 deletions(-) create mode 100644 imgsrc/calibreSymbols.spd create mode 100644 resources/fonts/calibreSymbols.otf diff --git a/imgsrc/calibreSymbols.spd b/imgsrc/calibreSymbols.spd new file mode 100644 index 0000000000..da751f442a --- /dev/null +++ b/imgsrc/calibreSymbols.spd @@ -0,0 +1,152 @@ +SplineFontDB: 3.0 +FontName: calibreSymbols +FullName: calibre Symbols +FamilyName: calibre Symbols +Weight: Medium +Copyright: Created by Kovid Goyal with FontForge 2.0 (http://fontforge.sf.net) +UComments: "2012-2-27: Created." +Version: 001.000 +ItalicAngle: 0 +UnderlinePosition: -100 +UnderlineWidth: 50 +Ascent: 800 +Descent: 200 +LayerCount: 2 +Layer: 0 0 "Back" 1 +Layer: 1 0 "Fore" 0 +NeedsXUIDChange: 1 +XUID: [1021 913 325894820 11538708] +FSType: 0 +OS2Version: 0 +OS2_WeightWidthSlopeOnly: 0 +OS2_UseTypoMetrics: 1 +CreationTime: 1330331997 +ModificationTime: 1330337167 +OS2TypoAscent: 0 +OS2TypoAOffset: 1 +OS2TypoDescent: 0 +OS2TypoDOffset: 1 +OS2TypoLinegap: 90 +OS2WinAscent: 0 +OS2WinAOffset: 1 +OS2WinDescent: 0 +OS2WinDOffset: 1 +HheadAscent: 0 +HheadAOffset: 1 +HheadDescent: 0 +HheadDOffset: 1 +MarkAttachClasses: 1 +DEI: 91125 +Encoding: UnicodeFull +UnicodeInterp: none +NameList: Adobe Glyph List +DisplaySize: -24 +AntiAlias: 1 +FitToEm: 1 +WidthSeparation: 150 +WinInfo: 0 75 22 +BeginPrivate: 0 +EndPrivate +BeginChars: 1114112 3 + +StartChar: uni2605 +Encoding: 9733 9733 0 +Width: 933 +VWidth: 0 +Flags: W +LayerCount: 2 +Fore +SplineSet +544.1 344.853 m 1 + 723.713 360.062 l 2 + 774.129 364.181 799.969 366.241 801.229 366.241 c 0 + 816.984 366.241 824.862 359.429 824.862 345.803 c 0 + 824.862 340.416 823.287 336.218 820.136 333.207 c 0 + 816.984 330.197 792.878 314.274 747.817 285.438 c 2 + 596.566 188 l 1 + 693.461 -56.3096 l 2 + 694.722 -58.8447 695.353 -62.6465 695.353 -67.7168 c 0 + 695.353 -72.4697 693.619 -76.5898 690.152 -80.0742 c 0 + 686.687 -83.5605 682.905 -85.3027 678.81 -85.3027 c 0 + 675.028 -85.3027 671.089 -83.9561 666.991 -81.2637 c 0 + 662.896 -78.5693 640.681 -59.7949 600.348 -24.9385 c 2 + 466.11 91.9873 l 1 + 333.765 -23.0381 l 2 + 292.172 -59.1621 269.405 -78.5693 265.467 -81.2637 c 0 + 261.527 -83.9561 257.667 -85.3027 253.887 -85.3027 c 0 + 249.475 -85.3027 245.457 -83.4814 241.833 -79.8369 c 0 + 238.209 -76.1934 236.397 -72.1523 236.397 -67.7168 c 0 + 236.397 -64.8652 245.379 -40.7832 263.34 4.53027 c 2 + 335.184 188 l 1 + 181.096 287.34 l 2 + 137.61 315.225 114.372 330.593 111.379 333.445 c 0 + 108.385 336.297 106.888 340.416 106.888 345.803 c 0 + 106.888 359.745 114.924 366.717 130.994 366.717 c 0 + 132.255 366.717 154.312 364.815 197.167 361.013 c 2 + 387.648 344.853 l 1 + 430.661 528.798 l 2 + 441.69 576.646 448.544 602.945 451.222 607.699 c 0 + 453.9 612.452 458.863 614.828 466.11 614.828 c 0 + 473.674 614.828 478.716 612.215 481.236 606.986 c 0 + 483.757 601.758 491.005 573.317 502.979 521.667 c 2 + 544.1 344.853 l 1 +EndSplineSet +Validated: 524289 +EndChar + +StartChar: zero +Encoding: 48 48 1 +Width: 1303 +VWidth: 2048 +Flags: W +HStem: -43.3789 76.7998<582.097 721.09> 623.341 76.7998<582.097 721.091> +VStem: 403.82 97.4395<148.044 508.66> 802.221 96.959<148.044 508.659> +LayerCount: 2 +Fore +SplineSet +651.5 623.341 m 0 + 601.58 623.341 564.061 598.78 538.939 549.66 c 0 + 513.82 500.541 501.26 426.7 501.26 328.141 c 0 + 501.26 229.9 513.82 156.221 538.939 107.101 c 0 + 564.061 57.9805 601.58 33.4209 651.5 33.4209 c 0 + 701.74 33.4209 739.42 57.9805 764.54 107.101 c 0 + 789.66 156.221 802.221 229.9 802.221 328.141 c 0 + 802.221 426.7 789.66 500.541 764.54 549.66 c 0 + 739.42 598.78 701.74 623.341 651.5 623.341 c 0 +651.5 700.141 m 0 + 731.82 700.141 793.18 668.38 835.58 604.859 c 0 + 877.979 541.341 899.18 449.101 899.18 328.141 c 0 + 899.18 207.5 877.979 115.421 835.58 51.9004 c 0 + 793.18 -11.6201 731.819 -43.3789 651.5 -43.3789 c 0 + 571.18 -43.3789 509.82 -11.6201 467.42 51.9004 c 0 + 425.021 115.421 403.82 207.5 403.82 328.141 c 0 + 403.82 449.101 425.021 541.341 467.42 604.859 c 0 + 509.82 668.38 571.18 700.141 651.5 700.141 c 0 +EndSplineSet +Validated: 524289 +EndChar + +StartChar: period +Encoding: 46 46 2 +Width: 516 +VWidth: 2048 +Flags: W +HStem: 53.4004 166.199<203.263 309.297> +VStem: 174.6 163.801<82.9501 190.955> +LayerCount: 2 +Fore +SplineSet +338.4 142.8 m 0 + 338.4 119.2 330.5 98.4004 314.7 80.4004 c 0 + 298.9 62.4004 277 53.4004 249 53.4004 c 0 + 225.4 53.4004 207.1 61.2002 194.1 76.7998 c 0 + 181.1 92.4004 174.6 111 174.6 132.6 c 0 + 174.6 155.8 182.6 176.1 198.6 193.5 c 0 + 214.6 210.9 236.8 219.6 265.2 219.6 c 0 + 288.8 219.6 306.9 212.2 319.5 197.4 c 0 + 332.1 182.6 338.4 164.4 338.4 142.8 c 0 +EndSplineSet +Validated: 524289 +EndChar +EndChars +EndSplineFont diff --git a/resources/fonts/calibreSymbols.otf b/resources/fonts/calibreSymbols.otf new file mode 100644 index 0000000000000000000000000000000000000000..6406e2b2a80d4d28937c2961905dad43e019a6dc GIT binary patch literal 3216 zcmdT`acou98ULMo?|alz`=HX&##(M>%ZjY!wFH@s9e2SNjn-m8Mv!d0()Z|dwC~wI zgbK-Sf`YC_moetpM%aRr8In4~MwZN)8!`ints^iXBQud~7PQK6w(x+qXTR^h*G_T4 zfA-Jr%lppn{LXj2?|063&V8?W<;rGEhYJ(orHzfYec-XDfWR>z*wfg!vT5CSH!Q&t-o`M`TM9)^b8sOcU&kbVTp$I((9SjvFVFiSCr% zfm-VOHOFlzaRrVpYp?!J=-yFGH!qOE+fM{#ex`j~A2hccl0OHAuzWbjctan=n!s%7 zn%n(I0w*5}pblDC=595D0B3yPkMew`RqvrjF`j{-IXOw9I8&YFv4%EysGb`zZT)qu z;p|5_D4H{mjm!%2(Kp2|#j{zgxYHkHF_Wm=EH*J;#k1H#Nc}F01DK)CXK@huMiDEj ztXr6B2frDtSi6BNHjsz0EH<%9&CFs8Woma82VkqWvN(uRmBvzZA&Ll6v~ASiiXPer zk-(FP`^+-p9(rsfznNSL?L>`aJBg+3!UoQ^S;uOG*;djc#ZMA-Siny#>nm->w;J7K zs~I6mzj?sYu4p6`ZL?c@><1H1#@p;=iJr(tdviS1ZZ{@6Q;mtP4N<$cI&4?Ar&7tf z1q)(iW5QN<$ErJ{DF#{ZtBi9EvL+iVsJnx`1hsc_II=O`+7-1|^mMc)Hj-%a*Br+t zdZ8)W7T?77W(%uh(3>Z*xn$Xh#i*i{Zx}VS`1~U3>>I?`b$0FIs@kgBa1EVrp5u!P zS;d8Pafxw%qiyDttWpg5*ubi2S9d(oX@|o#)!}fM%;!`5_nn&BDF3|4nd3VndmCGu6&a_B%0RoDTeOsJB1e(69RYuXz1t ze^I(T{pwhGuzzfGVY=apH`XvM|FXuSn5*&1LMV;CJ%sxQVQSSP><14>=msVvg1qVs5Y2f8Qha0~xx~gsoa%+~a2KcCCjGIUKw& z;L(04!GbP>eH?RtqV=Vi<6E)?O=Qyx8F)6MLId93Njq(bp0gyBc;)0@ zE71Bc`=IdPa_jZ}VNc^O zDXh#Pa)JBvWzu79 zJtK=GEP0xo$n+=q(ixJREF~vj8+Hk+xcV%srccZ6{pPsK7vM;ca~HnCC~1##OJ&Q) zMRTBz+<(xuQAfkr3;HD}nciZr-y%-?WKN62?h=~u7IN2@fQP?==>0?FM$$ybzlt0l zvoTNW`}3joH>nsi=7B0sRY1cWq|*nVxEgARJ`??1vHs^p&|bMr;_5UZ{*^C@uTcrq z_Z()D`Wq9RIzE@2F+py;!sEfN2QS7iiRN!3_m4YVR`;hxbo}|N9Ql1E&HXz)X1|zA zc;YpWc`Taq!;+HGXs`c((bb>HULPegWvOG2Ia3IluRoV!t30B(%i@?vDG=u0=%iMY zH7~i8^*X!eB^u*(az%e6x~-jN-b?J3&+(}3>D8`AcaUbsy-d@48+Qhkk2+evTTZ8< z#o%?nhsY{s#_@+8q7riB50jHDdg1^%^B9GTkEl2Xs(6#e+$=-eTtQ;CkyC&0=vXFl zEh#4g1q`RZE#rfZUjgcUPO7%=cKVMrI~p%JG?Ao3ZB-$9mY(KF@$Do-AJLd|JsQKE zLhPzt9I$Hr4C}!>xBi0B({soMk2B+?Z@Ap*iGHy|^GJ-#Vg`59u)2IZ-7_m)RoI)C zdnWhH`+0f8(}$lQ%)3=y-tx;XPd -1: + try: + _rating_font = unicode(list( + QFontDatabase.applicationFontFamilies(fontid))[0]) + except: + pass + return _rating_font def find_forms(srcdir): base = os.path.join(srcdir, 'calibre', 'gui2') diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index 628f846aea..08df7007a2 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -20,7 +20,7 @@ from calibre.ebooks.metadata.sources.identify import urls_from_identifiers from calibre.constants import filesystem_encoding from calibre.library.comments import comments_to_html from calibre.gui2 import (config, open_local_file, open_url, pixmap_to_data, - gprefs) + gprefs, rating_font) from calibre.utils.icu import sort_key from calibre.utils.formatter import EvalFormatter from calibre.utils.date import is_date_undefined @@ -116,6 +116,14 @@ def render_data(mi, use_roman_numbers=True, all_fields=False): val = force_unicode(val) ans.append((field, u'%s'%comments_to_html(val))) + elif metadata['datatype'] == 'rating': + val = getattr(mi, field) + if val: + val = val/2.0 + ans.append((field, + u'%s%s'%( + name, rating_font(), u'\u2605'*int(val)))) elif metadata['datatype'] == 'composite' and \ metadata['display'].get('contains_html', False): val = getattr(mi, field) diff --git a/src/calibre/gui2/cover_flow.py b/src/calibre/gui2/cover_flow.py index 4ba6c198f2..dd4763782a 100644 --- a/src/calibre/gui2/cover_flow.py +++ b/src/calibre/gui2/cover_flow.py @@ -10,10 +10,11 @@ Module to implement the Cover Flow feature import sys, os, time from PyQt4.Qt import (QImage, QSizePolicy, QTimer, QDialog, Qt, QSize, QAction, - QStackedLayout, QLabel, QByteArray, pyqtSignal, QKeySequence) + QStackedLayout, QLabel, QByteArray, pyqtSignal, QKeySequence, QFont) from calibre import plugins -from calibre.gui2 import config, available_height, available_width, gprefs +from calibre.gui2 import (config, available_height, available_width, gprefs, + rating_font) pictureflow, pictureflowerror = plugins['pictureflow'] @@ -102,6 +103,8 @@ if pictureflow is not None: type=Qt.QueuedConnection) self.context_menu = None self.setContextMenuPolicy(Qt.DefaultContextMenu) + if hasattr(self, 'setSubtitleFont'): + self.setSubtitleFont(QFont(rating_font())) def set_context_menu(self, cm): self.context_menu = cm diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index c9736719b5..13a64f154e 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -5,16 +5,12 @@ __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal ' __docformat__ = 'restructuredtext en' -from math import cos, sin, pi -from PyQt4.Qt import (QColor, Qt, QModelIndex, QSize, QApplication, - QPainterPath, QLinearGradient, QBrush, - QPen, QStyle, QPainter, QStyleOptionViewItemV4, - QIcon, QDoubleSpinBox, QVariant, QSpinBox, - QStyledItemDelegate, QComboBox, QTextDocument, - QAbstractTextDocumentLayout) +from PyQt4.Qt import (Qt, QApplication, QStyle, QIcon, QDoubleSpinBox, + QVariant, QSpinBox, QStyledItemDelegate, QComboBox, QTextDocument, + QAbstractTextDocumentLayout, QFont) -from calibre.gui2 import UNDEFINED_QDATETIME, error_dialog +from calibre.gui2 import UNDEFINED_QDATETIME, error_dialog, rating_font from calibre.gui2.widgets import EnLineEdit from calibre.gui2.complete import MultiCompleteLineEdit, MultiCompleteComboBox from calibre.utils.date import now, format_date, qt_to_dt @@ -27,81 +23,35 @@ from calibre.gui2.languages import LanguagesEdit class RatingDelegate(QStyledItemDelegate): # {{{ - COLOR = QColor("blue") - SIZE = 16 - def __init__(self, parent): - QStyledItemDelegate.__init__(self, parent) - self._parent = parent - self.dummy = QModelIndex() - self.star_path = QPainterPath() - self.star_path.moveTo(90, 50) - for i in range(1, 5): - self.star_path.lineTo(50 + 40 * cos(0.8 * i * pi), \ - 50 + 40 * sin(0.8 * i * pi)) - self.star_path.closeSubpath() - self.star_path.setFillRule(Qt.WindingFill) - self.gradient = QLinearGradient(0, 0, 0, 100) - self.factor = self.SIZE/100. - - def sizeHint(self, option, index): - #num = index.model().data(index, Qt.DisplayRole).toInt()[0] - return QSize(5*(self.SIZE), self.SIZE+4) - - def paint(self, painter, option, index): - style = self._parent.style() - option = QStyleOptionViewItemV4(option) - self.initStyleOption(option, index) - option.text = u'' - num = index.model().data(index, Qt.DisplayRole).toInt()[0] - def draw_star(): - painter.save() - painter.scale(self.factor, self.factor) - painter.translate(50.0, 50.0) - painter.rotate(-20) - painter.translate(-50.0, -50.0) - painter.drawPath(self.star_path) - painter.restore() - - painter.save() - if hasattr(QStyle, 'CE_ItemViewItem'): - style.drawControl(QStyle.CE_ItemViewItem, option, - painter, self._parent) - elif option.state & QStyle.State_Selected: - painter.fillRect(option.rect, option.palette.highlight()) - else: - painter.fillRect(option.rect, option.backgroundBrush) - - try: - painter.setRenderHint(QPainter.Antialiasing) - painter.setClipRect(option.rect) - y = option.rect.center().y()-self.SIZE/2. - x = option.rect.left() - color = index.data(Qt.ForegroundRole) - if color.isNull() or not color.isValid(): - color = self.COLOR - else: - color = QColor(color) - painter.setPen(QPen(color, 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin)) - self.gradient.setColorAt(0.0, color) - self.gradient.setColorAt(1.0, color) - painter.setBrush(QBrush(self.gradient)) - painter.translate(x, y) - i = 0 - while i < num: - draw_star() - painter.translate(self.SIZE, 0) - i += 1 - except: - import traceback - traceback.print_exc() - painter.restore() + def __init__(self, *args, **kwargs): + QStyledItemDelegate.__init__(self, *args, **kwargs) + self.rf = QFont(rating_font()) + self.em = Qt.ElideMiddle def createEditor(self, parent, option, index): sb = QStyledItemDelegate.createEditor(self, parent, option, index) sb.setMinimum(0) sb.setMaximum(5) + sb.setSuffix(' ' + _('stars')) return sb + + def displayText(self, value, locale): + r = value.toInt()[0] + if r < 0 or r > 5: + r = 0 + return u'\u2605'*r + + def sizeHint(self, option, index): + option.font = self.rf + option.textElideMode = self.em + return QStyledItemDelegate.sizeHint(self, option, index) + + def paint(self, painter, option, index): + option.font = self.rf + option.textElideMode = self.em + return QStyledItemDelegate.paint(self, painter, option, index) + # }}} class DateDelegate(QStyledItemDelegate): # {{{ diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 044c01c39e..0b3c048a2e 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -588,8 +588,8 @@ class BooksModel(QAbstractTableModel): # {{{ def rating_type(r, idx=-1): r = self.db.data[r][idx] - r = r/2 if r else 0 - return QVariant(r) + r = r/2.0 if r else 0 + return QVariant(int(r)) def datetime_type(r, idx=-1): val = self.db.data[r][idx] diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index 48049b765f..b622009a69 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -200,10 +200,10 @@ class BooksView(QTableView): # {{{ ac = a if self._model.sorted_on[1] else d ac.setCheckable(True) ac.setChecked(True) - if col not in ('ondevice', 'rating', 'inlibrary') and \ + if col not in ('ondevice', 'inlibrary') and \ (not self.model().is_custom_column(col) or \ self.model().custom_columns[col]['datatype'] not in ('bool', - 'rating')): + )): m = self.column_header_context_menu.addMenu( _('Change text alignment for %s') % name) al = self._model.alignment_map.get(col, 'left') diff --git a/src/calibre/gui2/metadata/single_download.py b/src/calibre/gui2/metadata/single_download.py index 091c10462b..6149c3be8a 100644 --- a/src/calibre/gui2/metadata/single_download.py +++ b/src/calibre/gui2/metadata/single_download.py @@ -27,7 +27,7 @@ from calibre.utils.logging import GUILog as Log from calibre.ebooks.metadata.sources.identify import (identify, urls_from_identifiers) from calibre.ebooks.metadata.book.base import Metadata -from calibre.gui2 import error_dialog, NONE +from calibre.gui2 import error_dialog, NONE, rating_font from calibre.utils.date import (utcnow, fromordinal, format_date, UNDEFINED_DATE, as_utc) from calibre.library.comments import comments_to_html @@ -254,6 +254,7 @@ class ResultsView(QTableView): # {{{ return ret def show_details(self, index): + f = rating_font() book = self.model().data(index, Qt.UserRole) parts = [ '
', @@ -265,7 +266,8 @@ class ResultsView(QTableView): # {{{ if series[1]: parts.append('
%s: %s
'%series) if not book.is_null('rating'): - parts.append('
%s
'%('\u2605'*int(book.rating))) + style = 'style=\'font-family:"%s"\''%f + parts.append('
%s
'%(style, '\u2605'*int(book.rating))) parts.append('
') if book.identifiers: urls = urls_from_identifiers(book.identifiers) diff --git a/src/calibre/gui2/pictureflow/pictureflow.cpp b/src/calibre/gui2/pictureflow/pictureflow.cpp index 4e9d8a402d..876c8cc65e 100644 --- a/src/calibre/gui2/pictureflow/pictureflow.cpp +++ b/src/calibre/gui2/pictureflow/pictureflow.cpp @@ -364,6 +364,8 @@ public: QTime previousPosTimestamp; int pixelDistanceMoved; int pixelsToMovePerSlide; + QFont subtitleFont; + void setImages(FlowImages *images); void dataChanged(); @@ -422,6 +424,7 @@ PictureFlowPrivate::PictureFlowPrivate(PictureFlow* w, int queueLength_) step = 0; target = 0; fade = 256; + subtitleFont = QFont(); triggerTimer.setSingleShot(true); triggerTimer.setInterval(0); @@ -674,9 +677,13 @@ void PictureFlowPrivate::render_text(QPainter *painter, int index) { caption = slideImages->caption(index); subtitle = slideImages->subtitle(index); buffer_width = buffer.width(); buffer_height = buffer.height(); + subtitleFont.setPixelSize(fontSize); brect = painter->boundingRect(QRect(0, 0, buffer_width, fontSize), TEXT_FLAGS, caption); + painter->save(); + painter->setFont(subtitleFont); brect2 = painter->boundingRect(QRect(0, 0, buffer_width, fontSize), TEXT_FLAGS, subtitle); + painter->restore(); // So that if there is no subtitle, the caption is not flush with the bottom if (brect2.height() < fontSize) brect2.setHeight(fontSize); @@ -691,7 +698,11 @@ void PictureFlowPrivate::render_text(QPainter *painter, int index) { painter->drawText(brect, TEXT_FLAGS, caption); brect2.moveTop(buffer_height - brect2.height()); + + painter->save(); + painter->setFont(subtitleFont); painter->drawText(brect2, TEXT_FLAGS, slideImages->subtitle(index)); + painter->restore(); } // Render the slides. Updates only the offscreen buffer. @@ -1168,6 +1179,17 @@ void PictureFlow::setSlideSize(QSize size) d->setSlideSize(size); } +void PictureFlow::setSubtitleFont(QFont font) +{ + d->subtitleFont = font; +} + +QFont PictureFlow::subtitleFont() const +{ + return d->subtitleFont; +} + + QImage PictureFlow::slide(int index) const { return d->slide(index); diff --git a/src/calibre/gui2/pictureflow/pictureflow.h b/src/calibre/gui2/pictureflow/pictureflow.h index f2c2c947e6..c5a9c76190 100644 --- a/src/calibre/gui2/pictureflow/pictureflow.h +++ b/src/calibre/gui2/pictureflow/pictureflow.h @@ -92,6 +92,7 @@ Q_OBJECT Q_PROPERTY(int currentSlide READ currentSlide WRITE setCurrentSlide) Q_PROPERTY(QSize slideSize READ slideSize WRITE setSlideSize) + Q_PROPERTY(QFont subtitleFont READ subtitleFont WRITE setSubtitleFont) public: /*! @@ -120,6 +121,17 @@ public: */ void setSlideSize(QSize size); + /*! + Returns the font used to render subtitles + */ + QFont subtitleFont() const; + + /*! + Sets the font used to render subtitles + */ + void setSubtitleFont(QFont font); + + /*! Clears any caches held to free up memory */ diff --git a/src/calibre/gui2/pictureflow/pictureflow.sip b/src/calibre/gui2/pictureflow/pictureflow.sip index 84d2498ea9..21c6209df5 100644 --- a/src/calibre/gui2/pictureflow/pictureflow.sip +++ b/src/calibre/gui2/pictureflow/pictureflow.sip @@ -41,6 +41,10 @@ public : void setSlideSize(QSize size); + QFont subtitleFont() const; + + void setSubtitleFont(QFont font); + void clearCaches(); virtual QImage slide(int index) const; diff --git a/src/calibre/library/field_metadata.py b/src/calibre/library/field_metadata.py index de95eabd40..5b81f4a6a6 100644 --- a/src/calibre/library/field_metadata.py +++ b/src/calibre/library/field_metadata.py @@ -173,7 +173,7 @@ class FieldMetadata(dict): 'datatype':'rating', 'is_multiple':{}, 'kind':'field', - 'name':_('Ratings'), + 'name':_('Rating'), 'search_terms':['rating'], 'is_custom':False, 'is_category':True,