summaryrefslogtreecommitdiff
path: root/NxWidgets
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-07-27 10:46:00 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-07-27 10:46:00 -0600
commit37317ad77cc8f1373007a2ff57aec7ee8880029c (patch)
treebcfebe6616b2fe77a6e86dff53dc1c4d0ba44e97 /NxWidgets
parent149c502323f818b0a359422f0541d4ba5b77b999 (diff)
downloadnuttx-37317ad77cc8f1373007a2ff57aec7ee8880029c.tar.gz
nuttx-37317ad77cc8f1373007a2ff57aec7ee8880029c.tar.bz2
nuttx-37317ad77cc8f1373007a2ff57aec7ee8880029c.zip
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
Diffstat (limited to 'NxWidgets')
-rw-r--r--NxWidgets/nxwm/include/cmediaplayer.hxx1
-rw-r--r--NxWidgets/nxwm/src/cmediaplayer.cxx12
2 files changed, 12 insertions, 1 deletions
diff --git a/NxWidgets/nxwm/include/cmediaplayer.hxx b/NxWidgets/nxwm/include/cmediaplayer.hxx
index 1b9b98a66..ea1133f98 100644
--- a/NxWidgets/nxwm/include/cmediaplayer.hxx
+++ b/NxWidgets/nxwm/include/cmediaplayer.hxx
@@ -152,6 +152,7 @@ namespace NxWM
enum EMediaPlayerState m_prevState; /**< Media player previous state */
enum EPendingRelease m_pending; /**< Pending image release event */
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 */
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
uint8_t m_level; /**< Current volume level, range 0-100 */
diff --git a/NxWidgets/nxwm/src/cmediaplayer.cxx b/NxWidgets/nxwm/src/cmediaplayer.cxx
index b43139f79..cd76e5a9c 100644
--- a/NxWidgets/nxwm/src/cmediaplayer.cxx
+++ b/NxWidgets/nxwm/src/cmediaplayer.cxx
@@ -133,6 +133,7 @@ CMediaPlayer::CMediaPlayer(CTaskbar *taskbar, CApplicationWindow *window)
m_state = MPLAYER_STOPPED;
m_prevState = MPLAYER_STOPPED;
m_pending = PENDING_NONE;
+ m_fileIndex = -1;
#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
m_level = 0;
#endif
@@ -1401,6 +1402,7 @@ void CMediaPlayer::checkFileSelection(void)
// No file is selected
m_fileReady = false;
+ m_fileIndex = -1;
// Nothing is selected.. If we are not stopped, then stop now
@@ -1417,8 +1419,16 @@ void CMediaPlayer::checkFileSelection(void)
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?
// Make sure that we are not already playing. Should be okay if
// are in a STOPPED or STAGED state. We are not really playing