| Summary: | patch : add autoexit feature (terminate app at end of clip) | ||
|---|---|---|---|
| Product: | [Unmaintained] kmplayer | Reporter: | Wim Delvaux <wim.delvaux> |
| Component: | general | Assignee: | Koos Vriezen <koos.vriezen> |
| Status: | RESOLVED UNMAINTAINED | ||
| Severity: | wishlist | CC: | kde-bugs |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Unlisted Binaries | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Wim Delvaux
2005-10-15 01:58:52 UTC
this is the patch
diff --exclude '*.o' -Naur kmplayer-0.9.1-rc1/src/kmplayerconfig.cpp kmplayer-0.9.1-rc1-patched/src/kmplayerconfig.cpp
--- kmplayer-0.9.1-rc1/src/kmplayerconfig.cpp 2005-10-14 14:56:55.000000000 +0200
+++ kmplayer-0.9.1-rc1-patched/src/kmplayerconfig.cpp 2005-10-15 01:10:30.092607792 +0200
@@ -139,6 +139,7 @@
static const char * strLoop = "Loop";
static const char * strFrameDrop = "Frame Drop";
static const char * strAdjustVolume = "Auto Adjust Volume";
+static const char * strAutoExit = "Auto Exit";
static const char * strAddConfigButton = "Add Configure Button";
static const char * strAddPlaylistButton = "Add Playlist Button";
static const char * strAddRecordButton = "Add Record Button";
@@ -282,6 +283,7 @@
loop = m_config->readBoolEntry (strLoop, false);
framedrop = m_config->readBoolEntry (strFrameDrop, true);
autoadjustvolume = m_config->readBoolEntry (strAdjustVolume, true);
+ doautoexit = m_config->readBoolEntry (strAutoExit, true);
mplayerpost090 = m_config->readBoolEntry (strPostMPlayer090, true);
showcnfbutton = m_config->readBoolEntry (strAddConfigButton, true);
showrecordbutton = m_config->readBoolEntry (strAddRecordButton, true);
@@ -398,6 +400,7 @@
configdialog->m_GeneralPageGeneral->loop->setChecked (loop);
configdialog->m_GeneralPageGeneral->framedrop->setChecked (framedrop);
configdialog->m_GeneralPageGeneral->adjustvolume->setChecked (autoadjustvolume);
+ configdialog->m_GeneralPageGeneral->autoexit->setChecked (doautoexit);
//configdialog->m_GeneralPageGeneral->autoHideSlider->setChecked (autohideslider);
configdialog->m_GeneralPageGeneral->showConfigButton->setChecked (showcnfbutton);
configdialog->m_GeneralPageGeneral->showPlaylistButton->setChecked (showplaylistbutton);
@@ -512,6 +515,7 @@
m_config->writeEntry (strLoop, loop);
m_config->writeEntry (strFrameDrop, framedrop);
m_config->writeEntry (strAdjustVolume, autoadjustvolume);
+ m_config->writeEntry (strAutoExit, doautoexit);
m_config->writeEntry (strSeekTime, seektime);
m_config->writeEntry (strVoDriver, videodriver);
m_config->writeEntry (strAoDriver, audiodriver);
@@ -637,6 +641,7 @@
loop = configdialog->m_GeneralPageGeneral->loop->isChecked ();
framedrop = configdialog->m_GeneralPageGeneral->framedrop->isChecked ();
autoadjustvolume = configdialog->m_GeneralPageGeneral->adjustvolume->isChecked ();
+ doautoexit = configdialog->m_GeneralPageGeneral->autoexit->isChecked ();
showcnfbutton = configdialog->m_GeneralPageGeneral->showConfigButton->isChecked ();
showplaylistbutton = configdialog->m_GeneralPageGeneral->showPlaylistButton->isChecked ();
showrecordbutton = configdialog->m_GeneralPageGeneral->showRecordButton->isChecked ();
diff --exclude '*.o' -Naur kmplayer-0.9.1-rc1/src/kmplayerconfig.h kmplayer-0.9.1-rc1-patched/src/kmplayerconfig.h
--- kmplayer-0.9.1-rc1/src/kmplayerconfig.h 2005-10-14 14:56:55.000000000 +0200
+++ kmplayer-0.9.1-rc1-patched/src/kmplayerconfig.h 2005-10-15 01:08:43.734776640 +0200
@@ -125,6 +125,7 @@
bool loop : 1;
bool framedrop : 1;
bool autoadjustvolume : 1;
+ bool doautoexit : 1;
bool showcnfbutton : 1;
bool showplaylistbutton : 1;
bool showrecordbutton : 1;
diff --exclude '*.o' -Naur kmplayer-0.9.1-rc1/src/kmplayercontrolpanel.cpp kmplayer-0.9.1-rc1-patched/src/kmplayercontrolpanel.cpp
--- kmplayer-0.9.1-rc1/src/kmplayercontrolpanel.cpp 2005-10-14 14:56:55.000000000 +0200
+++ kmplayer-0.9.1-rc1-patched/src/kmplayercontrolpanel.cpp 2005-10-15 01:28:38.281177984 +0200
@@ -377,7 +377,7 @@
m_buttonbox->addWidget (m_posSlider);
showPositionSlider (true);
m_volume = new VolumeBar (this, m_view);
- m_buttonbox->addWidget (m_volume);
+ m_buttonbox->addWidget(m_volume);
m_popupMenu = new KMPlayerPopupMenu (this);
m_playerMenu = new KMPlayerPopupMenu (this);
m_popupMenu->insertItem (i18n ("&Play with"), m_playerMenu, menu_player);
diff --exclude '*.o' -Naur kmplayer-0.9.1-rc1/src/kmplayerprocess.cpp kmplayer-0.9.1-rc1-patched/src/kmplayerprocess.cpp
--- kmplayer-0.9.1-rc1/src/kmplayerprocess.cpp 2005-10-14 14:56:55.000000000 +0200
+++ kmplayer-0.9.1-rc1-patched/src/kmplayerprocess.cpp 2005-10-15 01:39:01.991359624 +0200
@@ -20,6 +20,7 @@
#include <math.h>
#include <config.h>
#include <qstring.h>
+#include <qapplication.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qtimer.h>
@@ -724,8 +725,12 @@
int pos = m_source->position ();
play (m_source, m_mrl);
seek (pos, true);
- } else
+ } else {
+ if( m_settings->doautoexit ) {
+ qApp->quit();
+ }
MPlayerBase::processStopped (p);
+ }
}
}
diff --exclude '*.o' -Naur kmplayer-0.9.1-rc1/src/pref.cpp kmplayer-0.9.1-rc1-patched/src/pref.cpp
--- kmplayer-0.9.1-rc1/src/pref.cpp 2005-10-14 14:56:55.000000000 +0200
+++ kmplayer-0.9.1-rc1-patched/src/pref.cpp 2005-10-15 01:05:41.044549776 +0200
@@ -219,13 +219,15 @@
vbox->addWidget (bbox);
vbox->addWidget (sizesChoice);
- QGroupBox *playbox =new QGroupBox(3, Qt::Vertical,i18n("Playing"),this);
+ QGroupBox *playbox =new QGroupBox(4, Qt::Vertical,i18n("Playing"),this);
loop = new QCheckBox (i18n("Loop"), playbox);
QWhatsThis::add(loop, i18n("Makes current movie loop"));
framedrop = new QCheckBox (i18n ("Allow framedrops"), playbox);
QWhatsThis::add (framedrop, i18n ("Allow dropping frames for better audio and video synchronization"));
adjustvolume = new QCheckBox(i18n("Auto set volume on start"), playbox);
QWhatsThis::add (adjustvolume, i18n ("When a new source is selected, the volume will be set according the volume control"));
+ autoexit = new QCheckBox (i18n("Auto e&xit"), playbox);
+ QWhatsThis::add(autoexit, i18n("Exit after playing movie"));
QGroupBox * gbox =new QGroupBox (1, Qt::Vertical, i18n("Control Panel"), this);
bbox =new QWidget (gbox);
diff --exclude '*.o' -Naur kmplayer-0.9.1-rc1/src/pref.h kmplayer-0.9.1-rc1-patched/src/pref.h
--- kmplayer-0.9.1-rc1/src/pref.h 2005-10-14 14:56:55.000000000 +0200
+++ kmplayer-0.9.1-rc1-patched/src/pref.h 2005-10-15 01:05:48.944348824 +0200
@@ -109,6 +109,7 @@
QCheckBox *showBroadcastButton;
QCheckBox *framedrop;
QCheckBox *adjustvolume;
+ QCheckBox *autoexit;
QSpinBox *seekTime;
};
Thanks for the patch. Don't you think that this option should be coupled with whether the application is started with an URL or not. Ie. kmplayer mymov.avi #when autoexit is true than exit after playing the movie kmplayer #ignore autoexit Also because of the plugin, your patch will exit konqueror as well. Btw, kmplayer is now in a string freeze. So the GUI config option should be added after the 0.9.1 release, but users could edit kmplayerrc manually to enable this. I know this is a quick hack. If you can tell me the correct way to 'exit' playing (instead of qApp->quit()) and the correct way to check if you started with URL or not (instead of if( settings()->autoexit ) I will change the code and send a new patch. W I think qApp->quit is fine. But you should add it in Source::stateChange, because then it also works with playlists (state goes to NotRunning after playing a file, playlist or single) and for all players. You can check if started with url there, where also the IntroSource is created for the intro animation. Simple add an extra boolean for this in the Settings class I think. I tried adding it to Source::stateChange
...
} else if (news == Process::NotRunning) {
if (hasLength () && position () > length ())
setLength (m_document, position ());
if( m_player->settings()->doautoexit ) {
qApp->quit();
}
setPosition (0);
emit stopPlaying ();
} else if (news == Process::Ready) {
But that does not seem to work. I tried running a clip till end but it does not make the application stop. Did I misunderstand your remark ?
Also Can you be more precise with how I can detect whether the App was started with an URL ?
W
No, that should work AFAICS. However I just now see that there is also a signal emitted there ('stopPlaying'), so that should be a much better way.
The KMPlayerApp::openDocumentFile member is called from main, and the first time the m_played_intro is false, so there could the connection with the signal be made if autoexit is true and !url.isEmpty(). In the slot call qApp->quit unconditionally (add a private slot in kmplayer.h).
This has the advantage that all code for this is kept from the plugin.
This project is unfortunately no longer maintained. If a new maintainer wants to step up and take care, the project is archived here: https://invent.kde.org/multimedia/kmplayer You can just clone it in your private namespace on invent.kde.org and if you have started to work on it and fixed/implemented something get it reviewed and the project unarchived. Sorry for the inconveniences. |