~ubuntu-branches/ubuntu/quantal/transmission/quantal

« back to all changes in this revision

Viewing changes to web/javascript/transmission.js

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Klimonda, Krzysztof Klimonda, Chris Coulson
  • Date: 2010-03-03 02:55:26 UTC
  • mfrom: (1.1.34 upstream) (2.1.17 sid)
  • Revision ID: james.westby@ubuntu.com-20100303025526-qcjmpnlvk9jv3y5o
Tags: 1.92-0ubuntu1
[ Krzysztof Klimonda ]
* New upstream release (LP: #538034), rebased on debian testing.
  Remaining changes:
  - debian/control:
    + Added replaces & provides clutch (now included as part of transmission).
      Can be removed in lucid+1
    + Added liblaunchpad-integration-dev and lsb-release to Build-Depends
  - debian/rules:
    + create a po template during package build.
  - debian/patches/01_lpi.patch:
    + integrate transmission with launchpad
  - debian/patches/20_add_x-ubuntu-gettext-domain.diff:
    + add x-ubuntu-gettext-domain to .desktop file.
  - debian/transmission-daemon.default:
    - remove --auth from OPTIONS
  - debian/control, debian/rules:
    + build transmission gtk+ client with both gconf and libcanberra support.
  - debian/patches/dont_build_libevent.patch:
    + disable libevent in configure.ac and Makefile.am because we use autotools
      to regenerate build files.
  - lucid/debian/patches/updateminiupnpcstrings_double_escape_slash.patch:
    + Deleted as the bug is fixed upstream
* Fixes bugs:
  - Fix directory selection error in GTK+ 2.19 (LP: #518692)
  - Transmission "Set Location" - dialog doesn't disappear (LP: #529037)
  - The "Torrent Options" dialog's Torrent Priority row gets too much
    vertical stretch (LP: #527299)
  - "Open Folder" behavior can be confusing for single-file torrents
    (LP: #505861)
* Refreshed 99_autoreconf.patch

[ Chris Coulson ]
* debian/patches/disable_web_ui.patch:
  - Disable the web UI by default again (LP: #542194)

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
                $('#filter_paused_link').parent().bind('click', function(e){ tr.showPausedClicked(e); });
47
47
                $('#prefs_save_button').bind('click', function(e) { tr.savePrefsClicked(e); return false;});
48
48
                $('#prefs_cancel_button').bind('click', function(e){ tr.cancelPrefsClicked(e); return false; });
 
49
                $('#stats_close_button').bind('click', function(e){ tr.closeStatsClicked(e); return false; });
49
50
                $('.inspector_tab').bind('click', function(e){ tr.inspectorTabClicked(e, this); });
50
51
                $('.file_wanted_control').live('click', function(e){ tr.fileWantedClicked(e, this); });
51
52
                $('.file_priority_control').live('click', function(e){ tr.filePriorityClicked(e, this); });
120
121
                var tr = this;
121
122
                var async = false;
122
123
                this.loadDaemonPrefs( async );
 
124
                this.loadDaemonStats( async );
123
125
                this.initializeAllTorrents();
124
126
 
125
127
                this.togglePeriodicRefresh( true );
135
137
                }, async );
136
138
        },
137
139
 
 
140
        loadDaemonStats: function( async ){
 
141
                var tr = this;
 
142
                this.remote.loadDaemonStats( function(data){
 
143
                        var o = data.arguments;
 
144
                        tr.updateStats( o );
 
145
                }, async );
 
146
        },
 
147
 
138
148
        preloadImages: function() {
139
149
                if (iPhone) {
140
150
                        this.loadImages(
649
659
                tr.hidePrefsDialog( );
650
660
        },
651
661
 
 
662
        closeStatsClicked: function(event) {
 
663
                this.hideStatsDialog( );
 
664
        },
 
665
 
652
666
        removeClicked: function( event ) {      
653
667
                var tr = this;
654
668
                if( tr.isButtonEnabled( event ) ) {
817
831
                }
818
832
        },
819
833
 
 
834
        /*
 
835
         * Turn the periodic ajax stats refresh on & off
 
836
         */
 
837
        togglePeriodicStatsRefresh: function(state) {
 
838
                var tr = this;
 
839
                if (state && this._periodic_stats_refresh == null) {
 
840
                        // sanity check
 
841
                        if( !this[Prefs._SessionRefreshRate] )
 
842
                             this[Prefs._SessionRefreshRate] = 5;
 
843
                        remote = this.remote;
 
844
                        this._periodic_stats_refresh = setInterval(
 
845
                                function(){ tr.loadDaemonStats(); }, this[Prefs._SessionRefreshRate] * 1000
 
846
                        );
 
847
                } else {
 
848
                        clearInterval(this._periodic_stats_refresh);
 
849
                        this._periodic_stats_refresh = null;
 
850
                }
 
851
        },
 
852
 
820
853
        toggleTurtleClicked: function() {
821
854
                // Toggle the value
822
855
                this[Prefs._TurtleState] = !this[Prefs._TurtleState];
827
860
        },
828
861
 
829
862
        updateTurtleButton: function() {
 
863
                var w = $('#turtle_button');
 
864
                var t;
830
865
                if ( this[Prefs._TurtleState] ) {
831
 
                        $('#turtle_button').addClass('turtleEnabled');
832
 
                        $('#turtle_button').removeClass('turtleDisabled');
 
866
                        w.addClass('turtleEnabled');
 
867
                        w.removeClass('turtleDisabled');
 
868
                        t = "Click to disable Temporary Speed Limits";
833
869
                } else {
834
 
                        $('#turtle_button').removeClass('turtleEnabled');
835
 
                        $('#turtle_button').addClass('turtleDisabled');
 
870
                        w.removeClass('turtleEnabled');
 
871
                        w.addClass('turtleDisabled');
 
872
                        t = "Click to enable Temporary Speed Limits";
836
873
                }
 
874
                t += " (" + this._prefs[RPC._TurtleUpSpeedLimit] + " kB/s up, "
 
875
                          + this._prefs[RPC._TurtleDownSpeedLimit] + " kB/s down)";
 
876
                w.attr( 'title', t );
837
877
        },
838
878
 
839
879
        /*--------------------------------------------
915
955
                this.updateTurtleButton();
916
956
        },
917
957
 
 
958
        showStatsDialog: function( ) {
 
959
                this.loadDaemonStats();
 
960
                $('body').addClass('stats_showing');
 
961
                $('#stats_container').show();
 
962
                this.hideiPhoneAddressbar();
 
963
                if( Safari3 )
 
964
                        setTimeout("$('div#stats_container div.dialog_window').css('top', '0px');",10);
 
965
                this.updateButtonStates( );
 
966
                this.togglePeriodicStatsRefresh(true);
 
967
        },
 
968
 
 
969
        hideStatsDialog: function( ){
 
970
                $('body.stats_showing').removeClass('stats_showing');
 
971
                if (iPhone) {
 
972
                        this.hideiPhoneAddressbar();
 
973
                        $('#stats_container').hide();
 
974
                } else if (Safari3) {
 
975
                        $('div#stats_container div.dialog_window').css('top', '-425px');
 
976
                        setTimeout("$('#stats_container').hide();",500);
 
977
                } else {
 
978
                        $('#stats_container').hide();
 
979
                }
 
980
                this.updateButtonStates( );
 
981
                this.togglePeriodicStatsRefresh(false);
 
982
        },
 
983
 
 
984
        /*
 
985
         * Process got some new session stats from the server
 
986
         */
 
987
        updateStats: function( stats )
 
988
        {
 
989
                // can't think of a reason to remember this
 
990
                //this._stats = stats;
 
991
 
 
992
                var session = stats["current-stats"];
 
993
                var total = stats["cumulative-stats"];
 
994
 
 
995
                setInnerHTML( $('#stats_session_uploaded')[0], Math.formatBytes(session["uploadedBytes"]) );
 
996
                setInnerHTML( $('#stats_session_downloaded')[0], Math.formatBytes(session["downloadedBytes"]) );
 
997
                setInnerHTML( $('#stats_session_ratio')[0], Math.ratio(session["uploadedBytes"],session["downloadedBytes"]));
 
998
                setInnerHTML( $('#stats_session_duration')[0], Math.formatSeconds(session["secondsActive"]) );
 
999
                setInnerHTML( $('#stats_total_count')[0], total["sessionCount"] + " times" );
 
1000
                setInnerHTML( $('#stats_total_uploaded')[0], Math.formatBytes(total["uploadedBytes"]) );
 
1001
                setInnerHTML( $('#stats_total_downloaded')[0], Math.formatBytes(total["downloadedBytes"]) );
 
1002
                setInnerHTML( $('#stats_total_ratio')[0], Math.ratio(total["uploadedBytes"],total["downloadedBytes"]));
 
1003
                setInnerHTML( $('#stats_total_duration')[0], Math.formatSeconds(total["secondsActive"]) );
 
1004
        },
 
1005
 
918
1006
        setSearch: function( search ) {
919
1007
                this._current_search = search ? search.trim() : null;
920
1008
                this.refilter( );
947
1035
                                        $('div#prefs_container h2.dialog_heading').show();
948
1036
                                        tr.showPrefsDialog( );
949
1037
                                }
 
1038
                                else if ($element[0].id == 'statistics') {
 
1039
                                        $('div#stats_container div#stats_error').hide();
 
1040
                                        $('div#stats_container h2.dialog_heading').show();
 
1041
                                        tr.showStatsDialog( );
 
1042
                                }
950
1043
                                break;
951
1044
                        
952
1045
                        // Limit the download rate