diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 375e42ece4..aadf86eef9 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -120,6 +120,7 @@ defs['cover_grid_disk_cache_size'] = 2500 defs['cover_grid_show_title'] = False defs['cover_grid_texture'] = None defs['show_vl_tabs'] = False +defs['show_highlight_toggle_button'] = False del defs # }}} diff --git a/src/calibre/gui2/preferences/search.py b/src/calibre/gui2/preferences/search.py index 5c9e31790a..fd68cc0e9d 100644 --- a/src/calibre/gui2/preferences/search.py +++ b/src/calibre/gui2/preferences/search.py @@ -10,7 +10,7 @@ from PyQt4.Qt import QApplication from calibre.gui2.preferences import ConfigWidgetBase, test_widget, \ CommaSeparatedList from calibre.gui2.preferences.search_ui import Ui_Form -from calibre.gui2 import config, error_dialog +from calibre.gui2 import config, error_dialog, gprefs from calibre.utils.config import prefs from calibre.utils.icu import sort_key from calibre.library.caches import set_use_primary_find_in_search @@ -26,6 +26,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): r('search_as_you_type', config) r('highlight_search_matches', config) + r('show_highlight_toggle_button', gprefs) r('limit_search_columns', prefs) r('use_primary_find_in_search', prefs) r('limit_search_columns_to', prefs, setting=CommaSeparatedList) diff --git a/src/calibre/gui2/preferences/search.ui b/src/calibre/gui2/preferences/search.ui index 9ab23e110d..abd563a78b 100644 --- a/src/calibre/gui2/preferences/search.ui +++ b/src/calibre/gui2/preferences/search.ui @@ -14,28 +14,7 @@ Form - - - - Search as you &type - - - - - - - Unaccented characters match accented characters - - - - - - - &Highlight search results instead of restricting the book list to the results - - - - + What to search by default @@ -84,7 +63,133 @@ + + + + What to search when searching similar books + + + + + + <p>When you search for similar books by right clicking the + book and selecting "Similar books...", + calibre constructs a search using the column lookup names specified below. + By changing the lookup name to a grouped search term you can + search multiple columns at once.</p> + + + true + + + + + + + Similar authors: + + + + + + + + 10 + 0 + + + + + + + + + + + Similar series: + + + + + + + + 10 + 0 + + + + + + + + + + + Similar tags: + + + + + + + + + + + + + Similar publishers: + + + + + + + + + + + + + + + + 0 + 0 + + + + Clear search histories from all over calibre. Including the book list, e-book viewer, fetch news dialog, etc. + + + Clear search &histories + + + + + + + Search as you &type + + + + + + + Unaccented characters match accented characters + + + + + + + &Highlight search results instead of restricting the book list to the results + + + + Grouped Search Terms @@ -198,111 +303,16 @@ to be shown as user categories - - - - - 0 - 0 - - + + - Clear search histories from all over calibre. Including the book list, e-book viewer, fetch news dialog, etc. + <p>This option will cause a small button to appear next to the search bar. Clicking the button will toggle between showing only the search results and showing all books with the search results highlighted. - Clear search &histories + Show a quick &toggle button to switch between highlighting and restricting results next to the searchbar - - - - What to search when searching similar books - - - - - - <p>When you search for similar books by right clicking the - book and selecting "Similar books...", - calibre constructs a search using the column lookup names specified below. - By changing the lookup name to a grouped search term you can - search multiple columns at once.</p> - - - true - - - - - - - Similar authors: - - - - - - - - 10 - 0 - - - - - - - - - - - Similar series: - - - - - - - - 10 - 0 - - - - - - - - - - - Similar tags: - - - - - - - - - - - - - Similar publishers: - - - - - - - - - - - - diff --git a/src/calibre/gui2/search_box.py b/src/calibre/gui2/search_box.py index a50b3dfe9c..915783b6b5 100644 --- a/src/calibre/gui2/search_box.py +++ b/src/calibre/gui2/search_box.py @@ -14,7 +14,7 @@ from PyQt4.Qt import QComboBox, Qt, QLineEdit, QStringList, pyqtSlot, QDialog, \ pyqtSignal, QCompleter, QAction, QKeySequence, QTimer, \ QString, QIcon, QMenu -from calibre.gui2 import config, error_dialog, question_dialog +from calibre.gui2 import config, error_dialog, question_dialog, gprefs from calibre.gui2.dialogs.confirm_delete import confirm from calibre.gui2.dialogs.saved_search_editor import SavedSearchEditor from calibre.gui2.dialogs.search import SearchDialog @@ -435,6 +435,7 @@ class SearchBoxMixin(object): # {{{ self.highlight_only_button.setIcon(QIcon(I('highlight_only_on.png'))) else: self.highlight_only_button.setIcon(QIcon(I('highlight_only_off.png'))) + self.highlight_only_button.setVisible(gprefs['show_highlight_toggle_button']) self.library_view.model().set_highlight_only(config['highlight_search_matches']) def focus_search_box(self, *args):