diff options
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/mainwindow.cpp | 3 | ||||
-rw-r--r-- | src/qt/workers.cpp | 14 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/qt/mainwindow.cpp b/src/qt/mainwindow.cpp index 35151ca..9d1ea85 100644 --- a/src/qt/mainwindow.cpp +++ b/src/qt/mainwindow.cpp @@ -97,6 +97,7 @@ void MainWindow::workerResult(const enum Worker::Results_t& result) case Worker::RESULT_UPDATE_TEXT: ui->progressBar->setValue(worker->progress); ui->infoLabel->setText(worker->infoText); + worker->infoText.clear(); break; case Worker::RESULT_IS_INSTALLED: @@ -233,7 +234,7 @@ void MainWindow::openWebsite() void MainWindow::resetProgress() { - ui->progressBar->setFormat(""); + ui->progressBar->setFormat("%p%"); ui->progressBar->setValue(-1); } diff --git a/src/qt/workers.cpp b/src/qt/workers.cpp index 3fce706..8eb26df 100644 --- a/src/qt/workers.cpp +++ b/src/qt/workers.cpp @@ -14,7 +14,7 @@ struct thread_object_info { int working; - QString* infoText; + QString infoText; char* of_dir; char* remote; struct revision_t* rev; @@ -26,7 +26,6 @@ static void* thread_download(void* pinfo) struct thread_object_info* info = (struct thread_object_info*)pinfo; if (info) { - QString* infoText = info->infoText; char* of_dir = info->of_dir; char* remote = info->remote; struct revision_t* rev = info->rev; @@ -35,10 +34,10 @@ static void* thread_download(void* pinfo) struct file_info* file = &rev->files[i]; if (file->type == TYPE_WRITE) { - *info->infoText = QString("Verifying %1").arg(file->object); + info->infoText = QString("Verifying %1").arg(file->object); if (verifyFileHash(of_dir, file)) { - *infoText = QString("Downloading %1").arg(file->object); + info->infoText = QString("Downloading %1").arg(file->object); downloadObject(of_dir, remote, file); } } @@ -132,23 +131,24 @@ int Worker::update_setup(int local_rev, int remote_rev) pthread_t* thread = &download_threads[tindex]; struct thread_object_info* info = &thread_info[tindex]; - QString* threadString = &infoStrings[tindex]; + QString* threadString = &info->infoText; if (!threadString->isEmpty()) { infoText = *threadString; emit resultReady(RESULT_UPDATE_TEXT); + + // allow the main thread to clear the string before we continue + while (!infoText.isEmpty() && do_work) {}; } info->working = 1; - info->infoText = threadString; info->of_dir = of_dir; info->remote = remote; info->rev = rev; info->index = i; progress = (int)(((i * 100) + 1) / rev->file_count); - emit resultReady(RESULT_UPDATE_TEXT); pthread_create(thread, NULL, thread_download, info); } |