From 1ba634a1ad3743e802b48847446d8c061ed4b0c6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 23 May 2024 21:35:23 +0530 Subject: [PATCH] Allow using relative units for cover rounding --- src/calibre/gui2/__init__.py | 3 +- src/calibre/gui2/preferences/look_feel.py | 1 + src/calibre/gui2/preferences/look_feel.ui | 320 +++++++++++----------- 3 files changed, 167 insertions(+), 157 deletions(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index e28ed316cf..22e1f59adf 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -429,6 +429,7 @@ def create_defs(): defs['cover_grid_show_title'] = False defs['cover_grid_texture'] = None defs['cover_corner_radius'] = 0 + defs['cover_corner_radius_unit'] = 'px' defs['show_vl_tabs'] = False defs['vl_tabs_closable'] = True defs['show_highlight_toggle_button'] = False @@ -1766,7 +1767,7 @@ def clip_border_radius(painter, rect): r = gprefs['cover_corner_radius'] if r > 0: pp = QPainterPath() - pp.addRoundedRect(QRectF(rect), r, r) + pp.addRoundedRect(QRectF(rect), r, r, Qt.SizeMode.RelativeSize if gprefs['cover_corner_radius_unit'] == '%' else Qt.SizeMode.AbsoluteSize) painter.setClipPath(pp) try: yield diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py index 1ef80a7e49..0d4118df37 100644 --- a/src/calibre/gui2/preferences/look_feel.py +++ b/src/calibre/gui2/preferences/look_feel.py @@ -626,6 +626,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): r('bd_show_cover', gprefs) r('bd_overlay_cover_size', gprefs) r('cover_corner_radius', gprefs) + r('cover_corner_radius_unit', gprefs, choices=[(_('Pixels'), 'px'), (_('Percentage'), '%')]) r('cover_grid_width', gprefs) r('cover_grid_height', gprefs) r('cover_grid_cache_size_multiple', gprefs) diff --git a/src/calibre/gui2/preferences/look_feel.ui b/src/calibre/gui2/preferences/look_feel.ui index ad6f28bbe5..95c628d42a 100644 --- a/src/calibre/gui2/preferences/look_feel.ui +++ b/src/calibre/gui2/preferences/look_feel.ui @@ -27,7 +27,34 @@ &Main interface - + + + + + User interface style (&needs restart): + + + opt_ui_style + + + + + + + + + + + + + + + + + Change &icon theme + + + @@ -38,78 +65,13 @@ - - - - Show the &splash screen at startup - - - - - - - QComboBox::AdjustToMinimumContentsLengthWithIcon - - - 20 - - - - - - - Enable s&ystem tray icon (needs restart) - - - - - - - Show &row numbers in the book list - - - - - - - Choose &language (needs restart): - - - opt_language - - - - + Adjust &colors - - - - Disable all animations. Useful if you have a slow/old computer. - - - Disable &animations - - - - - - - Draw a &grid in the book list - - - - - - - - - - @@ -120,7 +82,7 @@ - + @@ -136,17 +98,102 @@ - - + + - Show &layout buttons in the status bar + Choose &language (needs restart): + + + opt_language - - + + + + QComboBox::AdjustToMinimumContentsLengthWithIcon + + + 20 + + + + + - Change &icon theme + &Round the corners of covers: + + + opt_cover_corner_radius + + + + + + + + + Round the corners of covers in many places they are displayed such as the Cover grid, Book details panel, etc. Adjust the amount of rounding with this setting. A value of between 5 and 10 looks good with most covers sizes. Zero disables rounding and is the default. + + + no rounding + + + + + + + The unit for the cover corner rounding. Either pixel values or as a percetage of the cover size. + + + + + + + + + Enable s&ystem tray icon (needs restart) + + + + + + + Disable all animations. Useful if you have a slow/old computer. + + + Disable &animations + + + + + + + Disable popup notifications when calibre completes jobs such a conversion, sending to device etc. The notifications are sent via the operating system notification facility, if available. Note that on Windows, you have to enable the system tray icon for notifications to work. + + + Disable n&otifications on job completion + + + + + + + Show the &splash screen at startup + + + + + + + Show &tooltips in the book list + + + + + + + Show &layout buttons in the status bar @@ -171,17 +218,14 @@ - + Change &font (needs restart) - - - - + Toolbar @@ -223,6 +267,47 @@ + + + + E&xtra spacing to add between rows in the book list (can be negative): + + + opt_book_list_extra_row_spacing + + + + + + + px + + + -20 + + + + + + + Show &row numbers in the book list + + + + + + + Draw a &grid in the book list + + + + + + + Allow using &drag and drop to merge books + + + @@ -236,83 +321,6 @@ - - - - User interface style (&needs restart): - - - opt_ui_style - - - - - - - px - - - -20 - - - - - - - Allow using &drag and drop to merge books - - - - - - - Disable popup notifications when calibre completes jobs such a conversion, sending to device etc. The notifications are sent via the operating system notification facility, if available. Note that on Windows, you have to enable the system tray icon for notifications to work. - - - Disable n&otifications on job completion - - - - - - - Show &tooltips in the book list - - - - - - - E&xtra spacing to add between rows in the book list (can be negative): - - - opt_book_list_extra_row_spacing - - - - - - - &Round the corners of covers: - - - opt_cover_corner_radius - - - - - - - Round the corners of covers in many places they are displayed such as the Cover grid, Book details panel, etc. Adjust the amount of rounding with this setting. A value of between 5 and 10 looks good with most covers sizes. Zero disables rounding and is the default. - - - no rounding - - - px - - -