mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-07-18 19:42:21 +08:00
修复在第一次下载进度报告前取消下载导致崩溃的问题
This commit is contained in:
parent
b0a2d64b71
commit
904cc3cb1c
@ -13,11 +13,11 @@ SpkUi::SpkPageDownloads::SpkPageDownloads(QWidget *parent) :
|
||||
mScrollWidget = new QWidget;
|
||||
mScrollArea = new QScrollArea(this);
|
||||
|
||||
mLayEntries->setAlignment(Qt::AlignTop);
|
||||
mScrollWidget->setLayout(mLayEntries);
|
||||
mScrollArea->setWidget(mScrollWidget);
|
||||
mScrollArea->setWidgetResizable(true);
|
||||
mMainLay->addWidget(mScrollArea);
|
||||
mMainLay->addStretch();
|
||||
setLayout(mMainLay);
|
||||
|
||||
mDownloadMgr = new SpkDownloadMgr(this);
|
||||
@ -118,6 +118,8 @@ void SpkUi::SpkPageDownloads::DownloadStopped(SpkDownloadMgr::TaskResult status,
|
||||
if(!mWaitingDownloads.isEmpty())
|
||||
{
|
||||
auto nextTask = mWaitingDownloads.dequeue();
|
||||
auto nextEntry = mEntries[nextTask.first];
|
||||
nextEntry->SetStatus(SpkDownloadEntry::Starting);
|
||||
mDownloadMgr->StartNewDownload(nextTask.second, nextTask.first);
|
||||
mCurrentStatus = Waiting;
|
||||
}
|
||||
@ -199,6 +201,8 @@ void SpkUi::SpkPageDownloads::NewDownloadTask(int id, QString downloadPath)
|
||||
mWaitingDownloads.enqueue({ id, downloadPath }); // Queue download task for future
|
||||
else
|
||||
{
|
||||
auto nextEntry = mEntries[id];
|
||||
nextEntry->SetStatus(SpkDownloadEntry::Starting);
|
||||
mCurrentStatus = Waiting;
|
||||
if(!mDownloadMgr->StartNewDownload(downloadPath, id)) // Initiate a download task when idle
|
||||
{
|
||||
|
@ -81,10 +81,16 @@ void SpkDownloadEntry::SetStatus(DownloadEntryStatus status, QString msg)
|
||||
mBtnDelete->setText(tr("Cancel"));
|
||||
break;
|
||||
|
||||
case Starting:
|
||||
mMessage->setText(tr("Starting download"));
|
||||
mBtnDelete->setVisible(false);
|
||||
break;
|
||||
|
||||
case Downloading:
|
||||
mMessage->setText(tr(""));
|
||||
mProgress->setVisible(true);
|
||||
mBtnActions->setVisible(false);
|
||||
mBtnDelete->setVisible(true);
|
||||
break;
|
||||
|
||||
case DownloadFailed:
|
||||
|
@ -25,6 +25,7 @@ class SpkDownloadEntry : public QWidget
|
||||
{
|
||||
Invalid = -1,
|
||||
Waiting,
|
||||
Starting,
|
||||
Downloading,
|
||||
DownloadFailed,
|
||||
ToBeInstalled,
|
||||
|
25
lang/zh.ts
25
lang/zh.ts
@ -201,38 +201,43 @@ Right now we are not just a Chinese group. We are discovering our way into more
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="81"/>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="130"/>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="136"/>
|
||||
<source>Cancel</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="94"/>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="85"/>
|
||||
<source>Starting download</source>
|
||||
<translation>正在开始下载</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="100"/>
|
||||
<source>Retry</source>
|
||||
<translation>重试</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="99"/>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="105"/>
|
||||
<source>Download Finished</source>
|
||||
<translation>下载完成</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="103"/>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="128"/>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="109"/>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="134"/>
|
||||
<source>Install</source>
|
||||
<translation>安装</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="116"/>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="122"/>
|
||||
<source>Installed</source>
|
||||
<translation>已安装完成</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="120"/>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="126"/>
|
||||
<source>Delete</source>
|
||||
<translation>删除</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="124"/>
|
||||
<location filename="../gui/spkdownloadentry.cpp" line="130"/>
|
||||
<source>Install Failed</source>
|
||||
<translation>安装失败</translation>
|
||||
</message>
|
||||
@ -772,12 +777,12 @@ to use terminal for program output.</source>
|
||||
<translation>下载“%1”时出错。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/page/spkpagedownloads.cpp" line="156"/>
|
||||
<location filename="../gui/page/spkpagedownloads.cpp" line="158"/>
|
||||
<source>Failed to start installation.</source>
|
||||
<translation>无法开始安装。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/page/spkpagedownloads.cpp" line="192"/>
|
||||
<location filename="../gui/page/spkpagedownloads.cpp" line="194"/>
|
||||
<source>Install failed, exit code: %1.</source>
|
||||
<translation>安装失败,退出代码:%1。</translation>
|
||||
</message>
|
||||
|
Loading…
x
Reference in New Issue
Block a user