~ubuntu-branches/ubuntu/lucid/ktorrent/lucid

« back to all changes in this revision

Viewing changes to plugins/infowidget/statustab.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2009-02-16 18:37:14 UTC
  • mfrom: (1.1.25 upstream) (0.4.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090216183714-52tf47jrnmk4xkmp
Tags: 3.2+dfsg.1-2ubuntu1
* Merge with Debian, remaining changes: (LP: #296433)
  - Use Kubuntu's kde4.mk
  - Build-depend on libboost-serialization1.35-dev since unversioned -dev is
    in universe
  - Change plasma-applet-ktorrent to plasma-widget-ktorrent since we're
    supposed to call them widgets for the users

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <kglobal.h>
25
25
#include <klocale.h>
26
26
#include <util/functions.h>
 
27
#include <util/log.h>
27
28
#include <interfaces/torrentinterface.h>
28
29
 
29
30
#include "downloadedchunkbar.h"
46
47
                ratio_limit->setMinimum(0.0f);
47
48
                ratio_limit->setMaximum(100.0f);
48
49
                ratio_limit->setSingleStep(0.1f);
 
50
                ratio_limit->setKeyboardTracking(false);
49
51
                connect(ratio_limit, SIGNAL(valueChanged(double)), this, SLOT(maxRatioChanged(double)));
50
52
                connect(use_ratio_limit, SIGNAL(toggled(bool)), this, SLOT( useRatioLimitToggled(bool)));
51
53
                
53
55
                time_limit->setMaximum(10000000.0f);
54
56
                time_limit->setSingleStep(0.05f);
55
57
                time_limit->setSpecialValueText(i18n("No limit"));
 
58
                time_limit->setKeyboardTracking(false);
56
59
                connect(use_time_limit,SIGNAL(toggled(bool)), this,SLOT(useTimeLimitToggled(bool)));
57
60
                connect(time_limit,SIGNAL(valueChanged(double)), this, SLOT(maxTimeChanged(double)));
58
61
                
153
156
                        next_update_in->clear();
154
157
                }
155
158
                
156
 
                tracker_status->setText(s.trackerstatus);
 
159
                tracker_status->setText(s.tracker_status_string);
157
160
                
158
161
                seeders->setText(QString("%1 (%2)")
159
162
                                .arg(s.seeders_connected_to).arg(s.seeders_total));
173
176
                Uint32 secs = curr_tc->getRunningTimeUL(); 
174
177
                if (secs == 0)
175
178
                {
176
 
                        avg_up_speed->setText(KBytesPerSecToString(0));
 
179
                        avg_up_speed->setText(BytesPerSecToString(0));
177
180
                }
178
181
                else
179
182
                {
180
 
                        double r = (double)s.bytes_uploaded / 1024.0;
181
 
                        avg_up_speed->setText(KBytesPerSecToString(r / secs));
 
183
                        double r = (double)s.bytes_uploaded;
 
184
                        avg_up_speed->setText(BytesPerSecToString(r / secs));
182
185
                }
183
186
                
184
187
                secs = curr_tc->getRunningTimeDL();
185
188
                if (secs == 0)
186
189
                {
187
 
                        avg_down_speed->setText(KBytesPerSecToString(0));
 
190
                        avg_down_speed->setText(BytesPerSecToString(0));
188
191
                }
189
192
                else
190
193
                {
191
 
                        double r = (double)(s.bytes_downloaded - s.imported_bytes)/ 1024.0;
192
 
                        avg_down_speed->setText(KBytesPerSecToString(r / secs));
 
194
                        double r = 0;
 
195
                        if (s.imported_bytes <= s.bytes_downloaded)
 
196
                                r = (double)(s.bytes_downloaded - s.imported_bytes);
 
197
                        else
 
198
                                r = (double)s.bytes_downloaded;
 
199
                        
 
200
                        avg_down_speed->setText(BytesPerSecToString(r / secs));
193
201
                }
194
202
        }
195
203