mirror of
https://github.com/ioquake/launch.git
synced 2024-11-10 06:31:39 +00:00
"copy" wizard page: show the name of the file being copied.
This commit is contained in:
parent
c09b876566
commit
70dbf58f44
2 changed files with 14 additions and 1 deletions
|
@ -28,6 +28,7 @@ void CopyWorker::copy()
|
|||
return;
|
||||
}
|
||||
|
||||
emit fileChanged(QFileInfo(sourceFile.fileName()).fileName());
|
||||
const qint64 totalBytes = sourceFile.size();
|
||||
qint64 totalBytesWritten = 0;
|
||||
|
||||
|
@ -77,6 +78,7 @@ InstallWizard_Copy::~InstallWizard_Copy()
|
|||
void InstallWizard_Copy::initializePage()
|
||||
{
|
||||
isCopyFinished = false;
|
||||
copyFilename = QString();
|
||||
|
||||
// Try to create the destination directory and baseq3 subdirectory.
|
||||
const QString quake3Path(((InstallWizard *)wizard())->getQuakePath() + QString("/baseq3"));
|
||||
|
@ -93,6 +95,7 @@ void InstallWizard_Copy::initializePage()
|
|||
copyWorker->moveToThread(©Thread);
|
||||
connect(©Thread, &QThread::finished, copyWorker, &QObject::deleteLater);
|
||||
connect(this, &InstallWizard_Copy::copy, copyWorker, &CopyWorker::copy);
|
||||
connect(copyWorker, &CopyWorker::fileChanged, this, &InstallWizard_Copy::setCopyFilename);
|
||||
connect(copyWorker, &CopyWorker::progressChanged, this, &InstallWizard_Copy::setCopyProgress);
|
||||
connect(copyWorker, &CopyWorker::errorMessage, this, &InstallWizard_Copy::setCopyErrorMessage);
|
||||
connect(copyWorker, &CopyWorker::copyFinished, this, &InstallWizard_Copy::finishCopy);
|
||||
|
@ -124,9 +127,14 @@ void InstallWizard_Copy::cancel()
|
|||
}
|
||||
}
|
||||
|
||||
void InstallWizard_Copy::setCopyFilename(const QString &filename)
|
||||
{
|
||||
copyFilename = filename;
|
||||
}
|
||||
|
||||
void InstallWizard_Copy::setCopyProgress(qint64 bytesWritten, qint64 bytesTotal)
|
||||
{
|
||||
ui->lblStatus->setText(QString("Copying %1MB / %2MB").arg(bytesWritten / 1024.0 / 1024.0, 0, 'f', 2).arg(bytesTotal / 1024.0 / 1024.0, 0, 'f', 2));
|
||||
ui->lblStatus->setText(QString("Copying %1 (%2MB / %3MB)").arg(copyFilename).arg(bytesWritten / 1024.0 / 1024.0, 0, 'f', 2).arg(bytesTotal / 1024.0 / 1024.0, 0, 'f', 2));
|
||||
ui->pbProgress->setMaximum((int)bytesTotal);
|
||||
ui->pbProgress->setValue((int)bytesWritten);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ public slots:
|
|||
void copy();
|
||||
|
||||
signals:
|
||||
void fileChanged(const QString &filename);
|
||||
void progressChanged(qint64 bytesWritten, qint64 bytesTotal);
|
||||
void errorMessage(const QString &message);
|
||||
void copyFinished();
|
||||
|
@ -47,6 +48,7 @@ public:
|
|||
void cancel();
|
||||
|
||||
private slots:
|
||||
void setCopyFilename(const QString &filename);
|
||||
void setCopyProgress(qint64 bytesWritten, qint64 bytesTotal);
|
||||
void setCopyErrorMessage(const QString &message);
|
||||
void finishCopy();
|
||||
|
@ -59,6 +61,9 @@ private:
|
|||
CopyWorker *copyWorker;
|
||||
QThread copyThread;
|
||||
bool isCopyFinished;
|
||||
|
||||
// The name of the file currently being copied.
|
||||
QString copyFilename;
|
||||
};
|
||||
|
||||
#endif // INSTALLWIZARD_COPY_H
|
||||
|
|
Loading…
Reference in a new issue