1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 14:41:39 +00:00

Disable symlink/hardlink option when not relevant (Qt)

When the "Replace with links" option is not enabled, the choice of
symlink or hardlink is irrelevant and causes confusion. Implemented core
mechanism for controlling the enabled state of that option. Also
implemented the Qt interface for it. Cocoa-part is still to be done.

I used this opportunity to greatly enhance documentation of this part of
the code. I'm beginning to like documenting...

Ref #247.
This commit is contained in:
Virgil Dupras
2013-12-06 15:48:01 -05:00
parent 7116674663
commit cb8bb5a70e
6 changed files with 95 additions and 13 deletions

View File

@@ -22,6 +22,7 @@ class DeletionOptions(QDialog):
self._setupUi()
self.model.view = self
self.linkCheckbox.stateChanged.connect(self.linkCheckboxChanged)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
@@ -42,7 +43,6 @@ class DeletionOptions(QDialog):
self.verticalLayout.addWidget(self.linkTypeRadio)
if not self.model.supports_links():
self.linkCheckbox.setEnabled(False)
self.linkTypeRadio.setEnabled(False)
self.linkCheckbox.setText(self.linkCheckbox.text() + tr(" (unsupported)"))
self.directCheckbox = QCheckBox(tr("Directly delete files"))
self.verticalLayout.addWidget(self.directCheckbox)
@@ -56,8 +56,12 @@ class DeletionOptions(QDialog):
self.buttonBox.addButton(tr("Cancel"), QDialogButtonBox.RejectRole)
self.verticalLayout.addWidget(self.buttonBox)
#--- Signals
def linkCheckboxChanged(self, changed: int):
self.model.link_deleted = bool(changed)
#--- model --> view
def update_msg(self, msg):
def update_msg(self, msg: str):
self.msgLabel.setText(msg)
def show(self):
@@ -70,3 +74,6 @@ class DeletionOptions(QDialog):
self.model.direct = self.directCheckbox.isChecked()
return result == QDialog.Accepted
def set_hardlink_option_enabled(self, is_enabled: bool):
self.linkTypeRadio.setEnabled(is_enabled)