1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Actually show extraction progress during mod installation

This commit is contained in:
Ivan Savenko
2023-12-18 00:34:00 +02:00
parent 74dedc4cc5
commit 1a4bcfadbc
2 changed files with 10 additions and 1 deletions

View File

@@ -591,7 +591,7 @@ void CModListView::downloadFile(QString file, QString url, QString description,
this, SLOT(downloadFinished(QStringList,QStringList,QStringList))); this, SLOT(downloadFinished(QStringList,QStringList,QStringList)));
connect(manager.get(), SIGNAL(extractionProgress(qint64,qint64)), connect(manager.get(), SIGNAL(extractionProgress(qint64,qint64)),
this, SLOT(downloadProgress(qint64,qint64))); this, SLOT(extractionProgress(qint64,qint64)));
connect(modModel, &CModListModel::dataChanged, filterModel, &QAbstractItemModel::dataChanged); connect(modModel, &CModListModel::dataChanged, filterModel, &QAbstractItemModel::dataChanged);
@@ -613,6 +613,14 @@ void CModListView::downloadProgress(qint64 current, qint64 max)
ui->progressBar->setValue(current / (1024 * 1024)); ui->progressBar->setValue(current / (1024 * 1024));
} }
void CModListView::extractionProgress(qint64 current, qint64 max)
{
// display progress, in extracted files
ui->progressBar->setVisible(true);
ui->progressBar->setMaximum(max);
ui->progressBar->setValue(current);
}
void CModListView::downloadFinished(QStringList savedFiles, QStringList failedFiles, QStringList errors) void CModListView::downloadFinished(QStringList savedFiles, QStringList failedFiles, QStringList errors)
{ {
QString title = tr("Download failed"); QString title = tr("Download failed");

View File

@@ -98,6 +98,7 @@ private slots:
void dataChanged(const QModelIndex & topleft, const QModelIndex & bottomRight); void dataChanged(const QModelIndex & topleft, const QModelIndex & bottomRight);
void modSelected(const QModelIndex & current, const QModelIndex & previous); void modSelected(const QModelIndex & current, const QModelIndex & previous);
void downloadProgress(qint64 current, qint64 max); void downloadProgress(qint64 current, qint64 max);
void extractionProgress(qint64 current, qint64 max);
void downloadFinished(QStringList savedFiles, QStringList failedFiles, QStringList errors); void downloadFinished(QStringList savedFiles, QStringList failedFiles, QStringList errors);
void modelReset(); void modelReset();
void hideProgressBar(); void hideProgressBar();