summaryrefslogtreecommitdiffstats
path: root/shemovcleaner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'shemovcleaner.cpp')
-rw-r--r--shemovcleaner.cpp28
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(){