summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore/device') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp17
-rw-r--r--libopie2/opiecore/device/odevice.h9
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp4
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.h8
-rw-r--r--libopie2/opiecore/device/odevice_jornada.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_jornada.h9
-rw-r--r--libopie2/opiecore/device/odevice_ramses.cpp3
-rw-r--r--libopie2/opiecore/device/odevice_ramses.h7
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp3
-rw-r--r--libopie2/opiecore/device/odevice_simpad.h8
-rw-r--r--libopie2/opiecore/device/odevice_yopy.cpp3
-rw-r--r--libopie2/opiecore/device/odevice_yopy.h9
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp3
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h8
-rw-r--r--libopie2/opiecore/device/odevicebutton.cpp15
-rw-r--r--libopie2/opiecore/device/odevicebutton.h11
16 files changed, 88 insertions, 31 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index 27b0e53..f3e2cfb 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -39,74 +39,74 @@ _;:, .> :=|. This program is free software; you can
#include <qfile.h>
#include <qtextstream.h>
#include <qwindowsystem_qws.h>
/* OPIE */
#include <qpe/config.h>
#include <qpe/resource.h>
#include <qpe/sound.h>
#include <qpe/qcopenvelope_qws.h>
/* STD */
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef QT_NO_SOUND
#include <linux/soundcard.h>
#endif
const char* PATH_PROC_CPUINFO = "/proc/cpuinfo";
-using namespace Opie;
+using namespace Opie::Core;
ODevice *ODevice::inst()
{
static ODevice *dev = 0;
// rewrite this to only use /proc/cpuinfo or so
if ( !dev )
{
QFile f( PATH_PROC_CPUINFO );
if ( f.open( IO_ReadOnly ) )
{
QTextStream s( &f );
while ( !s.atEnd() )
{
QString line;
line = s.readLine();
if ( line.startsWith( "Hardware" ) )
{
qDebug( "ODevice() - found '%s'", (const char*) line );
- if ( line.contains( "sharp", false ) ) dev = new Zaurus();
- else if ( line.contains( "ipaq", false ) ) dev = new iPAQ();
- else if ( line.contains( "simpad", false ) ) dev = new SIMpad();
- else if ( line.contains( "jornada", false ) ) dev = new Jornada();
- else if ( line.contains( "ramses", false ) ) dev = new Ramses();
+ if ( line.contains( "sharp", false ) ) dev = new Private::Zaurus();
+ else if ( line.contains( "ipaq", false ) ) dev = new Private::iPAQ();
+ else if ( line.contains( "simpad", false ) ) dev = new Private::SIMpad();
+ else if ( line.contains( "jornada", false ) ) dev = new Private::Jornada();
+ else if ( line.contains( "ramses", false ) ) dev = new Private::Ramses();
else qWarning( "ODevice() - unknown hardware - using default." );
break;
}
}
}
else
{
qWarning( "ODevice() - can't open '%s' - unknown hardware - using default." );
}
if ( !dev ) dev = new ODevice();
dev->init();
}
return dev;
}
ODevice::ODevice()
{
d = new ODeviceData;
d->m_modelstr = "Unknown";
d->m_model = Model_Unknown;
d->m_vendorstr = "Unknown";
d->m_vendor = Vendor_Unknown;
d->m_systemstr = "Unknown";
@@ -166,49 +166,49 @@ bool ODevice::setSoftSuspend ( bool /*soft*/ )
#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
/**
* This method will try to suspend the device
* It only works if the user is the QWS Server and the apm application
* is installed.
* It tries to suspend and then waits some time cause some distributions
* do have asynchronus apm implementations.
* This method will either fail and return false or it'll suspend the
* device and return once the device got woken up
*
* @return if the device got suspended
*/
bool ODevice::suspend()
{
qDebug("ODevice::suspend");
if ( !isQWS( ) ) // only qwsserver is allowed to suspend
return false;
if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
return false;
bool res = false;
ODevice::sendSuspendmsg();
-
+
struct timeval tvs, tvn;
::gettimeofday ( &tvs, 0 );
::sync(); // flush fs caches
res = ( ::system ( "apm --suspend" ) == 0 );
// This is needed because the iPAQ apm implementation is asynchronous and we
// can not be sure when exactly the device is really suspended
// This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
if ( res ) {
do { // wait at most 1.5 sec: either suspend didn't work or the device resumed
::usleep ( 200 * 1000 );
::gettimeofday ( &tvn, 0 );
} while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 );
}
return res;
}
//#include <linux/fb.h> better not rely on kernel headers in userspace ...
#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611
@@ -603,26 +603,29 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
{
initButtons();
if ( button >= (int) d->m_buttons->count())
return;
ODeviceButton &b = ( *d->m_buttons ) [button];
b. setHeldAction ( action );
Config buttonFile ( "ButtonSettings" );
buttonFile. setGroup ( "Button" + QString::number ( button ));
buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel());
buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message());
// buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data()));
QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
}
void ODevice::virtual_hook(int, void* ){
}
void ODevice::sendSuspendmsg()
{
+ if ( isQWS() )
+ return;
+
QCopEnvelope ( "QPE/System", "aboutToSuspend()" );
}
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index bccb449..5ee9cca 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -19,50 +19,51 @@ _;:, .> :=|. This program is free software; you can
..}^=.= = ; Library General Public License for more
++= -. .` .: details.
: = ...= . :.=-
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = Library General Public License along with
-- :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_H_
#define ODEVICE_H_
/* OPIE */
#include <opie2/odevicebutton.h>
#include <qpe/qpeapplication.h> /* for Transformation enum.. */
/* QT */
#include <qnamespace.h>
#include <qobject.h>
#include <qstring.h>
#include <qstrlist.h>
-namespace Opie
-{
+namespace Opie{
+namespace Core{
+
class ODeviceData;
/**
* The available devices
*/
enum OModel {
Model_Unknown, // = 0
Model_Series_Mask = 0xff000000,
Model_iPAQ = ( 1 << 24 ),
Model_iPAQ_All = ( Model_iPAQ | 0xffffff ),
Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ),
Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ),
Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ),
Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ),
Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ),
Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000011 ),
Model_Jornada = ( 6 << 24 ),
Model_Jornada_56x = ( Model_Jornada | 0x000001 ),
Model_Zaurus = ( 2 << 24 ),
@@ -229,49 +230,49 @@ public:
virtual void playAlarmSound();
virtual void playKeySound();
virtual void playTouchSound();
virtual QValueList <OLed> ledList() const;
virtual QValueList <OLedState> ledStateList ( OLed led ) const;
virtual OLedState ledState ( OLed led ) const;
virtual bool setLedState ( OLed led, OLedState st );
virtual bool hasLightSensor() const;
virtual int readLightSensor();
virtual int lightSensorResolution() const;
virtual bool hasHingeSensor() const;
virtual OHingeStatus readHingeSensor();
const QStrList &allowedCpuFrequencies() const;
bool setCurrentCpuFrequency(uint index);
/**
* Returns the available buttons on this device. The number and location
* of buttons will vary depending on the device. Button numbers will be assigned
* by the device manufacturer and will be from most preferred button to least preffered
* button. Note that this list only contains "user mappable" buttons.
- *
+ *
* @todo Make method const and take care of calling initButtons or make that const too
*
*/
const QValueList<ODeviceButton> &buttons();
/**
* Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it
* returns 0L
*/
const ODeviceButton *buttonForKeycode ( ushort keyCode );
/**
* Reassigns the pressed action for \a button. To return to the factory
* default pass an empty string as \a qcopMessage.
*/
void remapPressedAction ( int button, const OQCopMessage &qcopMessage );
/**
* Reassigns the held action for \a button. To return to the factory
* default pass an empty string as \a qcopMessage.
*/
void remapHeldAction ( int button, const OQCopMessage &qcopMessage );
/**
@@ -293,40 +294,42 @@ protected:
class ODeviceData {
public:
QString m_vendorstr;
OVendor m_vendor;
QString m_modelstr;
OModel m_model;
QString m_systemstr;
OSystem m_system;
QString m_sysverstr;
Transformation m_rotation;
ODirection m_direction;
QValueList <ODeviceButton> *m_buttons;
uint m_holdtime;
QStrList *m_cpu_frequencies;
};
}
+}
static inline bool isQWS()
{
return qApp ? ( qApp->type() == QApplication::GuiServer ) : false;
}
static QCString makeChannel ( const char *str )
{
if ( str && !::strchr ( str, '/' ))
return QCString ( "QPE/Application/" ) + str;
else
return str;
}
+
#endif
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index 8ecea1b..177fd4c 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -32,48 +32,52 @@
/* QT */
#include <qapplication.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qwindowsystem_qws.h>
/* OPIE */
#include <qpe/config.h>
#include <qpe/resource.h>
#include <qpe/sound.h>
#include <qpe/qcopenvelope_qws.h>
/* STD */
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef QT_NO_SOUND
#include <linux/soundcard.h>
#endif
+
+using namespace Opie::Core;
+using namespace Opie::Core::Private;
+
/* KERNEL */
#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
#define OD_IO(type,number) OD_IOC(0,type,number,0)
#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
typedef struct {
unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
unsigned char TotalTime; /* Units of 5 seconds */
unsigned char OnTime; /* units of 100m/s */
unsigned char OffTime; /* units of 100m/s */
} LED_IN;
typedef struct {
unsigned char mode;
unsigned char pwr;
unsigned char brightness;
} FLITE_IN;
#define LED_ON OD_IOW( 'f', 5, LED_IN )
#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
diff --git a/libopie2/opiecore/device/odevice_ipaq.h b/libopie2/opiecore/device/odevice_ipaq.h
index f512344..4f4af46 100644
--- a/libopie2/opiecore/device/odevice_ipaq.h
+++ b/libopie2/opiecore/device/odevice_ipaq.h
@@ -14,71 +14,77 @@
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_IPAQ
#define ODEVICE_IPAQ
#include "odevice.h"
/* QT */
#include <qwindowsystem_qws.h>
-using namespace Opie;
+namespace Opie {
+namespace Core {
+namespace Private {
class iPAQ : public ODevice, public QWSServer::KeyboardFilter
{
protected:
virtual void init();
virtual void initButtons();
public:
virtual bool setSoftSuspend( bool soft );
virtual bool setDisplayBrightness( int b );
virtual int displayBrightnessResolution() const;
virtual void playAlarmSound();
virtual QValueList <OLed> ledList() const;
virtual QValueList <OLedState> ledStateList( OLed led ) const;
virtual OLedState ledState( OLed led ) const;
virtual bool setLedState( OLed led, OLedState st );
virtual bool hasLightSensor() const;
virtual int readLightSensor();
virtual int lightSensorResolution() const;
protected:
virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
virtual void timerEvent( QTimerEvent *te );
int m_power_timer;
OLedState m_leds [2];
};
struct i_button {
uint model;
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
char *fpressedaction;
char *fheldservice;
char *fheldaction;
};
+}
+}
+}
+
#endif
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp
index 37bd6e9..b79b0b5 100644
--- a/libopie2/opiecore/device/odevice_jornada.cpp
+++ b/libopie2/opiecore/device/odevice_jornada.cpp
@@ -56,49 +56,49 @@
/* KERNEL */
#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
#define OD_IO(type,number) OD_IOC(0,type,number,0)
#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
typedef struct {
unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
unsigned char TotalTime; /* Units of 5 seconds */
unsigned char OnTime; /* units of 100m/s */
unsigned char OffTime; /* units of 100m/s */
} LED_IN;
typedef struct {
unsigned char mode;
unsigned char pwr;
unsigned char brightness;
} FLITE_IN;
#define LED_ON OD_IOW( 'f', 5, LED_IN )
#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
-using namespace Opie;
+using namespace Opie::Core::Private;
void Jornada::init()
{
d->m_vendorstr = "HP";
d->m_vendor = Vendor_HP;
d->m_modelstr = "Jornada 56x";
d->m_model = Model_Jornada_56x;
d->m_systemstr = "Familiar";
d->m_system = System_Familiar;
d->m_rotation = Rot0;
QFile f ( "/etc/familiar-version" );
f.setName ( "/etc/familiar-version" );
if ( f.open ( IO_ReadOnly )) {
QTextStream ts ( &f );
d->m_sysverstr = ts.readLine().mid( 10 );
f. close();
}
}
int Jornada::displayBrightnessResolution() const
diff --git a/libopie2/opiecore/device/odevice_jornada.h b/libopie2/opiecore/device/odevice_jornada.h
index 59be8da..c37d75e 100644
--- a/libopie2/opiecore/device/odevice_jornada.h
+++ b/libopie2/opiecore/device/odevice_jornada.h
@@ -11,40 +11,43 @@
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_JORNADA
#define ODEVICE_JORNADA
#include <opie2/odevice.h>
-using namespace Opie;
-
+namespace Opie {
+namespace Core {
+namespace Private {
class Jornada : public ODevice
{
protected:
virtual void init();
public:
virtual bool setSoftSuspend ( bool soft );
virtual bool setDisplayBrightness ( int b );
virtual int displayBrightnessResolution() const;
};
-
+}
+}
+}
#endif
diff --git a/libopie2/opiecore/device/odevice_ramses.cpp b/libopie2/opiecore/device/odevice_ramses.cpp
index 5bcf6a9..77de8c5 100644
--- a/libopie2/opiecore/device/odevice_ramses.cpp
+++ b/libopie2/opiecore/device/odevice_ramses.cpp
@@ -32,48 +32,51 @@
/* QT */
#include <qapplication.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qwindowsystem_qws.h>
/* OPIE */
#include <qpe/config.h>
#include <qpe/resource.h>
#include <qpe/sound.h>
#include <qpe/qcopenvelope_qws.h>
/* STD */
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef QT_NO_SOUND
#include <linux/soundcard.h>
#endif
+using namespace Opie::Core;
+using namespace Opie::Core::Private;
+
struct r_button ramses_buttons [] = {
{ Model_Ramses_MNCI,
Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
"devicebuttons/z_menu",
"QPE/TaskBar", "toggleMenu()",
"QPE/TaskBar", "toggleStartMenu()" },
{ Model_Ramses_MNCI,
Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
"devicebuttons/ipaq_home",
"QPE/Launcher", "home()",
"buttonsettings", "raise()" },
};
void Ramses::init()
{
d->m_vendorstr = "M und N";
d->m_vendor = Vendor_MundN;
QFile f("/proc/sys/board/ramses");
d->m_modelstr = "Ramses";
d->m_model = Model_Ramses_MNCI;
d->m_rotation = Rot0;
diff --git a/libopie2/opiecore/device/odevice_ramses.h b/libopie2/opiecore/device/odevice_ramses.h
index 1b660ab..e673b1a 100644
--- a/libopie2/opiecore/device/odevice_ramses.h
+++ b/libopie2/opiecore/device/odevice_ramses.h
@@ -13,60 +13,65 @@
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_RAMSES
#define ODEVICE_RAMSES
#include <opie2/odevice.h>
/* QT */
#include <qwindowsystem_qws.h>
-using namespace Opie;
+namespace Opie {
+namespace Core {
+namespace Private {
class Ramses : public ODevice, public QWSServer::KeyboardFilter
{
protected:
virtual void init();
public:
virtual bool setSoftSuspend( bool soft );
virtual bool suspend();
virtual bool setDisplayStatus( bool on );
virtual bool setDisplayBrightness( int b );
virtual int displayBrightnessResolution() const;
virtual bool setDisplayContrast( int b );
virtual int displayContrastResolution() const;
protected:
virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
virtual void timerEvent ( QTimerEvent *te );
int m_power_timer;
};
struct r_button {
uint model;
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
char *fpressedaction;
char *fheldservice;
char *fheldaction;
};
+}
+}
+}
#endif
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index 90aca2f..80d40a3 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -32,49 +32,50 @@ _;:, .> :=|. This program is free software; you can
/* QT */
#include <qapplication.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qwindowsystem_qws.h>
/* OPIE */
#include <qpe/config.h>
#include <qpe/resource.h>
#include <qpe/sound.h>
#include <qpe/qcopenvelope_qws.h>
/* STD */
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef QT_NO_SOUND
#include <linux/soundcard.h>
#endif
-using namespace Opie;
+using namespace Opie::Core;
+using namespace Opie::Core::Private;
struct s_button simpad_buttons [] = {
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"),
"devicebuttons/simpad_lower_up",
"datebook", "nextView()",
"today", "raise()" },
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"),
"devicebuttons/simpad_lower_down",
"addressbook", "raise()",
"addressbook", "beamBusinessCard()" },
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"),
"devicebuttons/simpad_lower_right",
"QPE/TaskBar", "toggleMenu()",
"QPE/TaskBar", "toggleStartMenu()" },
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"),
"devicebuttons/simpad_lower_left",
"mail", "raise()",
"mail", "newMail()" },
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
diff --git a/libopie2/opiecore/device/odevice_simpad.h b/libopie2/opiecore/device/odevice_simpad.h
index 3287ee8..1848151 100644
--- a/libopie2/opiecore/device/odevice_simpad.h
+++ b/libopie2/opiecore/device/odevice_simpad.h
@@ -14,68 +14,74 @@
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_SIMPAD
#define ODEVICE_SIMPAD
#include <opie2/odevice.h>
/* QT */
#include <qwindowsystem_qws.h>
-using namespace Opie;
+namespace Opie {
+namespace Core {
+namespace Private {
class SIMpad : public ODevice, public QWSServer::KeyboardFilter
{
protected:
virtual void init();
virtual void initButtons();
public:
virtual bool setSoftSuspend( bool soft );
virtual bool suspend();
virtual bool setDisplayStatus( bool on );
virtual bool setDisplayBrightness( int b );
virtual int displayBrightnessResolution() const;
virtual void playAlarmSound();
virtual QValueList <OLed> ledList() const;
virtual QValueList <OLedState> ledStateList( OLed led ) const;
virtual OLedState ledState( OLed led ) const;
virtual bool setLedState( OLed led, OLedState st );
protected:
virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
virtual void timerEvent( QTimerEvent *te );
int m_power_timer;
OLedState m_leds [1];
};
struct s_button {
uint model;
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
char *fpressedaction;
char *fheldservice;
char *fheldaction;
};
+}
+}
+}
+
#endif
diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp
index d241db8..f7a4025 100644
--- a/libopie2/opiecore/device/odevice_yopy.cpp
+++ b/libopie2/opiecore/device/odevice_yopy.cpp
@@ -32,49 +32,50 @@ _;:,     .>    :=|. This program is free software; you can
/* QT */
#include <qapplication.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qwindowsystem_qws.h>
/* OPIE */
#include <qpe/config.h>
#include <qpe/resource.h>
#include <qpe/sound.h>
#include <qpe/qcopenvelope_qws.h>
/* STD */
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef QT_NO_SOUND
#include <linux/soundcard.h>
#endif
-using namespace Opie;
+using namespace Opie::Core;
+using namespace Opie::Core::Private;
struct yopy_button yopy_buttons [] = {
{ Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Action Button" ),
"devicebuttons/yopy_action",
"datebook", "nextView()",
"today", "raise()" },
{ Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "OK Button" ),
"devicebuttons/yopy_ok",
"addressbook", "raise()",
"addressbook", "beamBusinessCard()" },
{ Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "End Button" ),
"devicebuttons/yopy_end",
"QPE/Launcher", "home()",
"buttonsettings", "raise()" },
};
void Yopy::init()
{
d->m_vendorstr = "G.Mate";
d->m_vendor = Vendor_GMate;
d->m_modelstr = "Yopy3700";
d->m_model = Model_Yopy_3700;
d->m_rotation = Rot0;
diff --git a/libopie2/opiecore/device/odevice_yopy.h b/libopie2/opiecore/device/odevice_yopy.h
index be8f62c..7d85479 100644
--- a/libopie2/opiecore/device/odevice_yopy.h
+++ b/libopie2/opiecore/device/odevice_yopy.h
@@ -11,52 +11,57 @@ _;:,     .>    :=|. This program is free software; you can
- .   .-<_>     .<> Foundation; either version 2 of the License,
   ._= =}       : or (at your option) any later version.
  .%`+i>       _;_.
  .i_,=:_.      -<s. This program is distributed in the hope that
   +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
  : ..    .:,     . . . without even the implied warranty of
  =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
