summaryrefslogtreecommitdiffstats
path: root/shemovcleaner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'shemovcleaner.cpp')
-rw-r--r--shemovcleaner.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/shemovcleaner.cpp b/shemovcleaner.cpp
index 9625db1..beb5baf 100644
--- a/shemovcleaner.cpp
+++ b/shemovcleaner.cpp
@@ -22,6 +22,8 @@
#include "shemovcleaner.h"
#include "filesorter.h"
+#include "torrentparser.h"
+#include "torrentdisplay.h"
ShemovCleaner::ShemovCleaner(QWidget *parent) : QMainWindow(parent){
QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL", "shemovdb");
@@ -76,10 +78,13 @@ void ShemovCleaner::setupGui(){
connect(mDelete, SIGNAL(clicked()), this, SLOT(deleteFiles()));
mMove = new QPushButton(tr("Move..."));
connect(mMove, SIGNAL(clicked()), this, SLOT(moveFiles()));
+ mInfo = new QPushButton(tr("Torrent..."));
+ connect(mInfo, SIGNAL(clicked()), this, SLOT(torrentInfo()));
QHBoxLayout *buttonL2 = new QHBoxLayout;
buttonL2->addStretch();
buttonL2->addWidget(mMove);
buttonL2->addWidget(mDelete);
+ buttonL2->addWidget(mInfo);
buttonL2->addStretch();
QWidget *mainWidget = new QWidget;
@@ -94,6 +99,7 @@ void ShemovCleaner::setupGui(){
setCentralWidget(mainWidget);
createStatusbar();
+ mTorrentDisplay = new TorrentDisplay(this);
connect(mFileView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(fileSelectionChanged(QItemSelection,QItemSelection)));
}
@@ -189,6 +195,21 @@ void ShemovCleaner::moveFiles(){
}
}
+void ShemovCleaner::torrentInfo(){
+ QModelIndexList sel = mFileView->selectionModel()->selectedRows(1);
+ if(sel.isEmpty()){
+ return;
+ }
+ QString fn = sel.first().data(Qt::UserRole + 1).toString();
+ TorrentParser p(fn, this);
+ QList<QVariant> tData = p.parse();
+ tData.removeAll(QVariant());
+ tData.removeAll(0);
+ mTorrentDisplay->setData(tData);
+ mTorrentDisplay->show();
+ return;
+}
+
void ShemovCleaner::selectDir(){
QString dir = QFileDialog::getExistingDirectory(this, tr("Select directory"), QDir::homePath());
mDir->setText(QDir::toNativeSeparators(dir));