diff --git a/src/FinishedTorrents.cpp b/src/FinishedTorrents.cpp
index 972496cd7..2bdd72e77 100644
--- a/src/FinishedTorrents.cpp
+++ b/src/FinishedTorrents.cpp
@@ -320,8 +320,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) {
@@ -341,7 +339,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 2bcd1d872..dcafb2ee1 100644
--- a/src/GUI.cpp
+++ b/src/GUI.cpp
@@ -160,8 +160,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);
if(!settings.value(QString::fromUtf8("Preferences/General/StartMinimized"), false).toBool()) {
@@ -185,9 +183,6 @@ GUI::~GUI() {
delete myTrayIconMenu;
}
delete tcpServer;
- previewProcess->kill();
- previewProcess->waitForFinished();
- delete previewProcess;
delete connecStatusLblIcon;
delete tabs;
// Keyboard shortcuts
@@ -391,12 +386,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() {
@@ -405,21 +394,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 f0fc961b3..e6da7752d 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
@@ -99,7 +97,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void torrentDoubleClicked(QString hash, bool finished);
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 9d80936ab..24480602b 100644
--- a/src/downloadingTorrents.cpp
+++ b/src/downloadingTorrents.cpp
@@ -253,8 +253,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) {
@@ -274,7 +272,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 338ac5b8a..e7779e232 100644
--- a/src/options.ui
+++ b/src/options.ui
@@ -313,51 +313,6 @@
- -
-
-
- Preview program
-
-
-
-
-
-
- 6
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
- Media player:
-
-
-
- -
-
-
- -
-
-
- ...
-
-
-
-
-
-
-
-
-
diff --git a/src/options_imp.cpp b/src/options_imp.cpp
index 91d9b5db2..ba037a091 100644
--- a/src/options_imp.cpp
+++ b/src/options_imp.cpp
@@ -155,7 +155,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(checkMinimizeToSysTray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkStartMinimized, 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()));
@@ -266,7 +265,6 @@ void options_imp::saveOptions(){
settings.setValue(QString::fromUtf8("MinimizeToTray"), minimizeToTray());
settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized());
settings.setValue(QString::fromUtf8("NotificationBaloons"), OSDEnabled());
- settings.setValue(QString::fromUtf8("MediaPlayer"), getPreviewProgram());
// End General preferences
settings.endGroup();
// Downloads preferences
@@ -413,7 +411,6 @@ void options_imp::loadOptions(){
checkStartMinimized->setChecked(settings.value(QString::fromUtf8("StartMinimized"), 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
@@ -593,12 +590,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();
@@ -1025,13 +1016,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 9b86b2a30..842c5f45a 100644
--- a/src/options_imp.h
+++ b/src/options_imp.h
@@ -73,7 +73,6 @@ class options_imp : public QDialog, private Ui::Dialog {
bool closeToTray() const;
bool startMinimized() const;
bool OSDEnabled() const;
- QString getPreviewProgram() const;
// Downloads
QString getSavePath() const;
bool preAllocateAllFiles() const;
@@ -133,7 +132,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());