From 8945f641f468e373b4d8d907bcc2f5be2922962e Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 4 Sep 2016 03:32:56 +0200 Subject: Display duration and num. of selected Files When selecting files in FileWidget, calculate the total duration and display it in the status bar. Also count the selected Files and show them. Update status bar on changing tabs. --- shemovcleaner.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'shemovcleaner.cpp') diff --git a/shemovcleaner.cpp b/shemovcleaner.cpp index 70b44ad..f5d74ad 100644 --- a/shemovcleaner.cpp +++ b/shemovcleaner.cpp @@ -36,6 +36,10 @@ ShemovCleaner::ShemovCleaner(QWidget *parent, Qt::WindowFlags f) : QMainWindow(p createActions(); connect(mTorrentTab, SIGNAL(statusMessage(QString)), this, SLOT(statusBarMessage(QString))); connect(mTorrentTab, SIGNAL(selectionCountChanged(QString)), this, SLOT(setSelectionCount(QString))); + connect(mFileTab, SIGNAL(statusMessage(QString)), this, SLOT(statusBarMessage(QString))); + connect(mFileTab, SIGNAL(selectionCountChanged(QString)), this, SLOT(setSelectionCount(QString))); + connect(mFileTab, SIGNAL(durationChanged(QString)), this, SLOT(setDuration(QString))); + connect(mTab, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); QSettings s; restoreGeometry(s.value("geometry").toByteArray()); @@ -45,6 +49,10 @@ void ShemovCleaner::statusBarMessage(const QString &msg){ statusBar()->showMessage(msg); } +void ShemovCleaner::setDuration(const QString &msg){ + mDuration->setText(msg); +} + void ShemovCleaner::setSelectionCount(const QString &msg){ mSelected->setText(msg); } @@ -57,6 +65,15 @@ void ShemovCleaner::configure(){ } } +void ShemovCleaner::tabChanged(int idx){ + if(idx == Torrents){ + mTorrentTab->fileSelectionChanged(QItemSelection(), QItemSelection()); + setDuration("00:00:00"); + }else if(idx == Videos){ + mFileTab->fileSelectionChanged(QItemSelection(), QItemSelection()); + } +} + void ShemovCleaner::closeEvent(QCloseEvent *e){ QSettings s; s.setValue("geometry", saveGeometry()); @@ -67,8 +84,13 @@ void ShemovCleaner::createStatusBar(){ QLabel *l1 = new QLabel(tr("Sel.")); mSelected = new QLabel("000/000"); mSelected->setFrameStyle(QFrame::Panel | QFrame::Sunken); + QLabel *l2 = new QLabel(tr("Dur.")); + mDuration = new QLabel("00:00:00"); + mDuration->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusBar()->addPermanentWidget(l1); statusBar()->addPermanentWidget(mSelected); + statusBar()->addPermanentWidget(l2); + statusBar()->addPermanentWidget(mDuration); } void ShemovCleaner::createActions(){ -- cgit v1.2.3-70-g09d2