mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-21 19:18:39 -04:00
Got rid of DownloadState::setDownloadInfo()
This commit is contained in:
parent
960f955723
commit
8ad42a2dc2
@ -265,7 +265,6 @@ void ContentManagerModel::cancelDownload(QModelIndex index)
|
||||
{
|
||||
auto node = static_cast<RowNode*>(index.internalPointer());
|
||||
node->setIsDownloading(false); // this stops & deletes the timer
|
||||
node->setDownloadInfo({0, "", "", false});
|
||||
emit dataChanged(index, index);
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,7 @@ void DownloadState::setIsDownloading(bool val)
|
||||
// of any events that may be in the process of being delivered to it
|
||||
// from another thread.
|
||||
m_downloadUpdateTimer.reset();
|
||||
m_downloadInfo = {0, "", "", false};
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,7 +124,7 @@ void DownloadState::updateDownloadStatus(QString id)
|
||||
percent = QString::number(percent, 'g', 3).toDouble();
|
||||
auto completedLength = convertToUnits(downloadInfos["completedLength"].toString());
|
||||
auto downloadSpeed = convertToUnits(downloadInfos["downloadSpeed"].toString()) + "/s";
|
||||
setDownloadInfo({percent, completedLength, downloadSpeed, false});
|
||||
m_downloadInfo = {percent, completedLength, downloadSpeed, false};
|
||||
if (!downloadInfos["status"].isValid()) {
|
||||
setIsDownloading(false); // this stops & deletes the timer
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ public:
|
||||
DownloadState();
|
||||
|
||||
bool isDownloading() const { return m_downloadUpdateTimer.get() != nullptr; }
|
||||
void setDownloadInfo(DownloadInfo downloadInfo) { m_downloadInfo = downloadInfo; }
|
||||
DownloadInfo getDownloadInfo() const { return m_downloadInfo; }
|
||||
QTimer* getDownloadUpdateTimer() const { return m_downloadUpdateTimer.get(); }
|
||||
void setIsDownloading(bool val);
|
||||
|
Loading…
x
Reference in New Issue
Block a user