00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "odevice_genuineintel.h"
00032
00033
00034 #include <qapplication.h>
00035 #include <qfile.h>
00036 #include <qtextstream.h>
00037 #include <qwindowsystem_qws.h>
00038
00039
00040 #include <qpe/config.h>
00041 #include <qpe/sound.h>
00042 #include <qpe/qcopenvelope_qws.h>
00043
00044 #include <opie2/okeyfilter.h>
00045 #include <opie2/oresource.h>
00046
00047 #ifndef QT_NO_SOUND
00048 #include <linux/soundcard.h>
00049 #endif
00050
00051 using namespace Opie::Core;
00052 using namespace Opie::Core::Internal;
00053
00054 struct gi_button genuineintel_buttons [] = {
00055 {
00056 Qt::Key_F1, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
00057 "devicebuttons/ipaq_calendar",
00058 "datebook", "nextView()",
00059 "today", "raise()" },
00060 {
00061 Qt::Key_F2, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
00062 "devicebuttons/ipaq_contact",
00063 "addressbook", "raise()",
00064 "addressbook", "beamBusinessCard()" },
00065 {
00066 Qt::Key_F3, QT_TRANSLATE_NOOP("Button", "Menu Button"),
00067 "devicebuttons/ipaq_menu",
00068 "QPE/TaskBar", "toggleMenu()",
00069 "QPE/TaskBar", "toggleStartMenu()" },
00070 {
00071 Qt::Key_F4, QT_TRANSLATE_NOOP("Button", "Mail Button"),
00072 "devicebuttons/ipaq_mail",
00073 "opiemail", "raise()",
00074 "opiemail", "newMail()" },
00075 {
00076 Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Home Button"),
00077 "devicebuttons/ipaq_home",
00078 "QPE/Launcher", "home()",
00079 "buttonsettings", "raise()" },
00080 {
00081 Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Record Button"),
00082 "devicebuttons/ipaq_record",
00083 "QPE/VMemo", "toggleRecord()",
00084 "sound", "raise()" },
00085 };
00086
00087 void GenuineIntel::init(const QString& model)
00088 {
00089 d->m_vendorstr = "Intel";
00090 d->m_vendor = Vendor_GenuineIntel;
00091
00092 QStringList SL = QStringList::split( " ", model );
00093
00094 d->m_model = Model_GenuineIntel;
00095 d->m_rotation = Rot0;
00096 }
00097
00098 void GenuineIntel::initButtons()
00099 {
00100 if ( d->m_buttons )
00101 return;
00102
00103 if ( isQWS( ) ) {
00104 addPreHandler(this);
00105 }
00106
00107 d->m_buttons = new QValueList <ODeviceButton>;
00108
00109 for ( uint i = 0; i < ( sizeof( genuineintel_buttons ) / sizeof( gi_button )); i++ ) {
00110 gi_button *ib = genuineintel_buttons + i;
00111 ODeviceButton b;
00112
00113 b. setKeycode ( ib->code );
00114 b. setUserText ( QObject::tr ( "Button", ib->utext ));
00115 b. setPixmap ( OResource::loadPixmap ( ib->pix ));
00116 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction ));
00117 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction ));
00118
00119 d->m_buttons->append ( b );
00120 }
00121 reloadButtonMapping();
00122 }
00123
00124 QValueList <OLed> GenuineIntel::ledList() const
00125 {
00126 QValueList <OLed> vl;
00127 return vl;
00128 }
00129
00130 QValueList <OLedState> GenuineIntel::ledStateList ( OLed ) const
00131 {
00132 QValueList <OLedState> vl;
00133 return vl;
00134 }
00135
00136 OLedState GenuineIntel::ledState ( OLed ) const
00137 {
00138 return Led_Off;
00139 }
00140
00141 bool GenuineIntel::setLedState ( OLed , OLedState )
00142 {
00143 return false;
00144 }
00145
00146
00147 bool GenuineIntel::filter ( int , int , int , bool , bool )
00148 {
00149 return false;
00150 }
00151
00152 void GenuineIntel::playAlarmSound()
00153 {
00154 #ifndef QT_NO_SOUND
00155 static Sound snd ( "alarm" );
00156 if(!snd.isFinished())
00157 return;
00158
00159 changeMixerForAlarm(0, "/dev/sound/mixer", &snd );
00160 snd. play();
00161 #endif
00162 }
00163
00164
00165 bool GenuineIntel::setDisplayBrightness ( int )
00166 {
00167 return false;
00168 }
00169
00170 int GenuineIntel::displayBrightnessResolution() const
00171 {
00172 return 1;
00173 }
00174
00175
00176 bool GenuineIntel::hasLightSensor() const
00177 {
00178 return false;
00179 }
00180
00181 int GenuineIntel::readLightSensor()
00182 {
00183 return 0;
00184 }
00185
00186 int GenuineIntel::lightSensorResolution() const
00187 {
00188 return 1;
00189 }