author | treke <treke> | 2003-12-08 06:52:35 (UTC) |
---|---|---|
committer | treke <treke> | 2003-12-08 06:52:35 (UTC) |
commit | 7b4e723545a645056156246d27b2c26c78d599f3 (patch) (side-by-side diff) | |
tree | 8b349615fc1441a60bc418e10c53b1799db895e4 | |
parent | 3bbeef6702ef80b7506b5393cc51d1fd5b04559d (diff) | |
download | opie-7b4e723545a645056156246d27b2c26c78d599f3.zip opie-7b4e723545a645056156246d27b2c26c78d599f3.tar.gz opie-7b4e723545a645056156246d27b2c26c78d599f3.tar.bz2 |
Automatic rotation. This might break binary compatibility, so beware including
in BRANCH_1_0
-rw-r--r-- | core/applets/rotateapplet/rotate.cpp | 43 | ||||
-rw-r--r-- | core/applets/rotateapplet/rotate.h | 1 | ||||
-rw-r--r-- | libopie/odevice.cpp | 124 | ||||
-rw-r--r-- | libopie/odevice.h | 4 | ||||
-rw-r--r-- | qt/qt-2.3.7.patch/qte237-all.patch | 11 |
5 files changed, 163 insertions, 20 deletions
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp index ac6b259..0da2f0c 100644 --- a/core/applets/rotateapplet/rotate.cpp +++ b/core/applets/rotateapplet/rotate.cpp @@ -21,141 +21,182 @@ -_. . . )=. = 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 <qpe/resource.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qiconset.h> #include <qpopupmenu.h> #include <opie/odevice.h> #include "rotate.h" using namespace Opie; RotateApplet::RotateApplet ( ) : QObject ( 0, "RotateApplet" ), ref ( 0 ), m_flipped( false ) { #if !defined(QT_NO_COP) QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this ); connect ( rotateChannel, SIGNAL( received( const QCString &, const QByteArray &) ), this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); #endif } RotateApplet::~RotateApplet ( ) { } /** * Qcop receive method. */ void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "flip()" ) { activated ( ); - } + } else if ( msg == "rotateDefault()") { + rotateDefault(); + } } int RotateApplet::position ( ) const { return 3; } QString RotateApplet::name ( ) const { return tr( "Rotate shortcut" ); } QString RotateApplet::text ( ) const { return tr( "Rotate" ); } /*QString RotateApplet::tr( const char* s ) const { return qApp->translate( "RotateApplet", s, 0 ); } QString RotateApplet::tr( const char* s, const char* p ) const { return qApp->translate( "RotateApplet", s, p ); } */ QIconSet RotateApplet::icon ( ) const { QPixmap pix; QImage img = Resource::loadImage ( "Rotation" ); if ( !img. isNull ( )) pix. convertFromImage ( img. smoothScale ( 14, 14 )); return pix; } QPopupMenu *RotateApplet::popup ( QWidget * ) const { return 0; } +void RotateApplet::rotateDefault ( ) +{ + + int rot = ODevice::inst()->rotation(); + + switch (rot) { + case Rot0: + rot=0; + break; + case Rot90: + rot=90; + break; + case Rot180: + rot=180; + break; + case Rot270: + rot=270; + break; + default: + rot=0; + break; + } + Config cfg( "qpe" ); + cfg.setGroup( "Appearance" ); + + bool rotateDisabled = cfg.readBoolEntry( "rotateEnabled",false ); + + if (rotateDisabled == true) + return; + + // hide inputs methods before rotation + QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); + + QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); + env << rot; + + m_flipped = false; + +} void RotateApplet::activated ( ) { int defaultRotation = QPEApplication::defaultRotation(); int newRotation = defaultRotation; Config cfg( "qpe" ); cfg.setGroup( "Appearance" ); int rotDirection = cfg.readNumEntry( "rotatedir" ); ODirection rot = CW; if (rotDirection == -1) { rot = ODevice::inst ( )-> direction ( ); } else { rot = (ODirection)rotDirection; } // hide inputs methods before rotation QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); if ( m_flipped ) { // if flipped, flip back to the original state, // regardless of rotation direction newRotation = defaultRotation; } else { if ( rot == CCW ) { newRotation = ( defaultRotation + 90 ) % 360; } else if ( rot == CW ) { newRotation = ( defaultRotation + 270 ) % 360; } else if ( rot == Flip ) { newRotation = ( defaultRotation + 180 ) % 360; } } QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); env << newRotation; m_flipped = !m_flipped; } QRESULT RotateApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_MenuApplet ) diff --git a/core/applets/rotateapplet/rotate.h b/core/applets/rotateapplet/rotate.h index de2a707..572b82a 100644 --- a/core/applets/rotateapplet/rotate.h +++ b/core/applets/rotateapplet/rotate.h @@ -13,59 +13,60 @@ + . -:. = 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 __OPIE_ROTATE_APPLET_H__ #define __OPIE_ROTATE_APPLET_H__ #include <qpe/menuappletinterface.h> #include <qobject.h> #include <qobject.h> class RotateApplet : public QObject, public MenuAppletInterface { Q_OBJECT public: RotateApplet ( ); virtual ~RotateApplet ( ); QRESULT queryInterface( const QUuid&, QUnknownInterface** ); Q_REFCOUNT virtual int position() const; virtual QString name ( ) const; virtual QIconSet icon ( ) const; virtual QString text ( ) const; /* virtual QString tr( const char* ) const; virtual QString tr( const char*, const char* ) const; */ virtual QPopupMenu *popup ( QWidget *parent ) const; virtual void activated ( ); + virtual void rotateDefault ( ); private slots: void channelReceived( const QCString &msg, const QByteArray & data ); private: ulong ref; bool m_flipped; }; #endif diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 9373ef9..5038cc9 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp @@ -96,96 +96,101 @@ public: 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]; }; class Jornada : public ODevice { protected: virtual void init ( ); //virtual void initButtons ( ); public: virtual bool setSoftSuspend ( bool soft ); virtual bool setDisplayBrightness ( int b ); virtual int displayBrightnessResolution ( ) const; static bool isJornada(); }; 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 alarmSound ( ); virtual void keySound ( ); virtual void touchSound ( ); 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 ); static bool isZaurus(); + + // Does this break BC? + virtual bool suspend ( ); + virtual Transformation rotation ( ) const; + virtual ODirection direction ( ) const; protected: virtual void buzzer ( int snd ); OLedState m_leds [1]; bool m_embedix; }; 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 alarmSound ( ); 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]; //FIXME check if really only one }; 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; @@ -244,100 +249,100 @@ struct i_button { struct z_button { Qt::Key code; char *utext; char *pix; char *fpressedservice; char *fpressedaction; char *fheldservice; char *fheldaction; } 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()" }, }; struct z_button z_buttons_c700 [] = { { 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", "Display Rotate"), + { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"), "", - "QPE/Rotation", "flip()", - "QPE/Rotation", "flip()" }, + "QPE/Rotation", "rotateDefault()", + "QPE/Rotation", "rotateDefault()" }, }; struct s_button { uint model; Qt::Key code; char *utext; char *pix; char *fpressedservice; char *fpressedaction; char *fheldservice; char *fheldaction; } 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, Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), "devicebuttons/simpad_upper_up", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), "devicebuttons/simpad_upper_down", "addressbook", "raise()", "addressbook", "beamBusinessCard()" }, { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), "devicebuttons/simpad_upper_right", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, @@ -1587,110 +1592,98 @@ void Zaurus::init ( ) f. close ( ); } pclose(uname); } else { d-> m_systemstr = "Zaurus"; d-> m_system = System_Zaurus; } f. setName ( "/proc/cpuinfo" ); if ( f. open ( IO_ReadOnly ) ) { QTextStream ts ( &f ); QString line; while( line = ts. readLine ( ) ) { if ( line. left ( 8 ) == "Hardware" ) break; } int loc = line. find ( ":" ); if ( loc != -1 ) model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); } if ( model == "SHARP Corgi" ) { d-> m_model = Model_Zaurus_SLC7x0; d-> m_modelstr = "Zaurus SL-C700"; } else if ( model == "SHARP Shepherd" ) { d-> m_model = Model_Zaurus_SLC7x0; d-> m_modelstr = "Zaurus SL-C750"; } else if ( model == "SHARP Husky" ) { d-> m_model = Model_Zaurus_SLC7x0; d-> m_modelstr = "Zaurus SL-C760"; } else if ( model == "SHARP Poodle" ) { d-> m_model = Model_Zaurus_SLB600; d-> m_modelstr = "Zaurus SL-B500 or SL-5600"; } else if ( model == "Sharp-Collie" || model == "Collie" ) { d-> m_model = Model_Zaurus_SL5500; d-> m_modelstr = "Zaurus SL-5500 or SL-5000d"; } else { d-> m_model = Model_Zaurus_SL5500; d-> m_modelstr = "Zaurus (Model unknown)"; } bool flipstate = false; switch ( d-> m_model ) { case Model_Zaurus_SLA300: d-> m_rotation = Rot0; break; case Model_Zaurus_SLC7x0: - // Note: need to 1) set flipstate based on physical screen orientation - // and 2) check to see if the user overrode the rotation direction - // using appearance, and if so, remove that item from the Config to - // ensure the rotate applet flips us back to the previous state. - // treke said he has patches for detecting the phys. so where are they, treke? -mickeyl. - if ( flipstate ) { - // 480x640 - d-> m_rotation = Rot0; - d-> m_direction = CW; - } else { - // 640x480 - d-> m_rotation = Rot270; - d-> m_direction = CCW; - } + d-> m_rotation = rotation(); + d-> m_direction = direction(); break; case Model_Zaurus_SLB600: case Model_Zaurus_SL5500: case Model_Zaurus_SL5000: default: d-> m_rotation = Rot270; break; } m_leds [0] = Led_Off; } void Zaurus::initButtons ( ) { if ( d-> m_buttons ) return; d-> m_buttons = new QValueList <ODeviceButton>; struct z_button * pz_buttons; int buttoncount; switch ( d-> m_model ) { case Model_Zaurus_SLC7x0: pz_buttons = z_buttons_c700; buttoncount = ARRAY_SIZE(z_buttons_c700); break; default: pz_buttons = z_buttons; buttoncount = ARRAY_SIZE(z_buttons); break; } for ( int i = 0; i < buttoncount; i++ ) { struct z_button *zb = pz_buttons + i; ODeviceButton b; b. setKeycode ( zb-> code ); b. setUserText ( QObject::tr ( "Button", zb-> utext )); b. setPixmap ( Resource::loadPixmap ( zb-> pix )); b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction )); b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction )); d-> m_buttons-> append ( b ); } reloadButtonMapping ( ); @@ -1701,96 +1694,98 @@ void Zaurus::initButtons ( ) #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> //#include <asm/sharp_char.h> // including kernel headers is evil ... #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 #define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ #define SHARP_BUZ_KEYSOUND 2 /* key sound */ #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ /* --- for SHARP_BUZZER device --- */ //#define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ //#define SHARP_PDA_APPSTART 9 /* application start */ //#define SHARP_PDA_APPQUIT 10 /* application ends */ //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ // #define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) +#define SHARP_IOCTL_GET_ROTATION 0x413c + typedef struct sharp_led_status { int which; /* select which LED status is wanted. */ int status; /* set new led status if you call SHARP_LED_SETSTATUS */ } sharp_led_status; #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ // #include <asm/sharp_apm.h> // including kernel headers is evil ... #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) #define APM_EVT_POWER_BUTTON (1 << 0) #define FL_IOCTL_STEP_CONTRAST 100 void Zaurus::buzzer ( int sound ) { #ifndef QT_NO_SOUND QString soundname; // Not all devices have real sound if ( d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLB600 ){ switch ( sound ){ case SHARP_BUZ_SCHEDULE_ALARM: soundname = "alarm"; break; case SHARP_BUZ_TOUCHSOUND: soundname = "touchsound"; break; case SHARP_BUZ_KEYSOUND: soundname = "keysound"; break; default: soundname = "alarm"; } } // If a soundname is defined, we expect that this device has // sound capabilities.. Otherwise we expect to have the buzzer // device.. @@ -1934,96 +1929,191 @@ bool Zaurus::setSoftSuspend ( bool soft ) if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources res = true; else perror ( "APM_IOCGEVTSRC" ); } else perror ( "APM_IOCGEVTSRC" ); ::close ( fd ); } else perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); return res; } bool Zaurus::setDisplayBrightness ( int bright ) { // FIXME The C7x0 have a proc-interface (/proc/drivers/corgi-bl) which // is nice to use. Currently it exposes 16+1 levels. Implement this! // (or wait for kergoth unifying the interfaces in the OpenZaurus kernel.) bool res = false; int fd; if ( bright > 255 ) bright = 255; if ( bright < 0 ) bright = 0; if (m_embedix) { if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus if ( bright && !bl ) bl = 1; res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 ); ::close ( fd ); } } else { #define FB_BACKLIGHT_SET_BRIGHTNESS _IOW('F', 1, u_int) /* set brightness */ if (( fd = ::open ( "/dev/fb0", O_WRONLY )) >= 0 ) { res = ( ::ioctl ( fd , FB_BACKLIGHT_SET_BRIGHTNESS, bright ) == 0 ); ::close ( fd ); } } return res; } +bool Zaurus::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; + + 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 { // Yes, wait 15 seconds. This APM bug sucks big time. + ::usleep ( 200 * 1000 ); + ::gettimeofday ( &tvn, 0 ); + } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); + } + + QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); + return res; +} + + +Transformation Zaurus::rotation ( ) const +{ + Transformation rot; + int handle = 0; + int retval = 0; + + switch ( d-> m_model ) { + case Model_Zaurus_SLC7x0: + handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); + if (handle == -1) { + return Rot270; + } else { + retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); + ::close (handle); + + if (retval == 2 ) + rot = Rot0; + else + rot = Rot270; + } + break; + case Model_Zaurus_SLA300: + case Model_Zaurus_SLB600: + case Model_Zaurus_SL5500: + case Model_Zaurus_SL5000: + default: + rot = d-> m_rotation; + break; + } + + return rot; +} +ODirection Zaurus::direction ( ) const +{ + ODirection dir; + int handle = 0; + int retval = 0; + switch ( d-> m_model ) { + case Model_Zaurus_SLC7x0: + handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); + if (handle == -1) { + dir = Rot270; + } else { + retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); + ::close (handle); + if (retval == 2 ) + dir = CCW; + else + dir = CW; + } + break; + case Model_Zaurus_SLA300: + case Model_Zaurus_SLB600: + case Model_Zaurus_SL5500: + case Model_Zaurus_SL5000: + default: + dir = d-> m_direction; + break; + } + return dir; + +} int Zaurus::displayBrightnessResolution ( ) const { if (m_embedix) return 5; else return 256; } /************************************************** * * SIMpad * **************************************************/ void SIMpad::init ( ) { d-> m_vendorstr = "SIEMENS"; d-> m_vendor = Vendor_SIEMENS; QFile f ( "/proc/hal/model" ); //TODO Implement model checking //FIXME For now we assume an SL4 d-> m_modelstr = "SL4"; d-> m_model = Model_SIMpad_SL4; switch ( d-> m_model ) { default: d-> m_rotation = Rot0; d-> m_direction = CCW; d-> m_holdtime = 1000; // 1000ms break; } f. setName ( "/etc/familiar-version" ); if ( f. open ( IO_ReadOnly )) { d-> m_systemstr = "Familiar"; d-> m_system = System_Familiar; QTextStream ts ( &f ); d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); f. close ( ); } else { f. setName ( "/etc/oz_version" ); diff --git a/libopie/odevice.h b/libopie/odevice.h index 25910b5..8273761 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h @@ -142,98 +142,98 @@ enum ODirection { CCW = 1, Flip = 2, }; /** * A singleton which gives informations about device specefic option * like the Hardware used, LEDs, the Base Distribution and * hardware key mappings. * * @short A small class for device specefic options * @see QObject * @author Robert Griebl * @version 1.0 */ class ODevice : public QObject { Q_OBJECT private: /* disable copy */ ODevice ( const ODevice & ); protected: ODevice ( ); virtual void init ( ); virtual void initButtons ( ); ODeviceData *d; public: // sandman do we want to allow destructions? -zecke? virtual ~ODevice ( ); static ODevice *inst ( ); // information QString modelString ( ) const; OModel model ( ) const; inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } QString vendorString ( ) const; OVendor vendor ( ) const; QString systemString ( ) const; OSystem system ( ) const; QString systemVersionString ( ) const; - Transformation rotation ( ) const; - ODirection direction ( ) const; + virtual Transformation rotation ( ) const; + virtual ODirection direction ( ) const; // system virtual bool setSoftSuspend ( bool on ); virtual bool suspend ( ); virtual bool setDisplayStatus ( bool on ); virtual bool setDisplayBrightness ( int brightness ); virtual int displayBrightnessResolution ( ) const; virtual bool setDisplayContrast ( int contrast ); virtual int displayContrastResolution ( ) const; // don't add new virtual methods, use this: // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; // and in your subclass do do overwrite // protected virtual int virtual_hook(int, void *) // which is defined below // input / output //FIXME playAlarmSound and al might be better -zecke virtual void alarmSound ( ); virtual void keySound ( ); virtual void touchSound ( ); 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; 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. */ const QValueList<ODeviceButton> &buttons ( ) /* ### make const */; /** * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it * returns 0L */ diff --git a/qt/qt-2.3.7.patch/qte237-all.patch b/qt/qt-2.3.7.patch/qte237-all.patch index 233996a..e6cf0a4 100644 --- a/qt/qt-2.3.7.patch/qte237-all.patch +++ b/qt/qt-2.3.7.patch/qte237-all.patch @@ -363,48 +363,59 @@ diff -ru qt-2.3.5_fresh/src/widgets/qcommonstyle.cpp qt-2.3.5/src/widgets/qcommo (this->*impl)(p, x, y, w, h, mi, g, enabled, active); Nur in qt-2.3.5/src/widgets: qcommonstyle.cpp.orig. diff -ru qt-2.3.5_fresh/src/widgets/qlistview.cpp qt-2.3.5/src/widgets/qlistview.cpp --- qt-2.3.5_fresh/src/widgets/qlistview.cpp 2003-05-13 15:56:12.000000000 +0200 +++ qt-2.3.5/src/widgets/qlistview.cpp 2003-05-13 15:58:18.000000000 +0200 @@ -4968,9 +4968,9 @@ l = l->childItem ? l->childItem : l->siblingItem; if ( l && l->height() ) - s.setHeight( s.height() + 10 * l->height() ); - else - s.setHeight( s.height() + 140 ); + s.setHeight( s.height() + 4 /*10*/ * l->height() ); + else // ^v much too big for handhelds + s.setHeight( s.height() + 30 /*140*/ ); if ( s.width() > s.height() * 3 ) s.setHeight( s.width() / 3 ); diff -ru qt-2.3.5_fresh/src/widgets/qtoolbutton.cpp qt-2.3.5/src/widgets/qtoolbutton.cpp --- qt-2.3.5_fresh/src/widgets/qtoolbutton.cpp 2003-05-13 15:56:12.000000000 +0200 +++ qt-2.3.5/src/widgets/qtoolbutton.cpp 2003-05-13 15:58:18.000000000 +0200 @@ -230,7 +230,7 @@ else QToolTip::add( this, textLabel ); } -#endif +#endif } @@ -324,12 +324,12 @@ QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Large, QIconSet::Normal); w = pm.width(); h = pm.height(); - if ( w < 32 ) - w = 32; - if ( h < 32 ) - h = 32; + if ( w < 24 ) + w = 24; + if ( h < 24 ) + h = 24; } else { - w = h = 16; + w = h = 14; QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Small, QIconSet::Normal); w = pm.width(); h = pm.height(); +--- qt-2.3.7/src/kernel/qkeyboard_qws.cpp~c7xxrotate 2003-07-16 18:20:25.000000000 -0700 ++++ qt-2.3.7/src/kernel/qkeyboard_qws.cpp 2003-12-07 15:54:10.000000000 -0800 +@@ -238,7 +238,7 @@ + { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 63 + { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 64 + { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 65 +- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 66 ++ { Qt::Key_F14, 0xffff , 0xffff , 0xffff }, // 66 + { Qt::Key_Meta, 0xffff , 0xffff , 0xffff }, // 67 + { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 68 + { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 69 |