diff --git a/Changelog b/Changelog index af00479a2..ba774972e 100644 --- a/Changelog +++ b/Changelog @@ -41,6 +41,7 @@ - FEATURE: Added an option to automatically delete torrents when they reach a given ratio (>= 1.0) - FEATURE: Added an option to display current transfer speeds in title bar - FEATURE: Torrent content is now displayed as a tree + - FEATURE: Better media file preview (player detected automatically) - I18N: Added Hungarian translation - I18N: Added Brazilian translation - BUGFIX: Progress of paused torrents is now correct on restart diff --git a/TODO b/TODO index 6e35e2983..01b72329d 100644 --- a/TODO +++ b/TODO @@ -52,12 +52,5 @@ -> in download list -> in seeding list -// in v1.0.0 - FEATURE FREEZE -- Fix all (or almost all) opened bugs in bug tracker -- Recheck doc -- Translations update (IN PROGRESS) - -rc7->rc8 changelog: -- BUGFIX: Fixed torrent files filtering -- BUGFIX: Stop search when clearing results -- BUGFIX: Fixed compilation on Fedora 8 +rc8->final? changelog: +- FEATURE: Better media file preview (player detected automatically) diff --git a/src/FinishedTorrents.cpp b/src/FinishedTorrents.cpp index 6dc947e7b..f7020d0dc 100644 --- a/src/FinishedTorrents.cpp +++ b/src/FinishedTorrents.cpp @@ -313,8 +313,6 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){ QModelIndex index; // Enable/disable pause/start action given the DL state QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes(); - QSettings settings("qBittorrent", "qBittorrent"); - QString previewProgram = settings.value("Preferences/general/MediaPlayer", QString()).toString(); bool has_pause = false, has_start = false, has_preview = false; foreach(index, selectedIndexes) { if(index.column() == F_NAME) { @@ -334,7 +332,7 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){ has_pause = true; } } - if(!previewProgram.isEmpty() && BTSession->isFilePreviewPossible(hash) && !has_preview) { + if(BTSession->isFilePreviewPossible(hash) && !has_preview) { myFinishedListMenu.addAction(actionPreview_file); has_preview = true; } diff --git a/src/GUI.cpp b/src/GUI.cpp index 855fe606c..f7ae291ae 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -159,8 +159,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis checkConnect = new QTimer(this); connect(checkConnect, SIGNAL(timeout()), this, SLOT(checkConnectionStatus())); checkConnect->start(5000); - previewProcess = new QProcess(this); - connect(previewProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(cleanTempPreviewFile(int, QProcess::ExitStatus))); // Accept drag 'n drops setAcceptDrops(true); show(); @@ -182,9 +180,6 @@ GUI::~GUI() { delete myTrayIconMenu; } delete tcpServer; - previewProcess->kill(); - previewProcess->waitForFinished(); - delete previewProcess; delete connecStatusLblIcon; delete tabs; // Keyboard shortcuts @@ -388,12 +383,6 @@ void GUI::on_actionPreview_file_triggered() { new previewSelect(this, h); } -void GUI::cleanTempPreviewFile(int, QProcess::ExitStatus) const { - if(!QFile::remove(QDir::tempPath()+QDir::separator()+QString::fromUtf8("qBT_preview.tmp"))) { - std::cerr << "Couldn't remove temporary file: " << (QDir::tempPath()+QDir::separator()+QString::fromUtf8("qBT_preview.tmp")).toUtf8().data() << "\n"; - } -} - // Necessary if we want to close the window // in one time if "close to systray" is enabled void GUI::on_actionExit_triggered() { @@ -402,21 +391,7 @@ void GUI::on_actionExit_triggered() { } void GUI::previewFile(QString filePath) { - // Check if there is already one preview running - if(previewProcess->state() == QProcess::NotRunning) { - // First copy temporarily (XXX: is it necessary?) - QString tmpPath = QDir::tempPath()+QDir::separator()+QString::fromUtf8("qBT_preview.tmp"); - QFile::remove(tmpPath); - QFile::copy(filePath, tmpPath); - // Launch program preview - QStringList params; - params << tmpPath; - QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); - QString previewProgram = settings.value(QString::fromUtf8("Preferences/General/MediaPlayer"), QString()).toString(); - previewProcess->start(previewProgram, params, QIODevice::ReadOnly); - }else{ - QMessageBox::critical(0, tr("Preview process already running"), tr("There is already another preview process running.\nPlease close the other one first.")); - } + QDesktopServices::openUrl(filePath); } unsigned int GUI::getCurrentTabIndex() const{ diff --git a/src/GUI.h b/src/GUI.h index 7ab54eae1..3040cc9c8 100644 --- a/src/GUI.h +++ b/src/GUI.h @@ -74,8 +74,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{ QShortcut *switchDownShortcut; QShortcut *switchUpShortcut; QShortcut *switchRSSShortcut; - // Preview - QProcess *previewProcess; // Search SearchEngine *searchEngine; // RSS @@ -98,7 +96,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{ void togglePausedState(QString hash); void on_actionPreview_file_triggered(); void previewFile(QString filePath); - void cleanTempPreviewFile(int, QProcess::ExitStatus) const; void balloonClicked(); void writeSettings(); void readSettings(); diff --git a/src/downloadingTorrents.cpp b/src/downloadingTorrents.cpp index f1a0c0f22..e333e9b83 100644 --- a/src/downloadingTorrents.cpp +++ b/src/downloadingTorrents.cpp @@ -246,8 +246,6 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) { QModelIndex index; // Enable/disable pause/start action given the DL state QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes(); - QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); - QString previewProgram = settings.value(QString::fromUtf8("Preferences/general/MediaPlayer"), QString()).toString(); bool has_pause = false, has_start = false, has_preview = false; foreach(index, selectedIndexes) { if(index.column() == NAME) { @@ -267,7 +265,7 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) { has_pause = true; } } - if(!previewProgram.isEmpty() && BTSession->isFilePreviewPossible(hash) && !has_preview) { + if(BTSession->isFilePreviewPossible(hash) && !has_preview) { myDLLlistMenu.addAction(actionPreview_file); has_preview = true; } diff --git a/src/options.ui b/src/options.ui index d45f60be8..3c7247761 100644 --- a/src/options.ui +++ b/src/options.ui @@ -306,51 +306,6 @@ - - - - Preview program - - - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Media player: - - - - - - - - - - ... - - - - - - - - diff --git a/src/options_imp.cpp b/src/options_imp.cpp index e42923d95..3e4504f47 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -152,7 +152,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ connect(checkCloseToSystray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(checkMinimizeToSysTray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(checkSystrayBalloons, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); - connect(textMediaPlayer, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); // Downloads tab connect(textSavePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); connect(checkPreallocateAll, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); @@ -262,7 +261,6 @@ void options_imp::saveOptions(){ settings.setValue(QString::fromUtf8("CloseToTray"), closeToTray()); settings.setValue(QString::fromUtf8("MinimizeToTray"), minimizeToTray()); settings.setValue(QString::fromUtf8("NotificationBaloons"), OSDEnabled()); - settings.setValue(QString::fromUtf8("MediaPlayer"), getPreviewProgram()); // End General preferences settings.endGroup(); // Downloads preferences @@ -406,7 +404,6 @@ void options_imp::loadOptions(){ checkMinimizeToSysTray->setChecked(settings.value(QString::fromUtf8("MinimizeToTray"), false).toBool()); checkSystrayBalloons->setChecked(settings.value(QString::fromUtf8("NotificationBaloons"), true).toBool()); } - textMediaPlayer->setText(settings.value(QString::fromUtf8("MediaPlayer"), QString()).toString()); // End General preferences settings.endGroup(); // Downloads preferences @@ -583,12 +580,6 @@ int options_imp::getEncryptionSetting() const{ return comboEncryption->currentIndex(); } -QString options_imp::getPreviewProgram() const{ - QString preview_txt = textMediaPlayer->text(); - preview_txt = preview_txt.trimmed(); - return preview_txt; -} - bool options_imp::minimizeToTray() const{ if(checkNoSystray->isChecked()) return false; return checkMinimizeToSysTray->isChecked(); @@ -996,13 +987,6 @@ void options_imp::on_browseFilterButton_clicked() { } } -void options_imp::on_browsePreviewButton_clicked() { - QString program_txt = QFileDialog::getOpenFileName(this, tr("Choose your favourite preview program"), QDir::homePath()); - if(!program_txt.isNull()){ - textMediaPlayer->setText(program_txt); - } -} - // Display dialog to choose save dir void options_imp::on_browseSaveDirButton_clicked(){ QString dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), QDir::homePath()); diff --git a/src/options_imp.h b/src/options_imp.h index 58946b432..e81dd155d 100644 --- a/src/options_imp.h +++ b/src/options_imp.h @@ -61,7 +61,6 @@ class options_imp : public QDialog, private Ui::Dialog{ bool minimizeToTray() const; bool closeToTray() const; bool OSDEnabled() const; - QString getPreviewProgram() const; // Downloads QString getSavePath() const; bool preAllocateAllFiles() const; @@ -119,7 +118,6 @@ class options_imp : public QDialog, private Ui::Dialog{ void on_addFilterRangeButton_clicked(); void on_delFilterRangeButton_clicked(); void on_browseScanDirButton_clicked(); - void on_browsePreviewButton_clicked(); void on_browseFilterButton_clicked(); void on_browseSaveDirButton_clicked(); void processFilterFile(QString filePath=QString());