_.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
:     =  ...= . :.=-
-.   .:....=;==+<; You should have received a copy of the GNU
-_. . .   )=.  = Library General Public License along with
  --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_YOPY
#define ODEVICE_YOPY
#include <opie2/odevice.h>
-using namespace Opie;
-
+namespace Opie {
+namespace Core {
+namespace Private {
class Yopy : public ODevice
{
protected:
virtual void init();
virtual void initButtons();
public:
virtual bool suspend();
virtual bool setDisplayBrightness ( int b );
virtual int displayBrightnessResolution() const;
};
struct yopy_button
{
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
char *fpressedaction;
char *fheldservice;
char *fheldaction;
};
+}
+}
+}
+
#endif
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 8ab3cbe..0d21f26 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -32,49 +32,50 @@ _;:, .> :=|. This program is free software; you can
/* QT */
#include <qapplication.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qwindowsystem_qws.h>
/* OPIE */
#include <qpe/config.h>
#include <qpe/resource.h>
#include <qpe/sound.h>
#include <qpe/qcopenvelope_qws.h>
/* STD */
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef QT_NO_SOUND
#include <linux/soundcard.h>
#endif
-using namespace Opie;
+using namespace Opie::Core;
+using namespace Opie::Core::Private;
struct z_button z_buttons [] = {
{ Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
"devicebuttons/z_calendar",
"datebook", "nextView()",
"today", "raise()" },
{ Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
"devicebuttons/z_contact",
"addressbook", "raise()",
"addressbook", "beamBusinessCard()" },
{ Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
"devicebuttons/z_home",
"QPE/Launcher", "home()",
"buttonsettings", "raise()" },
{ Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
"devicebuttons/z_menu",
"QPE/TaskBar", "toggleMenu()",
"QPE/TaskBar", "toggleStartMenu()" },
{ Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
"devicebuttons/z_mail",
"mail", "raise()",
"mail", "newMail()" },
};
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h
index f5c5172..ffb648f 100644
--- a/libopie2/opiecore/device/odevice_zaurus.h
+++ b/libopie2/opiecore/device/odevice_zaurus.h
@@ -24,73 +24,77 @@
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_ZAURUS
#define ODEVICE_ZAURUS
#include <opie2/odevice.h>
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif
// _IO and friends are only defined in kernel headers ...
#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
#define OD_IO(type,number) OD_IOC(0,type,number,0)
#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
-using namespace Opie;
+namespace Opie {
+namespace Core {
+namespace Private {
class Zaurus : public ODevice
{
protected:
virtual void init();
virtual void initButtons();
public:
virtual bool setSoftSuspend ( bool soft );
virtual bool setDisplayBrightness ( int b );
virtual int displayBrightnessResolution() const;
virtual void playAlarmSound();
virtual void playKeySound();
virtual void playTouchSound();
virtual QValueList <OLed> ledList() const;
virtual QValueList <OLedState> ledStateList ( OLed led ) const;
virtual OLedState ledState( OLed led ) const;
virtual bool setLedState( OLed led, OLedState st );
virtual bool hasHingeSensor() const;
virtual OHingeStatus readHingeSensor();
virtual bool suspend();
virtual Transformation rotation() const;
virtual ODirection direction() const;
protected:
virtual void buzzer ( int snd );
OLedState m_leds [1];
bool m_embedix;
};
struct z_button {
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
char *fpressedaction;
char *fheldservice;
char *fheldaction;
};
-
+}
+}
+}
#endif
diff --git a/libopie2/opiecore/device/odevicebutton.cpp b/libopie2/opiecore/device/odevicebutton.cpp
index 0b593d5..a081b7f 100644
--- a/libopie2/opiecore/device/odevicebutton.cpp
+++ b/libopie2/opiecore/device/odevicebutton.cpp
@@ -12,58 +12,64 @@
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qpixmap.h>
#include <qstring.h>
#include <qpe/qcopenvelope_qws.h>
#include <opie2/odevicebutton.h>
-using namespace Opie;
+
+namespace Opie {
+namespace Core {
+namespace Private {
class OQCopMessageData
{
public:
QCString m_channel;
QCString m_message;
QByteArray m_data;
};
+}
+using namespace Opie::Core;
+using namespace Opie::Core::Private;
OQCopMessage::OQCopMessage()
: d ( 0 )
{
init ( QCString(), QCString(), QByteArray());
}
OQCopMessage::OQCopMessage ( const OQCopMessage &copy )
: d ( 0 )
{
init ( copy. channel(), copy. message(), copy. data());
}
OQCopMessage &OQCopMessage::operator = ( const OQCopMessage &assign )
{
init ( assign. channel(), assign. message(), assign. data());
return *this;
}
OQCopMessage::OQCopMessage ( const QCString &ch, const QCString &m, const QByteArray &arg )
: d ( 0 )
{
init ( ch, m, arg );
}
@@ -103,50 +109,50 @@ QCString OQCopMessage::message() const
QByteArray OQCopMessage::data() const
{
return d->m_data;
}
bool OQCopMessage::isNull() const
{
return d->m_message.isNull() || d->m_channel.isNull();
}
void OQCopMessage::setChannel ( const QCString &ch )
{
d->m_channel = ch;
}
void OQCopMessage::setMessage ( const QCString &m )
{
d->m_message = m;
}
void OQCopMessage::setData ( const QByteArray &data )
{
d->m_data = data;
}
-/*! \class Opie::ODeviceButton
- \brief The Opie::ODeviceButton class represents a physical user mappable button on a Qtopia device.
+/*! \class Opie::Core::ODeviceButton
+ \brief The Opie::Core::ODeviceButton class represents a physical user mappable button on a Qtopia device.
This class represents a physical button on a Qtopia device. A
device may have "user programmable" buttons.
The location and number of buttons will vary from device to
device. userText() and pixmap() may be used to describe this button
to the user in help documentation.
\ingroup qtopiaemb
\internal
*/
ODeviceButton::ODeviceButton()
{}
ODeviceButton::~ODeviceButton()
{}
/*!
Returns the button's keycode.
*/
ushort ODeviceButton::keycode() const
{
return m_Keycode;
}
@@ -223,24 +229,27 @@ void ODeviceButton::setPixmap(const QPixmap& picture)
{
m_Pixmap = picture;
}
void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action)
{
m_FactoryPresetPressedAction = action;
}
void ODeviceButton::setPressedAction(const OQCopMessage& action)
{
m_PressedAction = action;
}
void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action)
{
m_FactoryPresetHeldAction = action;
}
void ODeviceButton::setHeldAction(const OQCopMessage& action)
{
m_HeldAction = action;
}
+
+}
+}
diff --git a/libopie2/opiecore/device/odevicebutton.h b/libopie2/opiecore/device/odevicebutton.h
index a66b88f..4000144 100644
--- a/libopie2/opiecore/device/odevicebutton.h
+++ b/libopie2/opiecore/device/odevicebutton.h
@@ -2,78 +2,80 @@
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef DEVICE_BUTTON_H
#define DEVICE_BUTTON_H
#include <qpixmap.h>
#include <qstring.h>
-class OQCopMessageData;
-namespace Opie
-{
+namespace Opie{
+namespace Core{
+namespace Private {
+class OQCopMessageData;
+}
class OQCopMessage
{
public:
OQCopMessage ( );
OQCopMessage ( const OQCopMessage &copy );
OQCopMessage ( const QCString &m_channel, const QCString &message, const QByteArray &args = QByteArray ( ));
OQCopMessage &operator = ( const OQCopMessage &assign );
void setChannel ( const QCString &channel );
void setMessage ( const QCString &message );
void setData ( const QByteArray &ba );
QCString channel ( ) const;
QCString message ( ) const;
QByteArray data ( ) const;
bool isNull()const;
bool send ( );
private:
void init ( const QCString &m_channel, const QCString &message, const QByteArray &args );
- OQCopMessageData *d;
+ Private::OQCopMessageData *d;
class Private;
Private* m_data;
};
/**
* This class represents a physical button on a Qtopia device. A device may
* have n "user programmable" buttons, which are number 1..n. The location
* and number of buttons will vary from device to device. userText() and pixmap()
* may be used to describe this button to the user in help documentation.
*
* @version 1.0
* @author Trolltech
* @short A representation of buttons
*/
class ODeviceButton
{
public:
ODeviceButton();
virtual ~ODeviceButton();
ushort keycode ( ) const;
QString userText ( ) const;
@@ -83,26 +85,27 @@ class ODeviceButton
OQCopMessage factoryPresetHeldAction ( ) const;
OQCopMessage heldAction ( ) const;
void setKeycode ( ushort keycode );
void setUserText ( const QString& text );
void setPixmap ( const QPixmap& picture );
void setFactoryPresetPressedAction ( const OQCopMessage& qcopMessage );
void setPressedAction ( const OQCopMessage& qcopMessage );
void setFactoryPresetHeldAction ( const OQCopMessage& qcopMessage );
void setHeldAction ( const OQCopMessage& qcopMessage );
private:
ushort m_Keycode;
QString m_UserText;
QPixmap m_Pixmap;
OQCopMessage m_FactoryPresetPressedAction;
OQCopMessage m_PressedAction;
OQCopMessage m_FactoryPresetHeldAction;
OQCopMessage m_HeldAction;
class Private;
Private *d;
};
}
+}
#endif