Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

odevice_genuineintel.cpp

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003 
00004                              Copyright (C)2002, 2003, 2004 The Opie Team <opie-devel@handhelds.org>
00005               =.
00006             .=l.
00007            .>+-=
00008  _;:,     .>    :=|.         This program is free software; you can
00009 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00010 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00011 .="- .-=="i,     .._         License as published by the Free Software
00012  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00013      ._= =}       :          or (at your option) any later version.
00014     .%`+i>       _;_.
00015     .i_,=:_.      -<s.       This program is distributed in the hope that
00016      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00017     : ..    .:,     . . .    without even the implied warranty of
00018     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00019   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00020 ..}^=.=       =       ;      Library General Public License for more
00021 ++=   -.     .`     .:       details.
00022 :     =  ...= . :.=-
00023  -.   .:....=;==+<;          You should have received a copy of the GNU
00024   -_. . .   )=.  =           Library General Public License along with
00025     --        :-=`           this library; see the file COPYING.LIB.
00026                              If not, write to the Free Software Foundation,
00027                              Inc., 59 Temple Place - Suite 330,
00028                              Boston, MA 02111-1307, USA.
00029 */
00030 
00031 #include "odevice_genuineintel.h"
00032 
00033 /* QT */
00034 #include <qapplication.h>
00035 #include <qfile.h>
00036 #include <qtextstream.h>
00037 #include <qwindowsystem_qws.h>
00038 
00039 /* OPIE */
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; //none
00128 }
00129 
00130 QValueList <OLedState> GenuineIntel::ledStateList ( OLed ) const
00131 {
00132     QValueList <OLedState> vl;
00133     return vl; //  none
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 /*unicode*/, 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; // perhaps to avoid division by zero
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; // see above
00189 }

Generated on Sat Nov 5 16:16:05 2005 for OPIE by  doxygen 1.4.2