diff options
author | Arno <arno@disconnect.de> | 2016-09-04 03:32:56 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2016-09-04 03:32:56 +0200 |
commit | 8945f641f468e373b4d8d907bcc2f5be2922962e (patch) | |
tree | 93b388c81a31abbc9573603e43017098a78853ba /shemovcleaner.cpp | |
parent | e11e257f88726fd04774bf0ca4584d1678bc7f9b (diff) | |
download | ShemovCleaner-8945f641f468e373b4d8d907bcc2f5be2922962e.tar.gz ShemovCleaner-8945f641f468e373b4d8d907bcc2f5be2922962e.tar.bz2 ShemovCleaner-8945f641f468e373b4d8d907bcc2f5be2922962e.zip |
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.
Diffstat (limited to 'shemovcleaner.cpp')
-rw-r--r-- | shemovcleaner.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
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(){ |