From f79fc6b5e278b9d08a19f386b86c79bd1d699be7 Mon Sep 17 00:00:00 2001
From: Tydus <Tydus@Tydus.org>
Date: Sat, 8 Dec 2012 23:13:32 +0800
Subject: [PATCH] Implemented stub hash_mode settings for core and gtkui
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Based on libtorrent v0.15. It's a quick-and dirty, even stub implementation, but works fine. Contains core and gtkui patches, but not webui.
Don't know if we should put a global config for seed mode.
We should do a simple check for existance of the target files at least, as ÎŒT does.
---
deluge/core/torrentmanager.py | 1 +
deluge/ui/gtkui/addtorrentdialog.py | 5 +++++
deluge/ui/gtkui/glade/add_torrent_dialog.ui | 15 +++++++++++++++
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
index d60d785..e9565b6 100644
a
|
b
|
def add(self, torrent_info=None, state=None, options=None, save_state=True,
|
455 | 455 | add_torrent_params["paused"] = True |
456 | 456 | add_torrent_params["auto_managed"] = False |
457 | 457 | add_torrent_params["duplicate_is_error"] = True |
| 458 | add_torrent_params["seed_mode"] = options.get("seed_mode", False) |
458 | 459 | |
459 | 460 | # We need to pause the AlertManager momentarily to prevent alerts |
460 | 461 | # for this torrent being generated before a Torrent object is created. |
diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py
index e2df0c9..ad9367d 100644
a
|
b
|
def update_torrent_options(self, torrent_id):
|
411 | 411 | options["sequential_download"]) |
412 | 412 | self.builder.get_object("chk_move_completed").set_active( |
413 | 413 | options["move_completed"]) |
| 414 | self.builder.get_object("chk_seedmode").set_active( |
| 415 | options["seed_mode"]) |
414 | 416 | |
415 | 417 | def save_torrent_options(self, row=None): |
416 | 418 | # Keeps the torrent options dictionary up-to-date with what the user has |
… |
… |
def set_download_true(model, path, itr):
|
466 | 468 | self.builder.get_object("chk_sequential_download").get_active() or False |
467 | 469 | options["move_completed"] = \ |
468 | 470 | self.builder.get_object("chk_move_completed").get_active() |
| 471 | options["seed_mode"] = \ |
| 472 | self.builder.get_object("chk_seedmode").get_active() |
469 | 473 | |
470 | 474 | self.options[torrent_id] = options |
471 | 475 | |
… |
… |
def set_default_options(self):
|
521 | 525 | self.core_config["sequential_download"]) |
522 | 526 | self.builder.get_object("chk_move_completed").set_active( |
523 | 527 | self.core_config["move_completed"]) |
| 528 | self.builder.get_object("chk_seedmode").set_active(False) |
524 | 529 | |
525 | 530 | def get_file_priorities(self, torrent_id): |
526 | 531 | # A list of priorities |
diff --git a/deluge/ui/gtkui/glade/add_torrent_dialog.ui b/deluge/ui/gtkui/glade/add_torrent_dialog.ui
index c83a228..c99d9af 100644
a
|
b
|
used sparingly.</property>
|
738 | 738 | <property name="position">2</property> |
739 | 739 | </packing> |
740 | 740 | </child> |
| 741 | <child> |
| 742 | <object class="GtkCheckButton" id="chk_seedmode"> |
| 743 | <property name="label" translatable="yes">Skip _Hash Check (Seed Mode)</property> |
| 744 | <property name="visible">True</property> |
| 745 | <property name="can_focus">True</property> |
| 746 | <property name="receives_default">False</property> |
| 747 | <property name="use_underline">True</property> |
| 748 | <property name="draw_indicator">True</property> |
| 749 | </object> |
| 750 | <packing> |
| 751 | <property name="expand">False</property> |
| 752 | <property name="fill">False</property> |
| 753 | <property name="position">3</property> |
| 754 | </packing> |
| 755 | </child> |
741 | 756 | </object> |
742 | 757 | </child> |
743 | 758 | </object> |