diff options
-rw-r--r-- | torrentwidget.cpp | 8 | ||||
-rw-r--r-- | torrentwidget.h | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/torrentwidget.cpp b/torrentwidget.cpp index ec83424..5279b88 100644 --- a/torrentwidget.cpp +++ b/torrentwidget.cpp @@ -176,7 +176,7 @@ void TorrentWidget::gatherData(){ mFileView->setSortingEnabled(false); mModel->clear(); QStandardItem *root = mModel->invisibleRootItem(); - mModel->setHorizontalHeaderLabels(QStringList() << QChar(0x26A7) << tr("Name") << tr("Created")); + mModel->setHorizontalHeaderLabels(QStringList() << QChar(0x26A7) << tr("Name") << tr("Content") << tr("Created")); QBrush redBrush(Qt::red); QBrush greenBrush(Qt::darkGreen); for(const auto &fi : fl){ @@ -189,6 +189,12 @@ void TorrentWidget::gatherData(){ } fData << item; } + TorrentParser p(fi.absoluteFilePath()); + const auto tData = p.parse(); + const auto tFiles = p.files(tData); + if(!tFiles.isEmpty()){ + fData[ContentColumn]->setText(tFiles.at(0)); + } int result = 0; q.bindValue(":fn", fi.fileName()); q.exec(); diff --git a/torrentwidget.h b/torrentwidget.h index 004380c..4ba7cdc 100644 --- a/torrentwidget.h +++ b/torrentwidget.h @@ -20,8 +20,8 @@ class TorrentWidget : public QWidget { Q_OBJECT public: enum CustomRoles { PresentRole = Qt::UserRole + 1, FullPathRole = Qt::UserRole + 2, CreatedRole = Qt::UserRole + 3 }; - enum { ColumnCount = 3 }; - enum Columns { IconColumn = 0, NameColumn = 1, CreatedColumn = 2 }; + enum { ColumnCount = 4 }; + enum Columns { IconColumn = 0, NameColumn = 1, ContentColumn = 2, CreatedColumn = 3 }; enum Present { NotPresent = 0, Present = 1 }; TorrentWidget(QWidget *parent = 0); QMenuBar *menuBar() { return mMenuBar; } |