diff options
Diffstat (limited to 'archivecontroller.cpp')
| -rw-r--r-- | archivecontroller.cpp | 26 | 
1 files changed, 26 insertions, 0 deletions
| diff --git a/archivecontroller.cpp b/archivecontroller.cpp index 30d94f3..bda54c2 100644 --- a/archivecontroller.cpp +++ b/archivecontroller.cpp @@ -61,6 +61,7 @@ void ArchiveController::setMetadata(QTextEdit *metadata){  void ArchiveController::init(){      connect(mArchiveSelection, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(treeSelectionChanged(QItemSelection,QItemSelection)));      connect(mArchiveFiles, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(fileDoubleClicked(QModelIndex))); +    connect(mFileSelection, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(fileSelectionChanged(QItemSelection,QItemSelection)));  }  void ArchiveController::playSelectedFiles(){ @@ -211,6 +212,31 @@ void ArchiveController::treeSelectionChanged(const QItemSelection &selected, con      }  } +void ArchiveController::fileSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected){ +    Q_UNUSED(selected); +    Q_UNUSED(deselected); +    QModelIndexList sel = mapToSource(mArchiveFilesProxy, mFileSelection->selectedRows()); +    if(sel.isEmpty()){ +        return; +    } +    qint64 size = 0; +    qint64 duration = 0; +    bool maybeMore = false; +    foreach(QModelIndex i, sel){ +        size += i.data(ArchiveFilesModel::SizeRole).toInt(); +        int type = i.data(ArchiveFilesModel::FileTypeRole).toInt(); +        if(type == ArchiveFilesModel::Movie){ +            int dur = i.data(ArchiveFilesModel::SizeDurRole).toInt(); +            duration += dur; +            if(dur == 0){ +                maybeMore = true; +            } +        } +    } +    emit sizeChanged(size); +    emit durationChanged(duration, maybeMore); +} +  void ArchiveController::fileDoubleClicked(const QModelIndex &idx){      if(!idx.isValid()){          return; | 
