From a13a1c0f6b916e2cf0c11b9ed66d4bfcd15b7b9a Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Wed, 13 Dec 2023 20:26:09 +0400 Subject: [PATCH] Renamed a few member functions --- src/contentmanagermodel.cpp | 6 +++--- src/rownode.cpp | 6 +++--- src/rownode.h | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/contentmanagermodel.cpp b/src/contentmanagermodel.cpp index 4612a53..cbca712 100644 --- a/src/contentmanagermodel.cpp +++ b/src/contentmanagermodel.cpp @@ -242,7 +242,7 @@ void ContentManagerModel::startDownload(QModelIndex index) node->setDownloadState(new DownloadState); QTimer *timer = node->getDownloadState()->getDownloadUpdateTimer(); connect(timer, &QTimer::timeout, this, [=]() { - node->getDownloadState()->updateDownloadStatus(node->getBookId()); + node->getDownloadState()->update(node->getBookId()); emit dataChanged(index, index); }); } @@ -250,14 +250,14 @@ void ContentManagerModel::startDownload(QModelIndex index) void ContentManagerModel::pauseDownload(QModelIndex index) { auto node = static_cast(index.internalPointer()); - node->getDownloadState()->pauseDownload(); + node->getDownloadState()->pause(); emit dataChanged(index, index); } void ContentManagerModel::resumeDownload(QModelIndex index) { auto node = static_cast(index.internalPointer()); - node->getDownloadState()->resumeDownload(); + node->getDownloadState()->resume(); emit dataChanged(index, index); } diff --git a/src/rownode.cpp b/src/rownode.cpp index e11a104..8f2a486 100644 --- a/src/rownode.cpp +++ b/src/rownode.cpp @@ -33,7 +33,7 @@ QString convertToUnits(QString size) } // unnamed namespace -void DownloadState::updateDownloadStatus(QString id) +void DownloadState::update(QString id) { auto downloadInfos = KiwixApp::instance()->getContentManager()->updateDownloadInfos(id, {"status", "completedLength", "totalLength", "downloadSpeed"}); double percent = downloadInfos["completedLength"].toDouble() / downloadInfos["totalLength"].toDouble(); @@ -54,13 +54,13 @@ void DownloadState::updateDownloadStatus(QString id) } } -void DownloadState::pauseDownload() +void DownloadState::pause() { m_downloadInfo.paused = true; m_downloadUpdateTimer->stop(); } -void DownloadState::resumeDownload() +void DownloadState::resume() { m_downloadInfo.paused = false; m_downloadUpdateTimer->start(1000); diff --git a/src/rownode.h b/src/rownode.h index defbc2e..99cf334 100644 --- a/src/rownode.h +++ b/src/rownode.h @@ -22,9 +22,9 @@ public: bool isDownloading() const { return m_downloadUpdateTimer.get() != nullptr; } DownloadInfo getDownloadInfo() const { return m_downloadInfo; } QTimer* getDownloadUpdateTimer() const { return m_downloadUpdateTimer.get(); } - void pauseDownload(); - void resumeDownload(); - void updateDownloadStatus(QString id); + void pause(); + void resume(); + void update(QString id); protected: // This is non-NULL only for a pending (even if paused) download