Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (ignore 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 | |||
@@ -46,4 +46,5 @@ | |||
46 | #include <qpe/sound.h> | 46 | #include <qpe/sound.h> |
47 | #include <qpe/qcopenvelope_qws.h> | 47 | #include <qpe/qcopenvelope_qws.h> |
48 | #include <qpe/sound.h> | ||
48 | #include <opie2/okeyfilter.h> | 49 | #include <opie2/okeyfilter.h> |
49 | 50 | ||
@@ -172,4 +173,8 @@ ODevice::ODevice() | |||
172 | d->m_cpu_frequencies = new QStrList; | 173 | d->m_cpu_frequencies = new QStrList; |
173 | 174 | ||
175 | |||
176 | /* mixer */ | ||
177 | d->m_sound = d->m_vol = d->m_mixer = -1; | ||
178 | |||
174 | // New distribution detection code first checks for legacy distributions, | 179 | // New distribution detection code first checks for legacy distributions, |
175 | // identified by /etc/familiar-version or /etc/oz_version. | 180 | // identified by /etc/familiar-version or /etc/oz_version. |
@@ -706,4 +711,9 @@ void ODevice::virtual_hook(int, void* ){ | |||
706 | } | 711 | } |
707 | 712 | ||
713 | /** | ||
714 | * Sends a QCOP message to channel QPE/System | ||
715 | * with the message "aboutToSuspend()" if this | ||
716 | * is the windowing server | ||
717 | */ | ||
708 | void ODevice::sendSuspendmsg() | 718 | void ODevice::sendSuspendmsg() |
709 | { | 719 | { |
@@ -714,4 +724,15 @@ void ODevice::sendSuspendmsg() | |||
714 | } | 724 | } |
715 | 725 | ||
726 | /** | ||
727 | * \brief Prepend the QWSServer::KeyboardFilter to the list of installed KeyFilters | ||
728 | * | ||
729 | * Prepend a QWSServer::KeyboardFilter to the List of Keyboard | ||
730 | * Filters. This function is the only way to prepend a KeyFilter. | ||
731 | * | ||
732 | * @param aFilter The KeyFilter to be prepended to the list of filters | ||
733 | * | ||
734 | * @see Opie::Core::OKeyFilter | ||
735 | * @see Opie::Core::OKeyFilter::inst() | ||
736 | */ | ||
716 | void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) | 737 | void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) |
717 | { | 738 | { |
@@ -719,4 +740,13 @@ void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) | |||
719 | } | 740 | } |
720 | 741 | ||
742 | /** | ||
743 | * \brief Remove the QWSServer::KeyboardFilter in the param from the list | ||
744 | * | ||
745 | * Remove the QWSServer::KeyboardFilter \par aFilter from the List | ||
746 | * of Keyfilters. Call this when you delete the KeyFilter! | ||
747 | * | ||
748 | * @param aFilter The filter to be removed from the Opie::Core::OKeyFilter | ||
749 | * @see Opie::Core::ODevice::addPreHandler | ||
750 | */ | ||
721 | void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) | 751 | void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) |
722 | { | 752 | { |
@@ -724,4 +754,31 @@ void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) | |||
724 | } | 754 | } |
725 | 755 | ||
756 | void ODevice::playingStopped() { | ||
757 | const_cast<QObject*>(sender())->disconnect( this ); | ||
758 | if ( d->m_sound >= 0 ) { | ||
759 | ::ioctl ( d->m_sound, MIXER_WRITE( d->m_mixer ), &d->m_vol ); | ||
760 | ::close ( d->m_sound ); | ||
761 | } | ||
762 | } | ||
763 | |||
764 | void ODevice::changeMixerForAlarm( int mixer, const char* file, Sound *snd ) { | ||
765 | if (( d->m_sound = ::open ( file, O_RDWR )) >= 0 ) { | ||
766 | if ( ::ioctl ( d->m_sound, MIXER_READ( mixer ), &d->m_vol ) >= 0 ) { | ||
767 | Config cfg ( "qpe" ); | ||
768 | cfg. setGroup ( "Volume" ); | ||
769 | |||
770 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | ||
771 | if ( volalarm < 0 ) | ||
772 | volalarm = 0; | ||
773 | else if ( volalarm > 100 ) | ||
774 | volalarm = 100; | ||
775 | volalarm |= ( volalarm << 8 ); | ||
776 | |||
777 | if ( ::ioctl ( d->m_sound, MIXER_WRITE( mixer ), &volalarm ) >= 0 ) | ||
778 | register_qpe_sound_finished(snd, this, SLOT(playingStopped())); | ||
779 | } | ||
780 | d->m_mixer = mixer; | ||
781 | } | ||
782 | } | ||
726 | 783 | ||
727 | } | 784 | } |