summaryrefslogtreecommitdiffstats
path: root/torrentwidget.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2017-12-19 06:59:14 +0100
committerArno <arno@disconnect.de>2017-12-19 06:59:14 +0100
commitfe7823d5d0ff884fee0436503fe5f2c9f52aab13 (patch)
tree924122d8cad392a270f7f51464148de85b9d8780 /torrentwidget.cpp
parent868a73530a00d0b58477ecff7cc658fcaec92c7a (diff)
downloadShemovCleaner-fe7823d5d0ff884fee0436503fe5f2c9f52aab13.tar.gz
ShemovCleaner-fe7823d5d0ff884fee0436503fe5f2c9f52aab13.tar.bz2
ShemovCleaner-fe7823d5d0ff884fee0436503fe5f2c9f52aab13.zip
Don't gatherData() when moving torrents
Just move the files and remove them from the view without a full parse.
Diffstat (limited to 'torrentwidget.cpp')
-rw-r--r--torrentwidget.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/torrentwidget.cpp b/torrentwidget.cpp
index 16e70e8..7f88eef 100644
--- a/torrentwidget.cpp
+++ b/torrentwidget.cpp
@@ -254,7 +254,8 @@ void TorrentWidget::moveFiles(){
if(!dir.isEmpty()){
s.setValue("dirs/movedir", dir);
int ctr = 0;
- foreach(QModelIndex i, sel){
+ QStringList removed;
+ for(const QModelIndex &i : sel){
QFileInfo fp(i.data(FullPathRole).toString());
QString newfn = QString("%1/%2").arg(dir).arg(fp.fileName());
bool ok = QFile::rename(fp.absoluteFilePath(), newfn);
@@ -268,10 +269,16 @@ void TorrentWidget::moveFiles(){
++ctr;
}
}
+ removed << i.data().toString();
+ }
+ for(const QString& f : removed){
+ QList<QStandardItem*> res = mModel->findItems(f, Qt::MatchExactly, NameColumn);
+ if(!res.isEmpty()){
+ mModel->removeRow(res.at(0)->row());
+ }
}
QString msg = QString(tr("Successfully moved %1 of %2 file(s)")).arg(QString::number(ctr)).arg(QString::number(sel.count()));
emit statusMessage(msg);
- gatherData();
emit freeSpaceChanged(mDir->text());
}
}