mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-10-24 11:12:21 +08:00
下载完成后自动更改按钮文案
This commit is contained in:
parent
f0604afcfc
commit
3fecd41c4f
@ -43,6 +43,9 @@ void AppIntoPage::clear()
|
||||
void AppIntoPage::setDownloadWidget(DownloadListWidget *w)
|
||||
{
|
||||
dw=w;
|
||||
connect(w, &DownloadListWidget::downloadFinished, [=]() {
|
||||
isDownloading();
|
||||
});
|
||||
}
|
||||
void AppIntoPage::openUrl(QUrl url)
|
||||
{
|
||||
@ -126,7 +129,7 @@ void AppIntoPage::openUrl(QUrl url)
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->downloadButton->setText(tr("Install"));
|
||||
ui->downloadButton->setText(tr("Download"));
|
||||
ui->downloadButton->setEnabled(true);
|
||||
ui->downloadButton->show();
|
||||
}
|
||||
@ -180,7 +183,7 @@ void AppIntoPage::isDownloading()
|
||||
switch (dw->isDownloading(SparkAPI::getServerUrl()+"store"+spk.path()+"/"+info["Filename"].toString())) {
|
||||
case 3:{
|
||||
ui->downloadButton->setEnabled(true);
|
||||
ui->downloadButton->setText(tr("Install"));
|
||||
ui->downloadButton->setText(tr("Download"));
|
||||
break;
|
||||
}
|
||||
case 1:{
|
||||
@ -262,6 +265,10 @@ AppIntoPage::~AppIntoPage()
|
||||
void AppIntoPage::on_downloadButton_clicked()
|
||||
{
|
||||
dw->addItem(info["Name"].toString(),info["Filename"].toString(),info["Pkgname"].toString(),iconpixmap,SparkAPI::getServerUrl()+"store"+spk.path()+"/"+info["Filename"].toString());
|
||||
if(ui->downloadButton->text() == tr("Reinstall"))
|
||||
{
|
||||
dw->getDIList()[dw->allDownload - 1]->reinstall = true;
|
||||
}
|
||||
isDownloading();
|
||||
}
|
||||
|
||||
|
||||
@ -96,6 +96,11 @@ void DownloadListWidget::addItem(QString name,QString fileName,QString pkgName,c
|
||||
}
|
||||
}
|
||||
|
||||
QList<DownloadItem *> DownloadListWidget::getDIList()
|
||||
{
|
||||
return downloaditemlist;
|
||||
}
|
||||
|
||||
void DownloadListWidget::startRequest(QUrl url, QString fileName)
|
||||
{
|
||||
ui->listWidget->show();
|
||||
@ -117,6 +122,7 @@ void DownloadListWidget::httpFinished() // 完成下载
|
||||
isBusy = false;
|
||||
downloaditemlist[nowDownload - 1]->readyInstall();
|
||||
downloaditemlist[nowDownload - 1]->free = true;
|
||||
emit downloadFinished();
|
||||
if(nowDownload < allDownload)
|
||||
{
|
||||
|
||||
|
||||
@ -22,13 +22,14 @@ class DownloadListWidget : public DBlurEffectWidget
|
||||
public:
|
||||
void addItem(QString name, QString fileName, QString pkgName, const QPixmap icon, QString downloadurl);
|
||||
int isDownloading(QString url);
|
||||
int nowDownload = 0;
|
||||
int allDownload = 0;
|
||||
QList<DownloadItem *> getDIList();
|
||||
void m_move(int x, int y);
|
||||
explicit DownloadListWidget(QWidget *parent = nullptr);
|
||||
~DownloadListWidget();
|
||||
|
||||
private:
|
||||
int nowDownload = 0;
|
||||
int allDownload = 0;
|
||||
int isdownload = false;
|
||||
bool isBusy = false;
|
||||
QStringList dlist;
|
||||
@ -51,6 +52,8 @@ private slots:
|
||||
bool eventFilter(QObject *, QEvent *);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void on_pushButton_clicked();
|
||||
signals:
|
||||
void downloadFinished();
|
||||
};
|
||||
|
||||
#endif // DOWNLOADLISTWIDGET_H
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user