mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 23:07:59 +00:00
- flush cache before file preview (libtorrent >= 0.15 only)
This commit is contained in:
parent
abf35a31f3
commit
bd5880843f
@ -64,6 +64,10 @@ protected slots:
|
|||||||
QModelIndex index;
|
QModelIndex index;
|
||||||
QModelIndexList selectedIndexes = previewList->selectionModel()->selectedRows(NAME);
|
QModelIndexList selectedIndexes = previewList->selectionModel()->selectedRows(NAME);
|
||||||
if(selectedIndexes.size() == 0) return;
|
if(selectedIndexes.size() == 0) return;
|
||||||
|
#ifdef LIBTORRENT_0_15
|
||||||
|
// Flush data
|
||||||
|
h.flush_cache();
|
||||||
|
#endif
|
||||||
QString path;
|
QString path;
|
||||||
foreach(index, selectedIndexes){
|
foreach(index, selectedIndexes){
|
||||||
path = h.files_path().at(indexes.at(index.row()));
|
path = h.files_path().at(indexes.at(index.row()));
|
||||||
|
@ -478,7 +478,10 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) {
|
|||||||
QString filename = misc::toQString(h.get_torrent_info().file_at(i).path.string());
|
QString filename = misc::toQString(h.get_torrent_info().file_at(i).path.string());
|
||||||
QString file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename));
|
QString file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename));
|
||||||
qDebug("Trying to open file at %s", file_path.toLocal8Bit().data());
|
qDebug("Trying to open file at %s", file_path.toLocal8Bit().data());
|
||||||
// TODO: Flush data (when libtorrent supports it)
|
#ifdef LIBTORRENT_0_15
|
||||||
|
// Flush data
|
||||||
|
h.flush_cache();
|
||||||
|
#endif
|
||||||
if(QFile::exists(file_path))
|
if(QFile::exists(file_path))
|
||||||
QDesktopServices::openUrl("file://"+file_path);
|
QDesktopServices::openUrl("file://"+file_path);
|
||||||
else
|
else
|
||||||
@ -496,7 +499,10 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) {
|
|||||||
QString filename = path_items.join(QDir::separator());
|
QString filename = path_items.join(QDir::separator());
|
||||||
QString file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename));
|
QString file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename));
|
||||||
qDebug("Trying to open folder at %s", file_path.toLocal8Bit().data());
|
qDebug("Trying to open folder at %s", file_path.toLocal8Bit().data());
|
||||||
// TODO: Flush data (when libtorrent supports it)
|
#ifdef LIBTORRENT_0_15
|
||||||
|
// Flush data
|
||||||
|
h.flush_cache();
|
||||||
|
#endif
|
||||||
if(QFile::exists(file_path))
|
if(QFile::exists(file_path))
|
||||||
QDesktopServices::openUrl("file://"+file_path);
|
QDesktopServices::openUrl("file://"+file_path);
|
||||||
else
|
else
|
||||||
|
@ -547,6 +547,11 @@ void QTorrentHandle::super_seeding(bool on) const {
|
|||||||
Q_ASSERT(h.is_valid());
|
Q_ASSERT(h.is_valid());
|
||||||
h.super_seeding(on);
|
h.super_seeding(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QTorrentHandle::flush_cache() const {
|
||||||
|
Q_ASSERT(h.is_valid());
|
||||||
|
h.flush_cache();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
|
@ -153,6 +153,7 @@ class QTorrentHandle {
|
|||||||
void move_storage(QString path) const;
|
void move_storage(QString path) const;
|
||||||
#ifdef LIBTORRENT_0_15
|
#ifdef LIBTORRENT_0_15
|
||||||
void super_seeding(bool on) const;
|
void super_seeding(bool on) const;
|
||||||
|
void flush_cache() const;
|
||||||
#endif
|
#endif
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
void resolve_countries(bool r);
|
void resolve_countries(bool r);
|
||||||
|
Loading…
Reference in New Issue
Block a user