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

  1. --- a/src/settings/dolphin_generalsettings.kcfg
  2. +++ b/src/settings/dolphin_generalsettings.kcfg
  3. @@ -81,6 +81,10 @@
  4. <label>Use auto-expanding folders for all view types</label>
  5. <default>false</default>
  6. </entry>
  7. + <entry name="AutoPlayMediaFiles" type="Bool">
  8. + <label>Play media files automatically while hovering a cursor</label>
  9. + <default>false</default>
  10. + </entry>
  11. <entry name="ShowZoomSlider" type="Bool">
  12. <label>Show zoom slider in the statusbar</label>
  13. <default>true</default>
  14. --- a/src/settings/navigation/navigationsettingspage.cpp
  15. +++ b/src/settings/navigation/navigationsettingspage.cpp
  16. @@ -29,7 +29,8 @@
  17. NavigationSettingsPage::NavigationSettingsPage(QWidget* parent) :
  18. SettingsPageBase(parent),
  19. m_openArchivesAsFolder(0),
  20. - m_autoExpandFolders(0)
  21. + m_autoExpandFolders(0),
  22. + m_autoPlayMediaFiles(0)
  23. {
  24. QVBoxLayout* topLayout = new QVBoxLayout(this);
  25. QWidget* vBox = new QWidget(this);
  26. @@ -43,12 +44,16 @@
  27. m_autoExpandFolders = new QCheckBox(i18nc("option:check", "Open folders during drag operations"), vBox);
  28. vBoxLayout->addWidget(m_autoExpandFolders);
  29. + m_autoPlayMediaFiles = new QCheckBox(i18nc("@option:check", "Play media files automatically"), vBox);
  30. + vBoxLayout->addWidget(m_autoPlayMediaFiles);
  31. +
  32. topLayout->addWidget(vBox);
  33. loadSettings();
  34. connect(m_openArchivesAsFolder, &QCheckBox::toggled, this, &NavigationSettingsPage::changed);
  35. connect(m_autoExpandFolders, &QCheckBox::toggled, this, &NavigationSettingsPage::changed);
  36. + connect(m_autoPlayMediaFiles, &QCheckBox::toggled, this, &NavigationSettingsPage::changed);
  37. }
  38. NavigationSettingsPage::~NavigationSettingsPage()
  39. @@ -60,6 +65,7 @@
  40. GeneralSettings* settings = GeneralSettings::self();
  41. settings->setBrowseThroughArchives(m_openArchivesAsFolder->isChecked());
  42. settings->setAutoExpandFolders(m_autoExpandFolders->isChecked());
  43. + settings->setAutoPlayMediaFiles(m_autoPlayMediaFiles->isChecked());
  44. settings->save();
  45. }
  46. @@ -76,5 +82,6 @@
  47. {
  48. m_openArchivesAsFolder->setChecked(GeneralSettings::browseThroughArchives());
  49. m_autoExpandFolders->setChecked(GeneralSettings::autoExpandFolders());
  50. + m_autoPlayMediaFiles->setChecked(GeneralSettings::autoPlayMediaFiles());
  51. }
  52. --- a/src/settings/navigation/navigationsettingspage.h
  53. +++ b/src/settings/navigation/navigationsettingspage.h
  54. @@ -46,6 +46,7 @@
  55. private:
  56. QCheckBox* m_openArchivesAsFolder;
  57. QCheckBox* m_autoExpandFolders;
  58. + QCheckBox* m_autoPlayMediaFiles;
  59. };
  60. #endif
  61. --- a/src/panels/information/phononwidget.cpp
  62. +++ b/src/panels/information/phononwidget.cpp
  63. @@ -19,6 +19,8 @@
  64. */
  65. #include "phononwidget.h"
  66. +#include "dolphin_generalsettings.h"
  67. +#include "dolphinmainwindow.h"
  68. #include <Phonon/AudioOutput>
  69. #include <Phonon/Global>
  70. @@ -32,6 +34,7 @@
  71. #include <QToolButton>
  72. #include <QDialog>
  73. #include <QIcon>
  74. +#include <QTimer>
  75. #include <KIconLoader>
  76. #include <QUrl>
  77. #include <KLocalizedString>
  78. @@ -79,6 +82,20 @@
  79. if (m_url != url) {
  80. stop(); // emits playingStopped() signal
  81. m_url = url;
  82. +
  83. + //TODO: autoplay starts (related to qtimer) even if the target file has changed before the timer has run out
  84. + //TODO: stop/destroy the preview once user does not highlight the item/Dolphin main window or use the window
  85. + //TODO: the autoplay feature should only apply to audio files, exclude video files (as it works in Caja/Nautilus)
  86. +
  87. + // Enables autoplay feature if it's enabled in Navigation Settings
  88. + // page. Set a single shot time delay (in msec) for media preview.
  89. + QTimer *m_autoplaytimer = new QTimer(this);
  90. +
  91. + if(GeneralSettings::autoPlayMediaFiles()) { //If the this radiobutton is checked, then
  92. + connect(m_autoplaytimer, SIGNAL(timeout()), this, SLOT(play()));
  93. + m_autoplaytimer->setSingleShot(true); // Play only once, otherwise this loops in 1 sec cycles
  94. + m_autoplaytimer->start(1000); // Delay to start the autoplay
  95. + }
  96. }
  97. }
  98. --- a/src/panels/information/phononwidget.h
  99. +++ b/src/panels/information/phononwidget.h
  100. @@ -78,6 +78,8 @@
  101. private:
  102. QUrl m_url;
  103. QSize m_videoSize;
  104. +
  105. + QTimer* m_autoplaytimer;
  106. QToolButton *m_playButton;
  107. QToolButton *m_stopButton;