mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 03:26:05 -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());
|
auto node = static_cast<RowNode*>(index.internalPointer());
|
||||||
node->setIsDownloading(false); // this stops & deletes the timer
|
node->setIsDownloading(false); // this stops & deletes the timer
|
||||||
node->setDownloadInfo({0, "", "", false});
|
|
||||||
emit dataChanged(index, index);
|
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
|
// of any events that may be in the process of being delivered to it
|
||||||
// from another thread.
|
// from another thread.
|
||||||
m_downloadUpdateTimer.reset();
|
m_downloadUpdateTimer.reset();
|
||||||
|
m_downloadInfo = {0, "", "", false};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ void DownloadState::updateDownloadStatus(QString id)
|
|||||||
percent = QString::number(percent, 'g', 3).toDouble();
|
percent = QString::number(percent, 'g', 3).toDouble();
|
||||||
auto completedLength = convertToUnits(downloadInfos["completedLength"].toString());
|
auto completedLength = convertToUnits(downloadInfos["completedLength"].toString());
|
||||||
auto downloadSpeed = convertToUnits(downloadInfos["downloadSpeed"].toString()) + "/s";
|
auto downloadSpeed = convertToUnits(downloadInfos["downloadSpeed"].toString()) + "/s";
|
||||||
setDownloadInfo({percent, completedLength, downloadSpeed, false});
|
m_downloadInfo = {percent, completedLength, downloadSpeed, false};
|
||||||
if (!downloadInfos["status"].isValid()) {
|
if (!downloadInfos["status"].isValid()) {
|
||||||
setIsDownloading(false); // this stops & deletes the timer
|
setIsDownloading(false); // this stops & deletes the timer
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ public:
|
|||||||
DownloadState();
|
DownloadState();
|
||||||
|
|
||||||
bool isDownloading() const { return m_downloadUpdateTimer.get() != nullptr; }
|
bool isDownloading() const { return m_downloadUpdateTimer.get() != nullptr; }
|
||||||
void setDownloadInfo(DownloadInfo downloadInfo) { m_downloadInfo = downloadInfo; }
|
|
||||||
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 setIsDownloading(bool val);
|
void setIsDownloading(bool val);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user