Browse Source

- Move deletion from hard drive to a thread to avoid GUI freezing

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
f4be28c014
  1. 1
      Changelog
  2. 1
      TODO
  3. 17
      src/GUI.cpp
  4. 3
      src/GUI.h
  5. 2
      src/src.pro

1
Changelog

@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
- BUGFIX: Force a refresh of download list when the window is shown (avoid delay)
- BUGFIX: Fixed deletion from hard drive (failed for non-empty folders)
- BUGFIX: qBittorrent now identifies its version correctly on the network
- BUGFIX: Preventing GUI from freezing when deleting a download permanently
- COSMETIC: Replaced OSD messages by systray messages
* Tue Nov 28 2006 - Christophe Dumez <chris@qbittorrent.org> - v0.8.0

1
TODO

@ -36,6 +36,5 @@ @@ -36,6 +36,5 @@
// In v0.9.0
- Wait for libtorrent v0.12 official release
- Move deletion from hard drive to a thread to avoid GUI freezing
- Should create options dialog only when needed to save up some memory
- Download from RSS feeds

17
src/GUI.cpp

@ -1081,10 +1081,21 @@ void GUI::deletePermanently(){ @@ -1081,10 +1081,21 @@ void GUI::deletePermanently(){
torrentBackup.remove(fileName+".incremental");
torrentBackup.remove(fileName+".pieces");
torrentBackup.remove(fileName+".savepath");
// Remove from Hard drive TODO
// Remove from Hard drive
qDebug("Removing this on hard drive: %s", qPrintable(savePath+QDir::separator()+fileName));
if(!misc::removePath(savePath+QDir::separator()+fileName)){
qDebug("Couldn't remove the download on the hard drive");
// Deleting in a thread to avoid GUI freeze
deleteThread *deleter = new deleteThread(savePath+QDir::separator()+fileName);
deleters << deleter;
int i = 0;
while(i < deleters.size()){
deleter = deleters.at(i);
if(deleter->isFinished()){
qDebug("Delete thread has finished, deleting it");
deleters.removeAt(i);
delete deleter;
}else{
++i;
}
}
// Update info bar
setInfoBar("'" + fileName +"' "+tr("removed.", "<file> removed."));

3
src/GUI.h

@ -43,6 +43,8 @@ @@ -43,6 +43,8 @@
#include "about_imp.h"
#include "previewSelect.h"
#include "trackerLogin.h"
#include "deleteThread.h"
#define TIME_TRAY_BALLOON 5000
@ -72,6 +74,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{ @@ -72,6 +74,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
downloadThread *downloader;
downloadFromURL *downloadFromURLDialog;
bool DHTEnabled;
QList<deleteThread*> deleters;
// GUI related
options_imp *options;
createtorrent *createWindow;

2
src/src.pro

@ -102,7 +102,7 @@ HEADERS += GUI.h misc.h options_imp.h about_imp.h \ @@ -102,7 +102,7 @@ HEADERS += GUI.h misc.h options_imp.h about_imp.h \
PropListDelegate.h previewSelect.h \
PreviewListDelegate.h trackerLogin.h \
downloadThread.h downloadFromURLImp.h \
torrentAddition.h
torrentAddition.h deleteThread.h
FORMS += MainWindow.ui options.ui about.ui \
properties.ui createtorrent.ui preview.ui \
login.ui downloadFromURL.ui addTorrentDialog.ui

Loading…
Cancel
Save