summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice.cpp
authorzecke <zecke>2004-08-25 21:51:13 (UTC)
committer zecke <zecke>2004-08-25 21:51:13 (UTC)
commitdf3e4c8b13c16aeb96e70dbaa2d409f83eed988e (patch) (side-by-side diff)
tree59b12028c6e8a53b99f1686278b6e9fdc57ab18e /libopie2/opiecore/device/odevice.cpp
parente4811064703ad34f42f15c3044cd8f63c0e7583c (diff)
downloadopie-df3e4c8b13c16aeb96e70dbaa2d409f83eed988e.zip
opie-df3e4c8b13c16aeb96e70dbaa2d409f83eed988e.tar.gz
opie-df3e4c8b13c16aeb96e70dbaa2d409f83eed988e.tar.bz2
-Have a common implementation for reading the config value
and setting the Mixer. The mixer, sound and path is configurable -Restore the Opie HEADER (who is guilty? probably me) -Fix warnings -Port Zaurus,Simpad,Ipaq to configure the mixer
Diffstat (limited to 'libopie2/opiecore/device/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp57
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 @@
#include <qpe/sound.h>
#include <qpe/qcopenvelope_qws.h>
+#include <qpe/sound.h>
#include <opie2/okeyfilter.h>
@@ -172,4 +173,8 @@ ODevice::ODevice()
d->m_cpu_frequencies = new QStrList;
+
+ /* mixer */
+ d->m_sound = d->m_vol = d->m_mixer = -1;
+
// New distribution detection code first checks for legacy distributions,
// identified by /etc/familiar-version or /etc/oz_version.
@@ -706,4 +711,9 @@ 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()
{
@@ -714,4 +724,15 @@ 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)
{
@@ -719,4 +740,13 @@ 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)
{
@@ -724,4 +754,31 @@ 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;
+ }
+}
}