Giter VIP home page Giter VIP logo

Comments (1)

joecronin2 avatar joecronin2 commented on September 26, 2024

Heres an idea:
image

I looked in the source code to see if theres something that tracks uploads/downloads, and it seems that only statistics being tracked in-between sessions are all-time upload and download (code attached). For a monthly limit (or daily/weekly/etc) to work, more specific statistics need to be added (which can also be a feature on its own). Im new to this though, so would like it if someone can give some feedback. Im going to try to see if I can add support for more specific statistics first.

This is in base/bittorrent/sessionImpl.cpp:

void SessionImpl::saveStatistics() const
{
    if (!m_isStatisticsDirty)
        return;

    const QVariantHash stats {
        {u"AlltimeDL"_s, m_status.allTimeDownload},
        {u"AlltimeUL"_s, m_status.allTimeUpload}};
    std::unique_ptr<QSettings> settings = Profile::instance()->applicationSettings(u"qBittorrent-data"_s);
    settings->setValue(u"Stats/AllStats"_s, stats);

    m_statisticsLastUpdateTimer.start();
    m_isStatisticsDirty = false;
}

void SessionImpl::loadStatistics()
{
    const std::unique_ptr<QSettings> settings = Profile::instance()->applicationSettings(u"qBittorrent-data"_s);
    const QVariantHash value = settings->value(u"Stats/AllStats"_s).toHash();

    m_previouslyDownloaded = value[u"AlltimeDL"_s].toLongLong();
    m_previouslyUploaded = value[u"AlltimeUL"_s].toLongLong();
}

from qbittorrent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.