|
|
@ -38,6 +38,7 @@ |
|
|
|
#include <QMessageBox> |
|
|
|
#include <QMessageBox> |
|
|
|
#include <QMenu> |
|
|
|
#include <QMenu> |
|
|
|
#include <QFileDialog> |
|
|
|
#include <QFileDialog> |
|
|
|
|
|
|
|
#include <QDesktopServices> |
|
|
|
#include <QInputDialog> |
|
|
|
#include <QInputDialog> |
|
|
|
#include "propertieswidget.h" |
|
|
|
#include "propertieswidget.h" |
|
|
|
#include "transferlistwidget.h" |
|
|
|
#include "transferlistwidget.h" |
|
|
@ -83,6 +84,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, GUI* main_window, TransferLi |
|
|
|
connect(collapseAllButton, SIGNAL(clicked()), filesList, SLOT(collapseAll())); |
|
|
|
connect(collapseAllButton, SIGNAL(clicked()), filesList, SLOT(collapseAll())); |
|
|
|
connect(expandAllButton, SIGNAL(clicked()), filesList, SLOT(expandAll())); |
|
|
|
connect(expandAllButton, SIGNAL(clicked()), filesList, SLOT(expandAll())); |
|
|
|
connect(filesList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayFilesListMenu(const QPoint&))); |
|
|
|
connect(filesList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayFilesListMenu(const QPoint&))); |
|
|
|
|
|
|
|
connect(filesList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openDoubleClickedFile(QModelIndex))); |
|
|
|
connect(PropListModel, SIGNAL(filteredFilesChanged()), this, SLOT(filteredFilesChanged())); |
|
|
|
connect(PropListModel, SIGNAL(filteredFilesChanged()), this, SLOT(filteredFilesChanged())); |
|
|
|
connect(addWS_button, SIGNAL(clicked()), this, SLOT(askWebSeed())); |
|
|
|
connect(addWS_button, SIGNAL(clicked()), this, SLOT(askWebSeed())); |
|
|
|
connect(deleteWS_button, SIGNAL(clicked()), this, SLOT(deleteSelectedUrlSeeds())); |
|
|
|
connect(deleteWS_button, SIGNAL(clicked()), this, SLOT(deleteSelectedUrlSeeds())); |
|
|
@ -467,6 +469,22 @@ void PropertiesWidget::on_files_button_clicked() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PropertiesWidget::openDoubleClickedFile(QModelIndex index) { |
|
|
|
|
|
|
|
if(!index.isValid()) return; |
|
|
|
|
|
|
|
if(!h.is_valid() || !h.has_metadata()) return; |
|
|
|
|
|
|
|
if(PropListModel->getType(index) == TFILE) { |
|
|
|
|
|
|
|
int i = PropListModel->getFileIndex(index); |
|
|
|
|
|
|
|
QDir saveDir(h.save_path()); |
|
|
|
|
|
|
|
QString filename = misc::toQString(h.get_torrent_info().file_at(i).path.string()); |
|
|
|
|
|
|
|
QString file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename)); |
|
|
|
|
|
|
|
qDebug("Trying to open file at %s", file_path.toLocal8Bit().data()); |
|
|
|
|
|
|
|
if(QFile::exists(file_path)) |
|
|
|
|
|
|
|
QDesktopServices::openUrl("file://"+file_path); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
QMessageBox::warning(this, tr("I/O Error"), tr("This file does not exist yet.")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void PropertiesWidget::displayFilesListMenu(const QPoint&){ |
|
|
|
void PropertiesWidget::displayFilesListMenu(const QPoint&){ |
|
|
|
QMenu myFilesLlistMenu; |
|
|
|
QMenu myFilesLlistMenu; |
|
|
|
QModelIndexList selectedRows = filesList->selectionModel()->selectedRows(0); |
|
|
|
QModelIndexList selectedRows = filesList->selectionModel()->selectedRows(0); |
|
|
|