initial working version
This commit is contained in:
112
simpleextractor/data/simpleextractor.js
Normal file
112
simpleextractor/data/simpleextractor.js
Normal file
@@ -0,0 +1,112 @@
|
||||
/*!
|
||||
* simpleextractor.js
|
||||
*
|
||||
* Copyright (c) Damien Churchill 2010 <damoxc@gmail.com>
|
||||
* Copyright (C) 2015 Chris Yereaztian <chris.yereaztian@gmail.com>
|
||||
*
|
||||
* This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
* the additional special exception to link portions of this program with the OpenSSL library.
|
||||
* See LICENSE for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
Ext.ns('Deluge.ux.preferences');
|
||||
|
||||
/**
|
||||
* @class Deluge.ux.preferences.SimpleExtractorPage
|
||||
* @extends Ext.Panel
|
||||
*/
|
||||
Deluge.ux.preferences.SimpleExtractorPage = Ext.extend(Ext.Panel, {
|
||||
|
||||
title: _('SimpleExtractor'),
|
||||
layout: 'fit',
|
||||
border: false,
|
||||
|
||||
initComponent: function() {
|
||||
Deluge.ux.preferences.SimpleExtractorPage.superclass.initComponent.call(this);
|
||||
|
||||
this.form = this.add({
|
||||
xtype: 'form',
|
||||
layout: 'form',
|
||||
border: false,
|
||||
autoHeight: true
|
||||
});
|
||||
|
||||
fieldset = this.form.add({
|
||||
xtype: 'fieldset',
|
||||
border: false,
|
||||
title: '',
|
||||
autoHeight: true,
|
||||
labelAlign: 'top',
|
||||
labelWidth: 80,
|
||||
defaultType: 'textfield'
|
||||
});
|
||||
|
||||
this.extract_path = fieldset.add({
|
||||
fieldLabel: _('Extract to:'),
|
||||
labelSeparator : '',
|
||||
name: 'extract_path',
|
||||
width: '97%'
|
||||
});
|
||||
|
||||
|
||||
this.use_name_folder = fieldset.add({
|
||||
xtype: 'checkbox',
|
||||
name: 'use_name_folder',
|
||||
height: 22,
|
||||
hideLabel: true,
|
||||
boxLabel: _('Create torrent name sub-folder')
|
||||
});
|
||||
|
||||
this.in_place_extraction = fieldset.add({
|
||||
xtype: 'checkbox',
|
||||
name: 'in_place_extraction',
|
||||
height: 22,
|
||||
hideLabel: true,
|
||||
boxLabel: _('Extract torrent in-place')
|
||||
});
|
||||
|
||||
this.on('show', this.updateConfig, this);
|
||||
},
|
||||
|
||||
onApply: function() {
|
||||
// build settings object
|
||||
var config = { }
|
||||
|
||||
config['extract_path'] = this.extract_path.getValue();
|
||||
config['use_name_folder'] = this.use_name_folder.getValue();
|
||||
config['in_place_extraction'] = this.in_place_extraction.getValue();
|
||||
|
||||
deluge.client.simpleextractor.set_config(config);
|
||||
},
|
||||
|
||||
onOk: function() {
|
||||
this.onApply();
|
||||
},
|
||||
|
||||
updateConfig: function() {
|
||||
deluge.client.simpleextractor.get_config({
|
||||
success: function(config) {
|
||||
this.extract_path.setValue(config['extract_path']);
|
||||
this.use_name_folder.setValue(config['use_name_folder']);
|
||||
this.in_place_extraction.setValue(config['in_place_extraction']);
|
||||
},
|
||||
scope: this
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Deluge.plugins.SimpleExtractorPlugin = Ext.extend(Deluge.Plugin, {
|
||||
|
||||
name: 'SimpleExtractor',
|
||||
|
||||
onDisable: function() {
|
||||
deluge.preferences.removePage(this.prefsPage);
|
||||
},
|
||||
|
||||
onEnable: function() {
|
||||
this.prefsPage = deluge.preferences.addPage(new Deluge.ux.preferences.SimpleExtractorPage());
|
||||
}
|
||||
});
|
||||
Deluge.registerPlugin('SimpleExtractor', Deluge.plugins.SimpleExtractorPlugin);
|
||||
117
simpleextractor/data/simpleextractor_prefs.glade
Normal file
117
simpleextractor/data/simpleextractor_prefs.glade
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0"?>
|
||||
<glade-interface>
|
||||
<!-- interface-requires gtk+ 2.6 -->
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<widget class="GtkWindow" id="window1">
|
||||
<child>
|
||||
<widget class="GtkVBox" id="extractor_prefs_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Extract to:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkFileChooserButton" id="folderchooser_path">
|
||||
<property name="action">select-folder</property>
|
||||
<property name="title" translatable="yes">Select A Folder</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="entry_path">
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_use_name">
|
||||
<property name="label" translatable="yes">Create torrent name sub-folder</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip" translatable="yes">This option will create a sub-folder using the torrent's name within the selected extract folder and put the extracted files there.</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_in_place_extraction">
|
||||
<property name="label" translatable="yes">Extract torrent in place</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip" translatable="yes">This option will extract the torrent in place.</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>General</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
||||
Reference in New Issue
Block a user