diff options
author | Arno <arno@disconnect.de> | 2016-12-06 11:34:41 +0100 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2016-12-06 11:34:41 +0100 |
commit | a68cf88e69c65014f2e528aa26db42b4808c3b64 (patch) | |
tree | 430cfe8249357f38ede3e83fae4959b1a9f62fe4 /progressdialog.cpp | |
parent | 0e02ad100b0e96c77b6030853bd88a6d4706a776 (diff) | |
download | ShemovCleaner-a68cf88e69c65014f2e528aa26db42b4808c3b64.tar.gz ShemovCleaner-a68cf88e69c65014f2e528aa26db42b4808c3b64.tar.bz2 ShemovCleaner-a68cf88e69c65014f2e528aa26db42b4808c3b64.zip |
Add destination to ProgressDialog
Elide the text if necessary. Only show the destination directory.
Diffstat (limited to 'progressdialog.cpp')
-rw-r--r-- | progressdialog.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/progressdialog.cpp b/progressdialog.cpp index f354a07..2f51857 100644 --- a/progressdialog.cpp +++ b/progressdialog.cpp @@ -5,7 +5,8 @@ #include "progressdialog.h" ProgressDialog::ProgressDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f){ - mLabel = new QLabel; + mSrc = new QLabel; + mDst = new QLabel; mProgress = new QProgressBar; QPushButton *cancelBtn = new QPushButton(tr("Cancel")); connect(cancelBtn, SIGNAL(clicked()), this, SIGNAL(cancelled())); @@ -14,7 +15,8 @@ ProgressDialog::ProgressDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(par btnLayout->addWidget(cancelBtn); btnLayout->addStretch(); QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->addWidget(mLabel); + mainLayout->addWidget(mSrc); + mainLayout->addWidget(mDst); mainLayout->addWidget(mProgress); mainLayout->addLayout(btnLayout); setMaximumWidth(400); @@ -22,11 +24,13 @@ ProgressDialog::ProgressDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(par setLayout(mainLayout); } -void ProgressDialog::setLabelText(const QString &text){ - QFontMetrics fm(mLabel->font()); - int width = mLabel->width() - 4; - QString fixed = fm.elidedText(text, Qt::ElideRight, width); - mLabel->setText(fixed); +void ProgressDialog::setLabelText(const QString &src, const QString &dst){ + QFontMetrics fm(mSrc->font()); + int width = mSrc->width() - 4; + QString srcElided = fm.elidedText(src, Qt::ElideRight, width); + mSrc->setText(srcElided); + QString dstElided = fm.elidedText(dst, Qt::ElideRight, width); + mDst->setText(dstElided); } void ProgressDialog::setValue(int val){ |