2016-05-25 02:53:03 +00:00
|
|
|
# Copyright 2016 Hardcoded Software (http://www.hardcoded.net)
|
2014-10-13 19:08:59 +00:00
|
|
|
#
|
2015-01-03 21:33:16 +00:00
|
|
|
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
2014-10-13 19:08:59 +00:00
|
|
|
# which should be included with this package. The terms are also available at
|
2015-01-03 21:33:16 +00:00
|
|
|
# http://www.gnu.org/licenses/gpl-3.0.html
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2023-01-06 06:35:23 +00:00
|
|
|
|
2011-11-01 19:44:18 +00:00
|
|
|
from hscommon.trans import trget
|
2020-07-30 01:13:58 +00:00
|
|
|
from hscommon.plat import ISLINUX
|
2011-04-21 15:17:19 +00:00
|
|
|
from core.scanner import ScanType
|
2016-05-31 02:27:59 +00:00
|
|
|
from core.app import AppMode
|
2011-01-21 12:57:54 +00:00
|
|
|
|
2022-05-09 06:40:08 +00:00
|
|
|
from qt.preferences_dialog import PreferencesDialogBase
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2020-01-01 02:16:27 +00:00
|
|
|
tr = trget("ui")
|
|
|
|
|
2011-04-21 15:17:19 +00:00
|
|
|
|
2011-01-21 12:57:54 +00:00
|
|
|
class PreferencesDialog(PreferencesDialogBase):
|
|
|
|
def _setupPreferenceWidgets(self):
|
|
|
|
self._setupFilterHardnessBox()
|
|
|
|
self.widgetsVLayout.addLayout(self.filterHardnessHLayout)
|
2021-08-15 09:10:18 +00:00
|
|
|
self._setupAddCheckbox("matchScaledBox", tr("Match pictures of different dimensions"))
|
2011-01-21 12:57:54 +00:00
|
|
|
self.widgetsVLayout.addWidget(self.matchScaledBox)
|
2020-01-01 02:16:27 +00:00
|
|
|
self._setupAddCheckbox("mixFileKindBox", tr("Can mix file kind"))
|
2011-01-21 12:57:54 +00:00
|
|
|
self.widgetsVLayout.addWidget(self.mixFileKindBox)
|
2021-08-15 09:10:18 +00:00
|
|
|
self._setupAddCheckbox("useRegexpBox", tr("Use regular expressions when filtering"))
|
2011-01-21 12:57:54 +00:00
|
|
|
self.widgetsVLayout.addWidget(self.useRegexpBox)
|
2021-08-15 09:10:18 +00:00
|
|
|
self._setupAddCheckbox("removeEmptyFoldersBox", tr("Remove empty folders on delete or move"))
|
2011-01-21 12:57:54 +00:00
|
|
|
self.widgetsVLayout.addWidget(self.removeEmptyFoldersBox)
|
2020-01-01 02:16:27 +00:00
|
|
|
self._setupAddCheckbox(
|
|
|
|
"ignoreHardlinkMatches",
|
|
|
|
tr("Ignore duplicates hardlinking to the same file"),
|
|
|
|
)
|
2011-01-21 12:57:54 +00:00
|
|
|
self.widgetsVLayout.addWidget(self.ignoreHardlinkMatches)
|
2020-08-01 17:07:45 +00:00
|
|
|
|
2011-01-21 12:57:54 +00:00
|
|
|
self._setupBottomPart()
|
2014-10-13 19:08:59 +00:00
|
|
|
|
2020-07-30 01:13:58 +00:00
|
|
|
def _setupDisplayPage(self):
|
|
|
|
super()._setupDisplayPage()
|
2021-08-15 09:10:18 +00:00
|
|
|
self._setupAddCheckbox("details_dialog_override_theme_icons", tr("Override theme icons in viewer toolbar"))
|
2020-07-30 01:13:58 +00:00
|
|
|
self.details_dialog_override_theme_icons.setToolTip(
|
2021-08-15 09:10:18 +00:00
|
|
|
tr("Use our own internal icons instead of those provided by the theme engine")
|
|
|
|
)
|
2020-07-30 01:13:58 +00:00
|
|
|
# Prevent changing this on platforms where themes are unpredictable
|
|
|
|
self.details_dialog_override_theme_icons.setEnabled(False if not ISLINUX else True)
|
|
|
|
# Insert this right after the vertical title bar option
|
2020-08-01 14:42:14 +00:00
|
|
|
index = self.details_groupbox_layout.indexOf(self.details_dialog_vertical_titlebar)
|
2021-08-15 09:10:18 +00:00
|
|
|
self.details_groupbox_layout.insertWidget(index + 1, self.details_dialog_override_theme_icons)
|
|
|
|
self._setupAddCheckbox("details_dialog_viewers_show_scrollbars", tr("Show scrollbars in image viewers"))
|
2020-07-30 01:13:58 +00:00
|
|
|
self.details_dialog_viewers_show_scrollbars.setToolTip(
|
2021-08-15 09:10:18 +00:00
|
|
|
tr(
|
|
|
|
"When the image displayed doesn't fit the viewport, \
|
|
|
|
show scrollbars to span the view around"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
self.details_groupbox_layout.insertWidget(index + 2, self.details_dialog_viewers_show_scrollbars)
|
2020-07-30 01:13:58 +00:00
|
|
|
|
2020-07-20 03:04:25 +00:00
|
|
|
def _load(self, prefs, setchecked, section):
|
2009-06-01 09:55:11 +00:00
|
|
|
setchecked(self.matchScaledBox, prefs.match_scaled)
|
2014-10-13 19:08:59 +00:00
|
|
|
|
2016-05-29 01:54:25 +00:00
|
|
|
# Update UI state based on selected scan type
|
2021-08-21 23:02:02 +00:00
|
|
|
scan_type = prefs.get_scan_type(AppMode.PICTURE)
|
|
|
|
fuzzy_scan = scan_type == ScanType.FUZZYBLOCK
|
2016-05-29 01:54:25 +00:00
|
|
|
self.filterHardnessSlider.setEnabled(fuzzy_scan)
|
2021-08-15 09:10:18 +00:00
|
|
|
setchecked(self.details_dialog_override_theme_icons, prefs.details_dialog_override_theme_icons)
|
|
|
|
setchecked(self.details_dialog_viewers_show_scrollbars, prefs.details_dialog_viewers_show_scrollbars)
|
2016-05-29 01:54:25 +00:00
|
|
|
|
2011-01-21 12:57:54 +00:00
|
|
|
def _save(self, prefs, ischecked):
|
2009-06-01 09:55:11 +00:00
|
|
|
prefs.match_scaled = ischecked(self.matchScaledBox)
|
2021-08-15 09:10:18 +00:00
|
|
|
prefs.details_dialog_override_theme_icons = ischecked(self.details_dialog_override_theme_icons)
|
|
|
|
prefs.details_dialog_viewers_show_scrollbars = ischecked(self.details_dialog_viewers_show_scrollbars)
|