1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

#671 "torrent queuing" -- better Web Client support of queue by deltasquare4

This commit is contained in:
Jordan Lee 2011-08-06 15:19:29 +00:00
parent 95223c3478
commit e8e812f787
3 changed files with 82 additions and 9 deletions

View file

@ -547,6 +547,11 @@
<li id="context_resume_selected" class="disabled context_resume_selected">Resume</li> <li id="context_resume_selected" class="disabled context_resume_selected">Resume</li>
<li id="context_resume_now_selected" class="disabled context_resume_selected">Resume Now</li> <li id="context_resume_now_selected" class="disabled context_resume_selected">Resume Now</li>
<li class="separator"></li> <li class="separator"></li>
<li id="context_move_top">Move to Top</li>
<li id="context_move_up">Move Up</li>
<li id="context_move_down">Move Down</li>
<li id="context_move_bottom">Move to Bottom</li>
<li class="separator"></li>
<li id="context_remove">Remove From List...</li> <li id="context_remove">Remove From List...</li>
<li id="context_removedata">Trash Data & Remove From List...</li> <li id="context_removedata">Trash Data & Remove From List...</li>
<li class="separator"></li> <li class="separator"></li>

View file

@ -101,6 +101,10 @@ Transmission.prototype =
this._context_pause_button = $('li#context_pause_selected')[0]; this._context_pause_button = $('li#context_pause_selected')[0];
this._context_start_button = $('li#context_resume_selected')[0]; this._context_start_button = $('li#context_resume_selected')[0];
this._context_start_now_button = $('li#context_resume_now_selected')[0]; this._context_start_now_button = $('li#context_resume_now_selected')[0];
this._context_move_top = $('li#context_move_top')[0];
this._context_move_up = $('li#context_move_up')[0];
this._context_move_down = $('li#context_move_down')[0];
this._context_move_bottom = $('li#context_move_bottom')[0];
var ti = '#torrent_inspector_'; var ti = '#torrent_inspector_';
this._inspector = { }; this._inspector = { };
@ -309,6 +313,21 @@ Transmission.prototype =
this.deselectAll( true ); this.deselectAll( true );
}, },
// Queue
contextMoveUp: function( ) {
this.moveUp( );
},
contextMoveDown: function( ) {
this.moveDown( );
},
contextMoveTop: function( ) {
this.moveTop( );
},
contextMoveBottom: function( ) {
this.moveBottom( );
},
/* /*
* Create the torrent right-click menu * Create the torrent right-click menu
*/ */
@ -324,7 +343,11 @@ Transmission.prototype =
context_reannounce: function(e){ tr.contextReannounceSelected(e); }, context_reannounce: function(e){ tr.contextReannounceSelected(e); },
context_toggle_inspector: function(e){ tr.contextToggleInspector(e); }, context_toggle_inspector: function(e){ tr.contextToggleInspector(e); },
context_select_all: function(e){ tr.contextSelectAll(e); }, context_select_all: function(e){ tr.contextSelectAll(e); },
context_deselect_all: function(e){ tr.contextDeselectAll(e); } context_deselect_all: function(e){ tr.contextDeselectAll(e); },
context_move_top: function(e){ tr.contextMoveTop(e); },
context_move_up: function(e){ tr.contextMoveUp(e); },
context_move_down: function(e){ tr.contextMoveDown(e); },
context_move_bottom: function(e){ tr.contextMoveBottom(e); }
}; };
// Setup the context menu // Setup the context menu
@ -2064,6 +2087,29 @@ Transmission.prototype =
scroll_timeout=null; scroll_timeout=null;
}, },
// Queue
moveTop: function( ) {
var torrent_ids = jQuery.map(this.getSelectedTorrents( ), function(t) { return t.id(); } );
var tr = this;
this.remote.moveTorrentsToTop( torrent_ids, function(){ tr.refreshTorrents(torrent_ids )} );
},
moveUp: function( ) {
var torrent_ids = jQuery.map(this.getSelectedTorrents( ), function(t) { return t.id(); } );
var tr = this;
this.remote.moveTorrentsUp( torrent_ids, function(){ tr.refreshTorrents(torrent_ids )} );
},
moveDown: function( ) {
var torrent_ids = jQuery.map(this.getSelectedTorrents( ), function(t) { return t.id(); } );
var tr = this;
this.remote.moveTorrentsDown( torrent_ids, function(){ tr.refreshTorrents(torrent_ids )} );
},
moveBottom: function( ) {
var torrent_ids = jQuery.map(this.getSelectedTorrents( ), function(t) { return t.id(); } );
var tr = this;
this.remote.moveTorrentsToBottom( torrent_ids, function(){ tr.refreshTorrents(torrent_ids )} );
},
/*** /***
**** ****
***/ ***/
@ -2138,14 +2184,18 @@ Transmission.prototype =
if( isSelected && !isActive ) havePausedSelection = true; if( isSelected && !isActive ) havePausedSelection = true;
} }
this.setEnabled( this._toolbar_pause_button, haveActiveSelection ); this.setEnabled( this._toolbar_pause_button, haveActiveSelection );
this.setEnabled( this._context_pause_button, haveActiveSelection ); this.setEnabled( this._context_pause_button, haveActiveSelection );
this.setEnabled( this._toolbar_start_button, havePausedSelection ); this.setEnabled( this._toolbar_start_button, havePausedSelection );
this.setEnabled( this._context_start_button, havePausedSelection ); this.setEnabled( this._context_start_button, havePausedSelection );
this.setEnabled( this._context_start_now_button, havePausedSelection ); this.setEnabled( this._context_move_top_button, haveSelection );
this.setEnabled( this._toolbar_remove_button, haveSelection ); this.setEnabled( this._context_move_up_button, haveSelection );
this.setEnabled( this._toolbar_pause_all_button, haveActive ); this.setEnabled( this._context_move_down_button, haveSelection );
this.setEnabled( this._toolbar_start_all_button, havePaused ); this.setEnabled( this._context_move_bottom_button, haveSelection );
this.setEnabled( this._context_start_now_button, havePausedSelection );
this.setEnabled( this._toolbar_remove_button, haveSelection );
this.setEnabled( this._toolbar_pause_all_button, haveActive );
this.setEnabled( this._toolbar_start_all_button, havePaused );
} }
} }
}; };

