author | zecke <zecke> | 2004-10-13 13:00:45 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-13 13:00:45 (UTC) |
commit | 72065f1f1aa12882ae63f8b063312e96dd683156 (patch) (side-by-side diff) | |
tree | 0e4a68f4aac3cc8686987d03adc323a795db6b5c /libopie2 | |
parent | c931e96eb4bf7df64bca49c2343f2203bac637ba (diff) | |
download | opie-72065f1f1aa12882ae63f8b063312e96dd683156.zip opie-72065f1f1aa12882ae63f8b063312e96dd683156.tar.gz opie-72065f1f1aa12882ae63f8b063312e96dd683156.tar.bz2 |
-Create the QPE/System channel in ODevice to listen for button remapping
-Remove various connect and QCopChannel creation from actual device implementations
Let us see if that breaks anything, I hope SIMpad still will do fine. We might need to
guard if a qApp exists?
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 13 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 1 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_yopy.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 4 |
6 files changed, 11 insertions, 17 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 8b64c41..67cae1c 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp @@ -174,12 +174,15 @@ ODevice::ODevice() d->m_buttons = 0; d->m_cpu_frequencies = new QStrList; /* mixer */ d->m_sound = d->m_vol = d->m_mixer = -1; + + /* System QCopChannel created */ + d->m_initializedButtonQcop = false; // New distribution detection code first checks for legacy distributions, // identified by /etc/familiar-version or /etc/oz_version. // Then check for OpenEmbedded and lastly, read /etc/issue for ( unsigned int i = 0; i < sizeof distributions; ++i ) @@ -230,15 +233,12 @@ void ODevice::initButtons() b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); d->m_buttons->append ( b ); } reloadButtonMapping(); - - QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); - connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); } ODevice::~ODevice() { // we leak m_devicebuttons and m_cpu_frequency // but it's a singleton and it is not so importantant @@ -642,12 +642,19 @@ const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) return 0; } void ODevice::reloadButtonMapping() { initButtons(); + + if(!d->m_initializedButtonQcop) { + QCopChannel *chan = new QCopChannel("QPE/System", this, "ODevice button channel"); + connect(chan,SIGNAL(received(const QCString&,const QByteArray&)), + this,SLOT(systemMessage(const QCString&,const QByteArray&))); + d->m_initializedButtonQcop = true; + } Config cfg ( "ButtonSettings" ); for ( uint i = 0; i < d->m_buttons->count(); i++ ) { ODeviceButton &b = ( *d->m_buttons ) [i]; QString group = "Button" + QString::number ( i ); diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index 6f0d036..21fcc3f 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h @@ -354,12 +354,13 @@ class ODeviceData { Transformation m_rotation; ODirection m_direction; QValueList <ODeviceButton> *m_buttons; uint m_holdtime; QStrList *m_cpu_frequencies; + bool m_initializedButtonQcop : 1; /* values for changeMixerForAlarm */ int m_sound, m_vol, m_mixer; }; extern bool isQWS(); diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index 6193ddc..9e01a0c 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp @@ -186,15 +186,12 @@ void iPAQ::initButtons() b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); d->m_buttons->append ( b ); } } reloadButtonMapping(); - - QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); - connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); } QValueList <OLed> iPAQ::ledList() const { QValueList <OLed> vl; vl << Led_Power; diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 2cab0c8..8141f1c 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp @@ -137,15 +137,12 @@ void Jornada::initButtons() b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); d->m_buttons->append ( b ); } } reloadButtonMapping(); - - QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); - connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); } int Jornada::displayBrightnessResolution() const { return 255; } diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp index a06d7ec..8f22514 100644 --- a/libopie2/opiecore/device/odevice_yopy.cpp +++ b/libopie2/opiecore/device/odevice_yopy.cpp @@ -106,16 +106,12 @@ void Yopy::initButtons() b. setFactoryPresetHeldAction ( OQCopMessage( makeChannel( ib->fheldservice ), ib->fheldaction ) ); d->m_buttons->append ( b ); } reloadButtonMapping(); - - QCopChannel *sysch = new QCopChannel( "QPE/System", this ); - connect( sysch, SIGNAL( received(const QCString&,const QByteArray&) ), - this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); } bool Yopy::suspend() { /* Opie for Yopy does not implement its own power management at the diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 733479e..ebe1949 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp @@ -235,16 +235,12 @@ void Zaurus::initButtons() zb->fheldaction )); d->m_buttons->append ( b ); } reloadButtonMapping(); - - QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); - connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), - this, SLOT( systemMessage(const QCString&,const QByteArray&))); } #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> |