diff options
| -rw-r--r-- | src/qmmp/soundcore.cpp | 2 | ||||
| -rw-r--r-- | src/qmmp/soundcore.h | 7 | ||||
| -rw-r--r-- | src/qmmp/statehandler.cpp | 15 | ||||
| -rw-r--r-- | src/qmmp/statehandler.h | 6 | ||||
| -rw-r--r-- | src/qmmpui/mediaplayer.cpp | 2 |
5 files changed, 25 insertions, 7 deletions
diff --git a/src/qmmp/soundcore.cpp b/src/qmmp/soundcore.cpp index 483add591..31c35e78a 100644 --- a/src/qmmp/soundcore.cpp +++ b/src/qmmp/soundcore.cpp @@ -58,7 +58,7 @@ SoundCore::SoundCore(QObject *parent) connect(m_handler, SIGNAL(metaDataChanged ()), SIGNAL(metaDataChanged ())); connect(m_handler, SIGNAL(stateChanged (Qmmp::State)), SIGNAL(stateChanged(Qmmp::State))); connect(m_handler, SIGNAL(stateChanged (Qmmp::State)), SLOT(startPendingEngine())); - connect(m_handler, SIGNAL(aboutToFinish()), SIGNAL(aboutToFinish())); + connect(m_handler, SIGNAL(nextTrackRequest()), SIGNAL(nextTrackRequest())); connect(m_handler, SIGNAL(bufferingProgress(int)), SIGNAL(bufferingProgress(int))); updateVolume(); connect(QmmpSettings::instance(), SIGNAL(eqSettingsChanged()), SIGNAL(eqSettingsChanged())); diff --git a/src/qmmp/soundcore.h b/src/qmmp/soundcore.h index 474d63c0c..2019598f9 100644 --- a/src/qmmp/soundcore.h +++ b/src/qmmp/soundcore.h @@ -183,11 +183,14 @@ signals: * @param right Right channel volume level. It should be \b [0..100] */ void volumeChanged(int left, int right); + /*! + * Emitted when equalizer settings have changed. + */ void eqSettingsChanged(); /*! - * Emitted before the playback ends. + * Emitted before playback ends. Use this signal to append new url to the queue. */ - void aboutToFinish(); + void nextTrackRequest(); private slots: bool enqueue(InputSource *); diff --git a/src/qmmp/statehandler.cpp b/src/qmmp/statehandler.cpp index ce7c1df32..c48538c78 100644 --- a/src/qmmp/statehandler.cpp +++ b/src/qmmp/statehandler.cpp @@ -24,7 +24,7 @@ #include "statehandler.h" #define TICK_INTERVAL 250 -#define PREFINISH_TIME 11000 +#define PREFINISH_TIME 6000 StateHandler* StateHandler::m_instance = 0; @@ -71,7 +71,7 @@ void StateHandler::dispatch(qint64 elapsed, { m_sendAboutToFinish = false; if(SoundCore::instance()->totalTime() - m_elapsed > PREFINISH_TIME/2) - emit aboutToFinish(); + emit nextTrackRequest(); } } if (m_frequency != frequency) @@ -203,6 +203,17 @@ QString StateHandler::metaData(Qmmp::MetaData key) return m_metaData.value(key); } +void StateHandler::sendNextTrackRequest() +{ + m_mutex.lock(); + if(m_sendAboutToFinish) + { + m_sendAboutToFinish = false; + emit nextTrackRequest(); + } + m_mutex.unlock(); +} + StateHandler *StateHandler::instance() { return m_instance; diff --git a/src/qmmp/statehandler.h b/src/qmmp/statehandler.h index cffa9a3ec..1fac1b4d1 100644 --- a/src/qmmp/statehandler.h +++ b/src/qmmp/statehandler.h @@ -101,6 +101,10 @@ public: */ QString metaData(Qmmp::MetaData key); /*! + * Sends \b nextTrackRequest() signal manually. + */ + void sendNextTrackRequest(); + /*! * Returns a pointer to the first created StateHandler instance. */ static StateHandler* instance(); @@ -146,7 +150,7 @@ signals: /*! * Emitted before the playback ends. */ - void aboutToFinish(); + void nextTrackRequest(); /*! * This signal is emitted when the stream reader fills it's buffer. * The argument \b progress indicates the current percentage of buffering completed. diff --git a/src/qmmpui/mediaplayer.cpp b/src/qmmpui/mediaplayer.cpp index 3fc6cd4a0..cf8a41d46 100644 --- a/src/qmmpui/mediaplayer.cpp +++ b/src/qmmpui/mediaplayer.cpp @@ -60,7 +60,7 @@ void MediaPlayer::initialize(SoundCore *core, PlayListManager *pl_manager) m_pl_manager = pl_manager; m_repeat = false; m_autoStop = false; - connect(m_core, SIGNAL(aboutToFinish()), SLOT(updateNextUrl())); + connect(m_core, SIGNAL(nextTrackRequest()), SLOT(updateNextUrl())); connect(m_core, SIGNAL(finished()), SLOT(playNext())); } |
