mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 11:37:56 -04:00
Renamed a few member functions
This commit is contained in:
parent
9ce484a664
commit
a13a1c0f6b
@ -242,7 +242,7 @@ void ContentManagerModel::startDownload(QModelIndex index)
|
|||||||
node->setDownloadState(new DownloadState);
|
node->setDownloadState(new DownloadState);
|
||||||
QTimer *timer = node->getDownloadState()->getDownloadUpdateTimer();
|
QTimer *timer = node->getDownloadState()->getDownloadUpdateTimer();
|
||||||
connect(timer, &QTimer::timeout, this, [=]() {
|
connect(timer, &QTimer::timeout, this, [=]() {
|
||||||
node->getDownloadState()->updateDownloadStatus(node->getBookId());
|
node->getDownloadState()->update(node->getBookId());
|
||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -250,14 +250,14 @@ void ContentManagerModel::startDownload(QModelIndex index)
|
|||||||
void ContentManagerModel::pauseDownload(QModelIndex index)
|
void ContentManagerModel::pauseDownload(QModelIndex index)
|
||||||
{
|
{
|
||||||
auto node = static_cast<RowNode*>(index.internalPointer());
|
auto node = static_cast<RowNode*>(index.internalPointer());
|
||||||
node->getDownloadState()->pauseDownload();
|
node->getDownloadState()->pause();
|
||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentManagerModel::resumeDownload(QModelIndex index)
|
void ContentManagerModel::resumeDownload(QModelIndex index)
|
||||||
{
|
{
|
||||||
auto node = static_cast<RowNode*>(index.internalPointer());
|
auto node = static_cast<RowNode*>(index.internalPointer());
|
||||||
node->getDownloadState()->resumeDownload();
|
node->getDownloadState()->resume();
|
||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ QString convertToUnits(QString size)
|
|||||||
|
|
||||||
} // unnamed namespace
|
} // unnamed namespace
|
||||||
|
|
||||||
void DownloadState::updateDownloadStatus(QString id)
|
void DownloadState::update(QString id)
|
||||||
{
|
{
|
||||||
auto downloadInfos = KiwixApp::instance()->getContentManager()->updateDownloadInfos(id, {"status", "completedLength", "totalLength", "downloadSpeed"});
|
auto downloadInfos = KiwixApp::instance()->getContentManager()->updateDownloadInfos(id, {"status", "completedLength", "totalLength", "downloadSpeed"});
|
||||||
double percent = downloadInfos["completedLength"].toDouble() / downloadInfos["totalLength"].toDouble();
|
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_downloadInfo.paused = true;
|
||||||
m_downloadUpdateTimer->stop();
|
m_downloadUpdateTimer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DownloadState::resumeDownload()
|
void DownloadState::resume()
|
||||||
{
|
{
|
||||||
m_downloadInfo.paused = false;
|
m_downloadInfo.paused = false;
|
||||||
m_downloadUpdateTimer->start(1000);
|
m_downloadUpdateTimer->start(1000);
|
||||||
|
@ -22,9 +22,9 @@ public:
|
|||||||
bool isDownloading() const { return m_downloadUpdateTimer.get() != nullptr; }
|
bool isDownloading() const { return m_downloadUpdateTimer.get() != nullptr; }
|
||||||
DownloadInfo getDownloadInfo() const { return m_downloadInfo; }
|
DownloadInfo getDownloadInfo() const { return m_downloadInfo; }
|
||||||
QTimer* getDownloadUpdateTimer() const { return m_downloadUpdateTimer.get(); }
|
QTimer* getDownloadUpdateTimer() const { return m_downloadUpdateTimer.get(); }
|
||||||
void pauseDownload();
|
void pause();
|
||||||
void resumeDownload();
|
void resume();
|
||||||
void updateDownloadStatus(QString id);
|
void update(QString id);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// This is non-NULL only for a pending (even if paused) download
|
// This is non-NULL only for a pending (even if paused) download
|
||||||
|
Loading…
x
Reference in New Issue
Block a user