mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-24 04:32:15 -04:00
Made DownloadState::status private
This commit is contained in:
parent
cbdb4b0404
commit
ce2fbbf7fc
@ -379,7 +379,7 @@ ContentManager::BookInfo ContentManager::getBookInfos(QString id, const QStringL
|
||||
ContentManager::BookState ContentManager::getBookState(QString bookId)
|
||||
{
|
||||
if ( const auto downloadState = DownloadManager::getDownloadState(bookId) ) {
|
||||
return downloadState->status == DownloadState::PAUSED
|
||||
return downloadState->getStatus() == DownloadState::PAUSED
|
||||
? BookState::DOWNLOAD_PAUSED
|
||||
: BookState::DOWNLOADING;
|
||||
// TODO: a download may be in error state
|
||||
|
@ -131,7 +131,7 @@ void showDownloadProgress(QPainter *painter, QRect box, const DownloadState& dow
|
||||
auto completedLength = downloadInfo.completedLength;
|
||||
auto downloadSpeed = downloadInfo.getDownloadSpeed();
|
||||
|
||||
if (downloadInfo.status == DownloadState::PAUSED) {
|
||||
if (downloadInfo.getStatus() == DownloadState::PAUSED) {
|
||||
createResumeSymbol(painter, dcl.pauseResumeButtonRect);
|
||||
createCancelButton(painter, dcl.cancelButtonRect);
|
||||
} else {
|
||||
|
@ -136,7 +136,6 @@ void DownloadManager::restoreDownloads()
|
||||
const kiwix::Book& book = mp_library->getBookById(bookId);
|
||||
if ( ! book.getDownloadId().empty() ) {
|
||||
const auto newDownload = std::make_shared<DownloadState>();
|
||||
newDownload->status = DownloadState::UNKNOWN;
|
||||
m_downloads.set(bookId, newDownload);
|
||||
}
|
||||
}
|
||||
|
@ -62,21 +62,21 @@ public: // types
|
||||
PAUSED
|
||||
};
|
||||
|
||||
|
||||
public: // data
|
||||
|
||||
double progress = 0;
|
||||
QString completedLength;
|
||||
Status status = UNKNOWN;
|
||||
|
||||
public: // functions
|
||||
void update(const DownloadInfo& info);
|
||||
QString getDownloadSpeed() const;
|
||||
Status getStatus() const { return status; }
|
||||
|
||||
// time in seconds since last update
|
||||
double timeSinceLastUpdate() const;
|
||||
|
||||
private: // data
|
||||
Status status = UNKNOWN;
|
||||
QString downloadSpeed;
|
||||
std::chrono::steady_clock::time_point lastUpdated;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user