- FEATURE: Better media file preview (player detected automatically)

This commit is contained in:
Christophe Dumez 2007-11-16 18:39:50 +00:00
commit c3a6b24ed1
9 changed files with 6 additions and 107 deletions

View file

@ -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

11
TODO
View file

@ -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)

View file

@ -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;
}

View file

@ -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{

View file

@ -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();

View file

@ -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;
}

View file

@ -306,51 +306,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="previewBox" >
<property name="title" >
<string>Preview program</string>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QLabel" name="lbl_preview" >
<property name="text" >
<string>Media player:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="textMediaPlayer" />
</item>
<item>
<widget class="QToolButton" name="browsePreviewButton" >
<property name="text" >
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >

View file

@ -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());

View file

@ -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());