From 153683e2e961b13c5e97e582563656851bce377c Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 22 Mar 2013 09:18:52 +0100 Subject: Show duration in statusBar Show total duration of selected Movies in FileView. Created a new class Helper::Duration for this and declared it as QMetaType. --- shemov.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'shemov.cpp') diff --git a/shemov.cpp b/shemov.cpp index 107959b..6aa7c74 100644 --- a/shemov.cpp +++ b/shemov.cpp @@ -127,6 +127,7 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla splash.showMessage(tr("Finishing..."), Qt::AlignHCenter, Qt::yellow); qApp->processEvents(); connect(mFSWidget->fileView(), SIGNAL(selectedSize(qint64)), this, SLOT(setSize(qint64))); + connect(mFSWidget->fileView(), SIGNAL(selectedDuration(QVariant)), this, SLOT(setDuration(QVariant))); connect(mFSWidget->fileView(), SIGNAL(numSelected(int)), this, SLOT(updateSelectedCount(int))); connect(mFSWidget, SIGNAL(windowTitle(QString)), this, SLOT(setWindowTitle(QString))); connect(mFSWidget->fileView(), SIGNAL(statusbarMessage(const QString &)), this, SLOT(statusbarMessage(const QString &))); @@ -202,14 +203,16 @@ void SheMov::tabChanged(int newTab){ mPVSelectAllA->disconnect(); mPVShowNPDialogA->setEnabled(newTab == 0); mPVAddToNPA->setEnabled(newTab == 0); + statusbarMessage(QString()); switch(newTab){ case 0: connect(mPVSelectAllA, SIGNAL(triggered()), mFSWidget, SLOT(selectAllPV())); + setDuration(mFSWidget->fileView()->duration()); break; case 2: connect(mPVSelectAllA, SIGNAL(triggered()), mPicWidget->picView(), SLOT(setPVAll())); - break; default: + setDuration(QVariant()); ;; } } @@ -327,6 +330,11 @@ void SheMov::setSize(qint64 size){ mSelectedSize->setText(val); } +void SheMov::setDuration(const QVariant dur){ + Helper::Duration d = dur.value(); + mSelectedDuration->setText(d.toString()); +} + QAction *SheMov::createSeparator(){ QAction *tmp = new QAction(this); tmp->setSeparator(true); @@ -349,6 +357,11 @@ QSignalMapper *SheMov::createHeaderMapper(SmTreeModel *model, QActionGroup *grou } void SheMov::createStatusbar(){ + QLabel *selDurL = new QLabel(tr("Duration")); + mSelectedDuration = new QLabel("00:00:00"); + mSelectedDuration->setFrameStyle(QFrame::Panel | QFrame::Sunken); + statusBar()->addPermanentWidget(selDurL); + statusBar()->addPermanentWidget(mSelectedDuration); QLabel *selSizeL = new QLabel(tr("Sel. Size")); mSelectedSize = new QLabel(tr("nothing selected yet")); mSelectedSize->setFrameStyle(QFrame::Panel | QFrame::Sunken); -- cgit v1.2.3-70-g09d2