NxWM::CMediaPlayer: Need to remember last text box selection or else each new Value Change event from the volume slider is confused with a new file selection
This commit is contained in:
parent
ad3862a383
commit
c0d9be145f
@ -152,6 +152,7 @@ namespace NxWM
|
|||||||
enum EMediaPlayerState m_prevState; /**< Media player previous state */
|
enum EMediaPlayerState m_prevState; /**< Media player previous state */
|
||||||
enum EPendingRelease m_pending; /**< Pending image release event */
|
enum EPendingRelease m_pending; /**< Pending image release event */
|
||||||
NXWidgets::CNxString m_filePath; /**< The full path to the selected file */
|
NXWidgets::CNxString m_filePath; /**< The full path to the selected file */
|
||||||
|
unsigned int m_fileIndex; /**< Last selected text box selection */
|
||||||
bool m_fileReady; /**< True: Ready to play */
|
bool m_fileReady; /**< True: Ready to play */
|
||||||
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
|
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
|
||||||
uint8_t m_level; /**< Current volume level, range 0-100 */
|
uint8_t m_level; /**< Current volume level, range 0-100 */
|
||||||
|
@ -133,6 +133,7 @@ CMediaPlayer::CMediaPlayer(CTaskbar *taskbar, CApplicationWindow *window)
|
|||||||
m_state = MPLAYER_STOPPED;
|
m_state = MPLAYER_STOPPED;
|
||||||
m_prevState = MPLAYER_STOPPED;
|
m_prevState = MPLAYER_STOPPED;
|
||||||
m_pending = PENDING_NONE;
|
m_pending = PENDING_NONE;
|
||||||
|
m_fileIndex = -1;
|
||||||
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
|
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
|
||||||
m_level = 0;
|
m_level = 0;
|
||||||
#endif
|
#endif
|
||||||
@ -1401,6 +1402,7 @@ void CMediaPlayer::checkFileSelection(void)
|
|||||||
// No file is selected
|
// No file is selected
|
||||||
|
|
||||||
m_fileReady = false;
|
m_fileReady = false;
|
||||||
|
m_fileIndex = -1;
|
||||||
|
|
||||||
// Nothing is selected.. If we are not stopped, then stop now
|
// Nothing is selected.. If we are not stopped, then stop now
|
||||||
|
|
||||||
@ -1417,8 +1419,16 @@ void CMediaPlayer::checkFileSelection(void)
|
|||||||
setMediaPlayerState(MPLAYER_STOPPED);
|
setMediaPlayerState(MPLAYER_STOPPED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// Ignore the file selection if it is the same file that was selected
|
||||||
|
// last time.
|
||||||
|
|
||||||
|
else if (newFileIndex != m_fileIndex)
|
||||||
{
|
{
|
||||||
|
// Remember the file selection
|
||||||
|
|
||||||
|
m_fileIndex = newFileIndex;
|
||||||
|
|
||||||
// A media file is selected. Were we in a STOPPED state before?
|
// A media file is selected. Were we in a STOPPED state before?
|
||||||
// Make sure that we are not already playing. Should be okay if
|
// Make sure that we are not already playing. Should be okay if
|
||||||
// are in a STOPPED or STAGED state. We are not really playing
|
// are in a STOPPED or STAGED state. We are not really playing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user