Various compilation scripts & patches for Linux programs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

122 lines
4.4 KiB

--- a/src/settings/dolphin_generalsettings.kcfg
+++ b/src/settings/dolphin_generalsettings.kcfg
@@ -81,6 +81,10 @@
<label>Use auto-expanding folders for all view types</label>
<default>false</default>
</entry>
+ <entry name="AutoPlayMediaFiles" type="Bool">
+ <label>Play media files automatically while hovering a cursor</label>
+ <default>false</default>
+ </entry>
<entry name="ShowZoomSlider" type="Bool">
<label>Show zoom slider in the statusbar</label>
<default>true</default>
--- a/src/settings/navigation/navigationsettingspage.cpp
+++ b/src/settings/navigation/navigationsettingspage.cpp
@@ -29,7 +29,8 @@
NavigationSettingsPage::NavigationSettingsPage(QWidget* parent) :
SettingsPageBase(parent),
m_openArchivesAsFolder(0),
- m_autoExpandFolders(0)
+ m_autoExpandFolders(0),
+ m_autoPlayMediaFiles(0)
{
QVBoxLayout* topLayout = new QVBoxLayout(this);
QWidget* vBox = new QWidget(this);
@@ -43,12 +44,16 @@
m_autoExpandFolders = new QCheckBox(i18nc("option:check", "Open folders during drag operations"), vBox);
vBoxLayout->addWidget(m_autoExpandFolders);
+ m_autoPlayMediaFiles = new QCheckBox(i18nc("@option:check", "Play media files automatically"), vBox);
+ vBoxLayout->addWidget(m_autoPlayMediaFiles);
+
topLayout->addWidget(vBox);
loadSettings();
connect(m_openArchivesAsFolder, &QCheckBox::toggled, this, &NavigationSettingsPage::changed);
connect(m_autoExpandFolders, &QCheckBox::toggled, this, &NavigationSettingsPage::changed);
+ connect(m_autoPlayMediaFiles, &QCheckBox::toggled, this, &NavigationSettingsPage::changed);
}
NavigationSettingsPage::~NavigationSettingsPage()
@@ -60,6 +65,7 @@
GeneralSettings* settings = GeneralSettings::self();
settings->setBrowseThroughArchives(m_openArchivesAsFolder->isChecked());
settings->setAutoExpandFolders(m_autoExpandFolders->isChecked());
+ settings->setAutoPlayMediaFiles(m_autoPlayMediaFiles->isChecked());
settings->save();
}
@@ -76,5 +82,6 @@
{
m_openArchivesAsFolder->setChecked(GeneralSettings::browseThroughArchives());
m_autoExpandFolders->setChecked(GeneralSettings::autoExpandFolders());
+ m_autoPlayMediaFiles->setChecked(GeneralSettings::autoPlayMediaFiles());
}
--- a/src/settings/navigation/navigationsettingspage.h
+++ b/src/settings/navigation/navigationsettingspage.h
@@ -46,6 +46,7 @@
private:
QCheckBox* m_openArchivesAsFolder;
QCheckBox* m_autoExpandFolders;
+ QCheckBox* m_autoPlayMediaFiles;
};
#endif
--- a/src/panels/information/phononwidget.cpp
+++ b/src/panels/information/phononwidget.cpp
@@ -19,6 +19,8 @@
*/
#include "phononwidget.h"
+#include "dolphin_generalsettings.h"
+#include "dolphinmainwindow.h"
#include <Phonon/AudioOutput>
#include <Phonon/Global>
@@ -32,6 +34,7 @@
#include <QToolButton>
#include <QDialog>
#include <QIcon>
+#include <QTimer>
#include <KIconLoader>
#include <QUrl>
#include <KLocalizedString>
@@ -79,6 +82,20 @@
if (m_url != url) {
stop(); // emits playingStopped() signal
m_url = url;
+
+ //TODO: autoplay starts (related to qtimer) even if the target file has changed before the timer has run out
+ //TODO: stop/destroy the preview once user does not highlight the item/Dolphin main window or use the window
+ //TODO: the autoplay feature should only apply to audio files, exclude video files (as it works in Caja/Nautilus)
+
+ // Enables autoplay feature if it's enabled in Navigation Settings
+ // page. Set a single shot time delay (in msec) for media preview.
+ QTimer *m_autoplaytimer = new QTimer(this);
+
+ if(GeneralSettings::autoPlayMediaFiles()) { //If the this radiobutton is checked, then
+ connect(m_autoplaytimer, SIGNAL(timeout()), this, SLOT(play()));
+ m_autoplaytimer->setSingleShot(true); // Play only once, otherwise this loops in 1 sec cycles
+ m_autoplaytimer->start(1000); // Delay to start the autoplay
+ }
}
}
--- a/src/panels/information/phononwidget.h
+++ b/src/panels/information/phononwidget.h
@@ -78,6 +78,8 @@
private:
QUrl m_url;
QSize m_videoSize;
+
+ QTimer* m_autoplaytimer;
QToolButton *m_playButton;
QToolButton *m_stopButton;