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
@@ -169,24 +169,27 @@ ODevice::ODevice()
169 d->m_sysverstr = "0.0"; 169 d->m_sysverstr = "0.0";
170 d->m_rotation = Rot0; 170 d->m_rotation = Rot0;
171 d->m_direction = CW; 171 d->m_direction = CW;
172 172
173 d->m_holdtime = 1000; // 1000ms 173 d->m_holdtime = 1000; // 1000ms
174 d->m_buttons = 0; 174 d->m_buttons = 0;
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 {
187 if ( QFile::exists( distributions[i].sysvfile ) ) 190 if ( QFile::exists( distributions[i].sysvfile ) )
188 { 191 {
189 d->m_systemstr = distributions[i].sysstr; 192 d->m_systemstr = distributions[i].sysstr;
190 d->m_system = distributions[i].system; 193 d->m_system = distributions[i].system;
191 d->m_sysverstr = "<Unknown>"; 194 d->m_sysverstr = "<Unknown>";
192 QFile f( distributions[i].sysvfile ); 195 QFile f( distributions[i].sysvfile );
@@ -224,27 +227,24 @@ void ODevice::initButtons()
224 for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { 227 for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) {
225 default_button *db = default_buttons + i; 228 default_button *db = default_buttons + i;
226 ODeviceButton b; 229 ODeviceButton b;
227 b. setKeycode ( db->code ); 230 b. setKeycode ( db->code );
228 b. setUserText ( QObject::tr ( "Button", db->utext )); 231 b. setUserText ( QObject::tr ( "Button", db->utext ));
229 b. setPixmap ( Resource::loadPixmap ( db->pix )); 232 b. setPixmap ( Resource::loadPixmap ( db->pix ));
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
245// -zecke 245// -zecke
246 delete d; 246 delete d;
247} 247}
248 248
249bool ODevice::setSoftSuspend ( bool /*soft*/ ) 249bool ODevice::setSoftSuspend ( bool /*soft*/ )
250{ 250{
@@ -637,24 +637,31 @@ const ODeviceButton *ODevice::buttonForKeycode ( ushort code )
637 637
638 for ( QValueListConstIterator<ODeviceButton> it = d->m_buttons->begin(); it != d->m_buttons->end(); ++it ) { 638 for ( QValueListConstIterator<ODeviceButton> it = d->m_buttons->begin(); it != d->m_buttons->end(); ++it ) {
639 if ( (*it). keycode() == code ) 639 if ( (*it). keycode() == code )
640 return &(*it); 640 return &(*it);
641 } 641 }
642 return 0; 642 return 0;
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
655 QCString pch, hch; 662 QCString pch, hch;
656 QCString pm, hm; 663 QCString pm, hm;
657 QByteArray pdata, hdata; 664 QByteArray pdata, hdata;
658 665
659 if ( cfg. hasGroup ( group )) { 666 if ( cfg. hasGroup ( group )) {
660 cfg. setGroup ( group ); 667 cfg. setGroup ( group );
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
@@ -348,24 +348,25 @@ class ODeviceData {
348 348
349 QString m_systemstr; 349 QString m_systemstr;
350 OSystem m_system; 350 OSystem m_system;
351 351
352 QString m_sysverstr; 352 QString m_sysverstr;
353 353
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();
366extern QCString makeChannel ( const char *str ); 367extern QCString makeChannel ( const char *str );
367} 368}
368} 369}
369 370
370 371
371 372
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
@@ -180,27 +180,24 @@ void iPAQ::initButtons()
180 180
181 if (( ib->model & d->m_model ) == d->m_model ) { 181 if (( ib->model & d->m_model ) == d->m_model ) {
182 b. setKeycode ( ib->code ); 182 b. setKeycode ( ib->code );
183 b. setUserText ( QObject::tr ( "Button", ib->utext )); 183 b. setUserText ( QObject::tr ( "Button", ib->utext ));
184 b. setPixmap ( Resource::loadPixmap ( ib->pix )); 184 b. setPixmap ( Resource::loadPixmap ( ib->pix ));
185 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); 185 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction ));
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;
201 198
202 if ( d->m_model == Model_iPAQ_H38xx ) 199 if ( d->m_model == Model_iPAQ_H38xx )
203 vl << Led_BlueTooth; 200 vl << Led_BlueTooth;
204 return vl; 201 return vl;
205} 202}
206 203
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
@@ -131,27 +131,24 @@ void Jornada::initButtons()
131 131
132 if (( ib->model & d->m_model ) == d->m_model ) { 132 if (( ib->model & d->m_model ) == d->m_model ) {
133 b. setKeycode ( ib->code ); 133 b. setKeycode ( ib->code );
134 b. setUserText ( QObject::tr ( "Button", ib->utext )); 134 b. setUserText ( QObject::tr ( "Button", ib->utext ));
135 b. setPixmap ( Resource::loadPixmap ( ib->pix )); 135 b. setPixmap ( Resource::loadPixmap ( ib->pix ));
136 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); 136 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction ));
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}
152 149
153 150
154bool Jornada::setDisplayBrightness( int bright ) 151bool Jornada::setDisplayBrightness( int bright )
155{ 152{
156 bool res = false; 153 bool res = false;
157 154
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
@@ -100,28 +100,24 @@ void Yopy::initButtons()
100 100
101 b. setKeycode ( ib->code ); 101 b. setKeycode ( ib->code );
102 b. setUserText ( QObject::tr ( "Button", ib->utext ) ); 102 b. setUserText ( QObject::tr ( "Button", ib->utext ) );
103 b. setPixmap ( Resource::loadPixmap ( ib->pix ) ); 103 b. setPixmap ( Resource::loadPixmap ( ib->pix ) );
104 b. setFactoryPresetPressedAction 104 b. setFactoryPresetPressedAction
105 ( OQCopMessage( makeChannel( ib->fpressedservice ), ib->fpressedaction ) ); 105 ( OQCopMessage( makeChannel( ib->fpressedservice ), ib->fpressedaction ) );
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
122 moment. The public version runs parallel to X, and relies on the 118 moment. The public version runs parallel to X, and relies on the
123 existing power management features. */ 119 existing power management features. */
124 return false; 120 return false;
125} 121}
126 122
127 123
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
@@ -229,28 +229,24 @@ void Zaurus::initButtons()
229 b. setKeycode ( zb->code ); 229 b. setKeycode ( zb->code );
230 b. setUserText ( QObject::tr ( "Button", zb->utext )); 230 b. setUserText ( QObject::tr ( "Button", zb->utext ));
231 b. setPixmap ( Resource::loadPixmap ( zb->pix )); 231 b. setPixmap ( Resource::loadPixmap ( zb->pix ));
232 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ), 232 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ),
233 zb->fpressedaction )); 233 zb->fpressedaction ));
234 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ), 234 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ),
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
251//#include <asm/sharp_char.h> // including kernel headers is evil ... 247//#include <asm/sharp_char.h> // including kernel headers is evil ...
252 248
253#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 249#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
254 250
255 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 251 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
256#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 252#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)