mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-31 03:50:20 -07:00
Clean up and refactor torrent content model code
This commit is contained in:
parent
8f4c4e8c40
commit
a5452d04ae
12 changed files with 1005 additions and 696 deletions
|
@ -46,7 +46,8 @@
|
|||
#include "torrentpersistentdata.h"
|
||||
#include "qbtsession.h"
|
||||
#include "proplistdelegate.h"
|
||||
#include "torrentfilesmodel.h"
|
||||
#include "torrentcontentfiltermodel.h"
|
||||
#include "torrentcontentmodel.h"
|
||||
#include "peerlistwidget.h"
|
||||
#include "trackerlist.h"
|
||||
#include "mainwindow.h"
|
||||
|
@ -73,7 +74,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, Tra
|
|||
setEnabled(false);
|
||||
|
||||
// Set Properties list model
|
||||
PropListModel = new TorrentFilesFilterModel();
|
||||
PropListModel = new TorrentContentFilterModel();
|
||||
filesList->setModel(PropListModel);
|
||||
PropDelegate = new PropListDelegate(this);
|
||||
filesList->setItemDelegate(PropDelegate);
|
||||
|
@ -414,7 +415,7 @@ void PropertiesWidget::loadUrlSeeds() {
|
|||
void PropertiesWidget::openDoubleClickedFile(QModelIndex index) {
|
||||
if (!index.isValid()) return;
|
||||
if (!h.is_valid() || !h.has_metadata()) return;
|
||||
if (PropListModel->getType(index) == TorrentFileItem::TFILE) {
|
||||
if (PropListModel->getType(index) == TorrentContentModelItem::TFILE) {
|
||||
int i = PropListModel->getFileIndex(index);
|
||||
const QDir saveDir(h.save_path());
|
||||
const QString filename = h.filepath_at(i);
|
||||
|
@ -516,7 +517,7 @@ void PropertiesWidget::renameSelectedFile() {
|
|||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
if (PropListModel->getType(index) == TorrentFileItem::TFILE) {
|
||||
if (PropListModel->getType(index) == TorrentContentModelItem::TFILE) {
|
||||
// File renaming
|
||||
const int file_index = PropListModel->getFileIndex(index);
|
||||
if (!h.is_valid() || !h.has_metadata()) return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue