Browse Source

- Fix for media file preview

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
90207020f2
  1. 4
      src/GUI.cpp
  2. 1
      src/GUI.h
  3. 2
      src/filterparserthread.h
  4. 8
      src/previewselect.h
  5. 4
      src/transferlistwidget.cpp
  6. 1
      src/transferlistwidget.h

4
src/GUI.cpp

@ -424,10 +424,6 @@ void GUI::on_actionExit_triggered() { @@ -424,10 +424,6 @@ void GUI::on_actionExit_triggered() {
close();
}
void GUI::previewFile(QString filePath) {
QDesktopServices::openUrl(QString("file://")+filePath);
}
int GUI::getCurrentTabIndex() const {
if(isMinimized() || !isVisible())
return -1;

1
src/GUI.h

@ -105,7 +105,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{ @@ -105,7 +105,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void on_actionShow_console_triggered();
void readParamsOnSocket();
void acceptConnection();
void previewFile(QString filePath);
void balloonClicked();
void writeSettings();
void readSettings();

2
src/filterparserthread.h

@ -72,7 +72,7 @@ class FilterParserThread : public QThread { @@ -72,7 +72,7 @@ class FilterParserThread : public QThread {
parseP2PFilterFile(filePath);
} else {
if(filePath.endsWith(".p2p", Qt::CaseInsensitive)) {
// PeerGuardian p2p file
// PeerGuardian p2b file
parseP2BFilterFile(filePath);
} else {
// Default: eMule DAT format

8
src/previewselect.h

@ -62,20 +62,20 @@ class previewSelect: public QDialog, private Ui::preview { @@ -62,20 +62,20 @@ class previewSelect: public QDialog, private Ui::preview {
protected slots:
void on_previewButton_clicked(){
QModelIndex index;
QModelIndexList selectedIndexes = previewList->selectionModel()->selectedIndexes();
QModelIndexList selectedIndexes = previewList->selectionModel()->selectedRows(NAME);
if(selectedIndexes.size() == 0) return;
QString path;
foreach(index, selectedIndexes){
if(index.column() == NAME){
path = h.files_path().at(indexes.at(index.row()));
// File
if(QFile::exists(path)){
emit readyToPreviewFile(path);
} else {
QMessageBox::critical(0, tr("Preview impossible"), tr("Sorry, we can't preview this file"));
}
close();
return;
}
}
qDebug("Cannot find file: %s", path.toLocal8Bit().data());
QMessageBox::critical(0, tr("Preview impossible"), tr("Sorry, we can't preview this file"));
close();
@ -123,9 +123,11 @@ class previewSelect: public QDialog, private Ui::preview { @@ -123,9 +123,11 @@ class previewSelect: public QDialog, private Ui::preview {
}
connect(this, SIGNAL(readyToPreviewFile(QString)), parent, SLOT(previewFile(QString)));
if(previewListModel->rowCount() == 1){
qDebug("Torrent file only contains one file, no need to display selection dialog before preview");
// Only one file : no choice
on_previewButton_clicked();
}else{
qDebug("Displaying media file selection dialog for preview");
show();
}
}

4
src/transferlistwidget.cpp

@ -251,6 +251,10 @@ void TransferListWidget::updateMetadata(QTorrentHandle &h) { @@ -251,6 +251,10 @@ void TransferListWidget::updateMetadata(QTorrentHandle &h) {
}
}
void TransferListWidget::previewFile(QString filePath) {
QDesktopServices::openUrl(QString("file://")+filePath);
}
int TransferListWidget::updateTorrent(int row) {
TorrentState s = STATE_INVALID;
QString hash = getHashFromRow(row);

1
src/transferlistwidget.h

@ -108,6 +108,7 @@ public slots: @@ -108,6 +108,7 @@ public slots:
void hidePriorityColumn(bool hide);
void displayDLHoSMenu(const QPoint&);
void applyFilter(int f);
void previewFile(QString filePath);
signals:
void currentTorrentChanged(QTorrentHandle &h);

Loading…
Cancel
Save