Ticket #1294: 0001-Implemented-stub-hash_mode-settings-for-core-and-gtk.2.patch

File 0001-Implemented-stub-hash_mode-settings-for-core-and-gtk.2.patch, 4.5 KB (added by Tydus, 12 years ago)

Patch for git master

  • deluge/core/torrentmanager.py

    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,  
    455455        add_torrent_params["paused"] = True
    456456        add_torrent_params["auto_managed"] = False
    457457        add_torrent_params["duplicate_is_error"] = True
     458        add_torrent_params["seed_mode"] = options.get("seed_mode", False)
    458459
    459460        # We need to pause the AlertManager momentarily to prevent alerts
    460461        # for this torrent being generated before a Torrent object is created.
  • deluge/ui/gtkui/addtorrentdialog.py

    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):  
    411411            options["sequential_download"])
    412412        self.builder.get_object("chk_move_completed").set_active(
    413413            options["move_completed"])
     414        self.builder.get_object("chk_seedmode").set_active(
     415            options["seed_mode"])
    414416
    415417    def save_torrent_options(self, row=None):
    416418        # Keeps the torrent options dictionary up-to-date with what the user has
    def set_download_true(model, path, itr):  
    466468            self.builder.get_object("chk_sequential_download").get_active() or False
    467469        options["move_completed"] = \
    468470            self.builder.get_object("chk_move_completed").get_active()
     471        options["seed_mode"] = \
     472            self.builder.get_object("chk_seedmode").get_active()
    469473
    470474        self.options[torrent_id] = options
    471475
    def set_default_options(self):  
    521525            self.core_config["sequential_download"])
    522526        self.builder.get_object("chk_move_completed").set_active(
    523527            self.core_config["move_completed"])
     528        self.builder.get_object("chk_seedmode").set_active(False)
    524529
    525530    def get_file_priorities(self, torrent_id):
    526531        # A list of priorities
  • deluge/ui/gtkui/glade/add_torrent_dialog.ui

    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>  
    738738                                        <property name="position">2</property>
    739739                                      </packing>
    740740                                    </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>
    741756                                  </object>
    742757                                </child>
    743758                              </object>