diff options
author | Arno <arno@disconnect.de> | 2018-07-30 20:36:59 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2018-07-30 20:36:59 +0200 |
commit | 598cb833aec9a404271a99eac6f7d360e62ce5c4 (patch) | |
tree | 91956bc278444c0e44d8760e72ee7e4fac51448a /shemovcleaner.cpp | |
parent | fa1f377ff5ce22f399b167e4e4b97b1a0f0ae5f9 (diff) | |
download | ShemovCleaner-598cb833aec9a404271a99eac6f7d360e62ce5c4.tar.gz ShemovCleaner-598cb833aec9a404271a99eac6f7d360e62ce5c4.tar.bz2 ShemovCleaner-598cb833aec9a404271a99eac6f7d360e62ce5c4.zip |
Give some indication that we're copying
Add a new label to the statusBar: When it's green the FileCopier is
idle, when working, show the count.
Diffstat (limited to 'shemovcleaner.cpp')
-rw-r--r-- | shemovcleaner.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/shemovcleaner.cpp b/shemovcleaner.cpp index 65153d8..fa21934 100644 --- a/shemovcleaner.cpp +++ b/shemovcleaner.cpp @@ -20,6 +20,7 @@ #include "shemovcleaner.h" #include "torrentwidget.h" #include "filewidget.h" +#include "filecopier.h" #include "torrentdisplay.h" #include "configurationwidget.h" #include "filewidget.h" @@ -65,6 +66,8 @@ ShemovCleaner::ShemovCleaner(QWidget *parent, Qt::WindowFlags f) : QMainWindow(p connect(mFileTab, &FileWidget::freeSpaceChanged, this, &ShemovCleaner::updateFreeSpace); connect(mTab, &QTabWidget::currentChanged, this, &ShemovCleaner::tabChanged); connect(this, &ShemovCleaner::configurationChanged, mFileTab, &FileWidget::readSettings); + connect(mFileTab->fileCopier(), &FileCopier::copying, this, &ShemovCleaner::updateCopying); + connect(mFileTab->fileCopier(), &FileCopier::finished, [=] { updateCopying(false, QString());} ); QMenu *helpMenu = new QMenu(tr("&Help")); QAction *aboutThisA = new QAction(tr("About ShemovCleaner..."), this); @@ -127,6 +130,22 @@ void ShemovCleaner::updateFreeSpace(const QString &path){ mFree->setPixmap(QPixmap::fromImage(img)); } +void ShemovCleaner::updateCopying(bool inProgress, const QString &count){ + QImage img(mCopying->size(), QImage::Format_ARGB32); + if(inProgress){ + img.fill(Qt::red); + QPainter p(&img); + QFont f(qApp->font()); + f.setBold(true); + p.setFont(f); + p.setPen(Qt::blue); + p.drawText(mCopying->rect(), Qt::AlignCenter, count); + }else{ + img.fill(Qt::green); + } + mCopying->setPixmap(QPixmap::fromImage(img)); +} + void ShemovCleaner::setSelectionCount(const QString &msg){ mSelected->setText(msg); } @@ -184,12 +203,21 @@ void ShemovCleaner::createStatusBar(){ f.setBold(true); QFontMetrics fm(f); mFree->setMaximumHeight(fm.height() + 6); + mCopying = new QLabel; + mCopying->setFrameStyle(QFrame::Panel | QFrame::Sunken); + mCopying->setMinimumWidth(fm.maxWidth() + 6); + mCopying->setMaximumWidth(fm.maxWidth() + 6); + mCopying->setMaximumHeight(fm.height() + 6); + mCopying->setMinimumHeight(fm.height() + 6); + statusBar()->addPermanentWidget(new QLabel(tr("C:"))); + statusBar()->addPermanentWidget(mCopying); statusBar()->addPermanentWidget(l1); statusBar()->addPermanentWidget(mSelected); statusBar()->addPermanentWidget(l2); statusBar()->addPermanentWidget(mDuration); statusBar()->addPermanentWidget(mDrive); statusBar()->addPermanentWidget(mFree); + updateCopying(false, QString()); } void ShemovCleaner::createGlobalActions(){ |