mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-26 03:06:37 +03:00
Performance improvement on ARM
This commit is contained in:
parent
5c8dd9f0fb
commit
8238c13dc0
5 changed files with 15 additions and 15 deletions
|
@ -518,7 +518,7 @@ QString misc::cacheLocation() {
|
|||
// use Binary prefix standards from IEC 60027-2
|
||||
// see http://en.wikipedia.org/wiki/Kilobyte
|
||||
// value must be given in bytes
|
||||
QString misc::friendlyUnit(double val) {
|
||||
QString misc::friendlyUnit(qreal val) {
|
||||
if(val < 0)
|
||||
return tr("Unknown", "Unknown (size)");
|
||||
int i = 0;
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
break;
|
||||
case PROGRESS:{
|
||||
QStyleOptionProgressBarV2 newopt;
|
||||
float progress = index.data().toDouble()*100.;
|
||||
qreal progress = index.data().toDouble()*100.;
|
||||
newopt.rect = opt.rect;
|
||||
// We don't want to display 100% unless
|
||||
// the torrent is really complete
|
||||
|
|
|
@ -81,7 +81,7 @@ using namespace libtorrent;
|
|||
QBtSession* QBtSession::m_instance = 0;
|
||||
|
||||
const int MAX_TRACKER_ERRORS = 2;
|
||||
const float MAX_RATIO = 100.;
|
||||
const qreal MAX_RATIO = 100.;
|
||||
enum VersionType { NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL };
|
||||
|
||||
// Main constructor
|
||||
|
@ -198,7 +198,7 @@ void QBtSession::processBigRatios() {
|
|||
if(!h.is_valid()) continue;
|
||||
if(h.is_seed()) {
|
||||
const QString hash = h.hash();
|
||||
const float ratio = getRealRatio(hash);
|
||||
const qreal ratio = getRealRatio(hash);
|
||||
qDebug("Ratio: %f (limit: %f)", ratio, ratio_limit);
|
||||
if(ratio <= MAX_RATIO && ratio >= ratio_limit) {
|
||||
if(high_ratio_action == REMOVE_ACTION) {
|
||||
|
@ -1395,7 +1395,7 @@ bool QBtSession::enableDHT(bool b) {
|
|||
return true;
|
||||
}
|
||||
|
||||
float QBtSession::getRealRatio(QString hash) const{
|
||||
qreal QBtSession::getRealRatio(QString hash) const{
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
if(!h.is_valid()) {
|
||||
return 0.;
|
||||
|
@ -1407,7 +1407,7 @@ float QBtSession::getRealRatio(QString hash) const{
|
|||
return 0;
|
||||
return 101;
|
||||
}
|
||||
float ratio = (float)h.all_time_upload()/(float)h.total_done();
|
||||
qreal ratio = (float)h.all_time_upload()/(float)h.total_done();
|
||||
Q_ASSERT(ratio >= 0.);
|
||||
if(ratio > 100.)
|
||||
ratio = 100.;
|
||||
|
@ -1731,7 +1731,7 @@ void QBtSession::setUploadRateLimit(long rate) {
|
|||
|
||||
// Torrents will a ratio superior to the given value will
|
||||
// be automatically deleted
|
||||
void QBtSession::setMaxRatio(float ratio) {
|
||||
void QBtSession::setMaxRatio(qreal ratio) {
|
||||
if(ratio < 0) ratio = -1.;
|
||||
if(ratio_limit == -1 && ratio != -1) {
|
||||
Q_ASSERT(!BigRatioTimer);
|
||||
|
@ -2459,14 +2459,14 @@ void QBtSession::processDownloadedFile(QString url, QString file_path) {
|
|||
// Return current download rate for the BT
|
||||
// session. Payload means that it only take into
|
||||
// account "useful" part of the rate
|
||||
float QBtSession::getPayloadDownloadRate() const{
|
||||
qreal QBtSession::getPayloadDownloadRate() const{
|
||||
return s->status().payload_download_rate;
|
||||
}
|
||||
|
||||
// Return current upload rate for the BT
|
||||
// session. Payload means that it only take into
|
||||
// account "useful" part of the rate
|
||||
float QBtSession::getPayloadUploadRate() const{
|
||||
qreal QBtSession::getPayloadUploadRate() const{
|
||||
return s->status().payload_upload_rate;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,11 +76,11 @@ public:
|
|||
QTorrentHandle getTorrentHandle(QString hash) const;
|
||||
std::vector<libtorrent::torrent_handle> getTorrents() const;
|
||||
bool isFilePreviewPossible(QString fileHash) const;
|
||||
float getPayloadDownloadRate() const;
|
||||
float getPayloadUploadRate() const;
|
||||
qreal getPayloadDownloadRate() const;
|
||||
qreal getPayloadUploadRate() const;
|
||||
libtorrent::session_status getSessionStatus() const;
|
||||
int getListenPort() const;
|
||||
float getRealRatio(QString hash) const;
|
||||
qreal getRealRatio(QString hash) const;
|
||||
QHash<QString, TrackerInfos> getTrackersInfo(QString hash) const;
|
||||
bool hasActiveTorrents() const;
|
||||
bool hasDownloadingTorrents() const;
|
||||
|
@ -129,7 +129,7 @@ public slots:
|
|||
void setMaxUploadsPerTorrent(int max);
|
||||
void setDownloadRateLimit(long rate);
|
||||
void setUploadRateLimit(long rate);
|
||||
void setMaxRatio(float ratio);
|
||||
void setMaxRatio(qreal ratio);
|
||||
void setDHTPort(int dht_port);
|
||||
void setProxySettings(const libtorrent::proxy_settings &proxySettings);
|
||||
void setSessionSettings(const libtorrent::session_settings &sessionSettings);
|
||||
|
@ -233,7 +233,7 @@ private:
|
|||
// Settings
|
||||
bool preAllocateAll;
|
||||
bool addInPause;
|
||||
float ratio_limit;
|
||||
qreal ratio_limit;
|
||||
int high_ratio_action;
|
||||
bool UPnPEnabled;
|
||||
bool LSDEnabled;
|
||||
|
|
|
@ -154,7 +154,7 @@ public:
|
|||
case TorrentModelItem::TR_RATIO:{
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
opt.displayAlignment = Qt::AlignRight;
|
||||
const double ratio = index.data().toDouble();
|
||||
const qreal ratio = index.data().toDouble();
|
||||
if(ratio > 100.)
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞"));
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue