Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index b58f9eb..26c6dca 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp @@ -47,2 +47,3 @@ #include <qpe/qcopenvelope_qws.h> +#include <qpe/sound.h> #include <opie2/okeyfilter.h> @@ -173,2 +174,6 @@ ODevice::ODevice() + + /* mixer */ + d->m_sound = d->m_vol = d->m_mixer = -1; + // New distribution detection code first checks for legacy distributions, @@ -707,2 +712,7 @@ void ODevice::virtual_hook(int, void* ){ +/** + * Sends a QCOP message to channel QPE/System + * with the message "aboutToSuspend()" if this + * is the windowing server + */ void ODevice::sendSuspendmsg() @@ -715,2 +725,13 @@ void ODevice::sendSuspendmsg() +/** + * \brief Prepend the QWSServer::KeyboardFilter to the list of installed KeyFilters + * + * Prepend a QWSServer::KeyboardFilter to the List of Keyboard + * Filters. This function is the only way to prepend a KeyFilter. + * + * @param aFilter The KeyFilter to be prepended to the list of filters + * + * @see Opie::Core::OKeyFilter + * @see Opie::Core::OKeyFilter::inst() + */ void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) @@ -720,2 +741,11 @@ void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) +/** + * \brief Remove the QWSServer::KeyboardFilter in the param from the list + * + * Remove the QWSServer::KeyboardFilter \par aFilter from the List + * of Keyfilters. Call this when you delete the KeyFilter! + * + * @param aFilter The filter to be removed from the Opie::Core::OKeyFilter + * @see Opie::Core::ODevice::addPreHandler + */ void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) @@ -725,2 +755,29 @@ void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) +void ODevice::playingStopped() { + const_cast<QObject*>(sender())->disconnect( this ); + if ( d->m_sound >= 0 ) { + ::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol ); + ::close ( d->m_sound ); + } +} + +void ODevice::changeMixerForAlarm( int mixer, const char* file, Sound *snd ) { + if (( d->m_sound = ::open ( file, O_RDWR )) >= 0 ) { + if ( ::ioctl ( d->m_sound, MIXER_READ( mixer ), &d->m_vol ) >= 0 ) { + Config cfg ( "qpe" ); + cfg. setGroup ( "Volume" ); + + int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); + if ( volalarm < 0 ) + volalarm = 0; + else if ( volalarm > 100 ) + volalarm = 100; + volalarm |= ( volalarm << 8 ); + + if ( ::ioctl ( d->m_sound, MIXER_WRITE( mixer ), &volalarm ) >= 0 ) + register_qpe_sound_finished(snd, this, SLOT(playingStopped())); + } + d->m_mixer = mixer; + } +} |