From eb39ef9d1223bb852c356cd624af836a2f62604b Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Tue, 20 Sep 2022 00:38:16 -0400 Subject: Tweak the progress dialog. Limit the width and elide text if necessary. --- qdeduper/mingui.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'qdeduper') diff --git a/qdeduper/mingui.cpp b/qdeduper/mingui.cpp index 4e4cc87..06b380c 100644 --- a/qdeduper/mingui.cpp +++ b/qdeduper/mingui.cpp @@ -109,6 +109,16 @@ DeduperMainWindow::DeduperMainWindow() pd->setMinimumDuration(0); pd->setAutoReset(false); pd->setAutoClose(false); + pd->setWindowTitle("Progress"); + pd->setFont(this->font()); + QLabel *pdlb = new QLabel(pd); + pdlb->setMaximumWidth(500); + pdlb->setAlignment(Qt::AlignmentFlag::AlignLeft | Qt::AlignmentFlag::AlignVCenter); + pd->setLabel(pdlb); + pd->setMinimumWidth(520); + pd->setMaximumWidth(520); + pd->setMaximumHeight(120); + pd->setMinimumHeight(120); pd->close(); for (size_t i = 0; i < keys.size(); ++i) @@ -410,7 +420,10 @@ void DeduperMainWindow::scan_dirs(std::vector> paths) if (std::chrono::steady_clock::now() - lt > 100ms) { lt = std::chrono::steady_clock::now(); - this->pd->setLabelText(QString("Looking for files to scan: %1").arg(fsstr_to_qstring(p))); + QString etxt = this->fontMetrics().elidedText(QString("Looking for files to scan: %1").arg(fsstr_to_qstring(p)), + Qt::TextElideMode::ElideMiddle, + 475); + this->pd->setLabelText(etxt); this->pd->setValue(c); } }, Qt::ConnectionType::QueuedConnection); -- cgit v1.2.3