From bae5fda42367ebbf1879a7cd588c1423480fbfa3 Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Sat, 16 May 2020 15:54:22 +0800 Subject: [PATCH] Improve UI display --- src/frontend/import_dialog.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/frontend/import_dialog.cpp b/src/frontend/import_dialog.cpp index 66a0faf..4caa830 100644 --- a/src/frontend/import_dialog.cpp +++ b/src/frontend/import_dialog.cpp @@ -463,8 +463,13 @@ void ImportDialog::StartImporting() { const u64 multiplier = (total_size + std::numeric_limits::max() - 1) / std::numeric_limits::max(); + auto* label = new QLabel(tr("Initializing...")); + label->setWordWrap(true); + label->setFixedWidth(600); + auto* dialog = new QProgressDialog(tr("Initializing..."), tr("Cancel"), 0, static_cast(total_size / multiplier), this); + dialog->setLabel(label); dialog->setWindowModality(Qt::WindowModal); dialog->setMinimumDuration(0); dialog->setValue(0); @@ -475,11 +480,12 @@ void ImportDialog::StartImporting() { [this, dialog, multiplier, total_count](u64 size_imported, u64 count, Core::ContentSpecifier next_content) { dialog->setValue(static_cast(size_imported / multiplier)); - dialog->setLabelText(tr("(%1/%2) Importing %3 (%4)...") - .arg(count) - .arg(total_count) - .arg(GetContentName(next_content)) - .arg(GetContentTypeName(next_content.type))); + dialog->setLabelText( + tr("

(%1/%2) Importing %3 (%4)...

") + .arg(count) + .arg(total_count) + .arg(GetContentName(next_content)) + .arg(GetContentTypeName(next_content.type))); current_content = next_content; current_count = count; }); @@ -487,7 +493,8 @@ void ImportDialog::StartImporting() { [this, dialog, multiplier, total_count](u64 total_size_imported, u64 current_size_imported) { dialog->setValue(static_cast(total_size_imported / multiplier)); - dialog->setLabelText(tr("(%1/%2) Importing %3 (%4) (%5/%6)...") + dialog->setLabelText(tr("

(%1/%2) Importing %3 (%4)...

%5 / %6

") .arg(current_count) .arg(total_count) .arg(GetContentName(current_content))