View file

@ -40,6 +40,10 @@ RPC._UtpEnabled = 'utp-enabled';
RPC._PeerPortRandom = 'peer-port-random-on-start'; RPC._PeerPortRandom = 'peer-port-random-on-start';
RPC._PortForwardingEnabled = 'port-forwarding-enabled'; RPC._PortForwardingEnabled = 'port-forwarding-enabled';
RPC._StartAddedTorrent = 'start-added-torrents'; RPC._StartAddedTorrent = 'start-added-torrents';
RPC._QueueMoveTop = 'queue-move-top';
RPC._QueueMoveBottom = 'queue-move-bottom';
RPC._QueueMoveUp = 'queue-move-up';
RPC._QueueMoveDown = 'queue-move-down';
function TransmissionRemote( controller ) function TransmissionRemote( controller )
{ {
@ -288,5 +292,19 @@ TransmissionRemote.prototype =
}, },
filesDeselectAll: function( torrent_ids, files, callback ) { filesDeselectAll: function( torrent_ids, files, callback ) {
this.sendTorrentSetRequests( 'torrent-set', torrent_ids, { 'files-unwanted': files }, callback ); this.sendTorrentSetRequests( 'torrent-set', torrent_ids, { 'files-unwanted': files }, callback );
},
// Added queue calls
moveTorrentsToTop: function( torrent_ids, callback ) {
this.sendTorrentActionRequests( RPC._QueueMoveTop, torrent_ids, callback );
},
moveTorrentsToBottom: function( torrent_ids, callback ) {
this.sendTorrentActionRequests( RPC._QueueMoveBottom, torrent_ids, callback );
},
moveTorrentsUp: function( torrent_ids, callback ) {
this.sendTorrentActionRequests( RPC._QueueMoveUp, torrent_ids, callback );
},
moveTorrentsDown: function( torrent_ids, callback ) {
this.sendTorrentActionRequests( RPC._QueueMoveDown, torrent_ids, callback );
} }
}; };