From 424d37e94dbf820e3d0559e0041d6d2cd005f072 Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 7 Feb 2014 15:06:09 +0100 Subject: Actually move Files... ...when moving them to burn. Was too eager removing debug statements Also behave properly after a model reset. --- archivebrowser.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'archivebrowser.cpp') diff --git a/archivebrowser.cpp b/archivebrowser.cpp index 5c919e2..fa72253 100644 --- a/archivebrowser.cpp +++ b/archivebrowser.cpp @@ -55,6 +55,7 @@ ArchiveBrowser::ArchiveBrowser(QWidget *parent) : QWidget(parent), mSelectedSize //connect connect(mTree->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(browserSelectionChanged(QItemSelection,QItemSelection))); + connect(mModel, SIGNAL(populated()), this, SLOT(resetAll())); //make widget QVBoxLayout *mainLayout = new QVBoxLayout; @@ -125,6 +126,7 @@ void ArchiveBrowser::moveToBurn() { int type = child.data(ArchiveBrowserModel::FileTypeRole).toInt(); QString destination = QString("%1/%2").arg(burnDirS).arg(current.fileName()); if(type == 1){ //movie + QFile::rename(current.absoluteFilePath(), destination); filesToUpdate << child.data(ArchiveBrowserModel::GenericIdRole).toInt(); }else{ QFile::copy(current.absoluteFilePath(), destination); @@ -134,6 +136,7 @@ void ArchiveBrowser::moveToBurn() { } mModel->updateDVDNo(filesToUpdate); mModel->refresh(); + mProxy->setBytesRemaining(0); } } @@ -174,6 +177,14 @@ void ArchiveBrowser::setupQualityFilter(){ mQualityFilter->addItems(qualityList); } +void ArchiveBrowser::resetAll() { + mTree->selectionModel()->clear(); + mSelectedItems = 0; + mSelectedSize = 0; + emit sizeChanged(0); + emit itemCountChanged(0); +} + QModelIndexList ArchiveBrowser::selectedRows(const QItemSelection &sel){ QModelIndexList retval; QModelIndexList selIdx = sel.indexes(); -- cgit v1.2.3-70-g09d2