mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-18 18:11:37 +08:00
重写下载按钮逻辑
This commit is contained in:
@@ -72,16 +72,12 @@ void DownloadListWidget::clearItem()
|
||||
}
|
||||
void DownloadListWidget::addItem(QString name,QString fileName,QString pkgName,const QPixmap icon,QString downloadurl)
|
||||
{
|
||||
allDownload += 1;
|
||||
urList.append(downloadurl);
|
||||
if(dlist.contains(downloadurl))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(fileName.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
allDownload += 1;
|
||||
DownloadItem *di=new DownloadItem(this);
|
||||
dlist<<downloadurl;
|
||||
downloaditemlist<<di;
|
||||
@@ -105,6 +101,11 @@ QList<DownloadItem *> DownloadListWidget::getDIList()
|
||||
return downloaditemlist;
|
||||
}
|
||||
|
||||
QList<QUrl> DownloadListWidget::getUrlList()
|
||||
{
|
||||
return urList;
|
||||
}
|
||||
|
||||
void DownloadListWidget::startRequest(QUrl url, QString fileName)
|
||||
{
|
||||
ui->listWidget->show();
|
||||
@@ -130,7 +131,6 @@ void DownloadListWidget::httpFinished() // 完成下载
|
||||
emit downloadFinished();
|
||||
if(nowDownload < allDownload)
|
||||
{
|
||||
|
||||
// 如果有排队则下载下一个
|
||||
qDebug() << "切换下一个下载...";
|
||||
nowDownload += 1;
|
||||
@@ -143,24 +143,6 @@ void DownloadListWidget::httpFinished() // 完成下载
|
||||
}
|
||||
}
|
||||
|
||||
int DownloadListWidget::isDownloading(QString url)
|
||||
{
|
||||
int i = urList.indexOf(QUrl(url),0);
|
||||
if(i == -1){
|
||||
return 3;
|
||||
}else if(i==nowDownload-1 && isdownload)
|
||||
{
|
||||
return 1;
|
||||
}else if(i==nowDownload-1 && !isdownload)
|
||||
{
|
||||
return 2;
|
||||
}else if(i<nowDownload-1)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DownloadListWidget::updateDataReadProgress(QString speedInfo, qint64 bytesRead, qint64 totalBytes)
|
||||
{
|
||||
if(totalBytes <= 0)
|
||||
|
||||
Reference in New Issue
Block a user