diff --git a/src/core/db/databasereader.cpp b/src/core/db/databasereader.cpp index 2043777c1..1616e8c90 100644 --- a/src/core/db/databasereader.cpp +++ b/src/core/db/databasereader.cpp @@ -664,7 +664,7 @@ namespace swift::core::db if (CEntityFlags::isSingleEntity(entity)) { emit this->entityDownloadProgress(entity, logId, m_networkReplyProgress, m_networkReplyCurrent, - m_networkReplyNax, url); + m_networkReplyMax, url); } } diff --git a/src/core/threadedreader.cpp b/src/core/threadedreader.cpp index 93ba36854..3e4d0da3a 100644 --- a/src/core/threadedreader.cpp +++ b/src/core/threadedreader.cpp @@ -34,8 +34,6 @@ namespace swift::core m_updateTimer.setSingleShot(true); } - CThreadedReader::~CThreadedReader() {} - qint64 CThreadedReader::lastModifiedMsSinceEpoch(QNetworkReply *nwReply) const { return CNetworkUtils::lastModifiedMsSinceEpoch(nwReply); @@ -53,28 +51,12 @@ namespace swift::core m_updateTimestamp = updateTimestamp; } - bool CThreadedReader::updatedWithinLastMs(qint64 timeLastMs) - { - QDateTime dt(getUpdateTimestamp()); - if (dt.isNull() || !dt.isValid()) { return false; } - qint64 delta = QDateTime::currentMSecsSinceEpoch() - dt.toMSecsSinceEpoch(); - return delta <= timeLastMs; - } - void CThreadedReader::startReader() { Q_ASSERT(m_initialTime > 0); QTimer::singleShot(m_initialTime, this, [=] { this->doWork(); }); } - void CThreadedReader::pauseReader() { QTimer::singleShot(0, &m_updateTimer, &QTimer::stop); } - - bool CThreadedReader::hasPendingUrls() const - { - QReadLocker l(&m_lock); - return m_urlReadLog.hasPending(); - } - CUrlLogList CThreadedReader::getUrlLogList() const { QReadLocker l(&m_lock); @@ -170,7 +152,7 @@ namespace swift::core QPair CThreadedReader::getNetworkReplyBytes() const { - return QPair(m_networkReplyCurrent, m_networkReplyNax); + return QPair(m_networkReplyCurrent, m_networkReplyMax); } void CThreadedReader::networkReplyProgress(int logId, qint64 current, qint64 max, const QUrl &url) @@ -178,7 +160,7 @@ namespace swift::core // max can be -1 if file size is not available m_networkReplyProgress = (current > 0 && max > 0) ? static_cast((current * 100) / max) : -1; m_networkReplyCurrent = current; - m_networkReplyNax = max; + m_networkReplyMax = max; Q_UNUSED(url); Q_UNUSED(logId); diff --git a/src/core/threadedreader.h b/src/core/threadedreader.h index 8c317bbfa..0016d4ea9 100644 --- a/src/core/threadedreader.h +++ b/src/core/threadedreader.h @@ -37,7 +37,7 @@ namespace swift::core static const QStringList &getLogCategories(); //! Destructor - virtual ~CThreadedReader(); + virtual ~CThreadedReader() = default; //! Thread safe, get update timestamp //! \threadsafe @@ -47,10 +47,6 @@ namespace swift::core //! \threadsafe void setUpdateTimestamp(const QDateTime &updateTimestamp = QDateTime::currentDateTimeUtc()); - //! Was setup read within last xx milliseconds - //! \threadsafe - bool updatedWithinLastMs(qint64 timeLastMs); - //! Is marked as read failed //! \threadsafe //! \deprecated likely to be removed @@ -69,26 +65,14 @@ namespace swift::core //! \threadsafe void startReader(); - //! Pauses the reader - //! \threadsafe - void pauseReader(); - //! Used in unit test //! \remark needs to be done before started in different thread void markAsUsedInUnitTest() { m_unitTest = true; } - //! Has pending URLs? - //! \threadsafe - bool hasPendingUrls() const; - //! Get the URL log list //! \threadsafe swift::misc::network::CUrlLogList getUrlLogList() const; - //! Progress 0..100 - //! \threadsafe - int getNetworkReplyProgress() const { return m_networkReplyProgress; } - //! Max./current bytes QPair getNetworkReplyBytes() const; @@ -98,7 +82,7 @@ namespace swift::core }; //!< lock which can be used from the derived classes std::atomic_int m_networkReplyProgress; //!< Progress percentage 0...100 std::atomic_llong m_networkReplyCurrent; //!< current bytes - std::atomic_llong m_networkReplyNax; //!< max bytes + std::atomic_llong m_networkReplyMax; //!< max bytes //! Constructor CThreadedReader(QObject *owner, const QString &name); @@ -106,7 +90,7 @@ namespace swift::core //! When was reply last modified, -1 if N/A qint64 lastModifiedMsSinceEpoch(QNetworkReply *nwReply) const; - //! Make sure everthing runs correctly in own thread + //! Make sure everything runs correctly in own thread void threadAssertCheck() const; //! Stores new content hash and returns if content changed (based on hash value