From 8335bd7751656c72aa5457013a6b09dbec1a6405 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 16 Apr 2022 12:50:41 +0200 Subject: Show first file in TorrentWidget When a torrent file is parseable, show the first filename in the view. --- torrentwidget.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'torrentwidget.cpp') 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(); -- cgit v1.2.3-70-g09d2