Refactor TorrentPersistentData

Conflicts:
	src/mainwindow.cpp
	src/mainwindow.h
	src/qtlibtorrent/qbtsession.cpp
	src/qtlibtorrent/qtorrenthandle.cpp
	src/transferlistwidget.cpp
	src/webui/btjson.cpp
This commit is contained in:
Ivan Sorokin 2014-11-02 16:52:26 +03:00
parent 70a114eb13
commit e3349092ad
10 changed files with 157 additions and 128 deletions

View file

@ -63,7 +63,6 @@
#include "preferences.h"
#include "trackerlist.h"
#include "peerlistwidget.h"
#include "torrentpersistentdata.h"
#include "transferlistfilterswidget.h"
#include "propertieswidget.h"
#include "statusbar.h"
@ -243,11 +242,6 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine): QMai
preventTimer = new QTimer(this);
connect(preventTimer, SIGNAL(timeout()), SLOT(checkForActiveTorrents()));
// Initialization of persistent data
TorrentPersistentData::load();
connect(&persistentDataSaver, SIGNAL(timeout()), SLOT(savePersistentData()));
persistentDataSaver.start(10000);
// Configure BT session according to options
loadPreferences(false);
@ -464,7 +458,6 @@ void MainWindow::shutdownCleanUp()
QBtSession::drop();
// Save window size, columns size
writeSettings();
TorrentPersistentData::save();
#ifdef Q_OS_MAC
// Workaround to avoid bug http://bugreports.qt.nokia.com/browse/QTBUG-7305
setUnifiedTitleAndToolBarOnMac(false);
@ -672,7 +665,7 @@ void MainWindow::balloonClicked()
// called when a torrent has finished
void MainWindow::finishedTorrent(const QTorrentHandle& h) const
{
if (TorrentPersistentData::isSeed(h.hash()))
if (TorrentPersistentData::instance().isSeed(h.hash()))
showNotificationBaloon(tr("Download completion"), tr("%1 has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(h.name()));
}
@ -1592,11 +1585,6 @@ void MainWindow::handleUpdateCheckFinished(bool update_available, QString new_ve
}
#endif
void MainWindow::savePersistentData()
{
TorrentPersistentData::save();
}
void MainWindow::on_actionDonate_money_triggered()
{
QDesktopServices::openUrl(QUrl("http://sourceforge.net/donate/index.php?group_id=163414"));