diff options
author | Arno <am@disconnect.de> | 2013-07-27 03:59:47 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2013-07-27 04:02:21 +0200 |
commit | 0afebd0e3cb3da831cd5ffba1eefbe9e61e408a1 (patch) | |
tree | e92bd13b2ddda3af1af51d25c22d5042fb635139 /shemov.cpp | |
parent | 46a552d89c70895abc75d94f3c647be29873afd9 (diff) | |
download | SheMov-0afebd0e3cb3da831cd5ffba1eefbe9e61e408a1.tar.gz SheMov-0afebd0e3cb3da831cd5ffba1eefbe9e61e408a1.tar.bz2 SheMov-0afebd0e3cb3da831cd5ffba1eefbe9e61e408a1.zip |
Read JSON from ffprobe
Use JSON output from ffprobe instead of string parsing to get some kind
of type safety.
For doing that, some changes were needed in FileView: Use delegates for
displaying Duration and Bitrate instead of mangling output in
Qt::Displayrole.
To reuse code, move all delegates from the new Archive to a separate
file.
And, of course, the initial objective: Show the accumulated size and
duration of selected files in the status bar from the experimental
archive.
Diffstat (limited to 'shemov.cpp')
-rw-r--r-- | shemov.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -102,6 +102,10 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla connect(mNewMovieWizard, SIGNAL(accepted()), c->archiveTreeModel(), SLOT(refresh())); mNewPicsDialog = new NewPicsDialog(this); + //experimental archive + connect(c, SIGNAL(sizeChanged(qint64)), this, SLOT(setSize(qint64))); + connect(c, SIGNAL(durationChanged(qint64,bool)), this, SLOT(setDuration(qint64,bool))); + QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(mTab); @@ -116,7 +120,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(selectedDuration(qint64,bool)), this, SLOT(setDuration(qint64,bool))); 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 &))); @@ -197,15 +201,19 @@ void SheMov::tabChanged(int newTab){ mPVShowNPDialogA->setEnabled(newTab == FileManager); mPVAddToNPA->setEnabled(newTab == FileManager); statusbarMessage(QString()); + ArchiveController *c = SmGlobals::instance()->archiveController(); switch(newTab){ case FileManager: connect(mPVSelectAllA, SIGNAL(triggered()), mFSWidget, SLOT(selectAllPV())); - setDuration(mFSWidget->fileView()->duration()); + mFSWidget->fileView()->selectedFilesChanged(); + break; + case Experimental: + c->fileSelectionChanged(QItemSelection(), QItemSelection()); break; case Pictures: connect(mPVSelectAllA, SIGNAL(triggered()), mPicWidget->picView(), SLOT(setPVAll())); default: - setDuration(QVariant()); + setDuration(0x0, false); ;; } } @@ -322,9 +330,13 @@ void SheMov::setSize(qint64 size){ mSelectedSize->setText(val); } -void SheMov::setDuration(const QVariant dur){ - Helper::Duration d = dur.value<Helper::Duration>(); - mSelectedDuration->setText(d.toString()); +void SheMov::setDuration(qint64 dur, bool maybeMore){ + Helper::Duration d(dur); + QString t = d.toString(); + if(maybeMore){ + t.append("+"); + } + mSelectedDuration->setText(t); } QAction *SheMov::createSeparator(){ |