Browse Source

- Allow the user to display torrent properties in finished list

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
cd70dcc3ba
  1. 23
      src/FinishedTorrents.cpp
  2. 6
      src/FinishedTorrents.h
  3. 5
      src/GUI.cpp
  4. 4
      src/GUI.h

23
src/FinishedTorrents.cpp

@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
#include "FinishedTorrents.h"
#include "misc.h"
#include "GUI.h"
#include "properties_imp.h"
#include <QFile>
FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession){
@ -147,3 +148,25 @@ QTreeView* FinishedTorrents::getFinishedList(){ @@ -147,3 +148,25 @@ QTreeView* FinishedTorrents::getFinishedList(){
QStandardItemModel* FinishedTorrents::getFinishedListModel(){
return finishedListModel;
}
// Show torrent properties dialog
void FinishedTorrents::showProperties(const QModelIndex &index){
int row = index.row();
QString fileHash = finishedListModel->data(finishedListModel->index(row, HASH)).toString();
torrent_handle h = BTSession->getTorrentHandle(fileHash);
QStringList errors = ((GUI*)parent)->trackerErrors.value(fileHash, QStringList(tr("None", "i.e: No error message")));
properties *prop = new properties(this, h, errors);
connect(prop, SIGNAL(changedFilteredFiles(torrent_handle, bool)), BTSession, SLOT(reloadTorrent(torrent_handle, bool)));
prop->show();
}
// display properties of selected items
void FinishedTorrents::propertiesSelection(){
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
QModelIndex index;
foreach(index, selectedIndexes){
if(index.column() == NAME){
showProperties(index);
}
}
}

6
src/FinishedTorrents.h

@ -42,13 +42,15 @@ class FinishedTorrents : public QWidget, public Ui::seeding{ @@ -42,13 +42,15 @@ class FinishedTorrents : public QWidget, public Ui::seeding{
~FinishedTorrents();
// Methods
QStringList getFinishedSHAs();
QTreeView* getFinishedList();
QStandardItemModel* getFinishedListModel();
public slots:
void addFinishedSHA(QString sha);
void updateFinishedList();
void deleteFromFinishedList(QString hash);
QTreeView* getFinishedList();
QStandardItemModel* getFinishedListModel();
void showProperties(const QModelIndex &index);
void propertiesSelection();
protected slots:
void setRowColor(int row, const QString& color);

5
src/GUI.cpp

@ -1215,6 +1215,11 @@ void GUI::addUnauthenticatedTracker(QPair<torrent_handle,std::string> tracker){ @@ -1215,6 +1215,11 @@ void GUI::addUnauthenticatedTracker(QPair<torrent_handle,std::string> tracker){
// display properties of selected items
void GUI::propertiesSelection(){
if(tabs->currentIndex() > 1) return;
if(tabs->currentIndex() == 1){
finishedTorrentTab->propertiesSelection();
return;
}
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
QModelIndex index;
foreach(index, selectedIndexes){

4
src/GUI.h

@ -59,11 +59,13 @@ namespace fs = boost::filesystem; @@ -59,11 +59,13 @@ namespace fs = boost::filesystem;
class GUI : public QMainWindow, private Ui::MainWindow{
Q_OBJECT
public:
QHash<QString, QStringList> trackerErrors;
private:
// Bittorrent
bittorrent BTSession;
QTimer *checkConnect;
QHash<QString, QStringList> trackerErrors;
QList<QPair<torrent_handle,std::string> > unauthenticated_trackers;
downloadFromURL *downloadFromURLDialog;
// GUI related

Loading…
Cancel
Save