summaryrefslogtreecommitdiff
path: root/libopie2
authorzecke <zecke>2004-10-13 13:00:45 (UTC)
committer zecke <zecke>2004-10-13 13:00:45 (UTC)
commit72065f1f1aa12882ae63f8b063312e96dd683156 (patch) (unidiff)
tree0e4a68f4aac3cc8686987d03adc323a795db6b5c /libopie2
parentc931e96eb4bf7df64bca49c2343f2203bac637ba (diff)
downloadopie-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?
Diffstat (limited to 'libopie2') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp13
-rw-r--r--libopie2/opiecore/device/odevice.h1
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp3
-rw-r--r--libopie2/opiecore/device/odevice_jornada.cpp3
-rw-r--r--libopie2/opiecore/device/odevice_yopy.cpp4
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp4
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
@@ -175,12 +175,15 @@ ODevice::ODevice()
175 d->m_cpu_frequencies = new QStrList; 175 d->m_cpu_frequencies = new QStrList;
176 176
177 177
178 /* mixer */ 178 /* mixer */
179 d->m_sound = d->m_vol = d->m_mixer = -1; 179 d->m_sound = d->m_vol = d->m_mixer = -1;
180 180
181 /* System QCopChannel created */
182 d->m_initializedButtonQcop = false;
183
181 // New distribution detection code first checks for legacy distributions, 184 // New distribution detection code first checks for legacy distributions,
182 // identified by /etc/familiar-version or /etc/oz_version. 185 // identified by /etc/familiar-version or /etc/oz_version.
183 // Then check for OpenEmbedded and lastly, read /etc/issue 186 // Then check for OpenEmbedded and lastly, read /etc/issue
184 187
185 for ( unsigned int i = 0; i < sizeof distributions; ++i ) 188 for ( unsigned int i = 0; i < sizeof distributions; ++i )
186 { 189 {
@@ -230,15 +233,12 @@ void ODevice::initButtons()
230 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); 233 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction ));
231 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); 234 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction ));
232 d->m_buttons->append ( b ); 235 d->m_buttons->append ( b );
233 } 236 }
234 237
235 reloadButtonMapping(); 238 reloadButtonMapping();
236
237 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
238 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
239} 239}
240 240
241ODevice::~ODevice() 241ODevice::~ODevice()
242{ 242{
243// we leak m_devicebuttons and m_cpu_frequency 243// we leak m_devicebuttons and m_cpu_frequency
244// but it's a singleton and it is not so importantant 244// but it's a singleton and it is not so importantant
@@ -643,12 +643,19 @@ const ODeviceButton *ODevice::buttonForKeycode ( ushort code )
643} 643}
644 644
645void ODevice::reloadButtonMapping() 645void ODevice::reloadButtonMapping()
646{ 646{
647 initButtons(); 647 initButtons();
648 648
649 if(!d->m_initializedButtonQcop) {
650 QCopChannel *chan = new QCopChannel("QPE/System", this, "ODevice button channel");
651 connect(chan,SIGNAL(received(const QCString&,const QByteArray&)),
652 this,SLOT(systemMessage(const QCString&,const QByteArray&)));
653 d->m_initializedButtonQcop = true;
654 }
655
649 Config cfg ( "ButtonSettings" ); 656 Config cfg ( "ButtonSettings" );
650 657
651 for ( uint i = 0; i < d->m_buttons->count(); i++ ) { 658 for ( uint i = 0; i < d->m_buttons->count(); i++ ) {
652 ODeviceButton &b = ( *d->m_buttons ) [i]; 659 ODeviceButton &b = ( *d->m_buttons ) [i];
653 QString group = "Button" + QString::number ( i ); 660 QString group = "Button" + QString::number ( i );
654 661
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 {
354 Transformation m_rotation; 354 Transformation m_rotation;
355 ODirection m_direction; 355 ODirection m_direction;
356 356
357 QValueList <ODeviceButton> *m_buttons; 357 QValueList <ODeviceButton> *m_buttons;
358 uint m_holdtime; 358 uint m_holdtime;
359 QStrList *m_cpu_frequencies; 359 QStrList *m_cpu_frequencies;
360 boolm_initializedButtonQcop : 1;
360 361
361 /* values for changeMixerForAlarm */ 362 /* values for changeMixerForAlarm */
362 int m_sound, m_vol, m_mixer; 363 int m_sound, m_vol, m_mixer;
363}; 364};
364 365
365extern bool isQWS(); 366extern 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()
186 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); 186 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction ));
187 187
188 d->m_buttons->append ( b ); 188 d->m_buttons->append ( b );
189 } 189 }
190 } 190 }
191 reloadButtonMapping(); 191 reloadButtonMapping();
192
193 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
194 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
195} 192}
196 193
197QValueList <OLed> iPAQ::ledList() const 194QValueList <OLed> iPAQ::ledList() const
198{ 195{
199 QValueList <OLed> vl; 196 QValueList <OLed> vl;
200 vl << Led_Power; 197 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()
137 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); 137 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction ));
138 138
139 d->m_buttons->append ( b ); 139 d->m_buttons->append ( b );
140 } 140 }
141 } 141 }
142 reloadButtonMapping(); 142 reloadButtonMapping();
143
144 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
145 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&)));
146} 143}
147 144
148int Jornada::displayBrightnessResolution() const 145int Jornada::displayBrightnessResolution() const
149{ 146{
150 return 255; 147 return 255;
151} 148}
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()
106 b. setFactoryPresetHeldAction 106 b. setFactoryPresetHeldAction
107 ( OQCopMessage( makeChannel( ib->fheldservice ), ib->fheldaction ) ); 107 ( OQCopMessage( makeChannel( ib->fheldservice ), ib->fheldaction ) );
108 108
109 d->m_buttons->append ( b ); 109 d->m_buttons->append ( b );
110 } 110 }
111 reloadButtonMapping(); 111 reloadButtonMapping();
112
113 QCopChannel *sysch = new QCopChannel( "QPE/System", this );
114 connect( sysch, SIGNAL( received(const QCString&,const QByteArray&) ),
115 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
116} 112}
117 113
118 114
119bool Yopy::suspend() 115bool Yopy::suspend()
120{ 116{
121 /* Opie for Yopy does not implement its own power management at the 117 /* 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()
235 zb->fheldaction )); 235 zb->fheldaction ));
236 236
237 d->m_buttons->append ( b ); 237 d->m_buttons->append ( b );
238 } 238 }
239 239
240 reloadButtonMapping(); 240 reloadButtonMapping();
241
242 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
243 connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)),
244 this, SLOT( systemMessage(const QCString&,const QByteArray&)));
245} 241}
246 242
247#include <unistd.h> 243#include <unistd.h>
248#include <fcntl.h> 244#include <fcntl.h>
249#include <sys/ioctl.h> 245#include <sys/ioctl.h>
250 246