1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-02-03 20:01:38 +00:00

Push edition-specific scan option listing down to the core

... rather than have each UI layer repeat them.

Did qt, but not cocoa yet.
This commit is contained in:
Virgil Dupras
2016-05-24 22:53:03 -04:00
parent de9122c3cb
commit 2ed1b82ecf
9 changed files with 112 additions and 135 deletions

View File

@@ -37,18 +37,17 @@ class PreferencesDialogBase(QDialog):
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
def _setupScanTypeBox(self, labels):
self.scanTypeHLayout = QHBoxLayout()
self.scanTypeLabel = QLabel(self)
self.scanTypeLabel.setText(tr("Scan Type:"))
self.scanTypeLabel.setMinimumSize(QSize(100, 0))
self.scanTypeLabel.setMaximumSize(QSize(100, 16777215))
self.scanTypeHLayout.addWidget(self.scanTypeLabel)
def _setupScanTypeBox(self):
hl = QHBoxLayout()
label = QLabel(tr("Scan Type:"), self)
label.setMinimumSize(QSize(100, 0))
label.setMaximumSize(QSize(100, 16777215))
hl.addWidget(label)
self.scanTypeComboBox = QComboBox(self)
for label in labels:
self.scanTypeComboBox.addItem(label)
self.scanTypeHLayout.addWidget(self.scanTypeComboBox)
self.widgetsVLayout.addLayout(self.scanTypeHLayout)
for scan_option in self.app.model.scanner.get_scan_options():
self.scanTypeComboBox.addItem(scan_option.label)
hl.addWidget(self.scanTypeComboBox)
self.widgetsVLayout.addLayout(hl)
def _setupFilterHardnessBox(self):
self.filterHardnessHLayout = QHBoxLayout()
@@ -141,10 +140,19 @@ class PreferencesDialogBase(QDialog):
self.mainVLayout.removeWidget(self.ignoreHardlinkMatches)
self.ignoreHardlinkMatches.setHidden(True)
def _load_scan_type(self, prefs):
SCAN_TYPE_ORDER = [so.scan_type for so in self.app.model.scanner.get_scan_options()]
scan_type_index = SCAN_TYPE_ORDER.index(prefs.scan_type)
self.scanTypeComboBox.setCurrentIndex(scan_type_index)
def _load(self, prefs, setchecked):
# Edition-specific
pass
def _save_scan_type(self, prefs):
scan_options = self.app.model.scanner.get_scan_options()
prefs.scan_type = scan_options[self.scanTypeComboBox.currentIndex()].scan_type
def _save(self, prefs, ischecked):
# Edition-specific
pass